Created
June 8, 2012 02:07
-
-
Save talios/2893027 to your computer and use it in GitHub Desktop.
Javac Compiler Bug...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Potential bug in JavaC. Surely the line should be: | |
annotationProcessingOccurred = c.annotationProcessingOccurred == true; | |
and do a comparison instead of multi-assignment ( and only assign it if annotationProcessingOccurred is current false, as I don't think we want to reassign a true setting to false here). | |
Open JDK 6: | |
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/tools/javac/main/JavaCompiler.java#JavaCompiler | |
995 JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); | |
996 if (c != this) | |
997 annotationProcessingOccurred = c.annotationProcessingOccurred = true; | |
998 return c; | |
Open JDK 7 | |
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/com/sun/tools/javac/main/JavaCompiler.java?av=f | |
1106 JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); | |
1107 if (c != this) | |
1108 annotationProcessingOccurred = c.annotationProcessingOccurred = true; | |
1109 // doProcessing will have handled deferred diagnostics | |
1110 Assert.check(c.log.deferDiagnostics == false | |
1111 && c.log.deferredDiagnostics.size() == 0); | |
1112 return c;' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The later is my current guess after thinking about it more, of course - I don't know WHY you'd have multiple instances of a javaCompiler so this might not actually be a problem. I have an odd thought that when annotation processing occurs, another javaCompiler instance is possibly created to compile any generated sources, which would mean the code here is probably correct - but kinda smelly code.