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 256349

Summary: Netbeans compiles lambda incorrectly (vs. javac)
Product: java Reporter: assylias <assylias>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 8.1   
Issue Type: DEFECT Exception Reporter:

Description assylias 2015-11-04 07:41:00 UTC
1. Create a new Project > Java > Java Application
2. Copy the code below in a "Test" class in the default package:

    import java.util.stream.Stream;
    public class Test {
      public static void main(String[] args) {
        A<Integer> a = new A<> ();
        a.max();
      }

      static class A<T extends Number & Comparable<? super T>> {
        public T max() { return s().max(T::compareTo).orElse(null); }
        public Stream<T> s() { return Stream.empty(); }
      }
    }

3. Right click > Run file

The output shows an exception:

Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
....
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type class java.lang.Number; not a subtype of implementation type interface java.lang.Comparable

4. Clean & Build and run again: no output as expected
5. Insert a space in the file and run again: exception
6. From the command line, in the directory where the Test.java file is located:

    javac -d . Test.java
    java -cp . Test

outputs nothing as expected.
Comment 1 assylias 2016-01-18 10:58:03 UTC
Fixed in 8.1