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 - Declarative hint on lambda shouldn't match and produces bad code
Summary: Declarative hint on lambda shouldn't match and produces bad code
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2015-05-29 02:58 UTC by err
Modified: 2015-05-29 02:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
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)