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

generics not working properly

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      code:
      class Gen<T,T,T>
      {
      T ob1,ob2,ob3;
      Gen(T o1,T o2,T o3)
      {
      ob1=o1;
      ob2=o2;
      ob3=o3;
      }
      T getob1()
      {
      return ob1;
      }
      T getob2()
      {
      return ob2;
      }
      T getob3()
      {
      return ob3;
      }
      }
      public class HelloWorld
      {
      public static void main(String []args)
      {
      Gen<Integer,Integer,Integer> a=new Gen<Integer,Integer,Integer>(100,500,1000);
      int a1=a.getob1();
      System.out.println(a1);
      }
      }



      compilation:
      An exception has occurred in the compiler (1.8.0_121). 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.comp.MemberEnter.baseEnv(MemberEnter.java:1388)
              at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1046)
              at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
              at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037)
              at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:973)
              at com.sun.tools.javac.code.Symbol$ClassSymbol.getKind(Symbol.java:1101)
              at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:162)
              at com.sun.tools.javac.comp.Check.duplicateError(Check.java:329)
              at com.sun.tools.javac.comp.Check.checkUnique(Check.java:3380)
              at com.sun.tools.javac.comp.Enter.visitTypeParameter(Enter.java:454)
              at com.sun.tools.javac.tree.JCTree$JCTypeParameter.accept(JCTree.java:2224)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
              at com.sun.tools.javac.comp.Enter.visitClassDef(Enter.java:418)
              at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
              at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:334)
              at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
              at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
              at com.sun.tools.javac.comp.Enter.complete(Enter.java:486)
              at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
              at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
              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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: