Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.4, 1.7.11, 1.8.8
-
None
-
Patch
Description
From looking at the code, this issue appears to affect all versions after 1.7.3, but I've only tested a few.
As with many other places in the code, printAnnotation needs to replace '$' with '.' in inner interface class names. Otherwise a "cannot find symbol" error occurs during java compilation.
In 1.7.4, the patch is:
diff --git a/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java b/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java index eff3ac1..7a1e92e 100644 --- a/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java +++ b/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java @@ -591,7 +591,7 @@ public class JavaStubGenerator private void printAnnotations(PrintWriter out, AnnotatedNode annotated) { if (!java5) return; for (AnnotationNode annotation : annotated.getAnnotations()) { - out.print("@" + annotation.getClassNode().getName() + "("); + out.print("@" + annotation.getClassNode().getName().replace('$', '.') + "("); boolean first = true; Map<String, Expression> members = annotation.getMembers(); for (String key : members.keySet()) {
In master, it would be:
diff --git a/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java b/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java index 1e8f585..42fc5e2 100644 --- a/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java +++ b/src/main/org/codehaus/groovy/tools/javac/JavaStubGenerator.java @@ -716,7 +716,7 @@ public class JavaStubGenerator { } private void printAnnotation(PrintWriter out, AnnotationNode annotation) { - out.print("@" + annotation.getClassNode().getName() + "("); + out.print("@" + annotation.getClassNode().getName().replace('$', '.') + "("); boolean first = true; Map<String, Expression> members = annotation.getMembers(); for (String key : members.keySet()) {