8191839: ModuleElement.DirectiveVisitor :: visit​() method behavior is deviating from the spec
Reviewed-by: jjg
--- a/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Thu Jan 18 02:25:18 2018 +0300
+++ b/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Wed Jan 17 17:53:37 2018 -0800
@@ -152,8 +152,8 @@
/**
* Visits a module element.
*
- * @implSpec Visits a {@code ModuleElement} by calling {@code
- * visitUnknown(e, p)}.
+ * @implSpec The default implementation visits a {@code
+ * ModuleElement} by calling {@code visitUnknown(e, p)}.
*
* @param e the element to visit
* @param p a visitor-specified parameter
--- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Jan 18 02:25:18 2018 +0300
+++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Wed Jan 17 17:53:37 2018 -0800
@@ -201,11 +201,10 @@
* Visits any directive as if by passing itself to that
* directive's {@link Directive#accept accept} method and passing
* {@code null} for the additional parameter.
- * The invocation {@code v.visit(d)} is equivalent to
- * {@code d.accept(v, null)}.
+ *
* @param d the directive to visit
* @return a visitor-specified result
- * @implSpec This implementation is {@code visit(d, null)}
+ * @implSpec The default implementation is {@code d.accept(v, null)}.
*/
default R visit(Directive d) {
return d.accept(this, null);
@@ -214,11 +213,11 @@
/**
* Visits any directive as if by passing itself to that
* directive's {@link Directive#accept accept} method.
- * The invocation {@code v.visit(d, p)} is equivalent to
- * {@code d.accept(v, p)}.
+ *
* @param d the directive to visit
* @param p a visitor-specified parameter
* @return a visitor-specified result
+ * @implSpec The default implementation is {@code d.accept(v, p)}.
*/
default R visit(Directive d, P p) {
return d.accept(this, p);
@@ -271,7 +270,7 @@
* @param p a visitor-specified parameter
* @return a visitor-specified result
* @throws UnknownDirectiveException a visitor implementation may optionally throw this exception
- * @implSpec This implementation throws {@code new UnknownDirectiveException(d, p)}.
+ * @implSpec The default implementation throws {@code new UnknownDirectiveException(d, p)}.
*/
default R visitUnknown(Directive d, P p) {
throw new UnknownDirectiveException(d, p);