< prev index next >

src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java

Print this page




  42  *
  43  * <p> <b>WARNING:</b> It is possible that methods will be added to
  44  * this interface to accommodate new, currently unknown, language
  45  * structures added to future versions of the Java&trade; programming
  46  * language.  Therefore, visitor classes directly implementing this
  47  * interface may be source incompatible with future versions of the
  48  * platform.  To avoid this source incompatibility, visitor
  49  * implementations are encouraged to instead extend the appropriate
  50  * abstract visitor class that implements this interface.  However, an
  51  * API should generally use this visitor interface as the type for
  52  * parameters, return type, etc. rather than one of the abstract
  53  * classes.
  54  *
  55  * <p>Note that methods to accommodate new language constructs could
  56  * be added in a source <em>compatible</em> way if they were added as
  57  * <em>default methods</em>.  However, default methods are only
  58  * available on Java SE 8 and higher releases and the {@code
  59  * javax.lang.model.*} packages bundled in Java SE 8 were required to
  60  * also be runnable on Java SE 7.  Therefore, default methods
  61  * were <em>not</em> used when extending {@code javax.lang.model.*}
  62  * to cover Java SE 8 language features.  However, default methods may
  63  * be used in subsequent revisions of the {@code javax.lang.model.*}
  64  * packages that are only required to run on Java SE 8 and higher
  65  * platform versions.
  66  *
  67  * @param <R> the return type of this visitor's methods.  Use {@link
  68  *            Void} for visitors that do not need to return results.
  69  * @param <P> the type of the additional parameter to this visitor's
  70  *            methods.  Use {@code Void} for visitors that do not need an
  71  *            additional parameter.
  72  *
  73  * @author Joseph D. Darcy
  74  * @author Scott Seligman
  75  * @author Peter von der Ah&eacute;
  76  * @since 1.6
  77  */
  78 public interface TypeVisitor<R, P> {
  79     /**
  80      * Visits a type.
  81      * @param t the type to visit
  82      * @param p a visitor-specified parameter
  83      * @return  a visitor-specified result




  42  *
  43  * <p> <b>WARNING:</b> It is possible that methods will be added to
  44  * this interface to accommodate new, currently unknown, language
  45  * structures added to future versions of the Java&trade; programming
  46  * language.  Therefore, visitor classes directly implementing this
  47  * interface may be source incompatible with future versions of the
  48  * platform.  To avoid this source incompatibility, visitor
  49  * implementations are encouraged to instead extend the appropriate
  50  * abstract visitor class that implements this interface.  However, an
  51  * API should generally use this visitor interface as the type for
  52  * parameters, return type, etc. rather than one of the abstract
  53  * classes.
  54  *
  55  * <p>Note that methods to accommodate new language constructs could
  56  * be added in a source <em>compatible</em> way if they were added as
  57  * <em>default methods</em>.  However, default methods are only
  58  * available on Java SE 8 and higher releases and the {@code
  59  * javax.lang.model.*} packages bundled in Java SE 8 were required to
  60  * also be runnable on Java SE 7.  Therefore, default methods
  61  * were <em>not</em> used when extending {@code javax.lang.model.*}
  62  * to cover Java SE 8 language features.  However, default methods
  63  * are used in subsequent revisions of the {@code javax.lang.model.*}
  64  * packages that are only required to run on Java SE 8 and higher
  65  * platform versions.
  66  *
  67  * @param <R> the return type of this visitor's methods.  Use {@link
  68  *            Void} for visitors that do not need to return results.
  69  * @param <P> the type of the additional parameter to this visitor's
  70  *            methods.  Use {@code Void} for visitors that do not need an
  71  *            additional parameter.
  72  *
  73  * @author Joseph D. Darcy
  74  * @author Scott Seligman
  75  * @author Peter von der Ah&eacute;
  76  * @since 1.6
  77  */
  78 public interface TypeVisitor<R, P> {
  79     /**
  80      * Visits a type.
  81      * @param t the type to visit
  82      * @param p a visitor-specified parameter
  83      * @return  a visitor-specified result


< prev index next >