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: | Unable to infer method return type from ternary operator | ||
---|---|---|---|
Product: | java | Reporter: | cezariusz <cezariusz> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | cezariusz |
Priority: | P3 | ||
Version: | 8.1 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
Invalid hint
Sample project Userdir and cache |
Description
cezariusz
2015-05-18 11:47:47 UTC
Already works in dev version Product Version: NetBeans IDE Dev (Build 201505220001) Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14 System: Windows 7 version 6.1 running on amd64; UTF-8; pl_PL (nb) No it doesn't. Created attachment 153818 [details]
Invalid hint
Well, I could attach the same screenshot where the hint says "Change ... to String". Built from fresh sources 10 minutes ago: Product Version: NetBeans IDE Dev (Build 20150522-2bbdcb3f4f50) Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 System: Linux version 3.16.0-25-generic running on amd64; UTF-8; pl_PL (nb) (I doubt that java micro-version would change anything - NB uses its own bundled javac impl for analysis). Anyway - could you please isolate the issue into a separate project, zip it and attach here ? Also please pack your $nbuser/config directory so I can recreate similar environment for testing. Thanks. Created attachment 153820 [details]
Sample project
Created attachment 153821 [details]
Userdir and cache
Reproduced on fresh userdir and cache.
Reproduced. Reassigning to Compiler for evaluation: Please use the sample project, run on JDK8 or configure JDK8 for the project. At all times, the TypeMirror which javac returns for the conditional expression is erroneous. When the source level is set to JDK8, javac API Trees.getOriginalType() returns `void' for the erroneous type. If the source level is JDK7, the getOriginalType() reports j.l.String Please check whether this difference is intentional / desirable. Suggestions how to compensate in java hints module are welcome. Thanks. Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/47043236be58 http://hg.netbeans.org/main/nb-javac/rev/4cb2e51c89a2 Integrated into 'main-silver', will be available in build *201508110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/47043236be58 User: Dusan Balek <dbalek@netbeans.org> Log: Issues #252456 and #253922 fixed. |