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

NPE in com.sun.tools.javac.code.Symbol - isSubClass

    Details

    • Subcomponent:
    • Resolved In Build:
      b123
    • CPU:
      x86
    • OS:
      windows_7
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_20"
      Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      Compilation of java code fails with NPE at "com.sun.tools.javac.code.Symbol$ClassSymbol.isSubClass(Symbol.java:731)".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile provided test case.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
          [javac] java.lang.NullPointerException
          [javac] at com.sun.tools.javac.code.Symbol$ClassSymbol.isSubClass(Symbol.java:731)
          [javac] at com.sun.tools.javac.comp.Lower.accessClass(Lower.java:929)
          [javac] at com.sun.tools.javac.comp.Lower.accessSymbol(Lower.java:797)
          [javac] at com.sun.tools.javac.comp.Lower.access(Lower.java:1032)
          [javac] at com.sun.tools.javac.comp.Lower.visitSelect(Lower.java:3118)
          [javac] at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.visitApply(Lower.java:2556)
          [javac] at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.visitTypeCast(Lower.java:2359)
          [javac] at com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:1448)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.visitTypeCast(Lower.java:2359)
          [javac] at com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:1448)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1913)
          [javac] at com.sun.tools.javac.comp.Lower.visitReturn(Lower.java:3053)
          [javac] at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1138)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:56)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:146)
          [javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3026)
          [javac] at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.visitTry(TreeTranslator.java:201)
          [javac] at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:967)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:56)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:146)
          [javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3026)
          [javac] at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:130)
          [javac] at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2349)
          [javac] at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2268)
          [javac] at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2013)
          [javac] at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
          [javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:44)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
          [javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1921)
          [javac] at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3163)
          [javac] at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1199)
          [javac] at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1118)
          [javac] at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
          [javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
          [javac] at com.sun.tools.javac.Main.compile(Main.java:69)
          [javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          [javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          [javac] at java.lang.reflect.Method.invoke(Method.java:597)
          [javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
          [javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
          [javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
          [javac] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
          [javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          [javac] at java.lang.reflect.Method.invoke(Method.java:597)
          [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
          [javac] at org.apache.tools.ant.Target.execute(Target.java:357)
          [javac] at org.apache.tools.ant.Target.performTasks(Target.java:385)
          [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
          [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
          [javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
          [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
          [javac] at org.apache.tools.ant.Main.runBuild(Main.java:758)
          [javac] at org.apache.tools.ant.Main.startAnt(Main.java:217)
          [javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
          [javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class JavaCastBug {

      public static <T extends JavaCastBug & ISomeInterface> T cloneObject(T object) {
      try {
      return (T) object.clone();
      } catch (CloneNotSupportedException e) {
      throw new IllegalStateException(e);
      }
      }

      private static interface ISomeInterface {

      public Integer doSomething();

      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Remove "& ISomeInterface" from "<T extends JavaCastBug & ISomeInterface>".

        Attachments

          Activity

            People

            • Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: