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

NPE thrown when calling a method on an intersection type

XMLWordPrintable

    • b33
    • generic, x86
    • generic, linux
    • Not verified

      The followin exception was thrown while coppilation of the Test1.java(see below). winxp and solaris platforms, java 6 and 7.
      ------------------------------------OutPut----------------------------------------------
      Information:An exception has occurred in the compiler (1.6.0). 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.
      Information:java.lang.NullPointerException
      Information: at com.sun.tools.javac.comp.TransTypes.retype(TransTypes.java:135)
      Information: at com.sun.tools.javac.comp.TransTypes.visitApply(TransTypes.java:566)
      Information: at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
      Information: at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
      Information: at com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:398)
      Information: at com.sun.tools.javac.comp.TransTypes.visitExec(TransTypes.java:529)
      Information: at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1074)
      Information: at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:56)
      Information: at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:146)
      Information: at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
      Information: at com.sun.tools.javac.comp.TransTypes.visitMethodDef(TransTypes.java:432)
      Information: at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
      Information: at com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:120)
      Information: at com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:742)
      Information: at com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:419)
      Information: at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
      Information: at com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:765)
      Information: at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1182)
      Information: at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1118)
      Information: at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
      Information: at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
      Information: at com.sun.tools.javac.main.Main.compile(Main.java:353)
      Information: at com.sun.tools.javac.main.Main.compile(Main.java:279)
      Information: at com.sun.tools.javac.main.Main.compile(Main.java:270)
      Information: at com.sun.tools.javac.Main.compile(Main.java:69)
      Information: at com.sun.tools.javac.Main.main(Main.java:54)
      Information: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      Information: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      Information: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      Information: at java.lang.reflect.Method.invoke(Method.java:597)
      Information: at com.intellij.rt.compiler.JavacRunner.main(JavacRunner.java:56)
      Information:Compilation completed with 1 error and 0 warnings
      Information:1 error
      Information:0 warnings
      Error:Compiler internal error. Process terminated with exit code 4

      ------------------------------Test1.java--------------------------------
      class A{ public void a(){}}
      class B extends A{ public void b(){}}
      interface I{ void i();}
      class E extends B implements I{ public void i(){};}

      class C<W extends B & I, T extends W>{
           public T fieldT;
      }

      public class Test1 {
          static void method(C<? extends I, ? extends E> arg){ //FAIL
      // // (C<? extends I, ? extends B> arg){ // OK
              arg.fieldT.a();
          }
      }

            mcimadamore Maurizio Cimadamore
            ynovozhi Yulia Novozhilova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: