Commit 4a4635ad authored by Eric Bruneton's avatar Eric Bruneton
Browse files

Address code review comments.

parent e532fb9c
Pipeline #4442 passed with stage
in 11 minutes and 53 seconds
......@@ -50,8 +50,8 @@ public interface Opcodes {
/*
* Internal flags used to redirect calls to deprecated methods. For instance, if a visitOldStuff
* method in API1 is deprecated and replaced with visitNewStuff in API2, then the redirection
* should be done as follows:
* method in API_OLD is deprecated and replaced with visitNewStuff in API_NEW, then the
* redirection should be done as follows:
*
* <pre>
* public class StuffVisitor {
......@@ -59,11 +59,11 @@ public interface Opcodes {
*
* &#64;Deprecated public void visitOldStuff(int arg, ...) {
* // SOURCE_DEPRECATED means "a call from a deprecated method using the old 'api' value".
* visitNewStuf(arg | (api &#60; API2 ? SOURCE_DEPRECATED : 0), ...);
* visitNewStuf(arg | (api &#60; API_NEW ? SOURCE_DEPRECATED : 0), ...);
* }
*
* public void visitNewStuff(int argAndSource, ...) {
* if (api &#60; API2 &#38;&#38; (argAndSource &#38; SOURCE_DEPRECATED) == 0) {
* if (api &#60; API_NEW &#38;&#38; (argAndSource &#38; SOURCE_DEPRECATED) == 0) {
* visitOldStuff(argAndSource, ...);
* } else {
* int arg = argAndSource &#38; ~SOURCE_MASK;
......@@ -73,7 +73,7 @@ public interface Opcodes {
* }
* </pre>
*
* <p>If 'api' is equal to API2, there are two cases:
* <p>If 'api' is equal to API_NEW, there are two cases:
*
* <ul>
* <li>call visitNewStuff: the redirection test is skipped and 'do stuff' is executed directly.
......@@ -82,7 +82,7 @@ public interface Opcodes {
* directly executes 'do stuff'.
* </ul>
*
* <p>If 'api' is equal to API1, there are two cases:
* <p>If 'api' is equal to API_OLD, there are two cases:
*
* <ul>
* <li>call visitOldSuff: the source is set to SOURCE_DEPRECATED before calling visitNewStuff.
......@@ -96,11 +96,11 @@ public interface Opcodes {
* <h1>User subclasses</h1>
*
* <p>If a user subclass overrides one of these methods, there are only two cases: either 'api' is
* API1 and visitOldStuff is overridden (and visitNewStuff is not), or 'api' is API2 or more, and
* visitNewStuff is overridden (and visitOldStuff is not). Any other case is a user programming
* error.
* API_OLD and visitOldStuff is overridden (and visitNewStuff is not), or 'api' is API_NEW or
* more, and visitNewStuff is overridden (and visitOldStuff is not). Any other case is a user
* programming error.
*
* <p>If 'api' is equal to API2, the class hierarchy is equivalent to
* <p>If 'api' is equal to API_NEW, the class hierarchy is equivalent to
*
* <pre>
* public class StuffVisitor {
......@@ -118,7 +118,7 @@ public interface Opcodes {
* <p>It is then obvious that whether visitNewStuff or visitOldStuff is called, 'do stuff' and 'do
* user stuff' will be executed, in this order.
*
* <p>If 'api' is equal to API1, the class hierarchy is equivalent to
* <p>If 'api' is equal to API_OLD, the class hierarchy is equivalent to
*
* <pre>
* public class StuffVisitor {
......@@ -157,13 +157,13 @@ public interface Opcodes {
* <h1>ASM subclasses</h1>
*
* <p>In ASM packages, subclasses of StuffVisitor can typically be sub classed again by the user,
* and can be used with API1 or API2. Because of this, if such a subclass must override
* and can be used with API_OLD or API_NEW. Because of this, if such a subclass must override
* visitNewStuff, it must do so in the following way (and must not override visitOldStuff):
*
* <pre>
* public class AsmStuffVisitor extends StuffVisitor {
* &#64;Override public void visitNewStuff(int argAndSource, ...) {
* if (api &#60; API2 &#38;&#38; (argAndSource &#38; SOURCE_DEPRECATED) == 0) {
* if (api &#60; API_NEW &#38;&#38; (argAndSource &#38; SOURCE_DEPRECATED) == 0) {
* super.visitNewStuff(argAndSource, ...);
* return;
* }
......@@ -174,7 +174,8 @@ public interface Opcodes {
* }
* </pre>
*
* <p>If a user class extends this with 'api' equal to API2, the class hierarchy is equivalent to
* <p>If a user class extends this with 'api' equal to API_NEW, the class hierarchy is equivalent
* to
*
* <pre>
* public class StuffVisitor {
......@@ -197,7 +198,7 @@ public interface Opcodes {
*
* <p>It is then obvious that whether visitNewStuff or visitOldStuff is called, 'do stuff', 'do
* other stuff' and 'do user stuff' will be executed, in this order. If, on the other hand, a user
* class extends AsmStuffVisitor with 'api' equal to API1, the class hierarchy is equivalent to
* class extends AsmStuffVisitor with 'api' equal to API_OLD, the class hierarchy is equivalent to
*
* <pre>
* public class StuffVisitor {
......@@ -238,7 +239,7 @@ public interface Opcodes {
* <h1>Notes</h1>
*
* <ul>
* <li>the SOURCE_DEPRECATED flag is set only if 'api' is API1, just before calling
* <li>the SOURCE_DEPRECATED flag is set only if 'api' is API_OLD, just before calling
* visitNewStuff. By hypothesis, this method is not overridden by the user. Therefore, user
* classes can never see this flag. Only ASM subclasses must take care of extracting the
* actual argument value by clearing the source flags.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment