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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P3
    • 8
    • Affects Version/s: 6
    • Component/s: core-libs
    • None
    • x86
    • windows_xp

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: