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

Annotation API should allow developers to specify which ClassLoader instance to use for classloading

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P3
    • 8
    • 6
    • core-libs
    • None
    • x86
    • windows_xp

    Description

      If an annotation takes java.lang.Class as the value type:

      @Target(ElementType.PACKAGE)
      @Retention(RetentionPolicy.RUNTIME)
      public @interface MainClass {
          Class value();
      }

      At runtime, the raw annotation information in the class files is examined lazily, and the "current" classloader for the code making the getAnnotations call is used.

      The problem is - this might not be the ClassLoader developers want to use. Thus, there should be a new API for reading annotations that let you specify which ClassLoader to use.

      This functionality is also useful for simplifying the annotation usages in JSR-277. This should be addressed in SE 7 if possible.

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              stanleyh Stanley Ho (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: