This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271784 - NetBeans editor reports errors where javac says code is valid
Summary: NetBeans editor reports errors where javac says code is valid
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-10 23:45 UTC by arren
Modified: 2017-11-11 01:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description arren 2017-11-10 23:45:49 UTC
Worked in netbeans 8.0.2
Broken in netbeans 8.2


Issue 1:

Set<? extends String> getFoo() { ... }
...
Set<String> v = new HashSet<>(getFoo()); // reports error: HashSet<CAP#1> cannot be converted to Set<String>


Set<String> v = new HashSet<String>(getFoo()); // OK


Issue 2:

class Foo<E extends Exception> {
public void foo() throws E;
}

class Bar extends Foo<RuntimeException> {
...
}

new Bar().foo(); // NetBeans 8.2 thinks this throws E, 8.0.2 knew it was only a RuntimeException and so not checked.
Comment 1 arren 2017-11-10 23:47:07 UTC
NetBeans 8.0.2 and 8.2 both ran on JDK1.8
Issue 2 also related to updating underlying java project to use JDK1.8.
Issue 1 project JDK not changted.
Comment 2 arren 2017-11-11 01:01:46 UTC
I have found a critical difference with JDK (outside netbeans):

1.8.0_72 (Azul Zulu) can compile the code in -source 1.7 but not in -source 1.8
1.8.0_151 (Oracle) can compile the code in -source 1.7 and -source 1.8
Comment 3 arren 2017-11-11 01:02:17 UTC
Note that the failing netbeans was running on Oracle JDK 1.8, though. This just leads me to wonder whether it found (or includes) an old tools.jar somewhere.