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

javac fails to substitute type variables into a constructor's throws clause

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 7
    • 6
    • tools
    • b44
    • x86
    • linux
    • Verified

    Description

      FULL PRODUCT VERSION :
      openjdk7

      A DESCRIPTION OF THE PROBLEM :
      The following program should compile without error, but javac rejects it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the enclosed sources and observe that it fails to compile.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      compile successfully.
      ACTUAL -
      fails to compile.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Hello.java:7: unreported exception X; must be caught or declared to be thrown
      new Hello(new Foo<Exception>());
      ^
      1 error


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Hello {
          static class Foo<X> {}

          <X extends Throwable> Hello(Foo<X> foo) throws X {}

          public static void main(String[] args) throws Exception {
      new Hello(new Foo<Exception>());
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none known

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: