jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RET.java
changeset 46174 5611d2529b49
parent 44797 8b3b3b911b8a
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RET.java	Tue Aug 08 22:52:41 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/RET.java	Sun Aug 13 21:10:40 2017 -0700
@@ -21,108 +21,131 @@
 
 package com.sun.org.apache.bcel.internal.generic;
 
-import java.io.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
 import com.sun.org.apache.bcel.internal.util.ByteSequence;
 
 /**
  * RET - Return from subroutine
  *
- * <PRE>Stack: ..., -&gt; ..., address</PRE>
+ * <PRE>Stack: ... -&gt; ...</PRE>
  *
- * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
+ * @version $Id: RET.java 1747278 2016-06-07 17:28:43Z britter $
  */
 public class RET extends Instruction implements IndexedInstruction, TypedInstruction {
-  private boolean wide;
-  private int     index; // index to local variable containg the return address
 
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  RET() {}
+    private boolean wide;
+    private int index; // index to local variable containg the return address
+
 
-  public RET(int index) {
-    super(com.sun.org.apache.bcel.internal.Constants.RET, (short)2);
-    setIndex(index);   // May set wide as side effect
-  }
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    RET() {
+    }
 
-  /**
-   * Dump instruction as byte code to stream out.
-   * @param out Output stream
-   */
-  public void dump(DataOutputStream out) throws IOException {
-    if(wide)
-      out.writeByte(com.sun.org.apache.bcel.internal.Constants.WIDE);
+
+    public RET(final int index) {
+        super(com.sun.org.apache.bcel.internal.Const.RET, (short) 2);
+        setIndex(index); // May set wide as side effect
+    }
+
 
-    out.writeByte(opcode);
-
-    if(wide)
-      out.writeShort(index);
-    else
-      out.writeByte(index);
-  }
+    /**
+     * Dump instruction as byte code to stream out.
+     * @param out Output stream
+     */
+    @Override
+    public void dump( final DataOutputStream out ) throws IOException {
+        if (wide) {
+            out.writeByte(com.sun.org.apache.bcel.internal.Const.WIDE);
+        }
+        out.writeByte(super.getOpcode());
+        if (wide) {
+            out.writeShort(index);
+        } else {
+            out.writeByte(index);
+        }
+    }
 
-  private final void setWide() {
-    if(wide = index > com.sun.org.apache.bcel.internal.Constants.MAX_BYTE)
-      length = 4; // Including the wide byte
-    else
-      length = 2;
-  }
 
-  /**
-   * Read needed data (e.g. index) from file.
-   */
-  protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
-  {
-    this.wide = wide;
+    private void setWide() {
+        wide = index > com.sun.org.apache.bcel.internal.Const.MAX_BYTE;
+        if (wide) {
+            super.setLength(4); // Including the wide byte
+        } else {
+            super.setLength(2);
+        }
+    }
+
 
-    if(wide) {
-      index  = bytes.readUnsignedShort();
-      length = 4;
-    } else {
-      index = bytes.readUnsignedByte();
-      length = 2;
+    /**
+     * Read needed data (e.g. index) from file.
+     */
+    @Override
+    protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
+        this.wide = wide;
+        if (wide) {
+            index = bytes.readUnsignedShort();
+            super.setLength(4);
+        } else {
+            index = bytes.readUnsignedByte();
+            super.setLength(2);
+        }
     }
-  }
 
-  /**
-   * @return index of local variable containg the return address
-   */
-  public final int getIndex() { return index; }
 
-  /**
-   * Set index of local variable containg the return address
-   */
-  public final void setIndex(int n) {
-    if(n < 0)
-      throw new ClassGenException("Negative index value: " + n);
+    /**
+     * @return index of local variable containg the return address
+     */
+    @Override
+    public final int getIndex() {
+        return index;
+    }
 
-    index = n;
-    setWide();
-  }
 
-  /**
-   * @return mnemonic for instruction
-   */
-  public String toString(boolean verbose) {
-    return super.toString(verbose) + " " + index;
-  }
+    /**
+     * Set index of local variable containg the return address
+     */
+    @Override
+    public final void setIndex( final int n ) {
+        if (n < 0) {
+            throw new ClassGenException("Negative index value: " + n);
+        }
+        index = n;
+        setWide();
+    }
 
-  /** @return return address type
-   */
-  public Type getType(ConstantPoolGen cp) {
-      return ReturnaddressType.NO_TARGET;
-  }
+
+    /**
+     * @return mnemonic for instruction
+     */
+    @Override
+    public String toString( final boolean verbose ) {
+        return super.toString(verbose) + " " + index;
+    }
+
 
-  /**
-   * Call corresponding visitor method(s). The order is:
-   * Call visitor methods of implemented interfaces first, then
-   * call methods according to the class hierarchy in descending order,
-   * i.e., the most specific visitXXX() call comes last.
-   *
-   * @param v Visitor object
-   */
-  public void accept(Visitor v) {
-    v.visitRET(this);
-  }
+    /** @return return address type
+     */
+    @Override
+    public Type getType( final ConstantPoolGen cp ) {
+        return ReturnaddressType.NO_TARGET;
+    }
+
+
+    /**
+     * Call corresponding visitor method(s). The order is:
+     * Call visitor methods of implemented interfaces first, then
+     * call methods according to the class hierarchy in descending order,
+     * i.e., the most specific visitXXX() call comes last.
+     *
+     * @param v Visitor object
+     */
+    @Override
+    public void accept( final Visitor v ) {
+        v.visitRET(this);
+    }
 }