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 258130 - Hints not relevant for the configured Java platform/sources format version are displayed
Summary: Hints not relevant for the configured Java platform/sources format version ar...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 262093 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-02-24 10:36 UTC by kalwi
Modified: 2016-05-26 11:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example project, messages.log, project cfg. screenshots. (256.75 KB, application/x-zip-compressed)
2016-03-27 00:40 UTC, kalwi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kalwi 2016-02-24 10:36:48 UTC
Java hints are displayed also in case they are not relevant for the configured Java platform version.

E.g. "Can Use Diamond" is wrongly displayed also when the project is configured to use JDK 1.6 platform/sources format, "Convert to Lambda or Member Reference" is wrongly displayed for JDK 1.6 and JDK 1.7, etc.

Tested with both native NB and Maven projects.

A workaround is to disable such hints (globally or per-project), but it's not too comfortable.
Comment 1 Jiri Prox 2016-03-24 16:12:10 UTC
Can you please share the project with this incorrect behavior and the messages.log file?
 I've tested it and it worked fine for me, in the common J2SE project.

What build do you use?
Comment 2 kalwi 2016-03-27 00:40:34 UTC
Created attachment 159012 [details]
Example project, messages.log, project cfg. screenshots.

See the attached ZIP file with the example project.

I use the latest dev. build, JDK 1.8 as the default NB platform and JDK 1.6/1.7 as the project platform (see the screenshots and messages.log included additionally in the attached ZIP for more details).

The screenshots with examples of invalid hints are taken with JDK 1.6 platform/source format. I've deleted the NB profile before, so I have a fresh one. The only prerequisite is to enable the relevant (or simply all) Java hints.

As I little bit remember, hints not relevant for the selected project platform/source format started to appear probably sometimes when the support for Java 1.5 (and lower) platform was removed from NetBeans. But I'm not 100% sure with this information.
Comment 3 Svata Dedic 2016-05-17 11:31:33 UTC
Individual hints should test the source level and bail out if source level of the inspected code is inappropriate. For simple cases I've added support to declare the minimum required source level for hint implementors and fixed inappropriately enabled hints.

Fixed in jet-main#3890c6763ec6
Comment 4 Quality Engineering 2016-05-19 01:43:41 UTC
Integrated into 'main-silver', will be available in build *201605190002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/dd8d1d5e3261
User: Svata Dedic <sdedic@netbeans.org>
Log: #258130: declarative support for required source level in hints
Comment 5 Svata Dedic 2016-05-26 11:30:12 UTC
*** Bug 262093 has been marked as a duplicate of this bug. ***