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 270727 - NetBeans produces incorrect type checking on streams without generic suppliers.
Summary: NetBeans produces incorrect type checking on streams without generic suppliers.
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: Dev
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2017-05-24 07:57 UTC by brettryan
Modified: 2017-05-24 07:58 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 brettryan 2017-05-24 07:57:19 UTC
When using a stream collector with a supplier producing a non-generic formed collection NetBeans thinks the result is of type Object, though this compiles fine.

this was fine in 8.2 and earlier dev builds.

The most basic form is:

    // compiles fine, netbeans errors thinking the type is Object
    Set res = toCollection(() -> new TreeSet())

In the following sets 1 and 3 produce an error though they are both valid.

    List<String> list = new ArrayList<>();
    Set<String> set1 = list.stream().collect(toCollection(()
            -> new TreeSet(String.CASE_INSENSITIVE_ORDER)));
    Set<String> set2 = list.stream().collect(toCollection(()
            -> new TreeSet<>(String.CASE_INSENSITIVE_ORDER)));
    Set<String> set3 = list.stream().collect(toCollection(() -> new TreeSet()));
    Set<String> set4 = list.stream().collect(toCollection(() -> new TreeSet<>()));
    Set<String> set5 = list.stream().collect(toCollection(TreeSet::new));
    Set<String> set6 = list.stream().collect(toSet());


Product Version: NetBeans IDE Dev (Build 201705170001)
Java: 1.8.0_131; Java HotSpot(TM) 64-Bit Server VM 25.131-b11
Runtime: Java(TM) SE Runtime Environment 1.8.0_131-b11
System: Mac OS X version 10.12.4 running on x86_64; UTF-8; en_AU (nb)
User directory: /Users/bryan/Library/Application Support/NetBeans/dev
Cache directory: /Users/bryan/Library/Caches/NetBeans/dev