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

NPE compiling lambda expression within conditional expression

XMLWordPrintable

    • b29
    • Verified

        ADDITIONAL SYSTEM INFORMATION :
        DELL 7720/OpenSUSE Leap 15.1/1.8.0_242

        A DESCRIPTION OF THE PROBLEM :
        boolean first = true;
        ...
        first = first ? false : (boolean)(() -> false) ;

        An exception has occurred in the compiler (1.8.0_242). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        at com.sun.tools.javac.code.Types.asSuper(Types.java:1949)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:921)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:844)
        at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:840)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:804)
        at com.sun.tools.javac.code.Types.isCastable(Types.java:1488)
        at com.sun.tools.javac.comp.Attr$11.compatible(Attr.java:3114)
        at com.sun.tools.javac.comp.Check.checkType(Check.java:546)
        at com.sun..................

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        boolean first = true;
        ...
        first = first ? false : (boolean)(() -> false) ;

        An exception has occurred in the compiler (1.8.0_242). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        at com.sun.tools.javac.code.Types.asSuper(Types.java:1949)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:921)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:844)
        at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:840)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:804)
        at com.sun.tools.javac.code.Types.isCastable(Types.java:1488)
        at com.sun.tools.javac.comp.Attr$11.compatible(Attr.java:3114)
        at com.sun.tools.javac.comp.Check.checkType(Check.java:546)
        at com.sun..................

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Compiler error.
        ACTUAL -
        An exception has occurred in the compiler (1.8.0_242). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        at com.sun.tools.javac.code.Types.asSuper(Types.java:1949)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:921)
        at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:844)
        at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:786)
        at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4571)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:840)
        at com.sun.tools.javac.code.Types.isSubtype(Types.java:804)
        at com.sun.tools.javac.code.Types.isCastable(Types.java:1488)
        at com.sun.tools.javac.comp.Attr$11.compatible(Attr.java:3114)
        at com.sun.tools.javac.comp.Check.checkType(Check.java:546)
        at com.sun..................

        ---------- BEGIN SOURCE ----------
        boolean first = true;
        ...
        first = first ? false : (boolean)(() -> false) ;

        ---------- END SOURCE ----------

        FREQUENCY : always


              asotona Adam Sotona
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: