-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK 14/15 compatibility #1106
Comments
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. |
…DK 12 compatibility. See google/error-prone#1106 git-svn-id: https://josm.openstreetmap.de/svn/trunk@14218 0c6e7542-c601-0410-84e7-c038aed88b3b
I have a new error with 2.3.2-SNAPSHOT:
|
…DK 12 compatibility. See google/error-prone#1106 git-svn-id: https://josm.openstreetmap.de/svn/trunk@14218 0c6e7542-c601-0410-84e7-c038aed88b3b
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 |
See google#1106 - field removed in JDK12 as per http://hg.openjdk.java.net/jdk/jdk/rev/de411d537aae#l26.131
With #1107 used on our project we get a new error:
|
See google/error-prone#1110 See google/error-prone#1106 (comment) git-svn-id: https://josm.openstreetmap.de/svn/trunk@14225 0c6e7542-c601-0410-84e7-c038aed88b3b
See google/error-prone#1110 See google/error-prone#1106 (comment) git-svn-id: https://josm.openstreetmap.de/svn/trunk@14225 0c6e7542-c601-0410-84e7-c038aed88b3b
Third problem:
|
See google/error-prone#1111 See google/error-prone#1106 (comment) git-svn-id: https://josm.openstreetmap.de/svn/trunk@14226 0c6e7542-c601-0410-84e7-c038aed88b3b
See google/error-prone#1111 See google/error-prone#1106 (comment) git-svn-id: https://josm.openstreetmap.de/svn/trunk@14226 0c6e7542-c601-0410-84e7-c038aed88b3b
Might have found a new one:
...where the error is:
Full log: https://travis-ci.org/apereo/cas/jobs/465117781 Using |
Since today, we fail to use error_prone with JDK13:
(using JOSM patched version containing fixes #1107 + #1110 + #1111) |
See google#1106 - field removed in JDK12 as per http://hg.openjdk.java.net/jdk/jdk/rev/de411d537aae#l26.131
See google#1106 - field removed in JDK13 as per http://hg.openjdk.java.net/jdk/jdk/rev/a772e65727c5#l1.23
See google#1106 - field removed in JDK13 as per http://hg.openjdk.java.net/jdk/jdk/rev/a772e65727c5#l1.23
See google/error-prone#1106 (comment) git-svn-id: https://josm.openstreetmap.de/svn/trunk@14784 0c6e7542-c601-0410-84e7-c038aed88b3b
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 $ bazel test src/test/shell/bazel:bazel_java14_test
[...]
Target //src/test/shell/bazel:bazel_java14_test up-to-date:
bazel-bin/src/test/shell/bazel/bazel_java14_test
INFO: Elapsed time: 279.479s, Critical Path: 186.00s
INFO: 1026 processes: 448 linux-sandbox, 1 local, 577 worker.
INFO: Build completed, 1 test FAILED, 1032 total actions
//src/test/shell/bazel:bazel_java14_test FAILED in 75.2s
$ cat bazel-out/k8-fastbuild/testlogs/src/test/shell/bazel/bazel_java14_test/test.log
external/openjdk14_linux_archive/bin/java -XX:+UseParallelOldGC -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' -jar external/local_java_tools/java_tools/JavaBuilder_deploy.jar @bazel-out/k8-fastbuild/bin/java/main/Javac14Example.jar-0.params @bazel-out/k8-fastbuild/bin/java/main/Javac14Example.jar-1.params)
Execution platform: @local_config_platform//:host
Note: java/main/Javac14Example.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
error: 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.5-SNAPSHOT
BugPattern: (see stack trace)
Stack Trace:
java.lang.NoClassDefFoundError: Could not initialize class com.google.errorprone.util.ASTHelpers
at com.google.errorprone.SuppressionInfo$1.visitClass(SuppressionInfo.java:117)
at com.google.errorprone.SuppressionInfo$1.visitClass(SuppressionInfo.java:114)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:823)
at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:80)
at jdk.compiler/com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:94)
at com.google.errorprone.SuppressionInfo.forCompilationUnit(SuppressionInfo.java:121)
at com.google.errorprone.scanner.Scanner.updateSuppressions(Scanner.java:87)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:54)
at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
at com.google.devtools.build.buildjar.javac.plugins.errorprone.ErrorPronePlugin.postFlow(ErrorPronePlugin.java:161) Interestingly, with outdated EP version on Bazel@HEAD (2.3.2-SNAPSHOT) it worked. This is the test program: function test_java14_record_type() {
mkdir -p java/main
cat >java/main/BUILD <<EOF
java_binary(
name = 'Javac14Example',
srcs = ['Javac14Example.java'],
main_class = 'Javac14Example',
javacopts = ["--enable-preview"],
jvm_flags = ["--enable-preview"],
)
EOF
cat >java/main/Javac14Example.java <<EOF
public class Javac14Example {
record Point(int x, int y) {}
public static void main(String[] args) {
Point point = new Point(0, 1);
System.out.println(point.x);
}
}
EOF
bazel run java/main:Javac14Example --test_output=all --verbose_failures &>"${TEST_log}"
expect_log "0"
} 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 |
@cushon Thanks, indeed,
I uploaded two PRs for upgrading EP version in Bazel: to 2.3.4 (with new dependency on |
They've been deprecated since 2018 and are incompatible with JDK 15. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313252393
#1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313258773
They've been deprecated since 2018 and are incompatible with JDK 15. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313252393
#1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313258773
It has a new getter for instanceof patterns, for now we proxy it to handle the new getter (and the new PatterTree AST node type that it returns) and unconditionally return `null`. This will require more work to actually support refaster matches on instanceof patterns. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313270135
The return type is a non-null 'void' type in recent JDK versions. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313289453
It has a new getter for instanceof patterns, for now we proxy it to handle the new getter (and the new PatterTree AST node type that it returns) and unconditionally return `null`. This will require more work to actually support refaster matches on instanceof patterns. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313270135
The return type is a non-null 'void' type in recent JDK versions. #1106 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313289453
FYI 2.4.0 has now been released and is available on maven central: https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core |
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.
The text was updated successfully, but these errors were encountered: