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

cascaded "internal error" diagnotics in method call with erroneous arguments

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b40
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      Reported at http://forum.java.sun.com/thread.jsp?forum=316&thread=467493&tstart=0&trange=50

       Greetings: While working on examples to demonstrate inference I was using the following code:


      public class Inference {
      public static <Type> List<Type> someMethod(final Type obj) {
      System.out.print("First");
      return new LinkedList<Type>();
      }

      public static <Type extends Number> List<Type> someMethod(final Type num) {
      System.out.print("Second");
      return new LinkedList<Type>();
      }

      public static <Type> List<Type> someMethod(final Type num, List<Type> list) {
      System.out.print("Third");
      return new LinkedList<Type>();
      }

      public final static void main(final String[] args) {
      // Simple
      Object obj = somemethod("hello");
      System.out.println("--> " + obj.getClass());

      System.out.println("--> " + somemethod(new Object()).getClass());
      System.out.println("--> " + somemethod(new Integer(5)).getClass());
      System.out.println("--> " + somemethod(5).getClass());
      System.out.println("--> " + somemethod().getClass());

      System.out.println("--> " + somemethod(5, null).getClass());

      }
      }



      Now if you will notice, I mislabeled someMethod() in my println to somemethod(). The resulting compile indicated the following errors:


      C:\dev\hcj\tiger\src>c:\j2sdk1.5.0\bin\javac -source 1.5 oreilly/hcj/tiger/*.java
      oreilly/hcj/tiger/Inference.java:42: cannot find symbol
      symbol : method somemethod(java.lang.Object)
      location: class oreilly.hcj.tiger.Inference
                      System.out.println("--> " + somemethod(new Object()).getClass());
                                                  ^
      oreilly/hcj/tiger/Inference.java:42: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (<any>)
                      System.out.println("--> " + somemethod(new Object()).getClass());
                                ^
      oreilly/hcj/tiger/Inference.java:43: cannot find symbol
      symbol : method somemethod(java.lang.Integer)
      location: class oreilly.hcj.tiger.Inference
                      System.out.println("--> " + somemethod(new Integer(5)).getClass());
                                                  ^
      oreilly/hcj/tiger/Inference.java:43: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (<any>)
                      System.out.println("--> " + somemethod(new Integer(5)).getClass());
                                ^
      oreilly/hcj/tiger/Inference.java:44: cannot find symbol
      symbol : method somemethod(int)
      location: class oreilly.hcj.tiger.Inference
                      System.out.println("--> " + somemethod(5).getClass());
                                                  ^
      oreilly/hcj/tiger/Inference.java:44: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (<any>)
                      System.out.println("--> " + somemethod(5).getClass());
                                ^
      oreilly/hcj/tiger/Inference.java:45: cannot find symbol
      symbol : method somemethod()
      location: class oreilly.hcj.tiger.Inference
                      System.out.println("--> " + somemethod().getClass());
                                                  ^
      oreilly/hcj/tiger/Inference.java:45: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (<any>)
                      System.out.println("--> " + somemethod().getClass());
                                ^
      oreilly/hcj/tiger/Inference.java:48: cannot find symbol
      symbol : method somemethod(int,<nulltype>)
      location: class oreilly.hcj.tiger.Inference
                      System.out.println("--> " + somemethod(5, null).getClass());
                                                  ^
      oreilly/hcj/tiger/Inference.java:48: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (<any>)
                      System.out.println("--> " + somemethod(5, null).getClass());
                                ^
      10 errors



      Now the cannot find symbol error I expected but the compiler internal error I did not expect. Did I just stumble on a bug or am I missing something here?

      TIA.

        Attachments

          Activity

            People

            Assignee:
            gafter Neal Gafter
            Reporter:
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: