--- old/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java 2010-04-29 22:39:09.000000000 -0700 +++ new/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java 2010-04-29 22:39:09.000000000 -0700 @@ -31,7 +31,6 @@ import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; - /** * A simple visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6} @@ -71,23 +70,18 @@ * @author Joseph D. Darcy * @author Scott Seligman * @author Peter von der Ahé + * + * @see SimpleElementVisitor7 * @since 1.6 */ @SupportedSourceVersion(RELEASE_6) -public class SimpleElementVisitor6 extends AbstractElementVisitor6 { - /** - * Default value to be returned; {@link #defaultAction - * defaultAction} returns this value unless the method is - * overridden. - */ - protected final R DEFAULT_VALUE; - +public class SimpleElementVisitor6 extends SharedSimpleElementVisitor { /** * Constructor for concrete subclasses; uses {@code null} for the * default value. */ protected SimpleElementVisitor6(){ - DEFAULT_VALUE = null; + super(); } /** @@ -97,73 +91,6 @@ * @param defaultValue the value to assign to {@link #DEFAULT_VALUE} */ protected SimpleElementVisitor6(R defaultValue){ - DEFAULT_VALUE = defaultValue; - } - /** - * The default action for visit methods. The implementation in - * this class just returns {@link #DEFAULT_VALUE}; subclasses will - * commonly override this method. - * - * @param e the element to process - * @param p a visitor-specified parameter - * @return {@code DEFAULT_VALUE} unless overridden - */ - protected R defaultAction(Element e, P p) { - return DEFAULT_VALUE; - } - - /** - * {@inheritDoc} This implementation calls {@code defaultAction}. - * - * @param e {@inheritDoc} - * @param p {@inheritDoc} - * @return the result of {@code defaultAction} - */ - public R visitPackage(PackageElement e, P p) { - return defaultAction(e, p); - } - - /** - * {@inheritDoc} This implementation calls {@code defaultAction}. - * - * @param e {@inheritDoc} - * @param p {@inheritDoc} - * @return the result of {@code defaultAction} - */ - public R visitType(TypeElement e, P p) { - return defaultAction(e, p); - } - - /** - * {@inheritDoc} This implementation calls {@code defaultAction}. - * - * @param e {@inheritDoc} - * @param p {@inheritDoc} - * @return the result of {@code defaultAction} - */ - public R visitVariable(VariableElement e, P p) { - return defaultAction(e, p); - } - - /** - * {@inheritDoc} This implementation calls {@code defaultAction}. - * - * @param e {@inheritDoc} - * @param p {@inheritDoc} - * @return the result of {@code defaultAction} - */ - public R visitExecutable(ExecutableElement e, P p) { - return defaultAction(e, p); - } - - /** - * {@inheritDoc} This implementation calls {@code defaultAction}. - * - * @param e {@inheritDoc} - * @param p {@inheritDoc} - * @return the result of {@code defaultAction} - */ - public R visitTypeParameter(TypeParameterElement e, P p) { - return defaultAction(e, p); + super(defaultValue); } }