Javac ignores §7.7.4 " It is a compile-time error if a provides directive specifies an enum class (§8.9) as the service."

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P5
    • None
    • Affects Version/s: 25
    • Component/s: specification
    • None
    • 9
    • generic
    • generic

      § 7.7.4 of the Java Language specification states:

      > It is a compile-time error if a provides directive specifies an enum class (§8.9) as the service.

      Javac ignores this and allows enum classes to be specified as service if the enum has a provider method.
      The Eclipse Compiler for Java (ECJ) honors this requirement.

      I speculate that this requirement was added without considering the provider method - as an enum can never have a public constructor and can therefore not have a provider constructor.

      Proposed fix: Remove this statement from the specification.

            Assignee:
            Unassigned
            Reporter:
            Johannes Kuhn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: