JDK 10 RFR of 8191234: TypeKindVisitor needs to handle modules,
joe darcy
joe.darcy at oracle.com
Tue Nov 21 06:34:32 UTC 2017
Hello,
Please review the patch below and CSR for
8191234: TypeKindVisitor needs to handle modules
CSR: https://bugs.openjdk.java.net/browse/JDK-8191642
The module-related javax.lang.model updates in JDK 9 overlooked adding
module support to the TypeKind family of visitors.
The treatment of TypeKind.MODULE is analogous to the how support for
ElementKind.RESOURCE_VARIABLE was added in JDK 7 to the ElementKind
visitors.
For now treating this fix was noreg-trivial, but I'll concede test are
appropriate and write a few if reviewers think they are needed.
Thanks,
-Joe
diff -r 5cc5b8270cad
src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
---
a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
Mon Nov 20 20:33:51 2017 -0800
+++
b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
Mon Nov 20 22:06:30 2017 -0800
@@ -257,7 +257,7 @@
*
* @implSpec This implementation dispatches to the visit method for
* the specific {@linkplain TypeKind kind} of pseudo-type:
- * {@code VOID}, {@code PACKAGE}, or {@code NONE}.
+ * {@code VOID}, {@code PACKAGE}, {@code MODULE}, or {@code NONE}.
*
* @param t {@inheritDoc}
* @param p {@inheritDoc}
@@ -273,6 +273,9 @@
case PACKAGE:
return visitNoTypeAsPackage(t, p);
+ case MODULE:
+ return visitNoTypeAsModule(t, p);
+
case NONE:
return visitNoTypeAsNone(t, p);
@@ -308,6 +311,21 @@
}
/**
+ * Visits a {@link TypeKind#MODULE MODULE} pseudo-type.
+ *
+ * @implSpec This implementation calls {@code visitUnknown}.
+ *
+ * @param t the type to visit
+ * @param p a visitor-specified parameter
+ * @return the result of {@code visitUnknown}
+ *
+ * @since 10
+ */
+ public R visitNoTypeAsModule(NoType t, P p) {
+ return visitUnknown(t, p);
+ }
+
+ /**
* Visits a {@link TypeKind#NONE NONE} pseudo-type.
*
* @implSpec This implementation calls {@code defaultAction}.
diff -r 5cc5b8270cad
src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java
---
a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java
Mon Nov 20 20:33:51 2017 -0800
+++
b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java
Mon Nov 20 22:06:30 2017 -0800
@@ -93,4 +93,20 @@
protected TypeKindVisitor9(R defaultValue) {
super(defaultValue);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @implSpec This implementation calls {@code defaultAction}.
+ *
+ * @param t {@inheritDoc}
+ * @param p {@inheritDoc}
+ * @return the result of {@code defaultAction}
+ *
+ * @since 10
+ */
+ @Override
+ public R visitNoTypeAsModule(NoType t, P p) {
+ return defaultAction(t, p);
+ }
}
More information about the compiler-dev
mailing list