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

generics: verify error in generated bytecode

    XMLWordPrintable

Details

    • mantis
    • generic
    • solaris_8

    Description

      frog:~/workspaces/test/Generic16 $ cat -n Case.java
           1 import java.util.Stack;
           2 public class Case
           3 {
           4 public static void main(String[] argv)
           5 {
           6 Stack<String> bar = new Stack<String>();
           7 String foo;
           8
           9 // Compiles, but causes verify error
          10 foo=(bar.empty()?"":bar.peek()).intern();
          11
          12 // The following two work fine
          13 foo = (bar.empty()?"":bar.peek().intern());
          14 foo = (bar.empty()?"":(String)bar.peek()).intern();
          15 }
          16 }
      frog:~/workspaces/test/Generic16 $ newjavac -gj Case.java
      frog:~/workspaces/test/Generic16 $ newjava Case
      + /java/re/j2se/1.4.1/promoted/latest/binaries/solaris-sparc/bin/java -Xfuture Case
      Exception in thread "main" java.lang.VerifyError: (class: Case, method: main signature: ([Ljava/lang/String;)V) Incompatible object argument for function call
      frog:~/workspaces/test/Generic16 $

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: