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

ElementScannerN, N > 9 should scan type parameters

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 14
    • core-libs
    • None
    • behavioral
    • minimal
    • Changing behavior of newly added class.
    • Java API
    • SE

    Description

      Summary

      Define ElementScanner14 to visit type parameters; surprisingly, type parameters and not visited by the previously available scanners.

      Problem

      Surprising behavior in javax.lang.model utility classes. At least one scanner class with the new functionality was written as part of the javac implementation.

      Solution

      Add overrides for the methods visiting executables and types to visit type parameters, if present.

      Specification

      --- old/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java 2019-12-04 19:16:42.857000999 -0800
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java 2019-12-04 19:16:42.601000999 -0800
      @@ -121,6 +123,48 @@
           }
      
           /**
      +     * {@inheritDoc}
      +     *
      +     * @implSpec This implementation scans the type parameters, if
      +     * any, and then the enclosed elements.
      +     * 
      +     *
      +     * @param e  {@inheritDoc}
      +     * @param p  {@inheritDoc}
      +     * @return the result of scanning
      +     */
      +    @Override
      +    public R visitType(TypeElement e, P p) {
      +        return scan(createScanningList(e, e.getEnclosedElements()), p);
      +    }
      +
      +    /**
      +     * {@inheritDoc}
      +     *
      +     * @implSpec This implementation first scans the type parameters, if any, and then
      +     * the parameters.
      +     *
      +     * @param e  {@inheritDoc}
      +     * @param p  {@inheritDoc}
      +     * @return the result of scanning
      +     */
      +    public R visitExecutable(ExecutableElement e, P p) {
      +        return scan(createScanningList(e, e.getParameters()), p);
      +    }
      +

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              darcy Joe Darcy
              Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: