8191839: ModuleElement.DirectiveVisitor :: visit​() method behavior is deviating from the spec

Reviewed-by: jjg
This commit is contained in:
Joe Darcy 2018-01-17 17:53:37 -08:00
parent 72ba3f508c
commit abb2ba45ae
2 changed files with 7 additions and 8 deletions

View File

@ -152,8 +152,8 @@ public interface ElementVisitor<R, P> {
/**
* 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

View File

@ -201,11 +201,10 @@ public interface ModuleElement extends Element, QualifiedNameable {
* 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 @@ public interface ModuleElement extends Element, QualifiedNameable {
/**
* 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 @@ public interface ModuleElement extends Element, QualifiedNameable {
* @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);