-
Bug
-
Resolution: Fixed
-
P3
-
7u2
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2219851 | 7u4 | James Holmlund | P3 | Closed | Fixed | b10 |
After unpacking http://netbeans.org/bugzilla/attachment.cgi?id=114753 and running 'mvn -f netbeans-generation-issue/sampleprocessor/pom.xml install', if (with JAVA_HOME set to JDK 7u1 or u2) you run 'mvn -f netbeans-generation-issue/generatingissue/pom.xml clean compile' you will get an error:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ generatingissue ---
[INFO] Compiling 2 source files to /tmp/netbeans-generation-issue/generatingissue/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[4,0] error: package jp.javelindev.netbeans.generatingissue.impl does not exist
[ERROR] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[14,32] error: cannot find symbol
[INFO] 2 errors
Using JDK 6u30 it works:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ generatingissue ---
[INFO] Compiling 2 source files to /tmp/netbeans-generation-issue/generatingissue/target/classes
[WARNING] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[4,0] package jp.javelindev.netbeans.generatingissue.impl does not exist
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
Pulling out the actual forked javac command line (obtainable using -X), which includes -verbose, shows that in JDK 7 (or javac built from langtools c747f413d531) no apparent attempt is made to run the annotation processor, though its @SupportedAnnotationTypes matches the annotation in the source file, whereas JDK 6 loads it as expected:
Round 1:
input files: {jp.javelindev.netbeans.generatingissue.ClassWithIssue, jp.javelindev.netbeans.generatingissue.GenerateOrigin}
annotations: [jp.javelindev.netbeans.sampleprocessor.SampleAnnotation]
last round: false
RUNNING...
Processor jp.javelindev.netbeans.sampleprocessor.SampleProcessor matches [jp.javelindev.netbeans.sampleprocessor.SampleAnnotation] and returns true.
The problem seems to go away if you replace the wildcard import with an exact import:
import jp.javelindev.netbeans.generatingissue.impl.GenerateOriginImpl;
Then even JDK 7 javac goes through the required multiple rounds, running the AP.
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ generatingissue ---
[INFO] Compiling 2 source files to /tmp/netbeans-generation-issue/generatingissue/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[4,0] error: package jp.javelindev.netbeans.generatingissue.impl does not exist
[ERROR] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[14,32] error: cannot find symbol
[INFO] 2 errors
Using JDK 6u30 it works:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ generatingissue ---
[INFO] Compiling 2 source files to /tmp/netbeans-generation-issue/generatingissue/target/classes
[WARNING] /tmp/netbeans-generation-issue/generatingissue/src/main/java/jp/javelindev/netbeans/generatingissue/ClassWithIssue.java:[4,0] package jp.javelindev.netbeans.generatingissue.impl does not exist
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
Pulling out the actual forked javac command line (obtainable using -X), which includes -verbose, shows that in JDK 7 (or javac built from langtools c747f413d531) no apparent attempt is made to run the annotation processor, though its @SupportedAnnotationTypes matches the annotation in the source file, whereas JDK 6 loads it as expected:
Round 1:
input files: {jp.javelindev.netbeans.generatingissue.ClassWithIssue, jp.javelindev.netbeans.generatingissue.GenerateOrigin}
annotations: [jp.javelindev.netbeans.sampleprocessor.SampleAnnotation]
last round: false
RUNNING...
Processor jp.javelindev.netbeans.sampleprocessor.SampleProcessor matches [jp.javelindev.netbeans.sampleprocessor.SampleAnnotation] and returns true.
The problem seems to go away if you replace the wildcard import with an exact import:
import jp.javelindev.netbeans.generatingissue.impl.GenerateOriginImpl;
Then even JDK 7 javac goes through the required multiple rounds, running the AP.
- backported by
-
JDK-2219851 javac fails to run annotation processors when star import of package of gensrc
-
- Closed
-
- relates to
-
JDK-7133314 The regression test for 7129225 fails when run with jtreg -samevm or jtreg -agentvm
-
- Closed
-