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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 7
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b44
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      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

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: