Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8056044

NullPointerException thrown when compiling method with lambda and method ref

XMLWordPrintable

    • x86_64
    • windows_7

        FULL PRODUCT VERSION :
        java version "1.8.0_20"
        Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
        Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        Upon trying to compile the sample code, Javac crashes with a NullPointerException
        The lines that cause this are 7-8 and 10-11

        REGRESSION. Last worked in version 8u5

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Successful compile
        ACTUAL -
        ant -f C:\\Users\\User\\Desktop\\JavacCrash -Dnb.internal.action.name=build jar
        init:
        Deleting: C:\Users\User\Desktop\JavacCrash\build\built-jar.properties
        deps-jar:
        Updating property file: C:\Users\User\Desktop\JavacCrash\build\built-jar.properties
        Compiling 3 source files to C:\Users\User\Desktop\JavacCrash\build\classes
        An exception has occurred in the compiler (1.8.0_20). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        C:\Users\User\Desktop\JavacCrash\nbproject\build-impl.xml:948: The following error occurred while executing this line:
        C:\Users\User\Desktop\JavacCrash\nbproject\build-impl.xml:288: Compile failed; see the compiler error output for details.
        BUILD FAILED (total time: 0 seconds)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.util.List;
        import java.util.logging.Logger;

        public class DummyTest {
            private static final Logger LOG = Logger.getLogger(DummyTest.class.getName());
        public static Thing foo(Iterable<String> rtf){
        List<Thing> things = new Query<>(rtf).select(
        Foo::getBar).toArrayList();
        Query<Thing> query = new Query<>(things);
        int estimate = query.aggregate(0,
        (i, item)-> i + item.getItems().size());
        Thing thing = new Thing(estimate);
        return query.aggregate(thing, (result, item)->result.addBar(item));
        }
        }
        ---------- END SOURCE ----------

              vromero Vicente Arturo Romero Zaldivar
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: