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.
Summary: | Generics type inference regression with platform JDK 1.7 | ||
---|---|---|---|
Product: | java | Reporter: | matthies <matthies> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | cbourque, jlahoda, sdedic |
Priority: | P1 | Keywords: | REGRESSION |
Version: | 8.2 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
matthies
2016-09-22 18:59:04 UTC
reproducible with NetBeans 8.2, Ubuntu 16.04.01 64bit and Oracle JDK 7 64bit Setting this to P1 because it basically makes NetBeans 8.2 unusable with JDK 1.7. I have also noticed the same bug and it's easily reproducible with this simple test case: public class Test { public void test1() { Map<String, Object> map = new HashMap<>(test2()); } public Map<String, ?> test2() { Map<String, ?> map = new HashMap<>(); return map; } } In NetBeans the statement in method test1() is underlined in red but it compiles just fine! Affects Compile on Save; the class contains auto-generated throw RuntimeException at the place of the reported error. Possibly javac regression: for Source = 1.8 the compiler works OK. When source is < 1.8, types are evaluated incorrectly. Note that javac compiler team may see this P1 as 'no issue' - see https://bugs.openjdk.java.net/browse/JDK-8075793 I can reproduce this as well in 8.2, both in my codebase and the attached example from matthies. My Java version is OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.10.2-b13), but I am targeting 1.6 via Maven. It is not an issue in Netbeans 8.1, netbeans-trunk-nightly-201701300002-javase-linux, or when 1.8 is targeted. Ok so I did some more digging on this and it's actually Javac emitting these warnings when to DiagnosticListenerImpl when -source is not 1.8 (only changing that option via code). Not sure why it's not doing this in 8.1 though. Is netbeans packaging it's own com.sun.tools.javac? I see that there is indeed nb-javac. Not sure I'm skilled enough to drill down and find where the issue was introduced there however - hg merges confuse me. JDK bug is fixed http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/49170d831308 and the fix is already in nb-javac http://hg.netbeans.org/main/nb-javac/rev/49170d831308. The problem is fixed in current dev. build of NetBeans. Thanks for the link Tomas. I realise it is currently fixed in nightly, however I am requesting that this fix please be backported and released as it makes Netbeans 8.2 essentially unusable for development with source < 8. Unfortunately, the recent changes to nb-javac (e.g. jdk9 modules support) prevent us from safely backporting any non trivial changes from dev to NB 8.2. Please use the current NB Development Build. |