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);
+ }
+