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 243109 - IDE thinks a statement has lambda expression when it doesn't
Summary: IDE thinks a statement has lambda expression when it doesn't
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-20 17:51 UTC by redsaz
Modified: 2014-08-27 02:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (58.15 KB, text/plain)
2014-03-20 17:51 UTC, redsaz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description redsaz 2014-03-20 17:51:07 UTC
Product Version = NetBeans IDE 7.4 (Build 201310111528)
Operating System = Linux version 3.13.6-200.fc20.x86_64 running on amd64
Java; VM; Vendor = 1.7.0_51
Runtime = OpenJDK 64-Bit Server VM 24.51-b03

Steps to reproduce:
Paste this into a class:

    public static void main(String[] args) {
        boolean dummy = (Object[].class.isAssignableFrom(null));
    }

What actually happens:
    In NetBeans 7.4 (all builds up to and including the build listed above) this marks it as an error claiming "lambda expression not expected here". However, I can build this just fine anyway.

What should happen:
    This doesn't get highlighted.

Notes:
According to http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html all lambdas have an arrow token, "->". There is nothing that even looks like that in here.

This appears to be a problem with array types. If I change the statement to the following:
        boolean dummy = (Object.class.isAssignableFrom(null));

Then the error goes away.
Comment 1 redsaz 2014-03-20 17:51:10 UTC
Created attachment 146189 [details]
IDE log
Comment 2 redsaz 2014-03-20 18:11:01 UTC
Verified that this exists in NetBeans 8.0 as well.
Comment 3 Svata Dedic 2014-08-22 09:33:41 UTC
There's a difference in behaviour of javac from 8u20 and NB-javac. Javac from JDK 8u20 properly processes the file (even though -source 8 was explicitly provided on command line), while NB-javac produces an error "lambda expression not expected here.

Also occurs in 8.0.1/dev
Comment 5 Quality Engineering 2014-08-27 02:38:29 UTC
Integrated into 'main-silver', will be available in build *201408270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c24db16113e9
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #243109: IDE thinks a statement has lambda expression when it doesn't - fixed.