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 242751 - Wrong hint "Parameter x not used" for lambda identity expressions (x -> x)
Summary: Wrong hint "Parameter x not used" for lambda identity expressions (x -> x)
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 8
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks: 257080
  Show dependency tree
 
Reported: 2014-03-10 16:04 UTC by xehpuk
Modified: 2016-01-28 16:03 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 xehpuk 2014-03-10 16:04:23 UTC
Product Version = NetBeans IDE 8.0 RC1 (Build 201402242200)
Operating System = Windows 8 version 6.2 running on amd64
Java; VM; Vendor = 1.8.0
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.0-b70

For lambda expressions returning the identity (i.e. x -> x) NetBeans raises the warning "Parameter x not used".

Custom examples:
IntStream.empty().map(i -> i); // primitive identity
IntStream.empty().mapToObj(i -> i); // autoboxing
Stream.empty().map(o -> o); // reference identity
Stream.<Integer>empty().mapToInt(i -> i); // unboxing

JDK example:
java.util.function.IntUnaryOperator.identity()
Comment 1 Svata Dedic 2015-09-25 14:06:30 UTC
fixed in jet-main#eb693fe43af0
Comment 2 Quality Engineering 2015-09-30 01:20:06 UTC
Integrated into 'main-silver', will be available in build *201509300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/eb693fe43af0
User: Svata Dedic <sdedic@netbeans.org>
Log: #242751: identifier expression in lambda body treated as read