Bug 268452 - “error: incompatible types” shown on compilable source code
“error: incompatible types” shown on compilable source code
Status: NEW
Product: java
Classification: Unclassified
Component: Compiler
Dev
PC Linux
: P3 (vote)
: Dev
Assigned To: Dusan Balek
issues@java
jdk_bug_8075793
: JDK_9, REGRESSION
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-10 15:20 UTC by Jesse Glick
Modified: 2017-01-06 15:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Screenshot of error (68.31 KB, image/png)
2016-10-10 15:20 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2016-10-10 15:20:04 UTC
Created attachment 162435 [details]
Screenshot of error

Observed in a few cases, but for example:

https://github.com/jenkinsci/workflow-support-plugin/blob/39210f5b185983bf5fc177c53060ddbf0725de9e/src/main/java/org/jenkinsci/plugins/workflow/support/concurrent/Futures.java#L243

Reproducible from dev sources (16f9bbc04752):

ant clean build-nozip tryme -Dcluster.config=java -Dtryme.arg.nbopen='--open …/jenkinsci/workflow-support-plugin …/jenkinsci/workflow-support-plugin/src/main/java/org/jenkinsci/plugins/workflow/support/concurrent/Futures.java:243'

The project is compilable using JDK 8:

JAVA_HOME=…/jdk1.8.0_101 mvn -f …/jenkinsci/workflow-support-plugin -DskipTests clean install

I tried in JDK 9 (EA 139) but got some unrelated error, presumably due to modules:

[ERROR] java.nio.file.NoSuchFileException: …/jenkinsci/workflow-support-plugin/target/classes/META-INF/annotations/org.kohsuke.accmod.Restricted
[ERROR] java.nio.file.NoSuchFileException: …/jenkinsci/workflow-support-plugin/target/classes/META-INF/annotations/hudson.Extension
Comment 1 Jesse Glick 2016-10-10 18:00:42 UTC
Tried to bisect (starting from 34c73be6b85c as known-good) but I am not sure if I screwed it up because in some IDE versions, an error badge appears on the project and on the editor tab while no error mark appears inside the editor in the gutter or on the line, and I get

WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=…/jenkinsci/workflow-support-plugin/src/main/java/org/jenkinsci/plugins/workflow/support/concurrent/Futures.java.
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Going to recompute root=…/jenkinsci/workflow-support-plugin/src/main/java, files in error=[].

At any rate, no big surprise at the result:

The first bad revision is:
changeset:   304109:8d2520b6f967
branch:      jdk9
tag:         jdk9ea
parent:      304107:3348dfc90e85
parent:      304108:432e1029c071
user:        Tomas Zezula <tzezula@netbeans.org>
date:        Sun Nov 29 10:53:59 2015 +0100
summary:     Merging default -> jdk9.

As usual with these things, it is possible that the JDK 9 javac is simply being stricter about some corner case in the language that earlier releases were more tolerant of, but if so I would like some sort of confirmation from the JDK team that treating this source file as erroneous is deliberate and the behavior in JDK 9 FCS will be the same.
Comment 2 Dusan Balek 2016-10-11 14:31:15 UTC
Yes, there is a change in JDK9's generics resolution. Could you please try to change your project's source level from 1.7 to 1.8 ? It should help.
Comment 3 Jesse Glick 2016-10-12 16:08:30 UTC
Adding

  <java.level>8</java.level>

to the POM’s `<properties>` section does cause the error to disappear. I am not about to do that, because this module must be usable on Java 7 runtimes.

Again, to clarify, the module does compile without error using Maven on JDK 8, where the POM default passes `-source 7 -target 7`.

So did JDK 9 include a deliberate change in generics resolution when applied to Java 7 sources?
Comment 4 Jesse Glick 2016-10-17 20:01:41 UTC
I think this is https://bugs.openjdk.java.net/browse/JDK-8075793. If the evaluation there is correct, there is no bug in NetBeans, but it is something that should be mentioned in release notes.
Comment 5 Jesse Glick 2017-01-06 15:55:28 UTC
Can you please update the bundled javac to a version which includes http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/49170d831308? That would effectively fix the bug.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo