Closed don-vip closed 4 years ago
See #860 (and #448); Error Prone 2.3.1 doesn't even officially support JDK 10 and 11.
It works fine with previous build (JDK 12 EA b08).
I'm surprised that it regressed, I wouldn't expect 2.3.1 to work with JDK 12 in general.
The next release should work better with JDK 10 and up, can you try the latest snapshot?
2.3.1 works with JDK 10, 11 and first EA builds of JDK 12 when used as a javac plugin, as advised in #860 comments. Up to b08 there was nothing really new in JDK 12 EA. b09 introduced compiler support for Switch Expressions, I guess this is where the regression comes from. I'm going to try latest snapshot.
I have a new error with 2.3.2-SNAPSHOT:
[javac] /var/lib/jenkins/jobs/Java-EarlyAccess-Integration/workspace/jdk/JDK12/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java:131: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
[javac] break;
[javac] ^
[javac] Please report this at https://github.com/google/error-prone/issues/new and include the following:
[javac]
[javac] error-prone version: 2.3.2-SNAPSHOT
[javac] BugPattern: Finally
[javac] Stack Trace:
[javac] java.lang.NoSuchFieldError: label
[javac] at com.google.errorprone.bugpatterns.Finally$FinallyJumpMatcher.<init>(Finally.java:173)
[javac] at com.google.errorprone.bugpatterns.Finally.matchBreak(Finally.java:81)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:537)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBreak.accept(JCTree.java:1575)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitCase(TreeScanner.java:372)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCase(ErrorProneScanner.java:558)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCase(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCase.accept(JCTree.java:1293)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitSwitch(TreeScanner.java:333)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:1034)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1235)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:528)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:207)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:896)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:904)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:588)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:145)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:603)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:597)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:64)
[javac] at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[javac] at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
[javac] at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:57)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1404)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1133)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at org.apache.tools.ant.Target.execute(Target.java:449)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:470)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:834)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:223)
[javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
[javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
[javac] 1 error
[javac] 1 warning
Change found: http://hg.openjdk.java.net/jdk/jdk/rev/de411d537aae#l26.131
public static class JCBreak extends JCStatement implements BreakTree {
- public Name label;
+ public JCExpression value;
public JCTree target;
- protected JCBreak(Name label, JCTree target) {
- this.label = label;
+ protected JCBreak(JCExpression value, JCTree target) {
+ this.value = value;
this.target = target;
}
@Override
public void accept(Visitor v) { v.visitBreak(this); }
+ public boolean isValueBreak() {
+ return target != null && target.hasTag(SWITCH_EXPRESSION);
+ }
@DefinedBy(Api.COMPILER_TREE)
public Kind getKind() { return Kind.BREAK; }
@DefinedBy(Api.COMPILER_TREE)
- public Name getLabel() { return label; }
+ public Name getLabel() {
+ return value != null && value.getKind() == Kind.IDENTIFIER ? ((JCIdent) value).getName() : null;
+ }
I guess we can just replace .label
by .getLabel()
for now.
With #1107 used on our project we get a new error:
[javac] /var/lib/jenkins/jobs/Java-EarlyAccess-Integration/workspace/jdk/JDK12/src/org/openstreetmap/josm/gui/NavigatableComponent.java:1297: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
[javac] public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate,
[javac] ^
[javac] Please report this at https://github.com/google/error-prone/issues/new and include the following:
[javac]
[javac] error-prone version: 2.3.2-SNAPSHOT
[javac] BugPattern: GuardedBy
[javac] Stack Trace:
[javac] java.lang.NullPointerException
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer$LockScanner.checkMatch(HeldLockAnalyzer.java:227)
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer$LockScanner.visitIdentifier(HeldLockAnalyzer.java:196)
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer$LockScanner.visitIdentifier(HeldLockAnalyzer.java:116)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2324)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBreak(TreeScanner.java:472)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBreak.accept(JCTree.java:1575)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitIf(TreeScanner.java:445)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1498)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitEnhancedForLoop(TreeScanner.java:307)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1178)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitEnhancedForLoop(TreeScanner.java:307)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1178)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitLabeledStatement(TreeScanner.java:320)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLabeledStatement.accept(JCTree.java:1206)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:207)
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer$LockScanner.visitMethod(HeldLockAnalyzer.java:153)
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer$LockScanner.visitMethod(HeldLockAnalyzer.java:116)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:904)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[javac] at com.google.errorprone.bugpatterns.threadsafety.HeldLockAnalyzer.analyze(HeldLockAnalyzer.java:88)
[javac] at com.google.errorprone.bugpatterns.threadsafety.GuardedByChecker.analyze(GuardedByChecker.java:75)
[javac] at com.google.errorprone.bugpatterns.threadsafety.GuardedByChecker.matchMethod(GuardedByChecker.java:64)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:890)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:904)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:588)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:145)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:603)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:597)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:64)
[javac] at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[javac] at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:141)
[javac] at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
[javac] 1 error
Third problem:
[javac] /var/lib/jenkins/jobs/Java-EarlyAccess-Integration/workspace/jdk/JDK12/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java:185: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
[javac] public class SessionSaveAsDialog extends ExtendedDialog {
[javac] ^
[javac] Please report this at https://github.com/google/error-prone/issues/new and include the following:
[javac]
[javac] error-prone version: 2.3.2-SNAPSHOT
[javac] BugPattern: ClassCanBeStatic
[javac] Stack Trace:
[javac] java.lang.NullPointerException
[javac] at com.google.errorprone.bugpatterns.CanBeStaticAnalyzer.visitIdent(CanBeStaticAnalyzer.java:60)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2316)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitBreak(TreeScanner.java:222)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBreak.accept(JCTree.java:1559)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitBlock(TreeScanner.java:143)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
[javac] at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitIf(TreeScanner.java:213)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1486)
And finally with #1107 + #1110 + #1111 we're able to run error_prone on JOSM source code with JDK 12!
Might have found a new one:
openjdk version "12-ea" 2019-03-19
OpenJDK Runtime Environment (build 12-ea+23)
...where the error is:
public abstract class RootCasException extends RuntimeException {
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.3-SNAPSHOT
BugPattern: OverrideThrowableToString
Stack Trace:
java.lang.AssertionError
at com.google.errorprone.fixes.SuggestedFixes.renameMethod(SuggestedFixes.java:463)
at com.google.errorprone.bugpatterns.OverrideThrowableToString.lambda$matchClass$4(OverrideThrowableToString.java:67)
at java.base/java.util.Optional.map(Optional.java:265)
at com.google.errorprone.bugpatterns.OverrideThrowableToString.matchClass(OverrideThrowableToString.java:67)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:424)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:521)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:148)
Full log: https://travis-ci.org/apereo/cas/jobs/465117781
Using 2.3.3-SNAPSHOT
.
Since today, we fail to use error_prone with JDK13:
openjdk version "13-ea" 2019-09-17
OpenJDK Runtime Environment (build 13-ea+6)
OpenJDK 64-Bit Server VM (build 13-ea+6, mixed mode, sharing)
[javac] public static <T> T find(Iterable<? extends T> collection, Predicate<? super T> predicate) {
[javac] ^
[javac] Please report this at https://github.com/google/error-prone/issues/new and include the following:
[javac]
[javac] error-prone version: 2.3.2-SNAPSHOT
[javac] BugPattern: TypeParameterUnusedInFormals
[javac] Stack Trace:
[javac] java.lang.NoSuchFieldError: bound
[javac] at com.google.errorprone.bugpatterns.TypeParameterUnusedInFormals.matchMethod(TypeParameterUnusedInFormals.java:73)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:890)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:146)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:904)
[javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
[javac] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:588)
[javac] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:146)
(using JOSM patched version containing fixes #1107 + #1110 + #1111)
Problem fixed in #1225. With #1107 + #1110 + #1111 + #1225 error_prone works with Java 8 to 13 for us.
Same sort of problem; different JDK version 11 and error-prone version:
java 11 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
...where the error is:
public abstract class RootCasException extends RuntimeException {
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.3
BugPattern: OverrideThrowableToString
Stack Trace:
java.lang.AssertionError
at com.google.errorprone.fixes.SuggestedFixes.renameMethod(SuggestedFixes.java:465)
at com.google.errorprone.bugpatterns.OverrideThrowableToString.lambda$matchClass$4(OverrideThrowableToString.java:65)
at java.base/java.util.Optional.map(Optional.java:265)
at com.google.errorprone.bugpatterns.OverrideThrowableToString.matchClass(OverrideThrowableToString.java:65)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:433)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:534)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:71)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:45)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
Same for Java 12:
error-prone version: 2.3.3
BugPattern: OverrideThrowableToString
Stack Trace:
java.lang.AssertionError
at com.google.errorprone.fixes.SuggestedFixes.renameMethod(SuggestedFixes.java:465)
at com.google.errorprone.bugpatterns.OverrideThrowableToString.lambda$matchClass$4(OverrideThrowableToString.java:65)
at java.base/java.util.Optional.map(Optional.java:265)
openjdk version "12" 2019-03-19
OpenJDK Runtime Environment (build 12+31)
OpenJDK 64-Bit Server VM (build 12+31, mixed mode, sharing)
/home/travis/build/Zialus/SD-DistributedFileSystem/src/main/java/fcup/StorageServer.java:50: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
break;
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.3
BugPattern: Finally
Stack Trace:
java.lang.NoSuchFieldError: label
at com.google.errorprone.bugpatterns.Finally$FinallyJumpMatcher.<init>(Finally.java:171)
at com.google.errorprone.bugpatterns.Finally.matchBreak(Finally.java:79)
https://travis-ci.org/Zialus/SD-DistributedFileSystem/jobs/504641231
Getting the same stuff as well with AdoptOpenJDK 12:
error: An unhandled exception was thrown by the Error Prone static analysis plugin.
break;
error-prone version: 2.3.3
BugPattern: Finally
Stack Trace:
java.lang.NoSuchFieldError: label
at com.google.errorprone.bugpatterns.Finally$FinallyJumpMatcher.<init>(Finally.java:171)
at com.google.errorprone.bugpatterns.Finally.matchBreak(Finally.java:79)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:433)
at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:513)
at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:150)
Works fine with 11.
Getting this exception with openjdk13 and error prone 2.3.3 in compileJava.
error: An unhandled exception was thrown by the Error Prone static analysis plugin.
LocalDate today = LocalDate.now();
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.3
BugPattern: JavaTimeDefaultTimeZone
Stack Trace:
java.lang.LinkageError: com.sun.tools.javac.comp.Resolve.findIdent(com.sun.tools.javac.comp.Env,com.sun.tools.javac.util.Name,com.sun.tools.javac.code.Kinds$KindSelector)
And
error: An unhandled exception was thrown by the Error Prone static analysis plugin.
Collection<File[]> specificFileList = new LinkedList<File[]>();
^
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.3
BugPattern: JdkObsolete
Stack Trace:
java.lang.LinkageError: com.sun.tools.javac.comp.Resolve.findIdent(com.sun.tools.javac.comp.Env,com.sun.tools.javac.util.Name,com.sun.tools.javac.code.Kinds$KindSelector)
Not sure if this is the exact same thing, however any hints as to how to work around or fix would be very helpful. This bug is blocking for me. Info:
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
Message:
An unhandled exception was thrown by the Error Prone static analysis plugin. [ERROR] Please report this at https://github.com/google/error-prone/issues/new and include the following: [ERROR] [ERROR] error-prone version: 2.3.3 [ERROR] BugPattern: Finally [ERROR] Stack Trace: [ERROR] java.lang.NoSuchFieldError: label
LMK if you need more of the stack trace
I'm using the latest 2.3.4-SNAPSHOT (as of 21st October 2019), and I still get the error when I compile using JDK12.0.2.
An unhandled exception was thrown by the Error Prone static analysis plugin. Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.4-SNAPSHOT
BugPattern: Finally
Stack Trace:
java.lang.NoSuchFieldError: label
at com.google.errorprone.bugpatterns.Finally$FinallyJumpMatcher.<init>(Finally.java:171)
at com.google.errorprone.bugpatterns.Finally.matchBreak(Finally.java:79)
The line of my code that gets flagged is actually not inside a try-finally anyway. It's a break inside a switch statement. The next piece of code after the switch is an if statement. The whole thing has a try-catch around it - but no try-finally.
Just as a test, I tried the following in an otherwise empty project:
int anInt = 0;
switch (anInt)
{
case 0:
System.out.println("case 0");
break;
case 1:
System.out.println("case 1");
break;
default:
System.out.println("default");
}
The errorprone analysis fell over at the first break statement.
(Sorry, just to say, not intended as a whinge, just a statement of fact!)
@cgruber wondering if libraries team or anyone is on this. this is a really cool tool. we're sadly well past the year anniversary of this issue. should we start considering ripping out error-prone? I'd really hate to
bump to @eaftan
The release process for version 2.3.4
seems to have begun: https://github.com/google/error-prone/releases/tag/2.3.4
Sorry, the JDK12 bug is still there in 2.3.4. I don't believe the code fix suggested in Finally.java (change .label to .getLabel) was actually implemented?
I'm compiling the test code:
int anInt = 0;
switch (anInt)
{
case 0:
System.out.println("case 0");
break;
case 1:
System.out.println("case 1");
break;
default:
System.out.println("default");
}
...using JDK12 in Netbeans 11, Maven 3.6.2, and I get:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project tryitout: Compilation failure tryitout/Tryitout.java:[513,9] An unhandled exception was thrown by the Error Prone static analysis plugin. Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.3.4
BugPattern: Finally
Stack Trace:
java.lang.NoSuchFieldError: label
at com.google.errorprone.bugpatterns.Finally$FinallyJumpMatcher.<init>(Finally.java:171)
at com.google.errorprone.bugpatterns.Finally.matchBreak(Finally.java:79)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451)
at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:528)
at com.google.errorprone.scanner.ErrorProneScanner.visitBreak(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBreak.accept(JCTree.java:1577)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
at jdk.compiler/com.sun.source.util.TreeScanner.visitCase(TreeScanner.java:372)
at com.google.errorprone.scanner.ErrorProneScanner.visitCase(ErrorProneScanner.java:536)
at com.google.errorprone.scanner.ErrorProneScanner.visitCase(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCase.accept(JCTree.java:1293)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
at jdk.compiler/com.sun.source.util.TreeScanner.visitSwitch(TreeScanner.java:333)
at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:826)
at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1235)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:522)
at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:207)
at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:742)
at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:904)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:550)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:814)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:145)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:562)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:152)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:597)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:56)
at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Still broken on JDK 13.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project spring-cloud-gcp-data-datastore: Compilation failure
[ERROR] /home/travis/build/spring-cloud/spring-cloud-gcp/spring-cloud-gcp-data-datastore/src/main/java/org/springframework/cloud/gcp/data/datastore/core/DatastoreTemplate.java:[41,1] An unhandled exception was thrown by the Error Prone static analysis plugin.
[ERROR] Please report this at https://github.com/google/error-prone/issues/new and include the following:
[ERROR]
[ERROR] error-prone version: 2.3.4
[ERROR] BugPattern: BadImport
[ERROR] Stack Trace:
[ERROR] java.lang.LinkageError: com.sun.tools.javac.comp.Resolve.findIdent(com.sun.tools.javac.comp.Env,com.sun.tools.javac.util.Name,com.sun.tools.javac.code.Kinds$KindSelector)
[ERROR] at com.google.errorprone.util.FindIdentifiers.findIdent(FindIdentifiers.java:104)
[ERROR] at com.google.errorprone.fixes.SuggestedFixes.qualifyType(SuggestedFixes.java:289)
[ERROR] at com.google.errorprone.bugpatterns.BadImport.matchImport(BadImport.java:120)
[ERROR] at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451)
[ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitImport(ErrorProneScanner.java:662)
[ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitImport(ErrorProneScanner.java:152)
[ERROR] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:670)
[ERROR] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:72)
[ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:46)
[ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
[ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:144)
[ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:562)
[ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:152)
[ERROR] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:601)
[ERROR] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:56)
[ERROR] at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[ERROR] at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
[ERROR] at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[ERROR] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1423)
[ERROR] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1370)
[ERROR] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
[ERROR] at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
[ERROR] at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
[ERROR] at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
[ERROR] at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
[ERROR] at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
[ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
[ERROR] at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1129)
[ERROR] at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:188)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:200)
[ERROR] at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
[ERROR] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[ERROR] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:830)
[ERROR] Caused by: java.lang.NoSuchMethodException: com.sun.tools.javac.comp.Resolve.findIdent(com.sun.tools.javac.comp.Env,com.sun.tools.javac.util.Name,com.sun.tools.javac.code.Kinds$KindSelector)
[ERROR] at java.base/java.lang.Class.getDeclaredMethod(Class.java:2476)
[ERROR] at com.google.errorprone.util.FindIdentifiers.findIdent(FindIdentifiers.java:98)
[ERROR] ... 45 more
Edit: Nevermind what I say below. It looks like the change to LineNumberReader
is going to be reverted.
If you guys get around to Java 14 compatibility, this change to LineNumberReader
in the JDK may cause headaches:
This program demonstrates the change in behavior:
String source = "ABC\n123";
try (LineNumberReader reader =
new LineNumberReader(new StringReader(source))) {
String line;
while ((line = reader.readLine()) != null) {
int lineNumber = reader.getLineNumber();
System.out.println(lineNumber + ": " + line);
}
}
In Java 13 that prints:
1: ABC
2: 123
In Java 14 that prints:
1: ABC
1: 123
If the source
string in my program ended with \n
, then the 14's output would be the same as 13's.
Error Prone relies on 13's behavior. Locally I was building on 8 and testing on 14 like this:
$ JAVA_HOME=/c/java/java8 mvn install -pl core -am -DskipTests
$ JAVA_HOME=/c/java/java14 mvn surefire:test -pl core
There are hundreds of test failures in 14 due to the new LineNumberReader
behavior.
I think the way Error Prone is using LineNumberReader
, like my example program, is actually wrong in the same way that one of the reviewer's examples was wrong. That is, Error Prone is always calling reader.readLine()
and then reader.getLineNumber()
and assuming that line numbers start at 1, but line numbers start at zero, and getLineNumber()
should be called before readLine()
, and the line number won't increment after the final call to readLine()
if the final line doesn't end with a line terminator.
Fixing all the usage of LineNumberReader
seems tough. Alternatively, a one-line fix that dodges the issue is to change ErrorProneInMemoryFileManager.forSourceLines(...)
, appending a \n
to the end of every generated source file. That is, change this line...
https://github.com/google/error-prone/blob/87cf33c2c484ae4f9a9de7c26d645053830040fb/test_helpers/src/main/java/com/google/errorprone/ErrorProneInMemoryFileManager.java#L157
...to this:
Files.write(path, (Joiner.on('\n').join(lines) + '\n').getBytes(UTF_8));
On Java 13+, #1439 is required in order to fix #1432
For completeness I'll mention that #1239 is necessary for Refaster to properly function on Java 9+. That's also a 1-line fix; the remainder is in test code.
@nglorioso are there plans to cut a minor release improving compatibility?
@nglorioso thanks, I was waiting for so long. Can you please also merge all the pull requests listed here so that error_prone finally works with recent versions of Java? Here is the list of the remaining ones:
I started work on this in #1571 and quickly ran into issues where the internal APIs have changed in JDK 12. Discussing internally on how to proceed forward, since we need to support JDK 8 and 11 internally.
All right. The plan now is to work on Java 14 compatibility. We are going to do an investigation into which method signatures are changed and what reflection (hacks) we need to put in place to make it work on both 8, 11 and 14.
Once we get a sense of the effect on maintainability for 14, we will make the final call on whether to go for the reflection solution. If that turns out to be a large can of worms, we need to reevaluate, but it is our current expectation that that is not the case.
After we have verified compatibility with 14, we will look into whether we can "just" support 12/13. If we can do so without any additional requirements, we will do so. If it turns out that many changes are required, we will not explicitly these Java versions.
TLDR: Investigate 14 compatibility. Based on the analysis, make a decision in terms of maintenance. 12/13 might follow, if that turns out to be minimal.
P.S. I will do this work alongside my primary task, so I don't have a timeline on when this is finished.
Thanks @TimvdLippe! We use error-prone heavily (and have a ton of our own rules and suggested-fix refactors based on it), so greatly appreciate your work maintaining it. Java 14 support in errorprone would mean we could stop dual compiling and fully switch over a bunch of our services to Java 14!
@TimvdLippe thank you for considering making error_prone finally compatible with latest version of Java. FYI we at @JOSM use a patched version for almost 2 years now and we update our patches at each new Java version. If you apply the merge requests I listed above, you can get quickly a version that works with Java 14/15-ea. A complete signature analysis will be useful, but don't forget that most of compatibility problems have already been reported, analyzed, and fixed by me and other users in the past two years. Could you please try to apply those community patches first and release a new version? It will solve all the currently known compatibility problems for a lot of users and will give you the time you need to perform a complete analysis.
Yes I will take a look at the community PRs. At this moment in time, I am trying to make it compile to get a sense of how many reflect hacks we have to put in place. I think I have an initial compile working for 14, with minimal changes. The next step is actually fixing the tests on JDK 14 and putting the reflect hacks in place to not break 8 and 11.
Short update: Java 14 changes an existing interface to add a new method (that isn't particularly a problem), but its return type is a type also introduced in Java 14: https://github.com/google/error-prone/pull/1571/files/b7cc8779ef31e8e6f209f76456274d51eaa69f5c#r410377439
This means that we can't implement this method on Java <14. We are considering options atm, but that is a lot more difficult than initially expected 😢
All right, it seems like multi-release jars are the appropriate solution. However, support in Maven seems spotty. I have made various attempts (latest failed attempt in https://github.com/google/error-prone/pull/1571/commits/52f2eff8411cd1d81ccaa17c28fd746955e3a662), but I can't seem to get it to work.
The latest version does correctly create the META-INF/versions/14
folder, but doesn't actually include the class file. Moreover, it still includes the UIInstanceOf
from src/main/java/
, even after explicitly excluding it.
The documentation of the maven-compiler-plugin
does not seem to indicate what could be wrong. The canonical page appears to be http://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html but it doesn't actually list any solution. The most promising solution links to a 404: http://in.relation.to/2017/02/13/building-multi-release-jars-with-maven/
I also took a look at https://github.com/apache/maven-compiler-plugin/tree/master/src/it/multirelease-patterns/singleproject-runtime and tried to replicate it, but again without success.
Is there anyone who has experience with multi-release jars and Maven? It appears to be largely unsupported/underdocumented or I might just be missing an obvious resource that describes the process.
FWIW: That most promising link above has a wayback snapshot available: https://web.archive.org/web/20180602175709/http://in.relation.to/2017/02/13/building-multi-release-jars-with-maven/
Of course, I could have known. Thanks for providing that link 😄
So I did get 1 step further. It is now properly compiling on Java 8 again. The Java 14 compilation succeeds as well, but the special maven-antrun-plugin
step fails with:
[INFO] --- maven-antrun-plugin:1.3:run (compile-java14) @ error_prone_core ---
[INFO] Executing tasks
[javac] Compiling 1 source file to /Users/tvanderlippe/Projects/error-prone/core/target/classes-java14
[javac] /Users/tvanderlippe/Projects/error-prone/core/src/main/java14/com/google/errorprone/refaster/UInstanceOf.java:25: error: cannot find symbol
[javac] import com.sun.tools.javac.tree.JCTree.JCPattern;
[javac] ^
[javac] symbol: class JCPattern
[javac] location: class JCTree
[javac] /Users/tvanderlippe/Projects/error-prone/core/src/main/java14/com/google/errorprone/refaster/UInstanceOf.java:39: error: cannot find symbol
[javac] public abstract JCPattern getPattern();
[javac] ^
[javac] symbol: class JCPattern
[javac] location: class UInstanceOf
[javac] /Users/tvanderlippe/Projects/error-prone/core/src/main/java14/com/google/errorprone/refaster/UInstanceOf.java:34: error: Did not generate @AutoValue class for com.google.errorprone.refaster.UInstanceOf because it references undefined types
[javac] abstract class UInstanceOf extends UExpression implements InstanceOfTree {
[javac] ^
[javac] 3 errors
[INFO] ------------------------------------------------------------------------
It seems like the JDK internal classes are not taken from the Java 14 JDK. I tried to explicitly point to that with the compiler
argument on the maven-antrun-plugin
task javac
, but sadly to no avail.
Have to stop for today, probably can get back to this next week.
P.S. If anyone figures this part out, please open a PR so that I can take a look. You should be able to pull #1571
I haven't had time this week to work on this and will not have time next week as well. Sadly getting a multi-release jar seems non-trivial, given lacking support with Maven. We might have to wait for improved support in Maven to be able to support multiple JDK versions with breaking changes between them.
Hey @TimvdLippe, I managed to get packaging working (things are made more complicated due to com.google.errorprone:javac
that conflicts with JDK internals); some tests still fail: refaster code transformation produces new Predicate<Foo>() { () { super(); } …
instead of new Predicate<Foo>() { …
https://github.com/tbroyer/error-prone/tree/jdk14
@tbroyer That's awesome, thanks for your work. Could you open a PR against my branch? This link should roughly work: https://github.com/TimvdLippe/error-prone/compare/update-travis-build-matrix...tbroyer:jdk14 (although I suppose I have to rebase on master to get the latest fixes in).
Thanks @TimvdLippe for getting this moving forward.
I have a branch with a collection of fixes passing CI for all major versions between 8 and 13 inclusive, and I will try to land those changes in the next day or so.
The hard part with JDK 14 still looks like the changes to add new AST nodes (and corresponding changes to visitors). I need to take a closer look at the options for using mrjars here in @tbroyer's branch (thanks for that!).
I'm experimenting with adding Java 14 toolchain support to Bazel. And after upgrading error prone to 2.3.5-SNAPSHOT in Bazel, trying to build simple Java 14 syntax program in Bazel test is failing with NCDFE
:
Interestingly, with outdated EP version on Bazel@HEAD (2.3.2-SNAPSHOT) it worked. This is the test program:
Is there any versions of EP available for me to try out to overcome that problem today? Let me know if you need a reproducer.
@davido Error Prone doesn't support JDK 14+ yet, this is the bug for that. This branch includes some WIP that has the tests passing on 14: https://github.com/google/error-prone/tree/jdk14
It's not clear why you're getting a NCDFE
, or whether it's related to JDK 14 support. Can you file a new bug with a repro? Are you sure you're not just missing a dependency (maybe on caffeine, which ASTHelpers
now references)?
@cushon Thanks, indeed, caffeine-cache
was missing ;-(
Are you sure you're not just missing a dependency (maybe on caffeine, which ASTHelpers now references)?
I uploaded two PRs for upgrading EP version in Bazel: to 2.3.4 (with new dependency on caffeine-cache
) and to 2.3.5-SNAPSHOT (with new dependency on threeten-extra-1.5.0.jar
). In preparation of the third PR: adding support for JDK 14 I did a mistake any only cherry-picked commit for 2.3.5-SNAPSHOT upgrade and in fact, transitive dependency on caffeine-cache
was missing.
As of https://github.com/google/error-prone/commit/746c15f1db94b27ca6b93942dc878389420b5a0e, CI is passing with JDK 14 and 15.
I filed #1639 to track a 2.4.0 release that will include all of those changes.
FYI 2.4.0 has now been released and is available on maven central: https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core
@cushon can you please take a look to #1872 ? I don't see an easy way to keep compatibility with older and newer versions of Java with this change.
What version of Error Prone are you using?
2.3.4 (originally 2.3.1)
Does this issue reproduce with the latest release?
Yes
What did you do?
Error-prone does not work with JDK12 EA b09 and produces the following exception:
It works fine with previous build (JDK 12 EA b08). I don't know what change causes this error.