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

Internal Error thrown during generic method/constructor invocation

    Details

    • Subcomponent:
    • Resolved In Build:
      b25
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      Description:
         
      The following code fails during compilation with "internal error".
      <code>

      public class TypeInferenceTest<S>{

          public TypeInferenceTest() {

          this(1,1); //Throws internal error; cannot instanatiate ...
          //<Number>this(1,1); //Cannot find symbol
          // <Integer>this(1); //Cannot find symbol
          // this(1); //Cannot find symbol
          }
          public <T extends S> TypeInferenceTest(T a, T b) {
              //.....
          }
          public <T extends S> TypeInferenceTest(T a) {
             //....
          }

          <T extends S> void met1(T a,T b){
             met2 (1,1);//Throws internal error; cannot instanatiate ...
             new TypeInferenceTest<Number> ().met2 (1,1); //Compiles fine -- Type Inference works
      // met2(1); // Cannot find symbol
          }
          <T extends S> void met2(T a,T b){
              //..
          }

          <T extends S> void met2(T a){
             //...
          }

      }



      </code>

      Compilation result is :
      <output>

      TypeInferenceTest.java:5: internal error; cannot instantiate <T>TypeInferenceTest(T,T) at TypeInferenceTest<S> to ()
          this(1,1); //Throws internal error; cannot instanatiate ...
              ^
      TypeInferenceTest.java:18: internal error; cannot instantiate <T>met2(T,T) at TypeInferenceTest<S> to (int,int)
             Integer i = met2 (1,1);//Throws internal error; cannot instanatiate ...
                              ^
      2 errors


      </output>

      Tried in :
      <version>
      java version "1.7.0-internal"
      Java(TM) SE Runtime Environment (build 1.7.0-internal-jprtadm_26_Sep_2007_03_43-b00)
      Java HotSpot(TM) Server VM (build 11.0-b06, mixed mode)

      uname -a
      SunOS bonsai 5.11 snv_49 i86pc i386 i86pc

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: