Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.4.3
-
None
-
None
Description
A MultipleCompilationErrorsException is thrown when we try to load a class that has a reference to a nested class via annotation.
Here a small example:
We have two classes class A and B. Class A has a reference to the nested class of class B (NestedInB) in the annotation. Class A can not be loaded except the annotation is removed.
package pkg2 import pkg1.B class A { @SuppressWarnings(value = [B.NestedInB.NestedProp]) A() { String name = B.NestedInB.class.getName(); System.out.println(name); System.out.println(B.NestedInB.NestedProp); } }
package pkg1 import pkg2.A public class B { public static final String Prop = "ABCD"; B() { A a = new A() } public static class NestedInB { public static final String NestedProp = "ABCD"; } }
@Test public void test2() throws Exception { final File mainDirectory = new File("Path to the class A and B"); URL url = mainDirectory.getAbsoluteFile().toURI().toURL(); groovyClassLoader.addURL(url); groovyClassLoader.addClasspath(mainDirectory.getPath()); final Class<?> a = groovyClassLoader.loadClass("pkg2.A"); a.newInstance(); assertNotNull(a); }
Attachments
Issue Links
- is related to
-
NETBEANS-5982 Groovy parser cannot handle annotations from source
- Open