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 268508 - Incorrect hint "no suitable method found"
Summary: Incorrect hint "no suitable method found"
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-13 14:02 UTC by lkishalmi
Modified: 2017-11-24 21:23 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample Project demonstrating the issue. (16.38 KB, application/x-zip-compressed)
2016-10-13 14:02 UTC, lkishalmi
Details
Picture demonstrating the issue using Language level Java 8 (32.46 KB, image/png)
2016-11-15 09:43 UTC, lkishalmi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lkishalmi 2016-10-13 14:02:01 UTC
Created attachment 162494 [details]
Sample Project demonstrating the issue.

I get Editor Error hints on the following code, when using Java 8 as source format (Java 6 and 7 are Ok):

public class Actions {

    public interface Action<T> {

        void execute(T t);
    }

    public static <T> Action<T> composite(Iterable<? extends Action<? super T>> actions) {
        return null;
    }

    public static <T> Action<T> composite(Action<? super T>... actions) {
        return composite(Arrays.asList(actions));
    }
}

Actually this is an excerpt from Gradle base-services sub-project.
On contrary there is a CollectionUtils class which only marked well when Java 8 is the source format.

It's maybe related to: #222487, though I think that's unlikely
Comment 1 lkishalmi 2016-11-15 09:43:48 UTC
Created attachment 162915 [details]
Picture demonstrating the issue using Language level Java 8
Comment 2 dtrebbien 2017-11-24 21:23:54 UTC
I'm not sure that this is an issue with the Hints component. The compilation error can be fixed by a small change:

    public static <T> Action<T> composite(Action<? super T>... actions) {
        return Actions.<T>composite(Arrays.asList(actions));
    }