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

ClassCastException in TransTypes.visitApply

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u25, 8u40
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b47
    • CPU:
      x86_64
    • OS:
      windows_7
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        javac 1.8.0_25

        java version "1.8.0_25"
        Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
        Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        Windows 7 Home Premium 64-bit

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Using 32-bit JDK 8u25.

        A DESCRIPTION OF THE PROBLEM :
        Compiling the attached source code produces a NullPointerException in javac.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile attached source code:

        javac CompilerNpeGenericGetters.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Compiles without error
        ACTUAL -
        An exception has occurred in the compiler (1.8.0_25). 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
        at com.sun.tools.javac.comp.TransTypes.retype(TransTypes.java:176)
        at com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:686)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:490)
        at com.sun.tools.javac.comp.TransTypes.visitExec(TransTypes.java:644)
        at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
        at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:162)
        at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:490)
        at com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:525)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
        at com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:134)
        at com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:1007)
        at com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:511)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
        at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:490)
        at com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:1035)
        at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1486)
        at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1356)
        at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
        at com.sun.tools.javac.main.Main.compile(Main.java:523)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)
        at com.sun.tools.javac.Main.main(Main.java:42)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        class CompilerNpeGenericGetters {
        interface IntfA {
        int getA();
        }
        interface Intf1<A extends IntfA> {
        A getInIntf1();
        }
        interface Intf2<B> {
        Intf1<? extends B> getInIntf2();
        }
        interface Intf3<C> {
        Intf2<? extends C> getInIntf3();
        }

        Intf3<?> f() {
        return null;
        }

        void g() {
        f().getInIntf3().getInIntf2().getInIntf1().getA();
        }
        }
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sadayapalam Srikanth Adayapalam
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: