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

Javac should reject TypeArguments on field access expression

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b34

      Description

      javac is accepting some code that doesn't look right according to the spec.

      In module java.xml.ws, class MessageImpl [1], the following line appear:

           static private final Iterator<AttachmentPart> nullIter =
      Collections.<AttachmentPart>EMPTY_LIST.iterator();

      I believe javac should reject this, there shouldn't be a type argument
      at that location. The type argument should be on iterator() like
      below, as per JLS 15.12
      <https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12> in
      the spec.

      static private final Iterator<AttachmentPart> nullIter =
      Collections.EMPTY_LIST.<AttachmentPart>iterator();

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                mtrudeau Michel Trudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: