src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -36,12 +36,15 @@
  * A simple visitor of program elements with default behavior
  * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6}
  * source version.
  *
  * Visit methods corresponding to {@code RELEASE_6} language
- * constructs call {@link #defaultAction}, passing their arguments to
- * {@code defaultAction}'s corresponding parameters.
+ * constructs call {@link #defaultAction defaultAction}, passing their
+ * arguments to {@code defaultAction}'s corresponding parameters.
+ *
+ * For constructs introduced in {@code RELEASE_7} and later, {@code
+ * visitUnknown} is called instead.
  *
  * <p> Methods in this class may be overridden subject to their
  * general contract.  Note that annotating methods in concrete
  * subclasses with {@link java.lang.Override @Override} will help
  * ensure that methods are overridden as intended.

@@ -135,18 +138,25 @@
     public R visitType(TypeElement e, P p) {
         return defaultAction(e, p);
     }
 
     /**
-     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     * {@inheritDoc}
+     *
+     * This implementation calls {@code defaultAction}, unless the
+     * element is a {@code RESOURCE_VARIABLE} in which case {@code
+     * visitUnknown} is called.
      *
      * @param e {@inheritDoc}
      * @param p {@inheritDoc}
-     * @return  the result of {@code defaultAction}
+     * @return  the result of {@code defaultAction} or {@code visitUnknown}
      */
     public R visitVariable(VariableElement e, P p) {
+        if (e.getKind() != ElementKind.RESOURCE_VARIABLE)
         return defaultAction(e, p);
+        else
+            return visitUnknown(e, p);
     }
 
     /**
      * {@inheritDoc} This implementation calls {@code defaultAction}.
      *