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

Javac should reject TypeArguments on field access expression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • tools
    • None
    • b34

      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();

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

              Created:
              Updated:
              Resolved: