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

com.sun.tools.javac.code.Types.lub() throws NPE

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b54)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b54, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      lub() thows a NullPointerException in case of a mix of
      varags/unboxing and generics.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the example

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The two methods min are ambiguous.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.6.0-ea). Please file a bug at the J
      ava Developer Connection (http://java.sun.com/webapps/bugreport) after checking
       the Bug Parade for duplicates. Include your program and the following diagnosti
      c in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.code.Types.lub(Types.java:2569)
              at com.sun.tools.javac.code.Types.lub(Types.java:2583)
              at com.sun.tools.javac.comp.Infer.minimizeInst(Infer.java:187)
              at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:328)
              at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:307)
              at com.sun.tools.javac.comp.Resolve.instantiate(Resolve.java:332)
              at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:570)
              at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:543)
              at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:720)
              at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:686)
              at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:766)
              at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:1157)
              at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:1620)
              at com.sun.tools.javac.tree.Tree$Ident.accept(Tree.java:1251)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:292)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1149)
              at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:992)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:336)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1141)
              at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:992)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:299)
              at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:925)
              at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:888)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:312)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:328)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:626)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:630)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:312)
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:537)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:545)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:277)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:312)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2525)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2457)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2393)
              at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:636
      )
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:549)
              at com.sun.tools.javac.main.Main.compile(Main.java:680)
              at com.sun.tools.javac.main.Main.compile(Main.java:611)
              at com.sun.tools.javac.main.Main.compile(Main.java:607)
              at com.sun.tools.javac.Main.compile(Main.java:70)
              at com.sun.tools.javac.Main.main(Main.java:55)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Min {
          public static int min(int a, int ... ints){

        int minTmp=a;
        for(int num:ints){
            if(num < minTmp)
          minTmp = num;
        }
        return minTmp;
        }
          
          public static <T extends Comparable<T>> T min(T a, T ... ints){
        T minTmp=a;
        for(T num:ints){
            if(num.compareTo(minTmp) < 0)
          minTmp = num;
        }
        return minTmp;
          }
          
          public static void main(String[] args){
        System.out.println(min(Integer.valueOf(1), Integer.valueOf(2)));
          }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ahe Peter Ahe
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: