We are having the problem described in the title of this issue when we are exposing keywords from a JavaLibraryA in a JavaLibraryB using the multiple keyword patterns approach.
We are encapsulating JavaLibraryA in JavaLibraryB as follows:
public class JavaLibraryB extends AnnotationLibrary {
private AnnotationLibrary libA = new JavaLibraryA();
// If we use the approach below we get the ExceptionInInitializerError when we call super.getKeywordNames method (look for the comment "Here is where we get the failure!!!!!")
//
// Notice in your example in the documentation you are declaring keywordPatterns as non-static, it must be declared as static if you want to use it in the constructor.
// static List keywordPatterns = new ArrayList() {{
// add("com/acme//keyword//*.class");
// add("org/some/other/place/**.class");
// }};
// public JavaLibraryB() {
// super(keywordPatterns);
// }
// Even trying something like this, it fails...
// public JavaLibraryB(){
// super(Arrays.asList("com/acme//keyword//*.class", "org/some/other/place/**.class"));
// }
//
// If we use this approach, it works fine but we cannot add multiple keyword patterns
public JavaLibraryB() {
super("com/acme/**/keyword/**/*.class");
}
@Override
public String[] getKeywordNames() {
String[] mine = super.getKeywordNames(); // --------> Here is where we get the failure!!!!!
return ArrayUtils.addAll(mine, libA.getKeywordNames()); // using Apache Commons Lang
}
@Override
public Object runKeyword(String name, Object[] args) {
if (Arrays.asList(libA.getKeywordNames()).contains(name)) {
return libA.runKeyword(name, args);
}
return super.runKeyword(name, args);
}
Hello,
We are having the problem described in the title of this issue when we are exposing keywords from a JavaLibraryA in a JavaLibraryB using the multiple keyword patterns approach.
We are encapsulating JavaLibraryA in JavaLibraryB as follows:
public class JavaLibraryB extends AnnotationLibrary { private AnnotationLibrary libA = new JavaLibraryA();
// If we use the approach below we get the ExceptionInInitializerError when we call super.getKeywordNames method (look for the comment "Here is where we get the failure!!!!!") // keywordPatterns = new ArrayList() {{
// add("com/acme//keyword//*.class");
// add("org/some/other/place/**.class");
// }};
// public JavaLibraryB() {
// super(keywordPatterns);
// }
// Notice in your example in the documentation you are declaring keywordPatterns as non-static, it must be declared as static if you want to use it in the constructor. // static List
// Even trying something like this, it fails... // public JavaLibraryB(){ // super(Arrays.asList("com/acme//keyword//*.class", "org/some/other/place/**.class")); // } //
// more overrides go here . . .
Any help would be appreciated. Thanks. Alejandro.