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

Add static methods to interfaces

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: mc57594 Date: 11/15/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      Much of the software I develop extensively uses reflection for the loading of
      classes at runtime. These classes often implement an interface which I use as
      the "contract" to decide whether the class in suitable for loading (it is
      easier to check if it implements an interface rather than if it implements all
      the required methods). To make this less vague, here is an example.

      I have a logging system which loads the required logging classes at runtime
      based on user/sys admin choices. These logging classes must have a constructor
      with a specific signature, a number of instance methods and a number of static
      methods. Here's the problem: You cannot specify constructor signatures, nor
      static methods in an interface.

      The second issue is a stumper. The static method are required to tell a
      configuration utility what properties the logging object needs specified, so I
      want to make this static, and not have to construct an object only to find out
      what information it requires!! If I specify the static methods as non-static
      within the interface, then they can't be implemented as static within any
      derived classes. Nor can I use static final constants for this particular
      task.
      (Review ID: 97779)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gbrachasunw Gilad Bracha (Inactive)
                Reporter:
                mchamnessunw Mark Chamness (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: