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

(anno) Introduce a new Annotation: RuntimeException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • x86
    • windows_2000

      A DESCRIPTION OF THE REQUEST :
      Introduce a new Annotation RuntimeException.

      It should be use to automatically document thrown runtime exceptions in a method by the compiler.

      This should then also be documented by java doc.

      IDE's can use this information to provide hints which exceptions can be catched. Just like with checked exceptions.

      JUSTIFICATION :
      RuntimeExceptions are part of the contract and should always be well documented. Unfortunatelly this is seldom the case. further more One ofen forgets or is not able to document runtime exceptions thrown by used third party code.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Annotation should contain a list of all thrown runtime exceptions inside a method
      The Annotation should also collect the exceptions from methods that contain that annotation.

      The underlying methods can of course change and with it the thrown runtime exceptions. But it seems better to have runtime exceptions annotated that are not thrown as the other way around.
      ACTUAL -
      Not applicable

      ---------- BEGIN SOURCE ----------
      @Target({METHOD, CONSTRUCTOR})
      @Retention(RetentionPolicy.RUNTIME)
      public @interface ThrownRuntimeExceptions{
      /** Names of the thrown runtime exception classes */
          String[] exceptions();
      }
      ---------- END SOURCE ----------
      ###@###.### 2004-12-22 18:26:54 GMT

            sseligmasunw Scott Seligman (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: