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 252672

Summary: Declarative hint on lambda shouldn't match and produces bad code
Product: java Reporter: err <err>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description err 2015-05-29 02:58:04 UTC
This fails with both 8.0.2 and todays daily build

Given the following:
    package javaapplication1;

    import java.util.Map;

    public class GenericizeHint {
            static class Item<K> { }

            void foo(Map<Integer, Item> m) {
                    Item item;
                    m.forEach((k,v) -> System.err.println(""));
            }
    }

and the hint (it adds the "<?>")

    $modifiers$ javaapplication1.GenericizeHint.Item $name = $init$;
    =>
    $modifiers$ javaapplication1.GenericizeHint.Item<?> $name = $init$;
    ;;

it matches
    m.forEach((k,v) -> System.err.println(""));
and rewrites it as
    m.forEach((k, Item<?> v) -> System.err.println(""));
which is a syntax error

The line should not match (or at least the match should be filtered out before
it gets to the user)