diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2009-11-12 18:45:15 -0800 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2009-11-12 18:45:15 -0800 |
| commit | 72e93344b4d1ffc71e9c832ec23de0657e5b04a5 (patch) | |
| tree | 1a08d1e43d54200ea737234d865c4668c5d3535b /dx/src | |
| parent | dfd0afbcb08b871e224a28ecb4ed427a7693545c (diff) | |
| download | android_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.tar.gz android_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.tar.bz2 android_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.zip | |
eclair snapshot
Diffstat (limited to 'dx/src')
318 files changed, 6018 insertions, 5808 deletions
diff --git a/dx/src/com/android/dx/Version.java b/dx/src/com/android/dx/Version.java index 02dc7b248..4950d39fe 100644 --- a/dx/src/com/android/dx/Version.java +++ b/dx/src/com/android/dx/Version.java @@ -20,6 +20,6 @@ package com.android.dx; * Version number for dx. */ public class Version { - /** non-null; version string */ - public static final String VERSION = "1.2"; + /** {@code non-null;} version string */ + public static final String VERSION = "1.3"; } diff --git a/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java b/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java index 12e1f74ba..acf5a9ef7 100644 --- a/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java +++ b/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java @@ -19,24 +19,24 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.cst.Constant; /** - * Attribute class for <code>AnnotationDefault</code> attributes. + * Attribute class for {@code AnnotationDefault} attributes. */ public final class AttAnnotationDefault extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "AnnotationDefault"; - /** non-null; the annotation default value */ + /** {@code non-null;} the annotation default value */ private final Constant value; - /** >= 0; attribute data length in the original classfile (not + /** {@code >= 0;} attribute data length in the original classfile (not * including the attribute header) */ private final int byteLength; /** * Constructs an instance. * - * @param value non-null; the annotation default value - * @param byteLength >= 0; attribute data length in the original + * @param value {@code non-null;} the annotation default value + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public AttAnnotationDefault(Constant value, int byteLength) { @@ -59,7 +59,7 @@ public final class AttAnnotationDefault extends BaseAttribute { /** * Gets the annotation default value. * - * @return non-null; the value + * @return {@code non-null;} the value */ public Constant getValue() { return value; diff --git a/dx/src/com/android/dx/cf/attrib/AttCode.java b/dx/src/com/android/dx/cf/attrib/AttCode.java index f00da2fde..89ba895ad 100644 --- a/dx/src/com/android/dx/cf/attrib/AttCode.java +++ b/dx/src/com/android/dx/cf/attrib/AttCode.java @@ -22,35 +22,35 @@ import com.android.dx.cf.iface.AttributeList; import com.android.dx.util.MutabilityException; /** - * Attribute class for standard <code>Code</code> attributes. + * Attribute class for standard {@code Code} attributes. */ public final class AttCode extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "Code"; - /** >= 0; the stack size */ + /** {@code >= 0;} the stack size */ private final int maxStack; - /** >= 0; the number of locals */ + /** {@code >= 0;} the number of locals */ private final int maxLocals; - /** non-null; array containing the bytecode per se */ + /** {@code non-null;} array containing the bytecode per se */ private final BytecodeArray code; - /** non-null; the exception table */ + /** {@code non-null;} the exception table */ private final ByteCatchList catches; - /** non-null; the associated list of attributes */ + /** {@code non-null;} the associated list of attributes */ private final AttributeList attributes; /** * Constructs an instance. * - * @param maxStack >= 0; the stack size - * @param maxLocals >= 0; the number of locals - * @param code non-null; array containing the bytecode per se - * @param catches non-null; the exception table - * @param attributes non-null; the associated list of attributes + * @param maxStack {@code >= 0;} the stack size + * @param maxLocals {@code >= 0;} the number of locals + * @param code {@code non-null;} array containing the bytecode per se + * @param catches {@code non-null;} the exception table + * @param attributes {@code non-null;} the associated list of attributes */ public AttCode(int maxStack, int maxLocals, BytecodeArray code, ByteCatchList catches, AttributeList attributes) { @@ -101,7 +101,7 @@ public final class AttCode extends BaseAttribute { /** * Gets the maximum stack size. * - * @return >= 0; the maximum stack size + * @return {@code >= 0;} the maximum stack size */ public int getMaxStack() { return maxStack; @@ -110,7 +110,7 @@ public final class AttCode extends BaseAttribute { /** * Gets the number of locals. * - * @return >= 0; the number of locals + * @return {@code >= 0;} the number of locals */ public int getMaxLocals() { return maxLocals; @@ -119,7 +119,7 @@ public final class AttCode extends BaseAttribute { /** * Gets the bytecode array. * - * @return non-null; the bytecode array + * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return code; @@ -128,7 +128,7 @@ public final class AttCode extends BaseAttribute { /** * Gets the exception table. * - * @return non-null; the exception table + * @return {@code non-null;} the exception table */ public ByteCatchList getCatches() { return catches; @@ -137,7 +137,7 @@ public final class AttCode extends BaseAttribute { /** * Gets the associated attribute list. * - * @return non-null; the attribute list + * @return {@code non-null;} the attribute list */ public AttributeList getAttributes() { return attributes; diff --git a/dx/src/com/android/dx/cf/attrib/AttConstantValue.java b/dx/src/com/android/dx/cf/attrib/AttConstantValue.java index a84da4342..a7436f3c7 100644 --- a/dx/src/com/android/dx/cf/attrib/AttConstantValue.java +++ b/dx/src/com/android/dx/cf/attrib/AttConstantValue.java @@ -24,22 +24,22 @@ import com.android.dx.rop.cst.CstString; import com.android.dx.rop.cst.TypedConstant; /** - * Attribute class for standard <code>ConstantValue</code> attributes. + * Attribute class for standard {@code ConstantValue} attributes. */ public final class AttConstantValue extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "ConstantValue"; - /** non-null; the constant value */ + /** {@code non-null;} the constant value */ private final TypedConstant constantValue; /** * Constructs an instance. * - * @param constantValue non-null; the constant value, which must - * be an instance of one of: <code>CstString</code>, - * <code>CstInteger</code>, <code>CstLong</code>, - * <code>CstFloat</code>, or <code>CstDouble</code> + * @param constantValue {@code non-null;} the constant value, which must + * be an instance of one of: {@code CstString}, + * {@code CstInteger}, {@code CstLong}, + * {@code CstFloat}, or {@code CstDouble} */ public AttConstantValue(TypedConstant constantValue) { super(ATTRIBUTE_NAME); @@ -65,11 +65,11 @@ public final class AttConstantValue extends BaseAttribute { /** * Gets the constant value of this instance. The returned value - * is an instance of one of: <code>CstString</code>, - * <code>CstInteger</code>, <code>CstLong</code>, - * <code>CstFloat</code>, or <code>CstDouble</code>. + * is an instance of one of: {@code CstString}, + * {@code CstInteger}, {@code CstLong}, + * {@code CstFloat}, or {@code CstDouble}. * - * @return non-null; the constant value + * @return {@code non-null;} the constant value */ public TypedConstant getConstantValue() { return constantValue; diff --git a/dx/src/com/android/dx/cf/attrib/AttDeprecated.java b/dx/src/com/android/dx/cf/attrib/AttDeprecated.java index cd1dd2463..d440aae71 100644 --- a/dx/src/com/android/dx/cf/attrib/AttDeprecated.java +++ b/dx/src/com/android/dx/cf/attrib/AttDeprecated.java @@ -17,10 +17,10 @@ package com.android.dx.cf.attrib; /** - * Attribute class for standard <code>Deprecated</code> attributes. + * Attribute class for standard {@code Deprecated} attributes. */ public final class AttDeprecated extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "Deprecated"; /** diff --git a/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java b/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java index 7cccad703..68a24d94b 100644 --- a/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java +++ b/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java @@ -20,24 +20,24 @@ import com.android.dx.rop.cst.CstNat; import com.android.dx.rop.cst.CstType; /** - * Attribute class for standards-track <code>EnclosingMethod</code> + * Attribute class for standards-track {@code EnclosingMethod} * attributes. */ public final class AttEnclosingMethod extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "EnclosingMethod"; - /** non-null; the innermost enclosing class */ + /** {@code non-null;} the innermost enclosing class */ private final CstType type; - /** null-ok; the name-and-type of the innermost enclosing method, if any */ + /** {@code null-ok;} the name-and-type of the innermost enclosing method, if any */ private final CstNat method; /** * Constructs an instance. * - * @param type non-null; the innermost enclosing class - * @param method null-ok; the name-and-type of the innermost enclosing + * @param type {@code non-null;} the innermost enclosing class + * @param method {@code null-ok;} the name-and-type of the innermost enclosing * method, if any */ public AttEnclosingMethod(CstType type, CstNat method) { @@ -59,7 +59,7 @@ public final class AttEnclosingMethod extends BaseAttribute { /** * Gets the innermost enclosing class. * - * @return non-null; the innermost enclosing class + * @return {@code non-null;} the innermost enclosing class */ public CstType getEnclosingClass() { return type; @@ -69,7 +69,7 @@ public final class AttEnclosingMethod extends BaseAttribute { * Gets the name-and-type of the innermost enclosing method, if * any. * - * @return null-ok; the name-and-type of the innermost enclosing + * @return {@code null-ok;} the name-and-type of the innermost enclosing * method, if any */ public CstNat getMethod() { diff --git a/dx/src/com/android/dx/cf/attrib/AttExceptions.java b/dx/src/com/android/dx/cf/attrib/AttExceptions.java index 59e624ef8..c592047f3 100644 --- a/dx/src/com/android/dx/cf/attrib/AttExceptions.java +++ b/dx/src/com/android/dx/cf/attrib/AttExceptions.java @@ -20,20 +20,20 @@ import com.android.dx.rop.type.TypeList; import com.android.dx.util.MutabilityException; /** - * Attribute class for standard <code>Exceptions</code> attributes. + * Attribute class for standard {@code Exceptions} attributes. */ public final class AttExceptions extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "Exceptions"; - /** non-null; list of exception classes */ + /** {@code non-null;} list of exception classes */ private final TypeList exceptions; /** * Constructs an instance. * - * @param exceptions non-null; list of classes, presumed but not - * verified to be subclasses of <code>Throwable</code> + * @param exceptions {@code non-null;} list of classes, presumed but not + * verified to be subclasses of {@code Throwable} */ public AttExceptions(TypeList exceptions) { super(ATTRIBUTE_NAME); @@ -58,9 +58,9 @@ public final class AttExceptions extends BaseAttribute { /** * Gets the list of classes associated with this instance. In * general, these classes are not pre-verified to be subclasses of - * <code>Throwable</code>. + * {@code Throwable}. * - * @return non-null; the list of classes + * @return {@code non-null;} the list of classes */ public TypeList getExceptions() { return exceptions; diff --git a/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java b/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java index df305395b..bd6c7cd6a 100644 --- a/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java +++ b/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java @@ -19,19 +19,19 @@ package com.android.dx.cf.attrib; import com.android.dx.util.MutabilityException; /** - * Attribute class for standard <code>InnerClasses</code> attributes. + * Attribute class for standard {@code InnerClasses} attributes. */ public final class AttInnerClasses extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "InnerClasses"; - /** non-null; list of inner class entries */ + /** {@code non-null;} list of inner class entries */ private final InnerClassList innerClasses; /** * Constructs an instance. * - * @param innerClasses non-null; list of inner class entries + * @param innerClasses {@code non-null;} list of inner class entries */ public AttInnerClasses(InnerClassList innerClasses) { super(ATTRIBUTE_NAME); @@ -56,7 +56,7 @@ public final class AttInnerClasses extends BaseAttribute { /** * Gets the list of "inner class" entries associated with this instance. * - * @return non-null; the list + * @return {@code non-null;} the list */ public InnerClassList getInnerClasses() { return innerClasses; diff --git a/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java b/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java index c5e65e80d..38980be19 100644 --- a/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java +++ b/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java @@ -20,19 +20,19 @@ import com.android.dx.cf.code.LineNumberList; import com.android.dx.util.MutabilityException; /** - * Attribute class for standard <code>LineNumberTable</code> attributes. + * Attribute class for standard {@code LineNumberTable} attributes. */ public final class AttLineNumberTable extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "LineNumberTable"; - /** non-null; list of line number entries */ + /** {@code non-null;} list of line number entries */ private final LineNumberList lineNumbers; /** * Constructs an instance. * - * @param lineNumbers non-null; list of line number entries + * @param lineNumbers {@code non-null;} list of line number entries */ public AttLineNumberTable(LineNumberList lineNumbers) { super(ATTRIBUTE_NAME); @@ -57,7 +57,7 @@ public final class AttLineNumberTable extends BaseAttribute { /** * Gets the list of "line number" entries associated with this instance. * - * @return non-null; the list + * @return {@code non-null;} the list */ public LineNumberList getLineNumbers() { return lineNumbers; diff --git a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java index 893f25477..53ba64fe1 100644 --- a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java +++ b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java @@ -19,16 +19,16 @@ package com.android.dx.cf.attrib; import com.android.dx.cf.code.LocalVariableList; /** - * Attribute class for standard <code>LocalVariableTable</code> attributes. + * Attribute class for standard {@code LocalVariableTable} attributes. */ public final class AttLocalVariableTable extends BaseLocalVariables { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "LocalVariableTable"; /** * Constructs an instance. * - * @param localVariables non-null; list of local variable entries + * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); diff --git a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java index 7037b7401..49cdb0c0f 100644 --- a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java +++ b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java @@ -19,16 +19,16 @@ package com.android.dx.cf.attrib; import com.android.dx.cf.code.LocalVariableList; /** - * Attribute class for standard <code>LocalVariableTypeTable</code> attributes. + * Attribute class for standard {@code LocalVariableTypeTable} attributes. */ public final class AttLocalVariableTypeTable extends BaseLocalVariables { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "LocalVariableTypeTable"; /** * Constructs an instance. * - * @param localVariables non-null; list of local variable entries + * @param localVariables {@code non-null;} list of local variable entries */ public AttLocalVariableTypeTable(LocalVariableList localVariables) { super(ATTRIBUTE_NAME, localVariables); diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java index 583ab17be..e83b76fb3 100644 --- a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java @@ -19,18 +19,18 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.annotation.Annotations; /** - * Attribute class for standard <code>RuntimeInvisibleAnnotations</code> + * Attribute class for standard {@code RuntimeInvisibleAnnotations} * attributes. */ public final class AttRuntimeInvisibleAnnotations extends BaseAnnotations { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "RuntimeInvisibleAnnotations"; /** * Constructs an instance. * - * @param annotations non-null; the list of annotations - * @param byteLength >= 0; attribute data length in the original + * @param annotations {@code non-null;} the list of annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public AttRuntimeInvisibleAnnotations(Annotations annotations, diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java index 08865e153..7dfe2069a 100644 --- a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java @@ -20,19 +20,19 @@ import com.android.dx.rop.annotation.AnnotationsList; /** * Attribute class for standard - * <code>RuntimeInvisibleParameterAnnotations</code> attributes. + * {@code RuntimeInvisibleParameterAnnotations} attributes. */ public final class AttRuntimeInvisibleParameterAnnotations extends BaseParameterAnnotations { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "RuntimeInvisibleParameterAnnotations"; /** * Constructs an instance. * - * @param parameterAnnotations non-null; the parameter annotations - * @param byteLength >= 0; attribute data length in the original + * @param parameterAnnotations {@code non-null;} the parameter annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public AttRuntimeInvisibleParameterAnnotations( diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java index c61acb5c2..9de05881d 100644 --- a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java @@ -19,18 +19,18 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.annotation.Annotations; /** - * Attribute class for standard <code>RuntimeVisibleAnnotations</code> + * Attribute class for standard {@code RuntimeVisibleAnnotations} * attributes. */ public final class AttRuntimeVisibleAnnotations extends BaseAnnotations { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "RuntimeVisibleAnnotations"; /** * Constructs an instance. * - * @param annotations non-null; the list of annotations - * @param byteLength >= 0; attribute data length in the original + * @param annotations {@code non-null;} the list of annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public AttRuntimeVisibleAnnotations(Annotations annotations, diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java index dfe57b2b6..76607c0f4 100644 --- a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java @@ -19,20 +19,20 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.annotation.AnnotationsList; /** - * Attribute class for standard <code>RuntimeVisibleParameterAnnotations</code> + * Attribute class for standard {@code RuntimeVisibleParameterAnnotations} * attributes. */ public final class AttRuntimeVisibleParameterAnnotations extends BaseParameterAnnotations { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "RuntimeVisibleParameterAnnotations"; /** * Constructs an instance. * - * @param annotations non-null; the parameter annotations - * @param byteLength >= 0; attribute data length in the original + * @param annotations {@code non-null;} the parameter annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public AttRuntimeVisibleParameterAnnotations( diff --git a/dx/src/com/android/dx/cf/attrib/AttSignature.java b/dx/src/com/android/dx/cf/attrib/AttSignature.java index 97edbbdd0..b9cb97d1f 100644 --- a/dx/src/com/android/dx/cf/attrib/AttSignature.java +++ b/dx/src/com/android/dx/cf/attrib/AttSignature.java @@ -19,19 +19,19 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.cst.CstUtf8; /** - * Attribute class for standards-track <code>Signature</code> attributes. + * Attribute class for standards-track {@code Signature} attributes. */ public final class AttSignature extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "Signature"; - /** non-null; the signature string */ + /** {@code non-null;} the signature string */ private final CstUtf8 signature; /** * Constructs an instance. * - * @param signature non-null; the signature string + * @param signature {@code non-null;} the signature string */ public AttSignature(CstUtf8 signature) { super(ATTRIBUTE_NAME); @@ -51,7 +51,7 @@ public final class AttSignature extends BaseAttribute { /** * Gets the signature string. * - * @return non-null; the signature string + * @return {@code non-null;} the signature string */ public CstUtf8 getSignature() { return signature; diff --git a/dx/src/com/android/dx/cf/attrib/AttSourceFile.java b/dx/src/com/android/dx/cf/attrib/AttSourceFile.java index f0872178f..941a2b0f0 100644 --- a/dx/src/com/android/dx/cf/attrib/AttSourceFile.java +++ b/dx/src/com/android/dx/cf/attrib/AttSourceFile.java @@ -19,19 +19,19 @@ package com.android.dx.cf.attrib; import com.android.dx.rop.cst.CstUtf8; /** - * Attribute class for standard <code>SourceFile</code> attributes. + * Attribute class for standard {@code SourceFile} attributes. */ public final class AttSourceFile extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "SourceFile"; - /** non-null; name of the source file */ + /** {@code non-null;} name of the source file */ private final CstUtf8 sourceFile; /** * Constructs an instance. * - * @param sourceFile non-null; the name of the source file + * @param sourceFile {@code non-null;} the name of the source file */ public AttSourceFile(CstUtf8 sourceFile) { super(ATTRIBUTE_NAME); @@ -51,7 +51,7 @@ public final class AttSourceFile extends BaseAttribute { /** * Gets the source file name of this instance. * - * @return non-null; the source file + * @return {@code non-null;} the source file */ public CstUtf8 getSourceFile() { return sourceFile; diff --git a/dx/src/com/android/dx/cf/attrib/AttSynthetic.java b/dx/src/com/android/dx/cf/attrib/AttSynthetic.java index daa9b0c23..e3841eb86 100644 --- a/dx/src/com/android/dx/cf/attrib/AttSynthetic.java +++ b/dx/src/com/android/dx/cf/attrib/AttSynthetic.java @@ -17,10 +17,10 @@ package com.android.dx.cf.attrib; /** - * Attribute class for standard <code>Synthetic</code> attributes. + * Attribute class for standard {@code Synthetic} attributes. */ public final class AttSynthetic extends BaseAttribute { - /** non-null; attribute name for attributes of this type */ + /** {@code non-null;} attribute name for attributes of this type */ public static final String ATTRIBUTE_NAME = "Synthetic"; /** diff --git a/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java b/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java index 0163e2cb4..4d9201e4b 100644 --- a/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java @@ -23,19 +23,19 @@ import com.android.dx.util.MutabilityException; * Base class for annotations attributes. */ public abstract class BaseAnnotations extends BaseAttribute { - /** non-null; list of annotations */ + /** {@code non-null;} list of annotations */ private final Annotations annotations; - /** >= 0; attribute data length in the original classfile (not + /** {@code >= 0;} attribute data length in the original classfile (not * including the attribute header) */ private final int byteLength; /** * Constructs an instance. * - * @param attributeName non-null; the name of the attribute - * @param annotations non-null; the list of annotations - * @param byteLength >= 0; attribute data length in the original + * @param attributeName {@code non-null;} the name of the attribute + * @param annotations {@code non-null;} the list of annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public BaseAnnotations(String attributeName, Annotations annotations, @@ -64,7 +64,7 @@ public abstract class BaseAnnotations extends BaseAttribute { /** * Gets the list of annotations associated with this instance. * - * @return non-null; the list + * @return {@code non-null;} the list */ public final Annotations getAnnotations() { return annotations; diff --git a/dx/src/com/android/dx/cf/attrib/BaseAttribute.java b/dx/src/com/android/dx/cf/attrib/BaseAttribute.java index ef1c6ac0d..c9c1b33cb 100644 --- a/dx/src/com/android/dx/cf/attrib/BaseAttribute.java +++ b/dx/src/com/android/dx/cf/attrib/BaseAttribute.java @@ -23,13 +23,13 @@ import com.android.dx.cf.iface.Attribute; * the attribute name but leaves the rest up to subclasses. */ public abstract class BaseAttribute implements Attribute { - /** non-null; attribute name */ + /** {@code non-null;} attribute name */ private final String name; /** * Constructs an instance. * - * @param name non-null; attribute name + * @param name {@code non-null;} attribute name */ public BaseAttribute(String name) { if (name == null) { diff --git a/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java b/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java index a39e72438..5ba5889cb 100644 --- a/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java +++ b/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java @@ -20,18 +20,18 @@ import com.android.dx.cf.code.LocalVariableList; import com.android.dx.util.MutabilityException; /** - * Base attribute class for standard <code>LocalVariableTable</code> - * and <code>LocalVariableTypeTable</code> attributes. + * Base attribute class for standard {@code LocalVariableTable} + * and {@code LocalVariableTypeTable} attributes. */ public abstract class BaseLocalVariables extends BaseAttribute { - /** non-null; list of local variable entries */ + /** {@code non-null;} list of local variable entries */ private final LocalVariableList localVariables; /** * Constructs an instance. * - * @param name non-null; attribute name - * @param localVariables non-null; list of local variable entries + * @param name {@code non-null;} attribute name + * @param localVariables {@code non-null;} list of local variable entries */ public BaseLocalVariables(String name, LocalVariableList localVariables) { @@ -57,7 +57,7 @@ public abstract class BaseLocalVariables extends BaseAttribute { /** * Gets the list of "local variable" entries associated with this instance. * - * @return non-null; the list + * @return {@code non-null;} the list */ public final LocalVariableList getLocalVariables() { return localVariables; diff --git a/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java index a927e3d5f..1b204b34e 100644 --- a/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java +++ b/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java @@ -23,19 +23,19 @@ import com.android.dx.util.MutabilityException; * Base class for parameter annotation list attributes. */ public abstract class BaseParameterAnnotations extends BaseAttribute { - /** non-null; list of annotations */ + /** {@code non-null;} list of annotations */ private final AnnotationsList parameterAnnotations; - /** >= 0; attribute data length in the original classfile (not + /** {@code >= 0;} attribute data length in the original classfile (not * including the attribute header) */ private final int byteLength; /** * Constructs an instance. * - * @param attributeName non-null; the name of the attribute - * @param parameterAnnotations non-null; the annotations - * @param byteLength >= 0; attribute data length in the original + * @param attributeName {@code non-null;} the name of the attribute + * @param parameterAnnotations {@code non-null;} the annotations + * @param byteLength {@code >= 0;} attribute data length in the original * classfile (not including the attribute header) */ public BaseParameterAnnotations(String attributeName, @@ -65,7 +65,7 @@ public abstract class BaseParameterAnnotations extends BaseAttribute { /** * Gets the list of annotation lists associated with this instance. * - * @return non-null; the list + * @return {@code non-null;} the list */ public final AnnotationsList getParameterAnnotations() { return parameterAnnotations; diff --git a/dx/src/com/android/dx/cf/attrib/InnerClassList.java b/dx/src/com/android/dx/cf/attrib/InnerClassList.java index 3585f1db8..96e1b60e2 100644 --- a/dx/src/com/android/dx/cf/attrib/InnerClassList.java +++ b/dx/src/com/android/dx/cf/attrib/InnerClassList.java @@ -22,7 +22,7 @@ import com.android.dx.util.FixedSizeList; /** * List of "inner class" entries, which are the contents of - * <code>InnerClasses</code> attributes. + * {@code InnerClasses} attributes. */ public final class InnerClassList extends FixedSizeList { /** @@ -37,8 +37,8 @@ public final class InnerClassList extends FixedSizeList { /** * Gets the indicated item. * - * @param n >= 0; which item - * @return null-ok; the indicated item + * @param n {@code >= 0;} which item + * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); @@ -47,11 +47,11 @@ public final class InnerClassList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which class - * @param innerClass non-null; class this item refers to - * @param outerClass null-ok; outer class that this class is a + * @param n {@code >= 0, < size();} which class + * @param innerClass {@code non-null;} class this item refers to + * @param outerClass {@code null-ok;} outer class that this class is a * member of, if any - * @param innerName null-ok; original simple name of this class, + * @param innerName {@code null-ok;} original simple name of this class, * if not anonymous * @param accessFlags original declared access flags */ @@ -64,13 +64,13 @@ public final class InnerClassList extends FixedSizeList { * Item in an inner classes list. */ public static class Item { - /** non-null; class this item refers to */ + /** {@code non-null;} class this item refers to */ private final CstType innerClass; - /** null-ok; outer class that this class is a member of, if any */ + /** {@code null-ok;} outer class that this class is a member of, if any */ private final CstType outerClass; - /** null-ok; original simple name of this class, if not anonymous */ + /** {@code null-ok;} original simple name of this class, if not anonymous */ private final CstUtf8 innerName; /** original declared access flags */ @@ -79,10 +79,10 @@ public final class InnerClassList extends FixedSizeList { /** * Constructs an instance. * - * @param innerClass non-null; class this item refers to - * @param outerClass null-ok; outer class that this class is a + * @param innerClass {@code non-null;} class this item refers to + * @param outerClass {@code null-ok;} outer class that this class is a * member of, if any - * @param innerName null-ok; original simple name of this + * @param innerName {@code null-ok;} original simple name of this * class, if not anonymous * @param accessFlags original declared access flags */ @@ -101,7 +101,7 @@ public final class InnerClassList extends FixedSizeList { /** * Gets the class this item refers to. * - * @return non-null; the class + * @return {@code non-null;} the class */ public CstType getInnerClass() { return innerClass; @@ -110,7 +110,7 @@ public final class InnerClassList extends FixedSizeList { /** * Gets the outer class that this item's class is a member of, if any. * - * @return null-ok; the class + * @return {@code null-ok;} the class */ public CstType getOuterClass() { return outerClass; @@ -119,7 +119,7 @@ public final class InnerClassList extends FixedSizeList { /** * Gets the original name of this item's class, if not anonymous. * - * @return null-ok; the name + * @return {@code null-ok;} the name */ public CstUtf8 getInnerName() { return innerName; diff --git a/dx/src/com/android/dx/cf/attrib/RawAttribute.java b/dx/src/com/android/dx/cf/attrib/RawAttribute.java index b89926d8a..585e5c5a2 100644 --- a/dx/src/com/android/dx/cf/attrib/RawAttribute.java +++ b/dx/src/com/android/dx/cf/attrib/RawAttribute.java @@ -23,11 +23,11 @@ import com.android.dx.util.ByteArray; * Raw attribute, for holding onto attributes that are unrecognized. */ public final class RawAttribute extends BaseAttribute { - /** non-null; attribute data */ + /** {@code non-null;} attribute data */ private final ByteArray data; /** - * null-ok; constant pool to use for resolution of cpis in {@link + * {@code null-ok;} constant pool to use for resolution of cpis in {@link * #data} */ private final ConstantPool pool; @@ -35,9 +35,9 @@ public final class RawAttribute extends BaseAttribute { /** * Constructs an instance. * - * @param name non-null; attribute name - * @param data non-null; attribute data - * @param pool null-ok; constant pool to use for cpi resolution + * @param name {@code non-null;} attribute name + * @param data {@code non-null;} attribute data + * @param pool {@code null-ok;} constant pool to use for cpi resolution */ public RawAttribute(String name, ByteArray data, ConstantPool pool) { super(name); @@ -53,11 +53,11 @@ public final class RawAttribute extends BaseAttribute { /** * Constructs an instance from a sub-array of a {@link ByteArray}. * - * @param name non-null; attribute name - * @param data non-null; array containing the attribute data - * @param offset offset in <code>data</code> to the attribute data + * @param name {@code non-null;} attribute name + * @param data {@code non-null;} array containing the attribute data + * @param offset offset in {@code data} to the attribute data * @param length length of the attribute data, in bytes - * @param pool null-ok; constant pool to use for cpi resolution + * @param pool {@code null-ok;} constant pool to use for cpi resolution */ public RawAttribute(String name, ByteArray data, int offset, int length, ConstantPool pool) { @@ -67,7 +67,7 @@ public final class RawAttribute extends BaseAttribute { /** * Get the raw data of the attribute. * - * @return non-null; the data + * @return {@code non-null;} the data */ public ByteArray getData() { return data; @@ -83,7 +83,7 @@ public final class RawAttribute extends BaseAttribute { * presumably came from the class file that this attribute came * from. * - * @return null-ok; the constant pool + * @return {@code null-ok;} the constant pool */ public ConstantPool getPool() { return pool; diff --git a/dx/src/com/android/dx/cf/code/BaseMachine.java b/dx/src/com/android/dx/cf/code/BaseMachine.java index 430e48be7..b7e700d42 100644 --- a/dx/src/com/android/dx/cf/code/BaseMachine.java +++ b/dx/src/com/android/dx/cf/code/BaseMachine.java @@ -33,44 +33,44 @@ import java.util.ArrayList; * TypeBearer}.</p> */ public abstract class BaseMachine implements Machine { - /* non-null; the prototype for the associated method */ + /* {@code non-null;} the prototype for the associated method */ private final Prototype prototype; - /** non-null; primary arguments */ + /** {@code non-null;} primary arguments */ private TypeBearer[] args; - /** >= 0; number of primary arguments */ + /** {@code >= 0;} number of primary arguments */ private int argCount; - /** null-ok; type of the operation, if salient */ + /** {@code null-ok;} type of the operation, if salient */ private Type auxType; - /** auxiliary <code>int</code> argument */ + /** auxiliary {@code int} argument */ private int auxInt; - /** null-ok; auxiliary constant argument */ + /** {@code null-ok;} auxiliary constant argument */ private Constant auxCst; /** auxiliary branch target argument */ private int auxTarget; - /** null-ok; auxiliary switch cases argument */ + /** {@code null-ok;} auxiliary switch cases argument */ private SwitchList auxCases; - /** null-ok; auxiliary initial value list for newarray */ + /** {@code null-ok;} auxiliary initial value list for newarray */ private ArrayList<Constant> auxInitValues; - /** >= -1; last local accessed */ + /** {@code >= -1;} last local accessed */ private int localIndex; - /** null-ok; local target spec, if salient and calculated */ + /** {@code null-ok;} local target spec, if salient and calculated */ private RegisterSpec localTarget; - /** non-null; results */ + /** {@code non-null;} results */ private TypeBearer[] results; /** - * >= -1; count of the results, or <code>-1</code> if no results + * {@code >= -1;} count of the results, or {@code -1} if no results * have been set */ private int resultCount; @@ -78,7 +78,7 @@ public abstract class BaseMachine implements Machine { /** * Constructs an instance. * - * @param prototype non-null; the prototype for the associated method + * @param prototype {@code non-null;} the prototype for the associated method */ public BaseMachine(Prototype prototype) { if (prototype == null) { @@ -254,7 +254,7 @@ public abstract class BaseMachine implements Machine { /** * Gets the number of primary arguments. * - * @return >= 0; the number of primary arguments + * @return {@code >= 0;} the number of primary arguments */ protected final int argCount() { return argCount; @@ -264,7 +264,7 @@ public abstract class BaseMachine implements Machine { * Gets the width of the arguments (where a category-2 value counts as * two). * - * @return >= 0; the argument width + * @return {@code >= 0;} the argument width */ protected final int argWidth() { int result = 0; @@ -277,10 +277,10 @@ public abstract class BaseMachine implements Machine { } /** - * Gets the <code>n</code>th primary argument. + * Gets the {@code n}th primary argument. * - * @param n >= 0, < argCount(); which argument - * @return non-null; the indicated argument + * @param n {@code >= 0, < argCount();} which argument + * @return {@code non-null;} the indicated argument */ protected final TypeBearer arg(int n) { if (n >= argCount) { @@ -298,14 +298,14 @@ public abstract class BaseMachine implements Machine { /** * Gets the type auxiliary argument. * - * @return null-ok; the salient type + * @return {@code null-ok;} the salient type */ protected final Type getAuxType() { return auxType; } /** - * Gets the <code>int</code> auxiliary argument. + * Gets the {@code int} auxiliary argument. * * @return the argument value */ @@ -316,7 +316,7 @@ public abstract class BaseMachine implements Machine { /** * Gets the constant auxiliary argument. * - * @return null-ok; the argument value + * @return {@code null-ok;} the argument value */ protected final Constant getAuxCst() { return auxCst; @@ -334,7 +334,7 @@ public abstract class BaseMachine implements Machine { /** * Gets the switch cases auxiliary argument. * - * @return null-ok; the argument value + * @return {@code null-ok;} the argument value */ protected final SwitchList getAuxCases() { return auxCases; @@ -343,7 +343,7 @@ public abstract class BaseMachine implements Machine { /** * Gets the init values auxiliary argument. * - * @return null-ok; the argument value + * @return {@code null-ok;} the argument value */ protected final ArrayList<Constant> getInitValues() { return auxInitValues; @@ -351,7 +351,7 @@ public abstract class BaseMachine implements Machine { /** * Gets the last local index accessed. * - * @return >= -1; the salient local index or <code>-1</code> if none + * @return {@code >= -1;} the salient local index or {@code -1} if none * was set since the last time {@link #clearArgs} was called */ protected final int getLocalIndex() { @@ -365,7 +365,7 @@ public abstract class BaseMachine implements Machine { * should be the sole result set by a call to {@link #setResult} (or * the combination {@link #clearResult} then {@link #addResult}. * - * @return null-ok; the salient register spec or <code>null</code> if no + * @return {@code null-ok;} the salient register spec or {@code null} if no * local target was set since the last time {@link #clearArgs} was * called */ @@ -417,7 +417,7 @@ public abstract class BaseMachine implements Machine { * <p><b>Note:</b> If there is more than one result value, the * others may be added by using {@link #addResult}.</p> * - * @param result non-null; result value + * @param result {@code non-null;} result value */ protected final void setResult(TypeBearer result) { if (result == null) { @@ -433,7 +433,7 @@ public abstract class BaseMachine implements Machine { * * @see #setResult * - * @param result non-null; result value + * @param result {@code non-null;} result value */ protected final void addResult(TypeBearer result) { if (result == null) { @@ -448,7 +448,7 @@ public abstract class BaseMachine implements Machine { * Gets the count of results. This throws an exception if results were * never set. (Explicitly clearing the results counts as setting them.) * - * @return >= 0; the count + * @return {@code >= 0;} the count */ protected final int resultCount() { if (resultCount < 0) { @@ -462,7 +462,7 @@ public abstract class BaseMachine implements Machine { * Gets the width of the results (where a category-2 value counts as * two). * - * @return >= 0; the result width + * @return {@code >= 0;} the result width */ protected final int resultWidth() { int width = 0; @@ -475,10 +475,10 @@ public abstract class BaseMachine implements Machine { } /** - * Gets the <code>n</code>th result value. + * Gets the {@code n}th result value. * - * @param n >= 0, < resultCount(); which result - * @return non-null; the indicated result value + * @param n {@code >= 0, < resultCount();} which result + * @return {@code non-null;} the indicated result value */ protected final TypeBearer result(int n) { if (n >= resultCount) { @@ -499,7 +499,7 @@ public abstract class BaseMachine implements Machine { * result is stored to that target; otherwise any results are pushed * onto the stack. * - * @param frame non-null; frame to operate on + * @param frame {@code non-null;} frame to operate on */ protected final void storeResults(Frame frame) { if (resultCount < 0) { @@ -529,8 +529,8 @@ public abstract class BaseMachine implements Machine { * Throws an exception that indicates a mismatch in local variable * types. * - * @param found non-null; the encountered type - * @param local non-null; the local variable's claimed type + * @param found {@code non-null;} the encountered type + * @param local {@code non-null;} the local variable's claimed type */ public static void throwLocalMismatch(TypeBearer found, TypeBearer local) { diff --git a/dx/src/com/android/dx/cf/code/BasicBlocker.java b/dx/src/com/android/dx/cf/code/BasicBlocker.java index 82e4a08d0..d67e52549 100644 --- a/dx/src/com/android/dx/cf/code/BasicBlocker.java +++ b/dx/src/com/android/dx/cf/code/BasicBlocker.java @@ -29,33 +29,37 @@ import java.util.ArrayList; * Utility that identifies basic blocks in bytecode. */ public final class BasicBlocker implements BytecodeArray.Visitor { - /** non-null; method being converted */ + /** {@code non-null;} method being converted */ private final ConcreteMethod method; - /** non-null; work set; bits indicate offsets in need of examination */ + /** + * {@code non-null;} work set; bits indicate offsets in need of + * examination + */ private final int[] workSet; /** - * non-null; live set; bits indicate potentially-live opcodes; contrawise, - * a bit that isn't on is either in the middle of an instruction or is - * a definitely-dead opcode + * {@code non-null;} live set; bits indicate potentially-live + * opcodes; contrawise, a bit that isn't on is either in the + * middle of an instruction or is a definitely-dead opcode */ private final int[] liveSet; /** - * non-null; block start set; bits indicate the starts of basic blocks, - * including the opcodes that start blocks of definitely-dead code + * {@code non-null;} block start set; bits indicate the starts of + * basic blocks, including the opcodes that start blocks of + * definitely-dead code */ private final int[] blockSet; /** - * non-null, sparse; for each instruction offset to a branch of + * {@code non-null, sparse;} for each instruction offset to a branch of * some sort, the list of targets for that instruction */ private final IntList[] targetLists; /** - * non-null, sparse; for each instruction offset to a throwing + * {@code non-null, sparse;} for each instruction offset to a throwing * instruction, the list of exception handlers for that instruction */ private final ByteCatchList[] catchLists; @@ -68,8 +72,8 @@ public final class BasicBlocker implements BytecodeArray.Visitor { * returning a list of them. The returned list notably omits any * definitely-dead code that is identified in the process. * - * @param method non-null; method to convert - * @return non-null; list of basic blocks + * @param method {@code non-null;} method to convert + * @return {@code non-null;} list of basic blocks */ public static ByteBlockList identifyBlocks(ConcreteMethod method) { BasicBlocker bb = new BasicBlocker(method); @@ -82,7 +86,7 @@ public final class BasicBlocker implements BytecodeArray.Visitor { * Constructs an instance. This class is not publicly instantiable; use * {@link #identifyBlocks}. * - * @param method non-null; method to convert + * @param method {@code non-null;} method to convert */ private BasicBlocker(ConcreteMethod method) { if (method == null) { @@ -262,10 +266,9 @@ public final class BasicBlocker implements BytecodeArray.Visitor { /** * Extracts the list of basic blocks from the bit sets. * - * @return non-null; the list of basic blocks + * @return {@code non-null;} the list of basic blocks */ private ByteBlockList getBlockList() { - ByteCatchList catches = method.getCatches(); BytecodeArray bytes = method.getCode(); ByteBlock[] bbs = new ByteBlock[bytes.size()]; int count = 0; @@ -366,7 +369,7 @@ public final class BasicBlocker implements BytecodeArray.Visitor { * isn't yet known to be possibly-live. * * @param offset offset to the instruction in question - * @param blockStart <code>true</code> iff this instruction starts a + * @param blockStart {@code true} iff this instruction starts a * basic block */ private void addWorkIfNecessary(int offset, boolean blockStart) { @@ -384,7 +387,7 @@ public final class BasicBlocker implements BytecodeArray.Visitor { * * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param nextIsLive <code>true</code> iff the instruction after + * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional branch, a return, or a switch) */ @@ -417,7 +420,7 @@ public final class BasicBlocker implements BytecodeArray.Visitor { * * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param nextIsLive <code>true</code> iff the instruction after + * @param nextIsLive {@code true} iff the instruction after * the indicated one is possibly-live (because this one isn't an * unconditional throw) */ diff --git a/dx/src/com/android/dx/cf/code/ByteBlock.java b/dx/src/com/android/dx/cf/code/ByteBlock.java index 065c5221c..40b91c38d 100644 --- a/dx/src/com/android/dx/cf/code/ByteBlock.java +++ b/dx/src/com/android/dx/cf/code/ByteBlock.java @@ -24,32 +24,32 @@ import com.android.dx.util.LabeledItem; * Representation of a basic block in a bytecode array. */ public final class ByteBlock implements LabeledItem { - /** >= 0; label for this block */ + /** {@code >= 0;} label for this block */ private final int label; - /** >= 0; bytecode offset (inclusive) of the start of the block */ + /** {@code >= 0;} bytecode offset (inclusive) of the start of the block */ private final int start; - /** > start; bytecode offset (exclusive) of the end of the block */ + /** {@code > start;} bytecode offset (exclusive) of the end of the block */ private final int end; - /** non-null; list of successors that this block may branch to */ + /** {@code non-null;} list of successors that this block may branch to */ private final IntList successors; - /** non-null; list of exceptions caught and their handler targets */ + /** {@code non-null;} list of exceptions caught and their handler targets */ private final ByteCatchList catches; /** * Constructs an instance. * - * @param label >= 0; target label for this block - * @param start >= 0; bytecode offset (inclusive) of the start + * @param label {@code >= 0;} target label for this block + * @param start {@code >= 0;} bytecode offset (inclusive) of the start * of the block - * @param end > start; bytecode offset (exclusive) of the end + * @param end {@code > start;} bytecode offset (exclusive) of the end * of the block - * @param successors non-null; list of successors that this block may + * @param successors {@code non-null;} list of successors that this block may * branch to - * @param catches non-null; list of exceptions caught and their + * @param catches {@code non-null;} list of exceptions caught and their * handler targets */ public ByteBlock(int label, int start, int end, IntList successors, @@ -100,7 +100,7 @@ public final class ByteBlock implements LabeledItem { /** * Gets the label of this block. * - * @return >= 0; the label + * @return {@code >= 0;} the label */ public int getLabel() { return label; @@ -109,7 +109,7 @@ public final class ByteBlock implements LabeledItem { /** * Gets the bytecode offset (inclusive) of the start of this block. * - * @return >= 0; the start offset + * @return {@code >= 0;} the start offset */ public int getStart() { return start; @@ -118,7 +118,7 @@ public final class ByteBlock implements LabeledItem { /** * Gets the bytecode offset (exclusive) of the end of this block. * - * @return > getStart(); the end offset + * @return {@code > getStart();} the end offset */ public int getEnd() { return end; @@ -128,7 +128,7 @@ public final class ByteBlock implements LabeledItem { * Gets the list of successors that this block may branch to * non-exceptionally. * - * @return non-null; the successor list + * @return {@code non-null;} the successor list */ public IntList getSuccessors() { return successors; @@ -137,7 +137,7 @@ public final class ByteBlock implements LabeledItem { /** * Gets the list of exceptions caught and their handler targets. * - * @return non-null; the catch list + * @return {@code non-null;} the catch list */ public ByteCatchList getCatches() { return catches; diff --git a/dx/src/com/android/dx/cf/code/ByteBlockList.java b/dx/src/com/android/dx/cf/code/ByteBlockList.java index 9d27b7fd9..412dfc3f7 100644 --- a/dx/src/com/android/dx/cf/code/ByteBlockList.java +++ b/dx/src/com/android/dx/cf/code/ByteBlockList.java @@ -28,7 +28,7 @@ public final class ByteBlockList extends LabeledList { /** * Constructs an instance. * - * @param size >= 0; the number of elements to be in the list + * @param size {@code >= 0;} the number of elements to be in the list */ public ByteBlockList(int size) { super(size); @@ -37,10 +37,10 @@ public final class ByteBlockList extends LabeledList { /** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this - * will throw <code>NullPointerException</code>. + * will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which element - * @return non-null; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code non-null;} the indicated element */ public ByteBlock get(int n) { return (ByteBlock) get0(n); @@ -50,7 +50,7 @@ public final class ByteBlockList extends LabeledList { * Gets the block with the given label. * * @param label the label to look for - * @return non-null; the block with the given label + * @return {@code non-null;} the block with the given label */ public ByteBlock labelToBlock(int label) { int idx = indexOfLabel(label); @@ -66,8 +66,8 @@ public final class ByteBlockList extends LabeledList { /** * Sets the element at the given index. * - * @param n >= 0, < size(); which element - * @param bb null-ok; the value to store + * @param n {@code >= 0, < size();} which element + * @param bb {@code null-ok;} the value to store */ public void set(int n, ByteBlock bb) { super.set(n, bb); diff --git a/dx/src/com/android/dx/cf/code/ByteCatchList.java b/dx/src/com/android/dx/cf/code/ByteCatchList.java index 375831e55..aab2087fa 100644 --- a/dx/src/com/android/dx/cf/code/ByteCatchList.java +++ b/dx/src/com/android/dx/cf/code/ByteCatchList.java @@ -24,10 +24,10 @@ import com.android.dx.util.IntList; /** * List of catch entries, that is, the elements of an "exception table," - * which is part of a standard <code>Code</code> attribute. + * which is part of a standard {@code Code} attribute. */ public final class ByteCatchList extends FixedSizeList { - /** non-null; convenient zero-entry instance */ + /** {@code non-null;} convenient zero-entry instance */ public static final ByteCatchList EMPTY = new ByteCatchList(0); /** @@ -41,10 +41,10 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the total length of this structure in bytes, when included in - * a <code>Code</code> attribute. The returned value includes the - * two bytes for <code>exception_table_length</code>. + * a {@code Code} attribute. The returned value includes the + * two bytes for {@code exception_table_length}. * - * @return >= 2; the total length, in bytes + * @return {@code >= 2;} the total length, in bytes */ public int byteLength() { return 2 + size() * 8; @@ -53,8 +53,8 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the indicated item. * - * @param n >= 0; which item - * @return null-ok; the indicated item + * @param n {@code >= 0;} which item + * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); @@ -63,8 +63,8 @@ public final class ByteCatchList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which entry to set - * @param item non-null; the item + * @param n {@code >= 0, < size();} which entry to set + * @param item {@code non-null;} the item */ public void set(int n, Item item) { if (item == null) { @@ -77,13 +77,13 @@ public final class ByteCatchList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which entry to set - * @param startPc >= 0; the start pc (inclusive) of the handler's range - * @param endPc >= startPc; the end pc (exclusive) of the + * @param n {@code >= 0, < size();} which entry to set + * @param startPc {@code >= 0;} the start pc (inclusive) of the handler's range + * @param endPc {@code >= startPc;} the end pc (exclusive) of the * handler's range - * @param handlerPc >= 0; the pc of the exception handler - * @param exceptionClass null-ok; the exception class or - * <code>null</code> to catch all exceptions with this handler + * @param handlerPc {@code >= 0;} the pc of the exception handler + * @param exceptionClass {@code null-ok;} the exception class or + * {@code null} to catch all exceptions with this handler */ public void set(int n, int startPc, int endPc, int handlerPc, CstType exceptionClass) { @@ -95,8 +95,8 @@ public final class ByteCatchList extends FixedSizeList { * automatically made immutable. * * @param pc which address - * @return non-null; list of exception handlers active at - * <code>pc</code> + * @return {@code non-null;} list of exception handlers active at + * {@code pc} */ public ByteCatchList listFor(int pc) { int sz = size(); @@ -128,12 +128,12 @@ public final class ByteCatchList extends FixedSizeList { * Helper method for {@link #listFor}, which tells whether a match * is <i>not</i> found for the exception type of the given item in * the given array. A match is considered to be either an exact type - * match or the class <code>Object</code> which represents a catch-all. + * match or the class {@code Object} which represents a catch-all. * - * @param item non-null; item with the exception type to look for - * @param arr non-null; array to search in - * @param count non-null; maximum number of elements in the array to check - * @return <code>true</code> iff the exception type is <i>not</i> found + * @param item {@code non-null;} item with the exception type to look for + * @param arr {@code non-null;} array to search in + * @param count {@code non-null;} maximum number of elements in the array to check + * @return {@code true} iff the exception type is <i>not</i> found */ private static boolean typeNotFound(Item item, Item[] arr, int count) { CstType type = item.getExceptionClass(); @@ -151,13 +151,13 @@ public final class ByteCatchList extends FixedSizeList { /** * Returns a target list corresponding to this instance. The result * is a list of all the exception handler addresses, with the given - * <code>noException</code> address appended if appropriate. The + * {@code noException} address appended if appropriate. The * result is automatically made immutable. * - * @param noException >= -1; the no-exception address to append, or - * <code>-1</code> not to append anything - * @return non-null; list of exception targets, with - * <code>noException</code> appended if necessary + * @param noException {@code >= -1;} the no-exception address to append, or + * {@code -1} not to append anything + * @return {@code non-null;} list of exception targets, with + * {@code noException} appended if necessary */ public IntList toTargetList(int noException) { if (noException < -1) { @@ -199,7 +199,7 @@ public final class ByteCatchList extends FixedSizeList { /** * Returns a rop-style catches list equivalent to this one. * - * @return non-null; the converted instance + * @return {@code non-null;} the converted instance */ public TypeList toRopCatchList() { int sz = size(); @@ -221,29 +221,29 @@ public final class ByteCatchList extends FixedSizeList { * Item in an exception handler list. */ public static class Item { - /** >= 0; the start pc (inclusive) of the handler's range */ + /** {@code >= 0;} the start pc (inclusive) of the handler's range */ private final int startPc; - /** >= startPc; the end pc (exclusive) of the handler's range */ + /** {@code >= startPc;} the end pc (exclusive) of the handler's range */ private final int endPc; - /** >= 0; the pc of the exception handler */ + /** {@code >= 0;} the pc of the exception handler */ private final int handlerPc; - /** null-ok; the exception class or <code>null</code> to catch all + /** {@code null-ok;} the exception class or {@code null} to catch all * exceptions with this handler */ private final CstType exceptionClass; /** * Constructs an instance. * - * @param startPc >= 0; the start pc (inclusive) of the + * @param startPc {@code >= 0;} the start pc (inclusive) of the * handler's range - * @param endPc >= startPc; the end pc (exclusive) of the + * @param endPc {@code >= startPc;} the end pc (exclusive) of the * handler's range - * @param handlerPc >= 0; the pc of the exception handler - * @param exceptionClass null-ok; the exception class or - * <code>null</code> to catch all exceptions with this handler + * @param handlerPc {@code >= 0;} the pc of the exception handler + * @param exceptionClass {@code null-ok;} the exception class or + * {@code null} to catch all exceptions with this handler */ public Item(int startPc, int endPc, int handlerPc, CstType exceptionClass) { @@ -268,7 +268,7 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the start pc (inclusive) of the handler's range. * - * @return >= 0; the start pc (inclusive) of the handler's range. + * @return {@code >= 0;} the start pc (inclusive) of the handler's range. */ public int getStartPc() { return startPc; @@ -277,7 +277,7 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the end pc (exclusive) of the handler's range. * - * @return >= startPc; the end pc (exclusive) of the + * @return {@code >= startPc;} the end pc (exclusive) of the * handler's range. */ public int getEndPc() { @@ -287,7 +287,7 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the pc of the exception handler. * - * @return >= 0; the pc of the exception handler + * @return {@code >= 0;} the pc of the exception handler */ public int getHandlerPc() { return handlerPc; @@ -296,7 +296,7 @@ public final class ByteCatchList extends FixedSizeList { /** * Gets the class of exception handled. * - * @return non-null; the exception class; {@link CstType#OBJECT} + * @return {@code non-null;} the exception class; {@link CstType#OBJECT} * if this entry handles all possible exceptions */ public CstType getExceptionClass() { @@ -308,7 +308,7 @@ public final class ByteCatchList extends FixedSizeList { * Returns whether the given address is in the range of this item. * * @param pc the address - * @return <code>true</code> iff this item covers <code>pc</code> + * @return {@code true} iff this item covers {@code pc} */ public boolean covers(int pc) { return (pc >= startPc) && (pc < endPc); diff --git a/dx/src/com/android/dx/cf/code/ByteOps.java b/dx/src/com/android/dx/cf/code/ByteOps.java index 4c420f6f6..ea7b514f6 100644 --- a/dx/src/com/android/dx/cf/code/ByteOps.java +++ b/dx/src/com/android/dx/cf/code/ByteOps.java @@ -242,114 +242,114 @@ public class ByteOps { /** invalid */ public static final int FMT_INVALID = 0; - /** "-": <code>op</code> */ + /** "-": {@code op} */ public static final int FMT_NO_ARGS = 1; - /** "0": <code>op</code>; implies <code>max_locals >= 1</code> */ + /** "0": {@code op}; implies {@code max_locals >= 1} */ public static final int FMT_NO_ARGS_LOCALS_1 = 2; - /** "1": <code>op</code>; implies <code>max_locals >= 2</code> */ + /** "1": {@code op}; implies {@code max_locals >= 2} */ public static final int FMT_NO_ARGS_LOCALS_2 = 3; - /** "2": <code>op</code>; implies <code>max_locals >= 3</code> */ + /** "2": {@code op}; implies {@code max_locals >= 3} */ public static final int FMT_NO_ARGS_LOCALS_3 = 4; - /** "3": <code>op</code>; implies <code>max_locals >= 4</code> */ + /** "3": {@code op}; implies {@code max_locals >= 4} */ public static final int FMT_NO_ARGS_LOCALS_4 = 5; - /** "4": <code>op</code>; implies <code>max_locals >= 5</code> */ + /** "4": {@code op}; implies {@code max_locals >= 5} */ public static final int FMT_NO_ARGS_LOCALS_5 = 6; - /** "b": <code>op target target</code> */ + /** "b": {@code op target target} */ public static final int FMT_BRANCH = 7; - /** "c": <code>op target target target target</code> */ + /** "c": {@code op target target target target} */ public static final int FMT_WIDE_BRANCH = 8; - /** "p": <code>op #cpi #cpi</code>; constant restricted as specified */ + /** "p": {@code op #cpi #cpi}; constant restricted as specified */ public static final int FMT_CPI = 9; /** - * "l": <code>op local</code>; category-1 local; implies - * <code>max_locals</code> is at least two more than the given + * "l": {@code op local}; category-1 local; implies + * {@code max_locals} is at least two more than the given * local number */ public static final int FMT_LOCAL_1 = 10; /** - * "m": <code>op local</code>; category-2 local; implies - * <code>max_locals</code> is at least two more than the given + * "m": {@code op local}; category-2 local; implies + * {@code max_locals} is at least two more than the given * local number */ public static final int FMT_LOCAL_2 = 11; /** - * "y": <code>op #byte</code> (<code>bipush</code> and - * <code>newarray</code>) + * "y": {@code op #byte} ({@code bipush} and + * {@code newarray}) */ public static final int FMT_LITERAL_BYTE = 12; - /** "I": <code>invokeinterface cpi cpi count 0</code> */ + /** "I": {@code invokeinterface cpi cpi count 0} */ public static final int FMT_INVOKEINTERFACE = 13; - /** "L": <code>ldc #cpi</code>; constant restricted as specified */ + /** "L": {@code ldc #cpi}; constant restricted as specified */ public static final int FMT_LDC = 14; - /** "S": <code>sipush #byte #byte</code> */ + /** "S": {@code sipush #byte #byte} */ public static final int FMT_SIPUSH = 15; - /** "T": <code>tableswitch ...</code> */ + /** "T": {@code tableswitch ...} */ public static final int FMT_TABLESWITCH = 16; - /** "U": <code>lookupswitch ...</code> */ + /** "U": {@code lookupswitch ...} */ public static final int FMT_LOOKUPSWITCH = 17; - /** "M": <code>multianewarray cpi cpi dims</code> */ + /** "M": {@code multianewarray cpi cpi dims} */ public static final int FMT_MULTIANEWARRAY = 18; - /** "W": <code>wide ...</code> */ + /** "W": {@code wide ...} */ public static final int FMT_WIDE = 19; /** mask for the bits representing the opcode format */ public static final int FMT_MASK = 0x1f; - /** "I": flag bit for valid cp type for <code>Integer</code> */ + /** "I": flag bit for valid cp type for {@code Integer} */ public static final int CPOK_Integer = 0x20; - /** "F": flag bit for valid cp type for <code>Float</code> */ + /** "F": flag bit for valid cp type for {@code Float} */ public static final int CPOK_Float = 0x40; - /** "J": flag bit for valid cp type for <code>Long</code> */ + /** "J": flag bit for valid cp type for {@code Long} */ public static final int CPOK_Long = 0x80; - /** "D": flag bit for valid cp type for <code>Double</code> */ + /** "D": flag bit for valid cp type for {@code Double} */ public static final int CPOK_Double = 0x100; - /** "c": flag bit for valid cp type for <code>Class</code> */ + /** "c": flag bit for valid cp type for {@code Class} */ public static final int CPOK_Class = 0x200; - /** "s": flag bit for valid cp type for <code>String</code> */ + /** "s": flag bit for valid cp type for {@code String} */ public static final int CPOK_String = 0x400; - /** "f": flag bit for valid cp type for <code>Fieldref</code> */ + /** "f": flag bit for valid cp type for {@code Fieldref} */ public static final int CPOK_Fieldref = 0x800; - /** "m": flag bit for valid cp type for <code>Methodref</code> */ + /** "m": flag bit for valid cp type for {@code Methodref} */ public static final int CPOK_Methodref = 0x1000; - /** "i": flag bit for valid cp type for <code>InterfaceMethodref</code> */ + /** "i": flag bit for valid cp type for {@code InterfaceMethodref} */ public static final int CPOK_InterfaceMethodref = 0x2000; /** - * non-null; map from opcodes to format or'ed with allowed constant + * {@code non-null;} map from opcodes to format or'ed with allowed constant * pool types */ private static final int[] OPCODE_INFO = new int[256]; - /** non-null; map from opcodes to their names */ + /** {@code non-null;} map from opcodes to their names */ private static final String[] OPCODE_NAMES = new String[256]; - /** non-null; bigass string describing all the opcodes */ + /** {@code non-null;} bigass string describing all the opcodes */ private static final String OPCODE_DETAILS = "00 - nop;" + "01 - aconst_null;" + @@ -623,8 +623,8 @@ public class ByteOps { /** * Gets the name of the given opcode. * - * @param opcode >= 0, <= 255; the opcode - * @return non-null; its name + * @param opcode {@code >= 0, <= 255;} the opcode + * @return {@code non-null;} its name */ public static String opName(int opcode) { String result = OPCODE_NAMES[opcode]; @@ -640,7 +640,7 @@ public class ByteOps { /** * Gets the format and allowed cp types of the given opcode. * - * @param opcode >= 0, <= 255; the opcode + * @param opcode {@code >= 0, <= 255;} the opcode * @return its format and allowed cp types */ public static int opInfo(int opcode) { diff --git a/dx/src/com/android/dx/cf/code/BytecodeArray.java b/dx/src/com/android/dx/cf/code/BytecodeArray.java index 71ba029f6..60f0cee07 100644 --- a/dx/src/com/android/dx/cf/code/BytecodeArray.java +++ b/dx/src/com/android/dx/cf/code/BytecodeArray.java @@ -32,23 +32,23 @@ import com.android.dx.util.Hex; import java.util.ArrayList; /** - * Bytecode array, which is part of a standard <code>Code</code> attribute. + * Bytecode array, which is part of a standard {@code Code} attribute. */ public final class BytecodeArray { /** convenient no-op implementation of {@link Visitor} */ public static final Visitor EMPTY_VISITOR = new BaseVisitor(); - /** non-null; underlying bytes */ + /** {@code non-null;} underlying bytes */ private final ByteArray bytes; - /** non-null; constant pool to use when resolving constant pool indices */ + /** {@code non-null;} constant pool to use when resolving constant pool indices */ private final ConstantPool pool; /** * Constructs an instance. * - * @param bytes non-null; underlying bytes - * @param pool non-null; constant pool to use when resolving constant + * @param bytes {@code non-null;} underlying bytes + * @param pool {@code non-null;} constant pool to use when resolving constant * pool indices */ public BytecodeArray(ByteArray bytes, ConstantPool pool) { @@ -67,7 +67,7 @@ public final class BytecodeArray { /** * Gets the underlying byte array. * - * @return non-null; the byte array + * @return {@code non-null;} the byte array */ public ByteArray getBytes() { return bytes; @@ -76,7 +76,7 @@ public final class BytecodeArray { /** * Gets the size of the bytecode array, per se. * - * @return >= 0; the length of the bytecode array + * @return {@code >= 0;} the length of the bytecode array */ public int size() { return bytes.size(); @@ -84,10 +84,10 @@ public final class BytecodeArray { /** * Gets the total length of this structure in bytes, when included in - * a <code>Code</code> attribute. The returned value includes the - * array size plus four bytes for <code>code_length</code>. + * a {@code Code} attribute. The returned value includes the + * array size plus four bytes for {@code code_length}. * - * @return >= 4; the total length, in bytes + * @return {@code >= 4;} the total length, in bytes */ public int byteLength() { return 4 + bytes.size(); @@ -96,7 +96,7 @@ public final class BytecodeArray { /** * Parses each instruction in the array, in order. * - * @param visitor null-ok; visitor to call back to for each instruction + * @param visitor {@code null-ok;} visitor to call back to for each instruction */ public void forEach(Visitor visitor) { int sz = bytes.size(); @@ -116,7 +116,7 @@ public final class BytecodeArray { * result is a bit set with the offset of each opcode-per-se flipped on. * * @see Bits - * @return non-null; appropriately constructed bit set + * @return {@code non-null;} appropriately constructed bit set */ public int[] getInstructionOffsets() { int sz = bytes.size(); @@ -139,8 +139,8 @@ public final class BytecodeArray { * work set is empty. It is expected that the visitor will regularly * set new bits in the work set during the process. * - * @param workSet non-null; the work set to process - * @param visitor non-null; visitor to call back to for each instruction + * @param workSet {@code non-null;} the work set to process + * @param visitor {@code non-null;} visitor to call back to for each instruction */ public void processWorkSet(int[] workSet, Visitor visitor) { if (visitor == null) { @@ -170,42 +170,42 @@ public final class BytecodeArray { * * <ul> * <li>The opcodes to push literal constants of primitive types all become - * <code>ldc</code>. - * E.g., <code>fconst_0</code>, <code>sipush</code>, and - * <code>lconst_0</code> qualify for this treatment.</li> - * <li><code>aconst_null</code> becomes <code>ldc</code> of a + * {@code ldc}. + * E.g., {@code fconst_0}, {@code sipush}, and + * {@code lconst_0} qualify for this treatment.</li> + * <li>{@code aconst_null} becomes {@code ldc} of a * "known null."</li> * <li>Shorthand local variable accessors become the corresponding - * longhand. E.g. <code>aload_2</code> becomes <code>aload</code>.</li> - * <li><code>goto_w</code> and <code>jsr_w</code> become <code>goto</code> - * and <code>jsr</code> (respectively).</li> - * <li><code>ldc_w</code> becomes <code>ldc</code>.</li> - * <li><code>tableswitch</code> becomes <code>lookupswitch</code>. + * longhand. E.g. {@code aload_2} becomes {@code aload}.</li> + * <li>{@code goto_w} and {@code jsr_w} become {@code goto} + * and {@code jsr} (respectively).</li> + * <li>{@code ldc_w} becomes {@code ldc}.</li> + * <li>{@code tableswitch} becomes {@code lookupswitch}. * <li>Arithmetic, array, and value-returning ops are collapsed - * to the <code>int</code> variant opcode, with the <code>type</code> + * to the {@code int} variant opcode, with the {@code type} * argument set to indicate the actual type. E.g., - * <code>fadd</code> becomes <code>iadd</code>, but - * <code>type</code> is passed as <code>Type.FLOAT</code> in that - * case. Similarly, <code>areturn</code> becomes - * <code>ireturn</code>. (However, <code>return</code> remains + * {@code fadd} becomes {@code iadd}, but + * {@code type} is passed as {@code Type.FLOAT} in that + * case. Similarly, {@code areturn} becomes + * {@code ireturn}. (However, {@code return} remains * unchanged.</li> - * <li>Local variable access ops are collapsed to the <code>int</code> - * variant opcode, with the <code>type</code> argument set to indicate - * the actual type. E.g., <code>aload</code> becomes <code>iload</code>, - * but <code>type</code> is passed as <code>Type.OBJECT</code> in + * <li>Local variable access ops are collapsed to the {@code int} + * variant opcode, with the {@code type} argument set to indicate + * the actual type. E.g., {@code aload} becomes {@code iload}, + * but {@code type} is passed as {@code Type.OBJECT} in * that case.</li> - * <li>Numeric conversion ops (<code>i2l</code>, etc.) are left alone - * to avoid too much confustion, but their <code>type</code> is - * the pushed type. E.g., <code>i2b</code> gets type - * <code>Type.INT</code>, and <code>f2d</code> gets type - * <code>Type.DOUBLE</code>. Other unaltered opcodes also get - * their pushed type. E.g., <code>arraylength</code> gets type - * <code>Type.INT</code>.</li> + * <li>Numeric conversion ops ({@code i2l}, etc.) are left alone + * to avoid too much confustion, but their {@code type} is + * the pushed type. E.g., {@code i2b} gets type + * {@code Type.INT}, and {@code f2d} gets type + * {@code Type.DOUBLE}. Other unaltered opcodes also get + * their pushed type. E.g., {@code arraylength} gets type + * {@code Type.INT}.</li> * </ul> * - * @param offset >= 0, < bytes.size(); offset to the start of the + * @param offset {@code >= 0, < bytes.size();} offset to the start of the * instruction - * @param visitor null-ok; visitor to call back to + * @param visitor {@code null-ok;} visitor to call back to * @return the length of the instruction, in bytes */ public int parseInstruction(int offset, Visitor visitor) { @@ -797,10 +797,10 @@ public final class BytecodeArray { } /** - * Helper to deal with <code>tableswitch</code>. + * Helper to deal with {@code tableswitch}. * - * @param offset the offset to the <code>tableswitch</code> opcode itself - * @param visitor non-null; visitor to use + * @param offset the offset to the {@code tableswitch} opcode itself + * @param visitor {@code non-null;} visitor to use * @return instruction length, in bytes */ private int parseTableswitch(int offset, Visitor visitor) { @@ -840,10 +840,10 @@ public final class BytecodeArray { } /** - * Helper to deal with <code>lookupswitch</code>. + * Helper to deal with {@code lookupswitch}. * - * @param offset the offset to the <code>lookupswitch</code> opcode itself - * @param visitor non-null; visitor to use + * @param offset the offset to the {@code lookupswitch} opcode itself + * @param visitor {@code non-null;} visitor to use * @return instruction length, in bytes */ private int parseLookupswitch(int offset, Visitor visitor) { @@ -878,10 +878,10 @@ public final class BytecodeArray { } /** - * Helper to deal with <code>newarray</code>. + * Helper to deal with {@code newarray}. * - * @param offset the offset to the <code>newarray</code> opcode itself - * @param visitor non-null; visitor to use + * @param offset the offset to the {@code newarray} opcode itself + * @param visitor {@code non-null;} visitor to use * @return instruction length, in bytes */ private int parseNewarray(int offset, Visitor visitor) { @@ -1061,10 +1061,10 @@ public final class BytecodeArray { /** - * Helper to deal with <code>wide</code>. + * Helper to deal with {@code wide}. * - * @param offset the offset to the <code>wide</code> opcode itself - * @param visitor non-null; visitor to use + * @param offset the offset to the {@code wide} opcode itself + * @param visitor {@code non-null;} visitor to use * @return instruction length, in bytes */ private int parseWide(int offset, Visitor visitor) { @@ -1159,7 +1159,7 @@ public final class BytecodeArray { * @param opcode the opcode * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param type non-null; type the instruction operates on + * @param type {@code non-null;} type the instruction operates on */ public void visitNoArgs(int opcode, int offset, int length, Type type); @@ -1171,9 +1171,9 @@ public final class BytecodeArray { * @param offset offset to the instruction * @param length length of the instruction, in bytes * @param idx the local variable index - * @param type non-null; the type of the accessed value + * @param type {@code non-null;} the type of the accessed value * @param value additional literal integer argument, if salient (i.e., - * for <code>iinc</code>) + * for {@code iinc}) */ public void visitLocal(int opcode, int offset, int length, int idx, Type type, int value); @@ -1182,23 +1182,23 @@ public final class BytecodeArray { * Visits an instruction which has a (possibly synthetic) * constant argument, and possibly also an * additional literal integer argument. In the case of - * <code>multianewarray</code>, the argument is the count of - * dimensions. In the case of <code>invokeinterface</code>, + * {@code multianewarray}, the argument is the count of + * dimensions. In the case of {@code invokeinterface}, * the argument is the parameter count or'ed with the * should-be-zero value left-shifted by 8. In the case of entries - * of type <code>int</code>, the <code>value</code> field always + * of type {@code int}, the {@code value} field always * holds the raw value (for convenience of clients). * * <p><b>Note:</b> In order to avoid giving it a barely-useful - * visitor all its own, <code>newarray</code> also uses this - * form, passing <code>value</code> as the array type code and - * <code>cst</code> as a {@link CstType} instance + * visitor all its own, {@code newarray} also uses this + * form, passing {@code value} as the array type code and + * {@code cst} as a {@link CstType} instance * corresponding to the array type.</p> * * @param opcode the opcode * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param cst non-null; the constant + * @param cst {@code non-null;} the constant * @param value additional literal integer argument, if salient * (ignore if not) */ @@ -1222,7 +1222,7 @@ public final class BytecodeArray { * @param opcode the opcode * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param cases non-null; list of (value, target) pairs, plus the + * @param cases {@code non-null;} list of (value, target) pairs, plus the * default target * @param padding the bytes found in the padding area (if any), * packed @@ -1235,8 +1235,8 @@ public final class BytecodeArray { * * @param offset offset to the instruction * @param length length of the instruction, in bytes - * @param cst non-null; the type of the array - * @param initVals non-null; list of bytecode offsets for init values + * @param cst {@code non-null;} the type of the array + * @param initVals {@code non-null;} list of bytecode offsets for init values */ public void visitNewarray(int offset, int length, CstType type, ArrayList<Constant> initVals); diff --git a/dx/src/com/android/dx/cf/code/ConcreteMethod.java b/dx/src/com/android/dx/cf/code/ConcreteMethod.java index 47f698dc2..70b6b452f 100644 --- a/dx/src/com/android/dx/cf/code/ConcreteMethod.java +++ b/dx/src/com/android/dx/cf/code/ConcreteMethod.java @@ -35,38 +35,38 @@ import com.android.dx.rop.type.Prototype; * Container for all the giblets that make up a concrete Java bytecode method. * It implements {@link Method}, so it provides all the original access * (by delegation), but it also constructs and keeps useful versions of - * stuff extracted from the method's <code>Code</code> attribute. + * stuff extracted from the method's {@code Code} attribute. */ public final class ConcreteMethod implements Method { - /** non-null; method being wrapped */ + /** {@code non-null;} method being wrapped */ private final Method method; /** - * null-ok; the class's <code>SourceFile</code> attribute value, + * {@code null-ok;} the class's {@code SourceFile} attribute value, * if any */ private final CstUtf8 sourceFile; /** * whether the class that this method is part of is defined with - * <code>ACC_SUPER</code> + * {@code ACC_SUPER} */ private final boolean accSuper; - /** non-null; the code attribute */ + /** {@code non-null;} the code attribute */ private final AttCode attCode; - /** non-null; line number list */ + /** {@code non-null;} line number list */ private final LineNumberList lineNumbers; - /** non-null; local variable list */ + /** {@code non-null;} local variable list */ private final LocalVariableList localVariables; /** * Constructs an instance. * - * @param method non-null; the method to be based on - * @param cf non-null; the class file that contains this method + * @param method {@code non-null;} the method to be based on + * @param cf {@code non-null;} the class file that contains this method * @param keepLines whether to keep the line number information * (if any) * @param keepLocals whether to keep the local variable @@ -178,9 +178,9 @@ public final class ConcreteMethod implements Method { /** * Gets whether the class that this method is part of is defined with - * <code>ACC_SUPER</code>. + * {@code ACC_SUPER}. * - * @return the <code>ACC_SUPER</code> value + * @return the {@code ACC_SUPER} value */ public boolean getAccSuper() { return accSuper; @@ -189,7 +189,7 @@ public final class ConcreteMethod implements Method { /** * Gets the maximum stack size. * - * @return >= 0; the maximum stack size + * @return {@code >= 0;} the maximum stack size */ public int getMaxStack() { return attCode.getMaxStack(); @@ -198,7 +198,7 @@ public final class ConcreteMethod implements Method { /** * Gets the number of locals. * - * @return >= 0; the number of locals + * @return {@code >= 0;} the number of locals */ public int getMaxLocals() { return attCode.getMaxLocals(); @@ -207,7 +207,7 @@ public final class ConcreteMethod implements Method { /** * Gets the bytecode array. * - * @return non-null; the bytecode array + * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return attCode.getCode(); @@ -216,7 +216,7 @@ public final class ConcreteMethod implements Method { /** * Gets the exception table. * - * @return non-null; the exception table + * @return {@code non-null;} the exception table */ public ByteCatchList getCatches() { return attCode.getCatches(); @@ -225,7 +225,7 @@ public final class ConcreteMethod implements Method { /** * Gets the line number list. * - * @return non-null; the line number list + * @return {@code non-null;} the line number list */ public LineNumberList getLineNumbers() { return lineNumbers; @@ -234,7 +234,7 @@ public final class ConcreteMethod implements Method { /** * Gets the local variable list. * - * @return non-null; the local variable list + * @return {@code non-null;} the local variable list */ public LocalVariableList getLocalVariables() { return localVariables; @@ -244,8 +244,8 @@ public final class ConcreteMethod implements Method { * Returns a {@link SourcePosition} instance corresponding to the * given bytecode offset. * - * @param offset >= 0; the bytecode offset - * @return non-null; an appropriate instance + * @param offset {@code >= 0;} the bytecode offset + * @return {@code non-null;} an appropriate instance */ public SourcePosition makeSourcePosistion(int offset) { return new SourcePosition(sourceFile, offset, diff --git a/dx/src/com/android/dx/cf/code/ExecutionStack.java b/dx/src/com/android/dx/cf/code/ExecutionStack.java index 1a2b565dd..15a9e6c12 100644 --- a/dx/src/com/android/dx/cf/code/ExecutionStack.java +++ b/dx/src/com/android/dx/cf/code/ExecutionStack.java @@ -30,11 +30,11 @@ import com.android.dx.util.MutabilityControl; * TypeBearer}.</p> */ public final class ExecutionStack extends MutabilityControl { - /** non-null; array of stack contents */ + /** {@code non-null;} array of stack contents */ private final TypeBearer[] stack; /** - * >= 0; stack pointer (points one past the end) / current stack + * {@code >= 0;} stack pointer (points one past the end) / current stack * size */ private int stackPtr; @@ -42,7 +42,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Constructs an instance. * - * @param maxStack >= 0; the maximum size of the stack for this + * @param maxStack {@code >= 0;} the maximum size of the stack for this * instance */ public ExecutionStack(int maxStack) { @@ -54,7 +54,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Makes and returns a mutable copy of this instance. * - * @return non-null; the copy + * @return {@code non-null;} the copy */ public ExecutionStack copy() { ExecutionStack result = new ExecutionStack(stack.length); @@ -69,7 +69,7 @@ public final class ExecutionStack extends MutabilityControl { * Annotates (adds context to) the given exception with information * about this instance. * - * @param ex non-null; the exception to annotate + * @param ex {@code non-null;} the exception to annotate */ public void annotate(ExceptionWithContext ex) { int limit = stackPtr - 1; @@ -86,7 +86,7 @@ public final class ExecutionStack extends MutabilityControl { * Replaces all the occurrences of the given uninitialized type in * this stack with its initialized equivalent. * - * @param type non-null; type to replace + * @param type {@code non-null;} type to replace */ public void makeInitialized(Type type) { if (stackPtr == 0) { @@ -108,7 +108,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Gets the maximum stack size for this instance. * - * @return >= 0; the max stack size + * @return {@code >= 0;} the max stack size */ public int getMaxStack() { return stack.length; @@ -117,7 +117,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Gets the current stack size. * - * @return >= 0, < getMaxStack(); the current stack size + * @return {@code >= 0, < getMaxStack();} the current stack size */ public int size() { return stackPtr; @@ -139,7 +139,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Pushes a value of the given type onto the stack. * - * @param type non-null; type of the value + * @param type {@code non-null;} type of the value * @throws SimException thrown if there is insufficient room on the * stack for the value */ @@ -171,14 +171,14 @@ public final class ExecutionStack extends MutabilityControl { } /** - * Peeks at the <code>n</code>th element down from the top of the stack. - * <code>n == 0</code> means to peek at the top of the stack. Note that - * this will return <code>null</code> if the indicated element is the + * Peeks at the {@code n}th element down from the top of the stack. + * {@code n == 0} means to peek at the top of the stack. Note that + * this will return {@code null} if the indicated element is the * deeper half of a category-2 value. * - * @param n >= 0; which element to peek at - * @return null-ok; the type of value stored at that element - * @throws SimException thrown if <code>n >= size()</code> + * @param n {@code >= 0;} which element to peek at + * @return {@code null-ok;} the type of value stored at that element + * @throws SimException thrown if {@code n >= size()} */ public TypeBearer peek(int n) { if (n < 0) { @@ -193,10 +193,10 @@ public final class ExecutionStack extends MutabilityControl { } /** - * Peeks at the <code>n</code>th element down from the top of the + * Peeks at the {@code n}th element down from the top of the * stack, returning the type per se, as opposed to the * <i>type-bearer</i>. This method is just a convenient shorthand - * for <code>peek(n).getType()</code>. + * for {@code peek(n).getType()}. * * @see #peek */ @@ -207,7 +207,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Pops the top element off of the stack. * - * @return non-null; the type formerly on the top of the stack + * @return {@code non-null;} the type formerly on the top of the stack * @throws SimException thrown if the stack is empty */ public TypeBearer pop() { @@ -227,10 +227,10 @@ public final class ExecutionStack extends MutabilityControl { * the following restriction on its behavior: You may only replace * values with other values of the same category. * - * @param n >= 0; which element to change, where <code>0</code> is + * @param n {@code >= 0;} which element to change, where {@code 0} is * the top element of the stack - * @param type non-null; type of the new value - * @throws SimException thrown if <code>n >= size()</code> or + * @param type {@code non-null;} type of the new value + * @throws SimException thrown if {@code n >= size()} or * the action is otherwise prohibited */ public void change(int n, TypeBearer type) { @@ -262,8 +262,8 @@ public final class ExecutionStack extends MutabilityControl { * returned. See {@link Merger#mergeStack(ExecutionStack,ExecutionStack) * Merger.mergeStack()} * - * @param other non-null; a stack to merge with - * @return non-null; the result of the merge + * @param other {@code non-null;} a stack to merge with + * @return {@code non-null;} the result of the merge */ public ExecutionStack merge(ExecutionStack other) { try { @@ -279,11 +279,11 @@ public final class ExecutionStack extends MutabilityControl { /** * Gets the string form for a stack element. This is the same as - * <code>toString()</code> except that <code>null</code> is converted - * to <code>"<invalid>"</code>. + * {@code toString()} except that {@code null} is converted + * to {@code "<invalid>"}. * - * @param type null-ok; the stack element - * @return non-null; the string form + * @param type {@code null-ok;} the stack element + * @return {@code non-null;} the string form */ private static String stackElementString(TypeBearer type) { if (type == null) { @@ -296,7 +296,7 @@ public final class ExecutionStack extends MutabilityControl { /** * Throws a properly-formatted exception. * - * @param msg non-null; useful message + * @param msg {@code non-null;} useful message * @return never (keeps compiler happy) */ private static TypeBearer throwSimException(String msg) { diff --git a/dx/src/com/android/dx/cf/code/Frame.java b/dx/src/com/android/dx/cf/code/Frame.java index a74d142ee..f34533530 100644 --- a/dx/src/com/android/dx/cf/code/Frame.java +++ b/dx/src/com/android/dx/cf/code/Frame.java @@ -29,20 +29,20 @@ import com.android.dx.util.IntList; * results" area. */ public final class Frame { - /** non-null; the locals */ + /** {@code non-null;} the locals */ private final LocalsArray locals; - /** non-null; the stack */ + /** {@code non-null;} the stack */ private final ExecutionStack stack; - /** null-ok; stack of labels of subroutines that this block is nested in */ + /** {@code null-ok;} stack of labels of subroutines that this block is nested in */ private final IntList subroutines; /** * Constructs an instance. * - * @param locals non-null; the locals array to use - * @param stack non-null; the execution stack to use + * @param locals {@code non-null;} the locals array to use + * @param stack {@code non-null;} the execution stack to use */ private Frame(LocalsArray locals, ExecutionStack stack) { this(locals, stack, IntList.EMPTY); @@ -51,9 +51,9 @@ public final class Frame { /** * Constructs an instance. * - * @param locals non-null; the locals array to use - * @param stack non-null; the execution stack to use - * @param subroutines non-null; list of subroutine start labels for + * @param locals {@code non-null;} the locals array to use + * @param stack {@code non-null;} the execution stack to use + * @param subroutines {@code non-null;} list of subroutine start labels for * subroutines this frame is nested in */ private Frame(LocalsArray locals, @@ -75,12 +75,12 @@ public final class Frame { /** * Constructs an instance. The locals array initially consists of - * all-uninitialized values (represented as <code>null</code>s) and + * all-uninitialized values (represented as {@code null}s) and * the stack starts out empty. * - * @param maxLocals >= 0; the maximum number of locals this instance + * @param maxLocals {@code >= 0;} the maximum number of locals this instance * can refer to - * @param maxStack >= 0; the maximum size of the stack for this + * @param maxStack {@code >= 0;} the maximum size of the stack for this * instance */ public Frame(int maxLocals, int maxStack) { @@ -92,7 +92,7 @@ public final class Frame { * contains copies of the locals and stack (that is, it doesn't * share them with the original). * - * @return non-null; the copy + * @return {@code non-null;} the copy */ public Frame copy() { return new Frame(locals.copy(), stack.copy(), subroutines); @@ -111,7 +111,7 @@ public final class Frame { * Replaces all the occurrences of the given uninitialized type in * this frame with its initialized equivalent. * - * @param type non-null; type to replace + * @param type {@code non-null;} type to replace */ public void makeInitialized(Type type) { locals.makeInitialized(type); @@ -121,7 +121,7 @@ public final class Frame { /** * Gets the locals array for this instance. * - * @return non-null; the locals array + * @return {@code non-null;} the locals array */ public LocalsArray getLocals() { return locals; @@ -130,7 +130,7 @@ public final class Frame { /** * Gets the execution stack for this instance. * - * @return non-null; the execution stack + * @return {@code non-null;} the execution stack */ public ExecutionStack getStack() { return stack; @@ -143,7 +143,7 @@ public final class Frame { * list is ordered such that the deepest nesting (the actual subroutine * this block is in) is the last label in the list. * - * @return non-null; list as noted above + * @return {@code non-null;} list as noted above */ public IntList getSubroutines() { return subroutines; @@ -171,10 +171,10 @@ public final class Frame { * be used when returning from a subroutine. The stack state of all * subroutine invocations is identical, but the locals state may differ. * - * @param startLabel >=0; The label of the returning subroutine's + * @param startLabel {@code >=0;} The label of the returning subroutine's * start block - * @param subLabel >=0; A calling label of a subroutine - * @return null-ok; an appropriatly-constructed instance, or null + * @param subLabel {@code >=0;} A calling label of a subroutine + * @return {@code null-ok;} an appropriatly-constructed instance, or null * if label is not in the set */ public Frame subFrameForLabel(int startLabel, int subLabel) { @@ -206,8 +206,8 @@ public final class Frame { * Merges two frames. If the merged result is the same as this frame, * then this instance is returned. * - * @param other non-null; another frame - * @return non-null; the result of merging the two frames + * @param other {@code non-null;} another frame + * @return {@code non-null;} the result of merging the two frames */ public Frame mergeWith(Frame other) { LocalsArray resultLocals; @@ -237,7 +237,7 @@ public final class Frame { * * @param otherSubroutines label list of subroutine start blocks, from * least-nested to most-nested. - * @return non-null; merged subroutine nest list as described above + * @return {@code non-null;} merged subroutine nest list as described above */ private IntList mergeSubroutineLists(IntList otherSubroutines) { if (subroutines.equals(otherSubroutines)) { @@ -265,10 +265,10 @@ public final class Frame { * need to be trimmed of all OneLocalsArray elements that relevent to * the subroutine that is returning. * - * @param locals non-null; LocalsArray from before a merge - * @param subroutines non-null; a label list of subroutine start blocks + * @param locals {@code non-null;} LocalsArray from before a merge + * @param subroutines {@code non-null;} a label list of subroutine start blocks * representing the subroutine nesting of the block being merged into. - * @return non-null; locals set appropriate for merge + * @return {@code non-null;} locals set appropriate for merge */ private static LocalsArray adjustLocalsForSubroutines( LocalsArray locals, IntList subroutines) { @@ -301,13 +301,13 @@ public final class Frame { /** * Merges this frame with the frame of a subroutine caller at - * <code>predLabel</code>. Only called on the frame at the first + * {@code predLabel}. Only called on the frame at the first * block of a subroutine. * - * @param other non-null; another frame + * @param other {@code non-null;} another frame * @param subLabel label of subroutine start block * @param predLabel label of calling block - * @return non-null; the result of merging the two frames + * @return {@code non-null;} the result of merging the two frames */ public Frame mergeWithSubroutineCaller(Frame other, int subLabel, int predLabel) { @@ -374,7 +374,7 @@ public final class Frame { * subroutine calls return. * * @param subLabel label of subroutine start block - * @param callerLabel >=0 label of the caller block where this frame + * @param callerLabel {@code >=0;} label of the caller block where this frame * came from. * @return a new instance to begin a called subroutine. */ @@ -406,7 +406,7 @@ public final class Frame { * Annotates (adds context to) the given exception with information * about this frame. * - * @param ex non-null; the exception to annotate + * @param ex {@code non-null;} the exception to annotate */ public void annotate(ExceptionWithContext ex) { locals.annotate(ex); diff --git a/dx/src/com/android/dx/cf/code/LineNumberList.java b/dx/src/com/android/dx/cf/code/LineNumberList.java index 35875b0a7..7af3f4e6b 100644 --- a/dx/src/com/android/dx/cf/code/LineNumberList.java +++ b/dx/src/com/android/dx/cf/code/LineNumberList.java @@ -20,19 +20,19 @@ import com.android.dx.util.FixedSizeList; /** * List of "line number" entries, which are the contents of - * <code>LineNumberTable</code> attributes. + * {@code LineNumberTable} attributes. */ public final class LineNumberList extends FixedSizeList { - /** non-null; zero-size instance */ + /** {@code non-null;} zero-size instance */ public static final LineNumberList EMPTY = new LineNumberList(0); /** * Returns an instance which is the concatenation of the two given * instances. * - * @param list1 non-null; first instance - * @param list2 non-null; second instance - * @return non-null; combined instance + * @param list1 {@code non-null;} first instance + * @param list2 {@code non-null;} second instance + * @return {@code non-null;} combined instance */ public static LineNumberList concat(LineNumberList list1, LineNumberList list2) { @@ -68,8 +68,8 @@ public final class LineNumberList extends FixedSizeList { /** * Gets the indicated item. * - * @param n >= 0; which item - * @return null-ok; the indicated item + * @param n {@code >= 0;} which item + * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); @@ -78,8 +78,8 @@ public final class LineNumberList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which element - * @param item non-null; the item + * @param n {@code >= 0, < size();} which element + * @param item {@code non-null;} the item */ public void set(int n, Item item) { if (item == null) { @@ -92,9 +92,9 @@ public final class LineNumberList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which element - * @param startPc >= 0; start pc of this item - * @param lineNumber >= 0; corresponding line number + * @param n {@code >= 0, < size();} which element + * @param startPc {@code >= 0;} start pc of this item + * @param lineNumber {@code >= 0;} corresponding line number */ public void set(int n, int startPc, int lineNumber) { set0(n, new Item(startPc, lineNumber)); @@ -103,8 +103,8 @@ public final class LineNumberList extends FixedSizeList { /** * Gets the line number associated with the given address. * - * @param pc >= 0; the address to look up - * @return >= -1; the associated line number, or <code>-1</code> if + * @param pc {@code >= 0;} the address to look up + * @return {@code >= -1;} the associated line number, or {@code -1} if * none is known */ public int pcToLine(int pc) { @@ -138,17 +138,17 @@ public final class LineNumberList extends FixedSizeList { * Item in a line number table. */ public static class Item { - /** >= 0; start pc of this item */ + /** {@code >= 0;} start pc of this item */ private final int startPc; - /** >= 0; corresponding line number */ + /** {@code >= 0;} corresponding line number */ private final int lineNumber; /** * Constructs an instance. * - * @param startPc >= 0; start pc of this item - * @param lineNumber >= 0; corresponding line number + * @param startPc {@code >= 0;} start pc of this item + * @param lineNumber {@code >= 0;} corresponding line number */ public Item(int startPc, int lineNumber) { if (startPc < 0) { diff --git a/dx/src/com/android/dx/cf/code/LocalVariableList.java b/dx/src/com/android/dx/cf/code/LocalVariableList.java index 10876036b..8f49a335f 100644 --- a/dx/src/com/android/dx/cf/code/LocalVariableList.java +++ b/dx/src/com/android/dx/cf/code/LocalVariableList.java @@ -23,20 +23,20 @@ import com.android.dx.util.FixedSizeList; /** * List of "local variable" entries, which are the contents of - * <code>LocalVariableTable</code> and <code>LocalVariableTypeTable</code> + * {@code LocalVariableTable} and {@code LocalVariableTypeTable} * attributes, as well as combinations of the two. */ public final class LocalVariableList extends FixedSizeList { - /** non-null; zero-size instance */ + /** {@code non-null;} zero-size instance */ public static final LocalVariableList EMPTY = new LocalVariableList(0); /** * Returns an instance which is the concatenation of the two given * instances. The result is immutable. * - * @param list1 non-null; first instance - * @param list2 non-null; second instance - * @return non-null; combined instance + * @param list1 {@code non-null;} first instance + * @param list2 {@code non-null;} second instance + * @return {@code non-null;} combined instance */ public static LocalVariableList concat(LocalVariableList list1, LocalVariableList list2) { @@ -70,14 +70,13 @@ public final class LocalVariableList extends FixedSizeList { * element in the signature list gets augmented with the * corresponding signature. The result is immutable. * - * @param descriptorList non-null; list with descriptors - * @param signatureList non-null; list with signatures - * @return non-null; the merged result + * @param descriptorList {@code non-null;} list with descriptors + * @param signatureList {@code non-null;} list with signatures + * @return {@code non-null;} the merged result */ public static LocalVariableList mergeDescriptorsAndSignatures( LocalVariableList descriptorList, LocalVariableList signatureList) { - int signatureSize = signatureList.size(); int descriptorSize = descriptorList.size(); LocalVariableList result = new LocalVariableList(descriptorSize); @@ -107,8 +106,8 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the indicated item. * - * @param n >= 0; which item - * @return null-ok; the indicated item + * @param n {@code >= 0;} which item + * @return {@code null-ok;} the indicated item */ public Item get(int n) { return (Item) get0(n); @@ -117,8 +116,8 @@ public final class LocalVariableList extends FixedSizeList { /** * Sets the item at the given index. * - * @param n >= 0, < size(); which element - * @param item non-null; the item + * @param n {@code >= 0, < size();} which element + * @param item {@code non-null;} the item */ public void set(int n, Item item) { if (item == null) { @@ -131,17 +130,17 @@ public final class LocalVariableList extends FixedSizeList { /** * Sets the item at the given index. * - * <p><b>Note:</b> At least one of <code>descriptor</code> or - * <code>signature</code> must be passed as non-null.</p> + * <p><b>Note:</b> At least one of {@code descriptor} or + * {@code signature} must be passed as non-null.</p> * - * @param n >= 0, < size(); which element - * @param startPc >= 0; the start pc of this variable's scope - * @param length >= 0; the length (in bytecodes) of this variable's + * @param n {@code >= 0, < size();} which element + * @param startPc {@code >= 0;} the start pc of this variable's scope + * @param length {@code >= 0;} the length (in bytecodes) of this variable's * scope - * @param name non-null; the variable's name - * @param descriptor null-ok; the variable's type descriptor - * @param signature null-ok; the variable's type signature - * @param index >= 0; the variable's local index + * @param name {@code non-null;} the variable's name + * @param descriptor {@code null-ok;} the variable's type descriptor + * @param signature {@code null-ok;} the variable's type signature + * @param index {@code >= 0;} the variable's local index */ public void set(int n, int startPc, int length, CstUtf8 name, CstUtf8 descriptor, CstUtf8 signature, int index) { @@ -153,9 +152,9 @@ public final class LocalVariableList extends FixedSizeList { * the given {@link com.android.dx.cf.code.LocalVariableList.Item} * in all respects but the type descriptor and signature, if any. * - * @param item non-null; local variable information to match - * @return null-ok; the corresponding local variable information stored - * in this instance, or <code>null</code> if there is no matching + * @param item {@code non-null;} local variable information to match + * @return {@code null-ok;} the corresponding local variable information stored + * in this instance, or {@code null} if there is no matching * information */ public Item itemToLocal(Item item) { @@ -178,10 +177,10 @@ public final class LocalVariableList extends FixedSizeList { * variable's start point is listed as the address of the instruction * <i>just past</i> the one that sets the variable. * - * @param pc >= 0; the address to look up - * @param index >= 0; the local variable index - * @return null-ok; the associated local variable information, or - * <code>null</code> if none is known + * @param pc {@code >= 0;} the address to look up + * @param index {@code >= 0;} the local variable index + * @return {@code null-ok;} the associated local variable information, or + * {@code null} if none is known */ public Item pcAndIndexToLocal(int pc, int index) { int sz = size(); @@ -201,37 +200,37 @@ public final class LocalVariableList extends FixedSizeList { * Item in a local variable table. */ public static class Item { - /** >= 0; the start pc of this variable's scope */ + /** {@code >= 0;} the start pc of this variable's scope */ private final int startPc; - /** >= 0; the length (in bytecodes) of this variable's scope */ + /** {@code >= 0;} the length (in bytecodes) of this variable's scope */ private final int length; - /** non-null; the variable's name */ + /** {@code non-null;} the variable's name */ private final CstUtf8 name; - /** null-ok; the variable's type descriptor */ + /** {@code null-ok;} the variable's type descriptor */ private final CstUtf8 descriptor; - /** null-ok; the variable's type signature */ + /** {@code null-ok;} the variable's type signature */ private final CstUtf8 signature; - /** >= 0; the variable's local index */ + /** {@code >= 0;} the variable's local index */ private final int index; /** * Constructs an instance. * - * <p><b>Note:</b> At least one of <code>descriptor</code> or - * <code>signature</code> must be passed as non-null.</p> + * <p><b>Note:</b> At least one of {@code descriptor} or + * {@code signature} must be passed as non-null.</p> * - * @param startPc >= 0; the start pc of this variable's scope - * @param length >= 0; the length (in bytecodes) of this variable's + * @param startPc {@code >= 0;} the start pc of this variable's scope + * @param length {@code >= 0;} the length (in bytecodes) of this variable's * scope - * @param name non-null; the variable's name - * @param descriptor null-ok; the variable's type descriptor - * @param signature null-ok; the variable's type signature - * @param index >= 0; the variable's local index + * @param name {@code non-null;} the variable's name + * @param descriptor {@code null-ok;} the variable's type descriptor + * @param signature {@code null-ok;} the variable's type signature + * @param index {@code >= 0;} the variable's local index */ public Item(int startPc, int length, CstUtf8 name, CstUtf8 descriptor, CstUtf8 signature, int index) { @@ -267,7 +266,7 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the start pc of this variable's scope. * - * @return >= 0; the start pc of this variable's scope + * @return {@code >= 0;} the start pc of this variable's scope */ public int getStartPc() { return startPc; @@ -276,7 +275,7 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the length (in bytecodes) of this variable's scope. * - * @return >= 0; the length (in bytecodes) of this variable's scope + * @return {@code >= 0;} the length (in bytecodes) of this variable's scope */ public int getLength() { return length; @@ -285,7 +284,7 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the variable's type descriptor. * - * @return null-ok; the variable's type descriptor + * @return {@code null-ok;} the variable's type descriptor */ public CstUtf8 getDescriptor() { return descriptor; @@ -294,7 +293,7 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the variable's LocalItem, a (name, signature) tuple * - * @return null-ok; the variable's type descriptor + * @return {@code null-ok;} the variable's type descriptor */ public LocalItem getLocalItem() { return LocalItem.make(name, signature); @@ -304,7 +303,7 @@ public final class LocalVariableList extends FixedSizeList { * Gets the variable's type signature. Private because if you need this, * you want getLocalItem() instead. * - * @return null-ok; the variable's type signature + * @return {@code null-ok;} the variable's type signature */ private CstUtf8 getSignature() { return signature; @@ -313,7 +312,7 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the variable's local index. * - * @return >= 0; the variable's local index + * @return {@code >= 0;} the variable's local index */ public int getIndex() { return index; @@ -321,9 +320,9 @@ public final class LocalVariableList extends FixedSizeList { /** * Gets the variable's type descriptor. This is a convenient shorthand - * for <code>Type.intern(getDescriptor().getString())</code>. + * for {@code Type.intern(getDescriptor().getString())}. * - * @return non-null; the variable's type + * @return {@code non-null;} the variable's type */ public Type getType() { return Type.intern(descriptor.getString()); @@ -333,8 +332,8 @@ public final class LocalVariableList extends FixedSizeList { * Constructs and returns an instance which is identical to this * one, except that the signature is changed to the given value. * - * @param newSignature non-null; the new signature - * @return non-null; an appropriately-constructed instance + * @param newSignature {@code non-null;} the new signature + * @return {@code non-null;} an appropriately-constructed instance */ public Item withSignature(CstUtf8 newSignature) { return new Item(startPc, length, name, descriptor, newSignature, @@ -345,10 +344,10 @@ public final class LocalVariableList extends FixedSizeList { * Gets whether this instance matches (describes) the given * address and index. * - * @param pc >= 0; the address in question - * @param index >= 0; the local variable index in question - * @return <code>true</code> iff this instance matches <code>pc</code> - * and <code>index</code> + * @param pc {@code >= 0;} the address in question + * @param index {@code >= 0;} the local variable index in question + * @return {@code true} iff this instance matches {@code pc} + * and {@code index} */ public boolean matchesPcAndIndex(int pc, int index) { return (index == this.index) && @@ -361,8 +360,8 @@ public final class LocalVariableList extends FixedSizeList { * other instance exactly in all fields except type descriptor and * type signature. * - * @param other non-null; the instance to compare to - * @return <code>true</code> iff this instance matches + * @param other {@code non-null;} the instance to compare to + * @return {@code true} iff this instance matches */ public boolean matchesAllButType(Item other) { return (startPc == other.startPc) diff --git a/dx/src/com/android/dx/cf/code/LocalsArray.java b/dx/src/com/android/dx/cf/code/LocalsArray.java index 1c324ca07..b2c268980 100644 --- a/dx/src/com/android/dx/cf/code/LocalsArray.java +++ b/dx/src/com/android/dx/cf/code/LocalsArray.java @@ -36,7 +36,7 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { /** * Constructs an instance, explicitly indicating the mutability. * - * @param mutable <code>true</code> if this instance is mutable + * @param mutable {@code true} if this instance is mutable */ protected LocalsArray(boolean mutable) { super(mutable); @@ -45,7 +45,7 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { /** * Makes and returns a mutable copy of this instance. * - * @return non-null; the copy + * @return {@code non-null;} the copy */ public abstract LocalsArray copy(); @@ -53,7 +53,7 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * Annotates (adds context to) the given exception with information * about this instance. * - * @param ex non-null; the exception to annotate + * @param ex {@code non-null;} the exception to annotate */ public abstract void annotate(ExceptionWithContext ex); @@ -61,7 +61,7 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * Replaces all the occurrences of the given uninitialized type in * this array with its initialized equivalent. * - * @param type non-null; type to replace + * @param type {@code non-null;} type to replace */ public abstract void makeInitialized(Type type); @@ -71,16 +71,17 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * @return the max locals */ public abstract int getMaxLocals(); + /** * Sets the type stored at the given local index. If the given type * is category-2, then (a) the index must be at least two less than - * <code>getMaxLocals()</code> and (b) the next index gets invalidated + * {@link #getMaxLocals} and (b) the next index gets invalidated * by the operation. In case of either category, if the <i>previous</i> * local contains a category-2 value, then it too is invalidated by * this operation. * - * @param idx >= 0, < getMaxLocals(); which local - * @param type non-null; new type for the local at <code>idx</code> + * @param idx {@code >= 0, < getMaxLocals();} which local + * @param type {@code non-null;} new type for the local at {@code idx} */ public abstract void set(int idx, TypeBearer type); @@ -88,25 +89,25 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * Sets the type for the local indicated by the given register spec * to that register spec (which includes type and optional name * information). This is identical to calling - * <code>set(spec.getReg(), spec)</code>. + * {@code set(spec.getReg(), spec)}. * - * @param spec non-null; register spec to use as the basis for the update + * @param spec {@code non-null;} register spec to use as the basis for the update */ public abstract void set(RegisterSpec spec); /** * Invalidates the local at the given index. * - * @param idx >= 0, < getMaxLocals(); which local + * @param idx {@code >= 0, < getMaxLocals();} which local */ public abstract void invalidate(int idx); /** - * Gets the type stored at the given local index, or <code>null</code> + * Gets the type stored at the given local index, or {@code null} * if the given local is uninitialized / invalid. * - * @param idx >= 0, < getMaxLocals(); which local - * @return null-ok; the type of value stored in that local + * @param idx {@code >= 0, < getMaxLocals();} which local + * @return {@code null-ok;} the type of value stored in that local */ public abstract TypeBearer getOrNull(int idx); @@ -115,9 +116,9 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * the given local contains a valid type (though it is allowed to * be an uninitialized instance). * - * @param idx >= 0, < getMaxLocals(); which local - * @return non-null; the type of value stored in that local - * @throws SimException thrown if <code>idx</code> is valid, but + * @param idx {@code >= 0, < getMaxLocals();} which local + * @return {@code non-null;} the type of value stored in that local + * @throws SimException thrown if {@code idx} is valid, but * the contents are invalid */ public abstract TypeBearer get(int idx); @@ -126,9 +127,9 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * Gets the type stored at the given local index, which is expected * to be an initialized category-1 value. * - * @param idx >= 0, < getMaxLocals(); which local - * @return non-null; the type of value stored in that local - * @throws SimException thrown if <code>idx</code> is valid, but + * @param idx {@code >= 0, < getMaxLocals();} which local + * @return {@code non-null;} the type of value stored in that local + * @throws SimException thrown if {@code idx} is valid, but * one of the following holds: (a) the local is invalid; (b) the local * contains an uninitialized instance; (c) the local contains a * category-2 value @@ -139,39 +140,39 @@ public abstract class LocalsArray extends MutabilityControl implements ToHuman { * Gets the type stored at the given local index, which is expected * to be a category-2 value. * - * @param idx >= 0, < getMaxLocals(); which local - * @return non-null; the type of value stored in that local - * @throws SimException thrown if <code>idx</code> is valid, but + * @param idx {@code >= 0, < getMaxLocals();} which local + * @return {@code non-null;} the type of value stored in that local + * @throws SimException thrown if {@code idx} is valid, but * one of the following holds: (a) the local is invalid; (b) the local * contains a category-1 value */ public abstract TypeBearer getCategory2(int idx); /** - * Merges this instance with <code>other</code>. If the merged result is + * Merges this instance with {@code other}. If the merged result is * the same as this instance, then this is returned (not a copy). * - * @param other non-null; another LocalsArray - * @return non-null; the merge result, a new instance or this + * @param other {@code non-null;} another LocalsArray + * @return {@code non-null;} the merge result, a new instance or this */ public abstract LocalsArray merge(LocalsArray other); /** - * Merges this instance with a <code>LocalsSet</code> from a subroutine + * Merges this instance with a {@code LocalsSet} from a subroutine * caller. To be used when merging in the first block of a subroutine. * - * @param other other non-null; another LocalsArray. The final locals + * @param other {@code other non-null;} another LocalsArray. The final locals * state of a subroutine caller. * @param predLabel the label of the subroutine caller block. - * @return non-null; the merge result, a new instance or this + * @return {@code non-null;} the merge result, a new instance or this */ public abstract LocalsArraySet mergeWithSubroutineCaller (LocalsArray other, int predLabel); /** * Gets the locals set appropriate for the current execution context. - * That is, if this is a <code>OneLocalsArray</code> instance, then return - * <code>this</code>, otherwise return <code>LocalsArraySet</code>'s + * That is, if this is a {@code OneLocalsArray} instance, then return + * {@code this}, otherwise return {@code LocalsArraySet}'s * primary. * * @return locals for this execution context. diff --git a/dx/src/com/android/dx/cf/code/LocalsArraySet.java b/dx/src/com/android/dx/cf/code/LocalsArraySet.java index 9e24da9b9..fa2acbe30 100644 --- a/dx/src/com/android/dx/cf/code/LocalsArraySet.java +++ b/dx/src/com/android/dx/cf/code/LocalsArraySet.java @@ -51,9 +51,9 @@ public class LocalsArraySet extends LocalsArray { /** * Constructs an instance. The locals array initially consists of - * all-uninitialized values (represented as <code>null</code>s). + * all-uninitialized values (represented as {@code null}s). * - * @param maxLocals >= 0; the maximum number of locals this instance + * @param maxLocals {@code >= 0;} the maximum number of locals this instance * can refer to */ public LocalsArraySet(int maxLocals) { @@ -65,8 +65,8 @@ public class LocalsArraySet extends LocalsArray { /** * Constructs an instance with the specified primary and secondaries set. * - * @param primary non-null; primary locals to use - * @param secondaries non-null; secondaries set, indexed by subroutine + * @param primary {@code non-null;} primary locals to use + * @param secondaries {@code non-null;} secondaries set, indexed by subroutine * caller label. */ public LocalsArraySet(OneLocalsArray primary, @@ -80,7 +80,7 @@ public class LocalsArraySet extends LocalsArray { /** * Constructs an instance which is a copy of another. * - * @param toCopy non-null; instance to copy. + * @param toCopy {@code non-null;} instance to copy. */ private LocalsArraySet(LocalsArraySet toCopy) { super(toCopy.getMaxLocals() > 0); @@ -89,7 +89,7 @@ public class LocalsArraySet extends LocalsArray { secondaries = new ArrayList(toCopy.secondaries.size()); int sz = toCopy.secondaries.size(); - for(int i = 0; i < sz; i++) { + for (int i = 0; i < sz; i++) { LocalsArray la = toCopy.secondaries.get(i); if (la == null) { @@ -106,7 +106,7 @@ public class LocalsArraySet extends LocalsArray { public void setImmutable() { primary.setImmutable(); - for (LocalsArray la: secondaries) { + for (LocalsArray la : secondaries) { if (la != null) { la.setImmutable(); } @@ -127,7 +127,7 @@ public class LocalsArraySet extends LocalsArray { primary.annotate(ex); int sz = secondaries.size(); - for(int label = 0; label < sz; label++) { + for (int label = 0; label < sz; label++) { LocalsArray la = secondaries.get(label); if (la != null) { @@ -149,7 +149,7 @@ public class LocalsArraySet extends LocalsArray { sb.append('\n'); int sz = secondaries.size(); - for(int label = 0; label < sz; label++) { + for (int label = 0; label < sz; label++) { LocalsArray la = secondaries.get(label); if (la != null) { @@ -178,7 +178,7 @@ public class LocalsArraySet extends LocalsArray { primary.makeInitialized(type); - for (LocalsArray la: secondaries) { + for (LocalsArray la : secondaries) { if (la != null) { la.makeInitialized(type); } @@ -198,7 +198,7 @@ public class LocalsArraySet extends LocalsArray { primary.set(idx, type); - for (LocalsArray la: secondaries) { + for (LocalsArray la : secondaries) { if (la != null) { la.set(idx, type); } @@ -218,7 +218,7 @@ public class LocalsArraySet extends LocalsArray { primary.invalidate(idx); - for (LocalsArray la: secondaries) { + for (LocalsArray la : secondaries) { if (la != null) { la.invalidate(idx); } @@ -250,10 +250,10 @@ public class LocalsArraySet extends LocalsArray { } /** - * Merges this set with another <code>LocalsArraySet</code> instance. + * Merges this set with another {@code LocalsArraySet} instance. * - * @param other non-null; to merge - * @return non-null; this instance if merge was a no-op, or + * @param other {@code non-null;} to merge + * @return {@code non-null;} this instance if merge was a no-op, or * new merged instance. */ private LocalsArraySet mergeWithSet(LocalsArraySet other) { @@ -301,10 +301,10 @@ public class LocalsArraySet extends LocalsArray { } /** - * Merges this set with a <code>OneLocalsArray</code> instance. + * Merges this set with a {@code OneLocalsArray} instance. * - * @param other non-null; to merge - * @return non-null; this instance if merge was a no-op, or + * @param other {@code non-null;} to merge + * @return {@code non-null;} this instance if merge was a no-op, or * new merged instance. */ private LocalsArraySet mergeWithOne(OneLocalsArray other) { @@ -365,11 +365,11 @@ public class LocalsArraySet extends LocalsArray { } /** - * Gets the <code>LocalsArray</code> instance for a specified subroutine + * Gets the {@code LocalsArray} instance for a specified subroutine * caller label, or null if label has no locals associated with it. * - * @param label >=0 subroutine caller label - * @return null-ok; locals if available. + * @param label {@code >= 0;} subroutine caller label + * @return {@code null-ok;} locals if available. */ private LocalsArray getSecondaryForLabel(int label) { if (label >= secondaries.size()) { @@ -445,8 +445,8 @@ public class LocalsArraySet extends LocalsArray { * Returns a LocalsArray instance representing the locals state that should * be used when returning to a subroutine caller. * - * @param subLabel >= 0; A calling label of a subroutine - * @return null-ok; an instance for this subroutine, or null if subroutine + * @param subLabel {@code >= 0;} A calling label of a subroutine + * @return {@code null-ok;} an instance for this subroutine, or null if subroutine * is not in this set. */ public LocalsArray subArrayForLabel(int subLabel) { diff --git a/dx/src/com/android/dx/cf/code/Machine.java b/dx/src/com/android/dx/cf/code/Machine.java index 517a10d6a..aff50b2f3 100644 --- a/dx/src/com/android/dx/cf/code/Machine.java +++ b/dx/src/com/android/dx/cf/code/Machine.java @@ -32,9 +32,9 @@ public interface Machine { /** * Gets the effective prototype of the method that this instance is * being used for. The <i>effective</i> prototype includes an initial - * <code>this</code> argument for instance methods. + * {@code this} argument for instance methods. * - * @return non-null; the method prototype + * @return {@code non-null;} the method prototype */ public Prototype getPrototype(); @@ -48,21 +48,21 @@ public interface Machine { * and store them in the arguments area, indicating that there are now * that many arguments. Also, clear the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param count >= 0; number of values to pop + * @param frame {@code non-null;} frame to operate on + * @param count {@code >= 0;} number of values to pop */ public void popArgs(Frame frame, int count); /** * Pops values from the stack of the types indicated by the given - * <code>Prototype</code> (popped in reverse of the argument + * {@code Prototype} (popped in reverse of the argument * order, so the first prototype argument type is for the deepest * element of the stack), and store them in the arguments area, * indicating that there are now that many arguments. Also, clear * the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param prototype non-null; prototype indicating arguments to pop + * @param frame {@code non-null;} frame to operate on + * @param prototype {@code non-null;} prototype indicating arguments to pop */ public void popArgs(Frame frame, Prototype prototype); @@ -71,8 +71,8 @@ public interface Machine { * in the arguments area, indicating that there are now that many * arguments. Also, clear the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param type non-null; type of the argument + * @param frame {@code non-null;} frame to operate on + * @param type {@code non-null;} type of the argument */ public void popArgs(Frame frame, Type type); @@ -83,9 +83,9 @@ public interface Machine { * area, indicating that there are now that many arguments. Also, * clear the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param type1 non-null; type of the first argument - * @param type2 non-null; type of the second argument + * @param frame {@code non-null;} frame to operate on + * @param type1 {@code non-null;} type of the first argument + * @param type2 {@code non-null;} type of the second argument */ public void popArgs(Frame frame, Type type1, Type type2); @@ -96,10 +96,10 @@ public interface Machine { * area, indicating that there are now that many arguments. Also, * clear the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param type1 non-null; type of the first argument - * @param type2 non-null; type of the second argument - * @param type3 non-null; type of the third argument + * @param frame {@code non-null;} frame to operate on + * @param type1 {@code non-null;} type of the first argument + * @param type2 {@code non-null;} type of the second argument + * @param type3 {@code non-null;} type of the third argument */ public void popArgs(Frame frame, Type type1, Type type2, Type type3); @@ -107,8 +107,8 @@ public interface Machine { * Loads the local variable with the given index as the sole argument in * the arguments area. Also, clear the auxiliary arguments. * - * @param frame non-null; frame to operate on - * @param idx >= 0; the local variable index + * @param frame {@code non-null;} frame to operate on + * @param idx {@code >= 0;} the local variable index */ public void localArg(Frame frame, int idx); @@ -116,28 +116,28 @@ public interface Machine { * Indicates that the salient type of this operation is as * given. This differentiates between, for example, the various * arithmetic opcodes, which, by the time they hit a - * <code>Machine</code> are collapsed to the <code>int</code> + * {@code Machine} are collapsed to the {@code int} * variant. (See {@link BytecodeArray#parseInstruction} for * details.) * - * @param type non-null; the salient type of the upcoming operation + * @param type {@code non-null;} the salient type of the upcoming operation */ public void auxType(Type type); /** * Indicates that there is an auxiliary (inline, not stack) - * argument of type <code>int</code>, with the given value. + * argument of type {@code int}, with the given value. * * <p><b>Note:</b> Perhaps unintuitively, the stack manipulation - * ops (e.g., <code>dup</code> and <code>swap</code>) use this to + * ops (e.g., {@code dup} and {@code swap}) use this to * indicate the result stack pattern with a straightforward hex * encoding of the push order starting with least-significant * nibbles getting pushed first). For example, an all-category-1 - * <code>dup2_x1</code> sets this to <code>0x12312</code>, and the + * {@code dup2_x1} sets this to {@code 0x12312}, and the * other form of that op sets this to - * <code>0x121</code>.</p> + * {@code 0x121}.</p> * - * <p><b>Also Note:</b> For <code>switch*</code> instructions, this is + * <p><b>Also Note:</b> For {@code switch*} instructions, this is * used to indicate the padding value (which is only useful for * verification).</p> * @@ -149,10 +149,10 @@ public interface Machine { * Indicates that there is an auxiliary (inline, not stack) object * argument, with the value based on the given constant. * - * <p><b>Note:</b> Some opcodes use both <code>int</code> and + * <p><b>Note:</b> Some opcodes use both {@code int} and * constant auxiliary arguments.</p> * - * @param cst non-null; the constant containing / referencing + * @param cst {@code non-null;} the constant containing / referencing * the value */ public void auxCstArg(Constant cst); @@ -167,12 +167,12 @@ public interface Machine { /** * Indicates that there is an auxiliary (inline, not stack) argument - * consisting of a <code>switch*</code> table. + * consisting of a {@code switch*} table. * * <p><b>Note:</b> This is generally used in conjunction with * {@link #auxIntArg} (which holds the padding).</p> * - * @param cases non-null; the list of key-target pairs, plus the default + * @param cases {@code non-null;} the list of key-target pairs, plus the default * target */ public void auxSwitchArg(SwitchList cases); @@ -181,7 +181,7 @@ public interface Machine { * Indicates that there is an auxiliary (inline, not stack) argument * consisting of a list of initial values for a newly created array. * - * @param initValues non-null; the list of constant values to initialize + * @param initValues {@code non-null;} the list of constant values to initialize * the array */ public void auxInitValues(ArrayList<Constant> initValues); @@ -189,9 +189,9 @@ public interface Machine { /** * Indicates that the target of this operation is the given local. * - * @param idx >= 0; the local variable index - * @param type non-null; the type of the local - * @param local null-ok; the name and signature of the local, if known + * @param idx {@code >= 0;} the local variable index + * @param type {@code non-null;} the type of the local + * @param local {@code null-ok;} the name and signature of the local, if known */ public void localTarget(int idx, Type type, LocalItem local); @@ -199,10 +199,10 @@ public interface Machine { * "Runs" the indicated opcode in an appropriate way, using the arguments * area as appropriate, and modifying the given frame in response. * - * @param frame non-null; frame to operate on - * @param offset >= 0; byte offset in the method to the opcode being + * @param frame {@code non-null;} frame to operate on + * @param offset {@code >= 0;} byte offset in the method to the opcode being * run - * @param opcode >= 0; the opcode to run + * @param opcode {@code >= 0;} the opcode to run */ public void run(Frame frame, int offset, int opcode); } diff --git a/dx/src/com/android/dx/cf/code/Merger.java b/dx/src/com/android/dx/cf/code/Merger.java index adeaab225..8da9a1841 100644 --- a/dx/src/com/android/dx/cf/code/Merger.java +++ b/dx/src/com/android/dx/cf/code/Merger.java @@ -35,9 +35,9 @@ public final class Merger { * Merges two locals arrays. If the merged result is the same as the first * argument, then return the first argument (not a copy). * - * @param locals1 non-null; a locals array - * @param locals2 non-null; another locals array - * @return non-null; the result of merging the two locals arrays + * @param locals1 {@code non-null;} a locals array + * @param locals2 {@code non-null;} another locals array + * @return {@code non-null;} the result of merging the two locals arrays */ public static OneLocalsArray mergeLocals(OneLocalsArray locals1, OneLocalsArray locals2) { @@ -87,9 +87,9 @@ public final class Merger { * Merges two stacks. If the merged result is the same as the first * argument, then return the first argument (not a copy). * - * @param stack1 non-null; a stack - * @param stack2 non-null; another stack - * @return non-null; the result of merging the two stacks + * @param stack1 {@code non-null;} a stack + * @param stack2 {@code non-null;} another stack + * @return {@code non-null;} the result of merging the two stacks */ public static ExecutionStack mergeStack(ExecutionStack stack1, ExecutionStack stack2) { @@ -144,9 +144,9 @@ public final class Merger { /** * Merges two frame types. * - * @param ft1 non-null; a frame type - * @param ft2 non-null; another frame type - * @return non-null; the result of merging the two types + * @param ft1 {@code non-null;} a frame type + * @param ft2 {@code non-null;} another frame type + * @return {@code non-null;} the result of merging the two types */ public static TypeBearer mergeType(TypeBearer ft1, TypeBearer ft2) { if ((ft1 == null) || ft1.equals(ft2)) { @@ -209,12 +209,12 @@ public final class Merger { * the given subtype. This takes into account primitiveness, * int-likeness, known-nullness, and array dimensions, but does * not assume anything about class hierarchy other than that the - * type <code>Object</code> is the supertype of all reference + * type {@code Object} is the supertype of all reference * types and all arrays are assignable to - * <code>Serializable</code> and <code>Cloneable</code>. + * {@code Serializable} and {@code Cloneable}. * - * @param supertypeBearer non-null; the supertype - * @param subtypeBearer non-null; the subtype + * @param supertypeBearer {@code non-null;} the supertype + * @param subtypeBearer {@code non-null;} the subtype */ public static boolean isPossiblyAssignableFrom(TypeBearer supertypeBearer, TypeBearer subtypeBearer) { diff --git a/dx/src/com/android/dx/cf/code/OneLocalsArray.java b/dx/src/com/android/dx/cf/code/OneLocalsArray.java index 3a590a105..cafd177d3 100644 --- a/dx/src/com/android/dx/cf/code/OneLocalsArray.java +++ b/dx/src/com/android/dx/cf/code/OneLocalsArray.java @@ -31,14 +31,14 @@ import com.android.dx.util.MutabilityControl; * com.android.dx.rop.type.TypeBearer}.</p> */ public class OneLocalsArray extends LocalsArray { - /** non-null; actual array */ + /** {@code non-null;} actual array */ private final TypeBearer[] locals; /** * Constructs an instance. The locals array initially consists of - * all-uninitialized values (represented as <code>null</code>s). + * all-uninitialized values (represented as {@code null}s). * - * @param maxLocals >= 0; the maximum number of locals this instance + * @param maxLocals {@code >= 0;} the maximum number of locals this instance * can refer to */ public OneLocalsArray(int maxLocals) { @@ -237,7 +237,7 @@ public class OneLocalsArray extends LocalsArray { * Throws a properly-formatted exception. * * @param idx the salient local index - * @param msg non-null; useful message + * @param msg {@code non-null;} useful message * @return never (keeps compiler happy) */ private static TypeBearer throwSimException(int idx, String msg) { diff --git a/dx/src/com/android/dx/cf/code/ReturnAddress.java b/dx/src/com/android/dx/cf/code/ReturnAddress.java index c69253c95..47c6071ca 100644 --- a/dx/src/com/android/dx/cf/code/ReturnAddress.java +++ b/dx/src/com/android/dx/cf/code/ReturnAddress.java @@ -28,13 +28,13 @@ import com.android.dx.util.Hex; * what instances of this class hang onto. */ public final class ReturnAddress implements TypeBearer { - /** >= 0; the start address of the subroutine being returned from */ + /** {@code >= 0;} the start address of the subroutine being returned from */ private final int subroutineAddress; /** * Constructs an instance. * - * @param subroutineAddress >= 0; the start address of the + * @param subroutineAddress {@code >= 0;} the start address of the * subroutine being returned from */ public ReturnAddress(int subroutineAddress) { @@ -100,7 +100,7 @@ public final class ReturnAddress implements TypeBearer { /** * Gets the subroutine address. * - * @return >= 0; the subroutine address + * @return {@code >= 0;} the subroutine address */ public int getSubroutineAddress() { return subroutineAddress; diff --git a/dx/src/com/android/dx/cf/code/Ropper.java b/dx/src/com/android/dx/cf/code/Ropper.java index f3eecab53..6e8c32893 100644 --- a/dx/src/com/android/dx/cf/code/Ropper.java +++ b/dx/src/com/android/dx/cf/code/Ropper.java @@ -66,10 +66,10 @@ public final class Ropper { /** number of special label offsets */ private static final int SPECIAL_LABEL_COUNT = 7; - /** non-null; method being converted */ + /** {@code non-null;} method being converted */ private final ConcreteMethod method; - /** non-null; original block list */ + /** {@code non-null;} original block list */ private final ByteBlockList blocks; /** max locals of the method */ @@ -78,30 +78,30 @@ public final class Ropper { /** max label (exclusive) of any original bytecode block */ private final int maxLabel; - /** non-null; simulation machine to use */ + /** {@code non-null;} simulation machine to use */ private final RopperMachine machine; - /** non-null; simulator to use */ + /** {@code non-null;} simulator to use */ private final Simulator sim; /** - * non-null; sparse array mapping block labels to initial frame contents, + * {@code non-null;} sparse array mapping block labels to initial frame contents, * if known */ private final Frame[] startFrames; - /** non-null; output block list in-progress */ + /** {@code non-null;} output block list in-progress */ private final ArrayList<BasicBlock> result; /** - * non-null; list of subroutine-nest labels + * {@code non-null;} list of subroutine-nest labels * (See {@link Frame#getSubroutines} associated with each result block. * Parallel to {@link Ropper#result}. */ private final ArrayList<IntList> resultSubroutines; /** - * non-null; for each block (by label) that is used as an exception + * {@code non-null;} for each block (by label) that is used as an exception * handler, the type of exception it catches */ private final Type[] catchTypes; @@ -112,10 +112,10 @@ public final class Ropper { */ private boolean synchNeedsExceptionHandler; - /** non-null; list of subroutines indexed by label of start address */ + /** {@code non-null;} list of subroutines indexed by label of start address */ private final Subroutine subroutines[]; - /** true if <code>subroutines</code> is non-empty */ + /** true if {@code subroutines} is non-empty */ private boolean hasSubroutines; /** @@ -155,7 +155,7 @@ public final class Ropper { } /** - * @return >= 0; the label of the subroutine's start block. + * @return {@code >= 0;} the label of the subroutine's start block. */ int getStartBlock() { return startBlock; @@ -194,13 +194,13 @@ public final class Ropper { IntList successors = new IntList(callerBlocks.size()); /* - * For each subroutine caller, get it's target. If the target is us, - * add the ret target (subroutine successor) to our list + * For each subroutine caller, get it's target. If the + * target is us, add the ret target (subroutine successor) + * to our list */ - for(int label = callerBlocks.nextSetBit(0); label >= 0 - ; label = callerBlocks.nextSetBit(label+1)) { - + for (int label = callerBlocks.nextSetBit(0); label >= 0; + label = callerBlocks.nextSetBit(label+1)) { BasicBlock subCaller = labelToBlock(label); successors.add(subCaller.getSuccessors().get(0)); } @@ -212,18 +212,15 @@ public final class Ropper { /** * Merges the specified frame into this subroutine's successors, - * setting <code>workSet</code> as appropriate. To be called with + * setting {@code workSet} as appropriate. To be called with * the frame of a subroutine ret block. * - * @param frame non-null; frame from ret block to merge - * @param workSet non-null; workset to update + * @param frame {@code non-null;} frame from ret block to merge + * @param workSet {@code non-null;} workset to update */ void mergeToSuccessors(Frame frame, int[] workSet) { - int sz = callerBlocks.size(); - - for(int label = callerBlocks.nextSetBit(0); label >= 0 - ; label = callerBlocks.nextSetBit(label+1)) { - + for (int label = callerBlocks.nextSetBit(0); label >= 0; + label = callerBlocks.nextSetBit(label+1)) { BasicBlock subCaller = labelToBlock(label); int succLabel = subCaller.getSuccessors().get(0); @@ -242,9 +239,9 @@ public final class Ropper { /** * Converts a {@link ConcreteMethod} to a {@link RopMethod}. * - * @param method non-null; method to convert - * @param advice non-null; translation advice to use - * @return non-null; the converted instance + * @param method {@code non-null;} method to convert + * @param advice {@code non-null;} translation advice to use + * @return {@code non-null;} the converted instance */ public static RopMethod convert(ConcreteMethod method, TranslationAdvice advice) { @@ -263,8 +260,8 @@ public final class Ropper { * Constructs an instance. This class is not publicly instantiable; use * {@link #convert}. * - * @param method non-null; method to convert - * @param advice non-null; translation advice to use + * @param method {@code non-null;} method to convert + * @param advice {@code non-null;} translation advice to use */ private Ropper(ConcreteMethod method, TranslationAdvice advice) { if (method == null) { @@ -307,7 +304,7 @@ public final class Ropper { * Gets the first (lowest) register number to use as the temporary * area when unwinding stack manipulation ops. * - * @return >= 0; the first register to use + * @return {@code >= 0;} the first register to use */ /*package*/ int getFirstTempStackReg() { /* @@ -326,8 +323,8 @@ public final class Ropper { * Gets the label for the exception handler setup block corresponding * to the given label. * - * @param label >= 0; the original label - * @return >= 0; the corresponding exception handler setup label + * @param label {@code >= 0;} the original label + * @return {@code >= 0;} the corresponding exception handler setup label */ private int getExceptionSetupLabel(int label) { return maxLabel + label; @@ -337,8 +334,8 @@ public final class Ropper { * Gets the label for the given special-purpose block. The given label * should be one of the static constants defined by this class. * - * @param label < 0; the special label constant - * @return >= 0; the actual label value to use + * @param label {@code < 0;} the special label constant + * @return {@code >= 0;} the actual label value to use */ private int getSpecialLabel(int label) { /* @@ -356,7 +353,7 @@ public final class Ropper { /** * Gets the minimum label for unreserved use. * - * @return >= 0; the minimum label + * @return {@code >= 0;} the minimum label */ private int getMinimumUnreservedLabel() { /* @@ -370,7 +367,7 @@ public final class Ropper { /** * Gets an arbitrary unreserved and available label. * - * @return >= 0; the label + * @return {@code >= 0;} the label */ private int getAvailableLabel() { int candidate = getMinimumUnreservedLabel(); @@ -409,7 +406,7 @@ public final class Ropper { * Gets the total number of registers used for "normal" purposes (i.e., * for the straightforward translation from the original Java). * - * @return >= 0; the total number of registers used + * @return {@code >= 0;} the total number of registers used */ private int getNormalRegCount() { return maxLocals + method.getMaxStack(); @@ -419,7 +416,7 @@ public final class Ropper { * Gets the register spec to use to hold the object to synchronize on, * for a synchronized method. * - * @return non-null; the register spec + * @return {@code non-null;} the register spec */ private RegisterSpec getSynchReg() { /* @@ -433,11 +430,11 @@ public final class Ropper { /** * Searches {@link #result} for a block with the given label. Return its - * index if found, or return <code>-1</code> if there is no such block. + * index if found, or return {@code -1} if there is no such block. * * @param label the label to look for - * @return >= -1; the index for the block with the given label or - * <code>-1</code> if there is no such block + * @return {@code >= -1;} the index for the block with the given label or + * {@code -1} if there is no such block */ private int labelToResultIndex(int label) { int sz = result.size(); @@ -456,7 +453,7 @@ public final class Ropper { * found, or throw an exception if there is no such block. * * @param label the label to look for - * @return non-null; the block with the given label + * @return {@code non-null;} the block with the given label */ private BasicBlock labelToBlock(int label) { int idx = labelToResultIndex(label); @@ -472,8 +469,8 @@ public final class Ropper { /** * Adds a block to the output result. * - * @param block non-null; the block to add - * @param subroutines non-null; subroutine label list as described in + * @param block {@code non-null;} the block to add + * @param subroutines {@code non-null;} subroutine label list as described in * {@link Frame#getSubroutines} */ private void addBlock(BasicBlock block, IntList subroutines) { @@ -491,11 +488,11 @@ public final class Ropper { * replacement, then any extra blocks that got added with the * original get removed as a result of calling this method. * - * @param block non-null; the block to add or replace - * @param subroutines non-null; subroutine label list as described in + * @param block {@code non-null;} the block to add or replace + * @param subroutines {@code non-null;} subroutine label list as described in * {@link Frame#getSubroutines} - * @return <code>true</code> if the block was replaced or - * <code>false</code> if it was added for the first time + * @return {@code true} if the block was replaced or + * {@code false} if it was added for the first time */ private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) { if (block == null) { @@ -529,11 +526,11 @@ public final class Ropper { * Adds or replaces a block in the output result. Do not delete * any successors. * - * @param block non-null; the block to add or replace - * @param subroutines non-null; subroutine label list as described in + * @param block {@code non-null;} the block to add or replace + * @param subroutines {@code non-null;} subroutine label list as described in * {@link Frame#getSubroutines} - * @return <code>true</code> if the block was replaced or - * <code>false</code> if it was added for the first time + * @return {@code true} if the block was replaced or + * {@code false} if it was added for the first time */ private boolean addOrReplaceBlockNoDelete(BasicBlock block, IntList subroutines) { @@ -564,7 +561,7 @@ public final class Ropper { * successors of it whose labels indicate that they are not in the * normally-translated range. * - * @param idx non-null; block to remove (etc.) + * @param idx {@code non-null;} block to remove (etc.) */ private void removeBlockAndSpecialSuccessors(int idx) { int minLabel = getMinimumUnreservedLabel(); @@ -591,7 +588,7 @@ public final class Ropper { /** * Extracts the resulting {@link RopMethod} from the instance. * - * @return non-null; the method object + * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { @@ -663,9 +660,9 @@ public final class Ropper { /** * Processes the given block. * - * @param block non-null; block to process - * @param frame non-null; start frame for the block - * @param workSet non-null; bits representing work to do, which this + * @param block {@code non-null;} block to process + * @param frame {@code non-null;} start frame for the block + * @param workSet {@code non-null;} bits representing work to do, which this * method may add to */ private void processBlock(ByteBlock block, Frame frame, int[] workSet) { @@ -950,14 +947,14 @@ public final class Ropper { * Helper for {@link #processBlock}, which merges frames and * adds to the work set, as necessary. * - * @param label >= 0; label to work on - * @param pred predecessor label. Must be >= 0 when - * <code>label</code> is a subroutine start block and calledSubroutine + * @param label {@code >= 0;} label to work on + * @param pred predecessor label; must be {@code >= 0} when + * {@code label} is a subroutine start block and calledSubroutine * is non-null. Otherwise, may be -1. - * @param calledSubroutine null-ok; a Subroutine instance if - * <code>label</code> is the first block in a subroutine. - * @param frame non-null; new frame for the labelled block - * @param workSet non-null; bits representing work to do, which this + * @param calledSubroutine {@code null-ok;} a Subroutine instance if + * {@code label} is the first block in a subroutine. + * @param frame {@code non-null;} new frame for the labelled block + * @param workSet {@code non-null;} bits representing work to do, which this * method may add to */ private void mergeAndWorkAsNecessary(int label, int pred, @@ -1078,7 +1075,7 @@ public final class Ropper { /** * Constructs and adds the return block, if necessary. The return - * block merely contains an appropriate <code>return</code> + * block merely contains an appropriate {@code return} * instruction. */ private void addReturnBlock() { @@ -1217,7 +1214,7 @@ public final class Ropper { /** * Checks to see if the basic block is a subroutine caller block. * - * @param bb non-null; the basic block in question + * @param bb {@code non-null;} the basic block in question * @return true if this block calls a subroutine */ private boolean isSubroutineCaller(BasicBlock bb) { @@ -1340,7 +1337,7 @@ public final class Ropper { /** * Inlines a subroutine. Start by calling - * <code>inlineSubroutineCalledFrom</code>. + * {@code inlineSubroutineCalledFrom}. */ private class SubroutineInliner { /** @@ -1399,9 +1396,8 @@ public final class Ropper { */ int newSubStartLabel = mapOrAllocateLabel(subroutineStart); - for(int label = workList.nextSetBit(0); label >= 0 - ; label = workList.nextSetBit(0)) { - + for (int label = workList.nextSetBit(0); label >= 0; + label = workList.nextSetBit(0)) { workList.clear(label); int newLabel = origLabelToCopiedLabel.get(label); @@ -1421,7 +1417,8 @@ public final class Ropper { addOrReplaceBlockNoDelete( new BasicBlock(b.getLabel(), b.getInsns(), IntList.makeImmutable (newSubStartLabel), - newSubStartLabel), labelToSubroutines.get(b.getLabel())); + newSubStartLabel), + labelToSubroutines.get(b.getLabel())); } /** @@ -1502,8 +1499,8 @@ public final class Ropper { * Checks to see if a specified label is involved in a specified * subroutine. * - * @param label >=0 a basic block label - * @param subroutineStart >=0 a subroutine as identified by the + * @param label {@code >= 0;} a basic block label + * @param subroutineStart {@code >= 0;} a subroutine as identified by the * label of its start block. * @return true if the block is dominated by the subroutine call. */ @@ -1554,10 +1551,10 @@ public final class Ropper { } /** - * Finds a <code>Subroutine<code> that is returned from by a ret in + * Finds a {@code Subroutine} that is returned from by a ret in * a given block. * @param label A block that originally contained a ret instruction - * @return null-ok; Subroutine or null if none was found. + * @return {@code null-ok;} Subroutine or null if none was found. */ private Subroutine subroutineFromRetBlock(int label) { for (int i = subroutines.length - 1 ; i >= 0 ; i--) { diff --git a/dx/src/com/android/dx/cf/code/RopperMachine.java b/dx/src/com/android/dx/cf/code/RopperMachine.java index 6d05b382e..dd7fcd46b 100644 --- a/dx/src/com/android/dx/cf/code/RopperMachine.java +++ b/dx/src/com/android/dx/cf/code/RopperMachine.java @@ -47,13 +47,13 @@ import java.util.ArrayList; * Machine implementation for use by {@link Ropper}. */ /*package*/ final class RopperMachine extends ValueAwareMachine { - /** non-null; array reflection class */ + /** {@code non-null;} array reflection class */ private static final CstType ARRAY_REFLECT_TYPE = new CstType(Type.internClassName("java/lang/reflect/Array")); /** - * non-null; method constant for use in converting - * <code>multianewarray</code> instructions + * {@code non-null;} method constant for use in converting + * {@code multianewarray} instructions */ private static final CstMethodRef MULTIANEWARRAY_METHOD = new CstMethodRef(ARRAY_REFLECT_TYPE, @@ -61,34 +61,34 @@ import java.util.ArrayList; new CstUtf8("(Ljava/lang/Class;[I)" + "Ljava/lang/Object;"))); - /** non-null; {@link Ropper} controlling this instance */ + /** {@code non-null;} {@link Ropper} controlling this instance */ private final Ropper ropper; - /** non-null; method being converted */ + /** {@code non-null;} method being converted */ private final ConcreteMethod method; - /** non-null; translation advice */ + /** {@code non-null;} translation advice */ private final TranslationAdvice advice; /** max locals of the method */ private final int maxLocals; - /** non-null; instructions for the rop basic block in-progress */ + /** {@code non-null;} instructions for the rop basic block in-progress */ private final ArrayList<Insn> insns; - /** non-null; catches for the block currently being processed */ + /** {@code non-null;} catches for the block currently being processed */ private TypeList catches; /** whether the catches have been used in an instruction */ private boolean catchesUsed; - /** whether the block contains a <code>return</code> */ + /** whether the block contains a {@code return} */ private boolean returns; /** primary successor index */ private int primarySuccessorIndex; - /** >= 0; number of extra basic blocks required */ + /** {@code >= 0;} number of extra basic blocks required */ private int extraBlockCount; /** true if last processed block ends with a jsr or jsr_W*/ @@ -105,13 +105,13 @@ import java.util.ArrayList; private ReturnAddress returnAddress; /** - * null-ok; the appropriate <code>return</code> op or <code>null</code> + * {@code null-ok;} the appropriate {@code return} op or {@code null} * if it is not yet known */ private Rop returnOp; /** - * null-ok; the source position for the return block or <code>null</code> + * {@code null-ok;} the source position for the return block or {@code null} * if it is not yet known */ private SourcePosition returnPosition; @@ -119,9 +119,9 @@ import java.util.ArrayList; /** * Constructs an instance. * - * @param ropper non-null; ropper controlling this instance - * @param method non-null; method being converted - * @param advice non-null; translation advice to use + * @param ropper {@code non-null;} ropper controlling this instance + * @param method {@code non-null;} method being converted + * @param advice {@code non-null;} translation advice to use */ public RopperMachine(Ropper ropper, ConcreteMethod method, TranslationAdvice advice) { @@ -154,7 +154,7 @@ import java.util.ArrayList; * Gets the instructions array. It is shared and gets modified by * subsequent calls to this instance. * - * @return non-null; the instructions array + * @return {@code non-null;} the instructions array */ public ArrayList<Insn> getInsns() { return insns; @@ -163,7 +163,7 @@ import java.util.ArrayList; /** * Gets the return opcode encountered, if any. * - * @return null-ok; the return opcode + * @return {@code null-ok;} the return opcode */ public Rop getReturnOp() { return returnOp; @@ -172,7 +172,7 @@ import java.util.ArrayList; /** * Gets the return position, if known. * - * @return null-ok; the return position + * @return {@code null-ok;} the return position */ public SourcePosition getReturnPosition() { return returnPosition; @@ -182,7 +182,7 @@ import java.util.ArrayList; * Gets ready to start working on a new block. This will clear the * {@link #insns} list, set {@link #catches}, reset whether it has * been used, reset whether the block contains a - * <code>return</code>, and reset {@link #primarySuccessorIndex}. + * {@code return}, and reset {@link #primarySuccessorIndex}. */ public void startBlock(TypeList catches) { this.catches = catches; @@ -201,7 +201,7 @@ import java.util.ArrayList; * Gets whether {@link #catches} was used. This indicates that the * last instruction in the block is one of the ones that can throw. * - * @return whether <code>catches</code> has been used + * @return whether {@code catches} has been used */ public boolean wereCatchesUsed() { return catchesUsed; @@ -209,7 +209,7 @@ import java.util.ArrayList; /** * Gets whether the block just processed ended with a - * <code>return</code>. + * {@code return}. * * @return whether the block returns */ @@ -220,12 +220,12 @@ import java.util.ArrayList; /** * Gets the primary successor index. This is the index into the * successors list where the primary may be found or - * <code>-1</code> if there are successors but no primary + * {@code -1} if there are successors but no primary * successor. This may return something other than - * <code>-1</code> in the case of an instruction with no + * {@code -1} in the case of an instruction with no * successors at all (primary or otherwise). * - * @return >= -1; the primary successor index + * @return {@code >= -1;} the primary successor index */ public int getPrimarySuccessorIndex() { return primarySuccessorIndex; @@ -236,7 +236,7 @@ import java.util.ArrayList; * block currently being translated. Each extra block should consist * of one instruction from the end of the original block. * - * @return >= 0; the number of extra blocks needed + * @return {@code >= 0;} the number of extra blocks needed */ public int getExtraBlockCount() { return extraBlockCount; @@ -259,16 +259,17 @@ import java.util.ArrayList; } /** - * @return true if a RET has ben encountered since the last call to - * startBlock() + * @return {@code true} if a {@code ret} has ben encountered since + * the last call to {@code startBlock()} */ public boolean hasRet() { return returnAddress != null; } /** - * @return null-ok; return address of a ret instruction if encountered - * since last call to startBlock(). null if no ret instruction encountered. + * @return {@code null-ok;} return address of a {@code ret} + * instruction if encountered since last call to startBlock(). + * {@code null} if no ret instruction encountered. */ public ReturnAddress getReturnAddress() { return returnAddress; @@ -444,7 +445,7 @@ import java.util.ArrayList; catches, MULTIANEWARRAY_METHOD); insns.add(insn); - // Add a move-result + // Add a move-result. rop = Rops.opMoveResult(MULTIANEWARRAY_METHOD.getPrototype() .getReturnType()); insn = new PlainInsn(rop, pos, objectReg, RegisterSpecList.EMPTY); @@ -457,7 +458,6 @@ import java.util.ArrayList; opcode = ByteOps.CHECKCAST; sources = RegisterSpecList.make(objectReg); - } else if (opcode == ByteOps.JSR) { // JSR has no Rop instruction hasJsr = true; @@ -474,12 +474,14 @@ import java.util.ArrayList; } ropOpcode = jopToRopOpcode(opcode, cst); - rop = Rops.ropFor(ropOpcode, destType, sources, cst); Insn moveResult = null; if (dest != null && rop.isCallLike()) { - // We're going to want to have a move-result in the next basic block + /* + * We're going to want to have a move-result in the next + * basic block. + */ extraBlockCount++; moveResult = new PlainInsn( @@ -488,8 +490,10 @@ import java.util.ArrayList; dest = null; } else if (dest != null && rop.canThrow()) { - // We're going to want to have a move-result-pseudo - // in the next basic block + /* + * We're going to want to have a move-result-pseudo in the + * next basic block. + */ extraBlockCount++; moveResult = new PlainInsn( @@ -599,11 +603,12 @@ import java.util.ArrayList; } /* - * If initValues is non-null, it means that the parser has seen a group - * of compatible constant initialization bytecodes that are applied to - * the current newarray. The action we take here is to convert these - * initialization bytecodes into a single fill-array-data ROP which lays - * out all the constant values in a table. + * If initValues is non-null, it means that the parser has + * seen a group of compatible constant initialization + * bytecodes that are applied to the current newarray. The + * action we take here is to convert these initialization + * bytecodes into a single fill-array-data ROP which lays out + * all the constant values in a table. */ if (initValues != null) { extraBlockCount++; @@ -619,9 +624,9 @@ import java.util.ArrayList; * instruction. * * @param opcode the opcode being translated - * @param stackPointer >= 0; the stack pointer after the instruction's - * arguments have been popped - * @return non-null; the sources + * @param stackPointer {@code >= 0;} the stack pointer after the + * instruction's arguments have been popped + * @return {@code non-null;} the sources */ private RegisterSpecList getSources(int opcode, int stackPointer) { int count = argCount(); @@ -692,8 +697,8 @@ import java.util.ArrayList; /** * Sets or updates the information about the return block. * - * @param op non-null; the opcode to use - * @param pos non-null; the position to use + * @param op {@code non-null;} the opcode to use + * @param pos {@code non-null;} the position to use */ private void updateReturnOp(Rop op, SourcePosition pos) { if (op == null) { @@ -723,9 +728,9 @@ import java.util.ArrayList; /** * Gets the register opcode for the given Java opcode. * - * @param jop >= 0; the Java opcode - * @param cst null-ok; the constant argument, if any - * @return >= 0; the corresponding register opcode + * @param jop {@code >= 0;} the Java opcode + * @param cst {@code null-ok;} the constant argument, if any + * @return {@code >= 0;} the corresponding register opcode */ private int jopToRopOpcode(int jop, Constant cst) { switch (jop) { diff --git a/dx/src/com/android/dx/cf/code/Simulator.java b/dx/src/com/android/dx/cf/code/Simulator.java index 3c90ee593..408e1261d 100644 --- a/dx/src/com/android/dx/cf/code/Simulator.java +++ b/dx/src/com/android/dx/cf/code/Simulator.java @@ -35,34 +35,37 @@ import java.util.ArrayList; /** * Class which knows how to simulate the effects of executing bytecode. - * + * * <p><b>Note:</b> This class is not thread-safe. If multiple threads * need to use a single instance, they must synchronize access explicitly * between themselves.</p> */ public class Simulator { - /** non-null; canned error message for local variable table mismatches */ - private static final String LOCAL_MISMATCH_ERROR = + /** + * {@code non-null;} canned error message for local variable + * table mismatches + */ + private static final String LOCAL_MISMATCH_ERROR = "This is symptomatic of .class transformation tools that ignore " + "local variable information."; - /** non-null; machine to use when simulating */ + /** {@code non-null;} machine to use when simulating */ private final Machine machine; - /** non-null; array of bytecode */ + /** {@code non-null;} array of bytecode */ private final BytecodeArray code; - /** non-null; local variable information */ + /** {@code non-null;} local variable information */ private final LocalVariableList localVariables; - /** non-null; visitor instance to use */ + /** {@code non-null;} visitor instance to use */ private final SimVisitor visitor; /** * Constructs an instance. * - * @param machine non-null; machine to use when simulating - * @param method non-null; method data to use + * @param machine {@code non-null;} machine to use when simulating + * @param method {@code non-null;} method data to use */ public Simulator(Machine machine, ConcreteMethod method) { if (machine == null) { @@ -83,8 +86,8 @@ public class Simulator { * Simulates the effect of executing the given basic block. This modifies * the passed-in frame to represent the end result. * - * @param bb non-null; the basic block - * @param frame non-null; frame to operate on + * @param bb {@code non-null;} the basic block + * @param frame {@code non-null;} frame to operate on */ public void simulate(ByteBlock bb, Frame frame) { int end = bb.getEnd(); @@ -107,8 +110,8 @@ public class Simulator { * Simulates the effect of the instruction at the given offset, by * making appropriate calls on the given frame. * - * @param offset >= 0; offset of the instruction to simulate - * @param frame non-null; frame to operate on + * @param offset {@code >= 0;} offset of the instruction to simulate + * @param frame {@code non-null;} frame to operate on * @return the length of the instruction, in bytes */ public int simulate(int offset, Frame frame) { @@ -130,13 +133,13 @@ public class Simulator { */ private class SimVisitor implements BytecodeArray.Visitor { /** - * non-null; machine instance to use (just to avoid excessive - * cross-object field access) + * {@code non-null;} machine instance to use (just to avoid excessive + * cross-object field access) */ private final Machine machine; /** - * null-ok; frame to use; set with each call to + * {@code null-ok;} frame to use; set with each call to * {@link Simulator#simulate} */ private Frame frame; @@ -155,7 +158,7 @@ public class Simulator { /** * Sets the frame to act on. * - * @param frame non-null; the frame + * @param frame {@code non-null;} the frame */ public void setFrame(Frame frame) { if (frame == null) { @@ -255,25 +258,21 @@ public class Simulator { /* * Change the type (which is to be pushed) to * reflect the actual component type of the array - * being popped. + * being popped, unless it turns out to be a + * known-null, in which case we just use the type + * implied by the original instruction. */ - Type requireType = type.getArrayType(); - type = frame.getStack().peekType(1); - if (type == Type.KNOWN_NULL) { - /* - * The type is a known-null: Just treat the - * popped type as whatever is expected. In - * reality, unless this frame is revisited - * (due to a branch merge), execution will - * result in the throwing of a - * NullPointerException, but claiming the - * expected type at here should be good enough - * for the purposes at this level. - */ - type = requireType; + Type foundArrayType = frame.getStack().peekType(1); + Type requireArrayType; + + if (foundArrayType != Type.KNOWN_NULL) { + requireArrayType = foundArrayType; + type = foundArrayType.getComponentType(); + } else { + requireArrayType = type.getArrayType(); } - type = type.getComponentType(); - machine.popArgs(frame, requireType, Type.INT); + + machine.popArgs(frame, requireArrayType, Type.INT); break; } case ByteOps.IADD: @@ -292,7 +291,7 @@ public class Simulator { case ByteOps.IUSHR: { machine.popArgs(frame, type, Type.INT); break; - } + } case ByteOps.LCMP: { machine.popArgs(frame, Type.LONG, Type.LONG); break; @@ -308,8 +307,28 @@ public class Simulator { break; } case ByteOps.IASTORE: { - Type arrayType = type.getArrayType(); - machine.popArgs(frame, arrayType, Type.INT, type); + /* + * Change the type (which is the type of the + * element) to reflect the actual component type + * of the array being popped, unless it turns out + * to be a known-null, in which case we just use + * the type implied by the original instruction. + * The category 1 vs. 2 thing here is that, if the + * element type is category 2, we have to skip over + * one extra stack slot to find the array. + */ + Type foundArrayType = + frame.getStack().peekType(type.isCategory1() ? 2 : 3); + Type requireArrayType; + + if (foundArrayType != Type.KNOWN_NULL) { + requireArrayType = foundArrayType; + type = foundArrayType.getComponentType(); + } else { + requireArrayType = type.getArrayType(); + } + + machine.popArgs(frame, requireArrayType, Type.INT, type); break; } case ByteOps.POP2: @@ -456,7 +475,7 @@ public class Simulator { * Checks whether the prototype is compatible with returning the * given type, and throws if not. * - * @param encountered non-null; the encountered return type + * @param encountered {@code non-null;} the encountered return type */ private void checkReturnType(Type encountered) { Type returnType = machine.getPrototype().getReturnType(); diff --git a/dx/src/com/android/dx/cf/code/SwitchList.java b/dx/src/com/android/dx/cf/code/SwitchList.java index dc04137fb..fdd159614 100644 --- a/dx/src/com/android/dx/cf/code/SwitchList.java +++ b/dx/src/com/android/dx/cf/code/SwitchList.java @@ -21,15 +21,15 @@ import com.android.dx.util.MutabilityControl; /** * List of (value, target) mappings representing the choices of a - * <code>tableswitch</code> or <code>lookupswitch</code> instruction. It + * {@code tableswitch} or {@code lookupswitch} instruction. It * also holds the default target for the switch. */ public final class SwitchList extends MutabilityControl { - /** non-null; list of test values */ + /** {@code non-null;} list of test values */ private final IntList values; /** - * non-null; list of targets corresponding to the test values; there + * {@code non-null;} list of targets corresponding to the test values; there * is always one extra element in the target list, to hold the * default target */ @@ -41,7 +41,7 @@ public final class SwitchList extends MutabilityControl { /** * Constructs an instance. * - * @param size >= 0; the number of elements to be in the table + * @param size {@code >= 0;} the number of elements to be in the table */ public SwitchList(int size) { super(true); @@ -61,7 +61,7 @@ public final class SwitchList extends MutabilityControl { /** * Gets the size of the list. * - * @return >= 0; the list size + * @return {@code >= 0;} the list size */ public int size() { return size; @@ -70,7 +70,7 @@ public final class SwitchList extends MutabilityControl { /** * Gets the indicated test value. * - * @param n >= 0;, < size(); which index + * @param n {@code >= 0;}, < size(); which index * @return the test value */ public int getValue(int n) { @@ -78,11 +78,11 @@ public final class SwitchList extends MutabilityControl { } /** - * Gets the indicated target. Asking for the target at <code>size()</code> + * Gets the indicated target. Asking for the target at {@code size()} * returns the default target. * - * @param n >= 0, <= size(); which index - * @return >= 0; the target + * @param n {@code >= 0, <= size();} which index + * @return {@code >= 0;} the target */ public int getTarget(int n) { return targets.get(n); @@ -90,9 +90,9 @@ public final class SwitchList extends MutabilityControl { /** * Gets the default target. This is just a shorthand for - * <code>getTarget(size())</code>. + * {@code getTarget(size())}. * - * @return >= 0; the default target + * @return {@code >= 0;} the default target */ public int getDefaultTarget() { return targets.get(size); @@ -102,7 +102,7 @@ public final class SwitchList extends MutabilityControl { * Gets the list of all targets. This includes one extra element at the * end of the list, which holds the default target. * - * @return non-null; the target list + * @return {@code non-null;} the target list */ public IntList getTargets() { return targets; @@ -111,7 +111,7 @@ public final class SwitchList extends MutabilityControl { /** * Gets the list of all case values. * - * @return non-null; the case value list + * @return {@code non-null;} the case value list */ public IntList getValues() { return values; @@ -121,7 +121,7 @@ public final class SwitchList extends MutabilityControl { * Sets the default target. It is only valid to call this method * when all the non-default elements have been set. * - * @param target >= 0; the absolute (not relative) default target + * @param target {@code >= 0;} the absolute (not relative) default target * address */ public void setDefaultTarget(int target) { @@ -142,7 +142,7 @@ public final class SwitchList extends MutabilityControl { * Adds the given item. * * @param value the test value - * @param target >= 0; the absolute (not relative) target address + * @param target {@code >= 0;} the absolute (not relative) target address */ public void add(int value, int target) { throwIfImmutable(); diff --git a/dx/src/com/android/dx/cf/code/ValueAwareMachine.java b/dx/src/com/android/dx/cf/code/ValueAwareMachine.java index 4062c3b94..43aab8a67 100644 --- a/dx/src/com/android/dx/cf/code/ValueAwareMachine.java +++ b/dx/src/com/android/dx/cf/code/ValueAwareMachine.java @@ -30,7 +30,8 @@ public class ValueAwareMachine extends BaseMachine { /** * Constructs an instance. * - * @param prototype non-null; the prototype for the associated method + * @param prototype {@code non-null;} the prototype for the associated + * method */ public ValueAwareMachine(Prototype prototype) { super(prototype); diff --git a/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java b/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java index 953981c90..7cd9c9be4 100644 --- a/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java +++ b/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java @@ -41,29 +41,29 @@ import static com.android.dx.cf.cst.ConstantTags.*; * Parser for a constant pool embedded in a class file. */ public final class ConstantPoolParser { - /** non-null; the bytes of the constant pool */ + /** {@code non-null;} the bytes of the constant pool */ private final ByteArray bytes; - /** non-null; actual parsed constant pool contents */ + /** {@code non-null;} actual parsed constant pool contents */ private final StdConstantPool pool; - /** non-null; byte offsets to each cst */ + /** {@code non-null;} byte offsets to each cst */ private final int[] offsets; /** * -1 || >= 10; the end offset of this constant pool in the - * <code>byte[]</code> which it came from or <code>-1</code> if not + * {@code byte[]} which it came from or {@code -1} if not * yet parsed */ private int endOffset; - /** null-ok; parse observer, if any */ + /** {@code null-ok;} parse observer, if any */ private ParseObserver observer; /** * Constructs an instance. * - * @param bytes non-null; the bytes of the file + * @param bytes {@code non-null;} the bytes of the file */ public ConstantPoolParser(ByteArray bytes) { int size = bytes.getUnsignedShort(8); // constant_pool_count @@ -77,17 +77,17 @@ public final class ConstantPoolParser { /** * Sets the parse observer for this instance. * - * @param observer null-ok; the observer + * @param observer {@code null-ok;} the observer */ public void setObserver(ParseObserver observer) { this.observer = observer; } /** - * Gets the end offset of this constant pool in the <code>byte[]</code> + * Gets the end offset of this constant pool in the {@code byte[]} * which it came from. * - * @return >= 10; the end offset + * @return {@code >= 10;} the end offset */ public int getEndOffset() { parseIfNecessary(); @@ -97,7 +97,7 @@ public final class ConstantPoolParser { /** * Gets the actual constant pool. * - * @return non-null; the constant pool + * @return {@code non-null;} the constant pool */ public StdConstantPool getPool() { parseIfNecessary(); @@ -215,7 +215,7 @@ public final class ConstantPoolParser { * depends on. * * @param idx which constant - * @return non-null; the parsed constant + * @return {@code non-null;} the parsed constant */ private Constant parse0(int idx) { Constant cst = pool.getOrNull(idx); @@ -316,7 +316,7 @@ public final class ConstantPoolParser { * Parses a utf8 constant. * * @param at offset to the start of the constant (where the tag byte is) - * @return non-null; the parsed value + * @return {@code non-null;} the parsed value */ private CstUtf8 parseUtf8(int at) { int length = bytes.getUnsignedShort(at + 1); diff --git a/dx/src/com/android/dx/cf/cst/ConstantTags.java b/dx/src/com/android/dx/cf/cst/ConstantTags.java index 64bc8d874..9febbdf5e 100644 --- a/dx/src/com/android/dx/cf/cst/ConstantTags.java +++ b/dx/src/com/android/dx/cf/cst/ConstantTags.java @@ -20,36 +20,36 @@ package com.android.dx.cf.cst; * Tags for constant pool constants. */ public interface ConstantTags { - /** tag for a <code>CONSTANT_Utf8_info</code> */ + /** tag for a {@code CONSTANT_Utf8_info} */ int CONSTANT_Utf8 = 1; - /** tag for a <code>CONSTANT_Integer_info</code> */ + /** tag for a {@code CONSTANT_Integer_info} */ int CONSTANT_Integer = 3; - /** tag for a <code>CONSTANT_Float_info</code> */ + /** tag for a {@code CONSTANT_Float_info} */ int CONSTANT_Float = 4; - /** tag for a <code>CONSTANT_Long_info</code> */ + /** tag for a {@code CONSTANT_Long_info} */ int CONSTANT_Long = 5; - /** tag for a <code>CONSTANT_Double_info</code> */ + /** tag for a {@code CONSTANT_Double_info} */ int CONSTANT_Double = 6; - /** tag for a <code>CONSTANT_Class_info</code> */ + /** tag for a {@code CONSTANT_Class_info} */ int CONSTANT_Class = 7; - /** tag for a <code>CONSTANT_String_info</code> */ + /** tag for a {@code CONSTANT_String_info} */ int CONSTANT_String = 8; - /** tag for a <code>CONSTANT_Fieldref_info</code> */ + /** tag for a {@code CONSTANT_Fieldref_info} */ int CONSTANT_Fieldref = 9; - /** tag for a <code>CONSTANT_Methodref_info</code> */ + /** tag for a {@code CONSTANT_Methodref_info} */ int CONSTANT_Methodref = 10; - /** tag for a <code>CONSTANT_InterfaceMethodref_info</code> */ + /** tag for a {@code CONSTANT_InterfaceMethodref_info} */ int CONSTANT_InterfaceMethodref = 11; - /** tag for a <code>CONSTANT_NameAndType_info</code> */ + /** tag for a {@code CONSTANT_NameAndType_info} */ int CONSTANT_NameAndType = 12; } diff --git a/dx/src/com/android/dx/cf/direct/AnnotationParser.java b/dx/src/com/android/dx/cf/direct/AnnotationParser.java index 5d800869b..88e4cd289 100644 --- a/dx/src/com/android/dx/cf/direct/AnnotationParser.java +++ b/dx/src/com/android/dx/cf/direct/AnnotationParser.java @@ -51,23 +51,23 @@ import java.io.IOException; * Parser for annotations. */ public final class AnnotationParser { - /** non-null; class file being parsed */ + /** {@code non-null;} class file being parsed */ private final DirectClassFile cf; - /** non-null; constant pool to use */ + /** {@code non-null;} constant pool to use */ private final ConstantPool pool; - /** non-null; bytes of the attribute data */ + /** {@code non-null;} bytes of the attribute data */ private final ByteArray bytes; - /** null-ok; parse observer, if any */ + /** {@code null-ok;} parse observer, if any */ private final ParseObserver observer; - /** non-null; input stream to parse from */ + /** {@code non-null;} input stream to parse from */ private final ByteArray.MyDataInputStream input; /** - * non-null; cursor for use when informing the observer of what + * {@code non-null;} cursor for use when informing the observer of what * was parsed */ private int parseCursor; @@ -75,10 +75,10 @@ public final class AnnotationParser { /** * Constructs an instance. * - * @param cf non-null; class file to parse from - * @param offset >= 0; offset into the class file data to parse at - * @param length >= 0; number of bytes left in the attribute data - * @param observer null-ok; parse observer to notify, if any + * @param cf {@code non-null;} class file to parse from + * @param offset {@code >= 0;} offset into the class file data to parse at + * @param length {@code >= 0;} number of bytes left in the attribute data + * @param observer {@code null-ok;} parse observer to notify, if any */ public AnnotationParser(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -95,9 +95,9 @@ public final class AnnotationParser { } /** - * Parses an annotation value (<code>element_value</code>) attribute. + * Parses an annotation value ({@code element_value}) attribute. * - * @return non-null; the parsed constant value + * @return {@code non-null;} the parsed constant value */ public Constant parseValueAttribute() { Constant result; @@ -119,8 +119,8 @@ public final class AnnotationParser { /** * Parses a parameter annotation attribute. * - * @param visibility non-null; visibility of the parsed annotations - * @return non-null; the parsed list of lists of annotations + * @param visibility {@code non-null;} visibility of the parsed annotations + * @return {@code non-null;} the parsed list of lists of annotations */ public AnnotationsList parseParameterAttribute( AnnotationVisibility visibility) { @@ -143,8 +143,8 @@ public final class AnnotationParser { /** * Parses an annotation attribute, per se. * - * @param visibility non-null; visibility of the parsed annotations - * @return non-null; the list of annotations read from the attribute + * @param visibility {@code non-null;} visibility of the parsed annotations + * @return {@code non-null;} the list of annotations read from the attribute * data */ public Annotations parseAnnotationAttribute( @@ -168,8 +168,8 @@ public final class AnnotationParser { /** * Parses a list of annotation lists. * - * @param visibility non-null; visibility of the parsed annotations - * @return non-null; the list of annotation lists read from the attribute + * @param visibility {@code non-null;} visibility of the parsed annotations + * @return {@code non-null;} the list of annotation lists read from the attribute * data */ private AnnotationsList parseAnnotationsList( @@ -203,8 +203,8 @@ public final class AnnotationParser { /** * Parses an annotation list. * - * @param visibility non-null; visibility of the parsed annotations - * @return non-null; the list of annotations read from the attribute + * @param visibility {@code non-null;} visibility of the parsed annotations + * @return {@code non-null;} the list of annotations read from the attribute * data */ private Annotations parseAnnotations(AnnotationVisibility visibility) @@ -238,8 +238,8 @@ public final class AnnotationParser { /** * Parses a single annotation. * - * @param visibility non-null; visibility of the parsed annotation - * @return non-null; the parsed annotation + * @param visibility {@code non-null;} visibility of the parsed annotation + * @return {@code non-null;} the parsed annotation */ private Annotation parseAnnotation(AnnotationVisibility visibility) throws IOException { @@ -278,7 +278,7 @@ public final class AnnotationParser { /** * Parses a {@link NameValuePair}. * - * @return non-null; the parsed element + * @return {@code non-null;} the parsed element */ private NameValuePair parseElement() throws IOException { requireLength(5); @@ -304,7 +304,7 @@ public final class AnnotationParser { /** * Parses an annotation value. * - * @return non-null; the parsed value + * @return {@code non-null;} the parsed value */ private Constant parseValue() throws IOException { int tag = input.readUnsignedByte(); @@ -421,7 +421,7 @@ public final class AnnotationParser { * Helper for {@link #parseValue}, which parses a constant reference * and returns the referred-to constant value. * - * @return non-null; the parsed value + * @return {@code non-null;} the parsed value */ private Constant parseConstant() throws IOException { int constValueIndex = input.readUnsignedShort(); @@ -454,8 +454,8 @@ public final class AnnotationParser { * only be used (for efficiency sake) if the parse is known to be * observed. * - * @param length >= 0; number of bytes parsed - * @param message non-null; associated message + * @param length {@code >= 0;} number of bytes parsed + * @param message {@code non-null;} associated message */ private void parsed(int length, String message) { observer.parsed(bytes, parseCursor, length, message); @@ -464,7 +464,7 @@ public final class AnnotationParser { /** * Convenience wrapper that simply calls through to - * <code>observer.changeIndent()</code>. + * {@code observer.changeIndent()}. * * @param indent the amount to change the indent by */ diff --git a/dx/src/com/android/dx/cf/direct/AttributeFactory.java b/dx/src/com/android/dx/cf/direct/AttributeFactory.java index 420d74175..d00a85961 100644 --- a/dx/src/com/android/dx/cf/direct/AttributeFactory.java +++ b/dx/src/com/android/dx/cf/direct/AttributeFactory.java @@ -58,13 +58,13 @@ public class AttributeFactory { * the name, and then does all the setup to call on to {@link #parse0}, * which does the actual construction. * - * @param cf non-null; class file to parse from - * @param context context to parse in; one of the <code>CTX_*</code> + * @param cf {@code non-null;} class file to parse from + * @param context context to parse in; one of the {@code CTX_*} * constants - * @param offset offset into <code>dcf</code>'s <code>bytes</code> + * @param offset offset into {@code dcf}'s {@code bytes} * to start parsing at - * @param observer null-ok; parse observer to report to, if any - * @return non-null; an appropriately-constructed {@link Attribute} + * @param observer {@code null-ok;} parse observer to report to, if any + * @return {@code non-null;} an appropriately-constructed {@link Attribute} */ public final Attribute parse(DirectClassFile cf, int context, int offset, ParseObserver observer) { @@ -108,15 +108,15 @@ public class AttributeFactory { * an instance of {@link RawAttribute}. Subclasses are expected to * override this to do something better in most cases. * - * @param cf non-null; class file to parse from - * @param context context to parse in; one of the <code>CTX_*</code> + * @param cf {@code non-null;} class file to parse from + * @param context context to parse in; one of the {@code CTX_*} * constants - * @param name non-null; the attribute name - * @param offset offset into <code>bytes</code> to start parsing at; this + * @param name {@code non-null;} the attribute name + * @param offset offset into {@code bytes} to start parsing at; this * is the offset to the start of attribute data, not to the header * @param length the length of the attribute data - * @param observer null-ok; parse observer to report to, if any - * @return non-null; an appropriately-constructed {@link Attribute} + * @param observer {@code null-ok;} parse observer to report to, if any + * @return {@code non-null;} an appropriately-constructed {@link Attribute} */ protected Attribute parse0(DirectClassFile cf, int context, String name, int offset, int length, diff --git a/dx/src/com/android/dx/cf/direct/AttributeListParser.java b/dx/src/com/android/dx/cf/direct/AttributeListParser.java index 765226565..2715e6a94 100644 --- a/dx/src/com/android/dx/cf/direct/AttributeListParser.java +++ b/dx/src/com/android/dx/cf/direct/AttributeListParser.java @@ -27,7 +27,7 @@ import com.android.dx.util.Hex; * Parser for lists of attributes. */ final /*package*/ class AttributeListParser { - /** non-null; the class file to parse from */ + /** {@code non-null;} the class file to parse from */ private final DirectClassFile cf; /** attribute parsing context */ @@ -36,26 +36,26 @@ final /*package*/ class AttributeListParser { /** offset in the byte array of the classfile to the start of the list */ private final int offset; - /** non-null; attribute factory to use */ + /** {@code non-null;} attribute factory to use */ private final AttributeFactory attributeFactory; - /** non-null; list of parsed attributes */ + /** {@code non-null;} list of parsed attributes */ private final StdAttributeList list; - /** >= -1; the end offset of this list in the byte array of the - * classfile, or <code>-1</code> if not yet parsed */ + /** {@code >= -1;} the end offset of this list in the byte array of the + * classfile, or {@code -1} if not yet parsed */ private int endOffset; - /** null-ok; parse observer, if any */ + /** {@code null-ok;} parse observer, if any */ private ParseObserver observer; /** * Constructs an instance. * - * @param cf non-null; class file to parse from + * @param cf {@code non-null;} class file to parse from * @param context attribute parsing context (see {@link AttributeFactory}) - * @param offset offset in <code>bytes</code> to the start of the list - * @param attributeFactory non-null; attribute factory to use + * @param offset offset in {@code bytes} to the start of the list + * @param attributeFactory {@code non-null;} attribute factory to use */ public AttributeListParser(DirectClassFile cf, int context, int offset, AttributeFactory attributeFactory) { @@ -80,17 +80,17 @@ final /*package*/ class AttributeListParser { /** * Sets the parse observer for this instance. * - * @param observer null-ok; the observer + * @param observer {@code null-ok;} the observer */ public void setObserver(ParseObserver observer) { this.observer = observer; } /** - * Gets the end offset of this constant pool in the <code>byte[]</code> + * Gets the end offset of this constant pool in the {@code byte[]} * which it came from. * - * @return >= 0; the end offset + * @return {@code >= 0;} the end offset */ public int getEndOffset() { parseIfNecessary(); @@ -100,7 +100,7 @@ final /*package*/ class AttributeListParser { /** * Gets the parsed list. * - * @return non-null; the list + * @return {@code non-null;} the list */ public StdAttributeList getList() { parseIfNecessary(); diff --git a/dx/src/com/android/dx/cf/direct/ClassPathOpener.java b/dx/src/com/android/dx/cf/direct/ClassPathOpener.java index d30234990..927e9bd68 100644 --- a/dx/src/com/android/dx/cf/direct/ClassPathOpener.java +++ b/dx/src/com/android/dx/cf/direct/ClassPathOpener.java @@ -36,9 +36,9 @@ import java.util.Collections; */ public class ClassPathOpener { - /** non-null; pathname to start with */ + /** {@code non-null;} pathname to start with */ private final String pathname; - /** non-null; callback interface */ + /** {@code non-null;} callback interface */ private final Consumer consumer; /** * If true, sort such that classes appear before their inner @@ -48,20 +48,20 @@ public class ClassPathOpener { private final boolean sort; /** - * Callback interface for <code>ClassOpener</code>. + * Callback interface for {@code ClassOpener}. */ public interface Consumer { /** * Provides the file name and byte array for a class path element. * - * @param name non-null; filename of element. May not be a valid + * @param name {@code non-null;} filename of element. May not be a valid * filesystem path. * - * @param bytes non-null; file data + * @param bytes {@code non-null;} file data * @return true on success. Result is or'd with all other results - * from <code>processFileBytes</code> and returned to the caller - * of <code>process()</code>. + * from {@code processFileBytes} and returned to the caller + * of {@code process()}. */ boolean processFileBytes(String name, byte[] bytes); @@ -69,14 +69,14 @@ public class ClassPathOpener { * Informs consumer that an exception occurred while processing * this path element. Processing will continue if possible. * - * @param ex non-null; exception + * @param ex {@code non-null;} exception */ void onException(Exception ex); /** * Informs consumer that processing of an archive file has begun. * - * @param file non-null; archive file being processed + * @param file {@code non-null;} archive file being processed */ void onProcessArchiveStart(File file); } @@ -84,11 +84,11 @@ public class ClassPathOpener { /** * Constructs an instance. * - * @param pathname non-null; path element to process + * @param pathname {@code non-null;} path element to process * @param sort if true, sort such that classes appear before their inner * classes and "package-info" occurs before all other classes in that * package. - * @param consumer non-null; callback interface + * @param consumer {@code non-null;} callback interface */ public ClassPathOpener(String pathname, boolean sort, Consumer consumer) { this.pathname = pathname; @@ -100,7 +100,7 @@ public class ClassPathOpener { * Processes a path element. * * @return the OR of all return values - * from <code>Consumer.processFileBytes()</code>. + * from {@code Consumer.processFileBytes()}. */ public boolean process() { File file = new File(pathname); @@ -111,7 +111,7 @@ public class ClassPathOpener { /** * Processes one file. * - * @param file non-null; the file to process + * @param file {@code non-null;} the file to process * @param topLevel whether this is a top-level file (that is, * specified directly on the commandline) * @return whether any processing actually happened @@ -142,9 +142,9 @@ public class ClassPathOpener { * Sorts java class names such that outer classes preceed their inner * classes and "package-info" preceeds all other classes in its package. * - * @param a non-null; first class name - * @param b non-null; second class name - * @return <code>compareTo()</code>-style result + * @param a {@code non-null;} first class name + * @param b {@code non-null;} second class name + * @return {@code compareTo()}-style result */ private static int compareClassNames(String a, String b) { // Ensure inner classes sort second @@ -164,7 +164,7 @@ public class ClassPathOpener { /** * Processes a directory recursively. * - * @param dir non-null; file representing the directory + * @param dir {@code non-null;} file representing the directory * @param topLevel whether this is a top-level directory (that is, * specified directly on the commandline) * @return whether any processing actually happened @@ -194,10 +194,10 @@ public class ClassPathOpener { } /** - * Processes the contents of an archive (<code>.zip</code>, - * <code>.jar</code>, or <code>.apk</code>). + * Processes the contents of an archive ({@code .zip}, + * {@code .jar}, or {@code .apk}). * - * @param file non-null; archive file to process + * @param file {@code non-null;} archive file to process * @return whether any processing actually happened * @throws IOException on i/o problem */ @@ -220,8 +220,7 @@ public class ClassPathOpener { consumer.onProcessArchiveStart(file); - for (ZipEntry one: entriesList) { - + for (ZipEntry one : entriesList) { if (one.isDirectory()) { continue; } diff --git a/dx/src/com/android/dx/cf/direct/CodeObserver.java b/dx/src/com/android/dx/cf/direct/CodeObserver.java index 950147fdb..952f1bc5e 100644 --- a/dx/src/com/android/dx/cf/direct/CodeObserver.java +++ b/dx/src/com/android/dx/cf/direct/CodeObserver.java @@ -39,17 +39,17 @@ import java.util.ArrayList; * Bytecode visitor to use when "observing" bytecode getting parsed. */ public class CodeObserver implements BytecodeArray.Visitor { - /** non-null; actual array of bytecode */ + /** {@code non-null;} actual array of bytecode */ private final ByteArray bytes; - /** non-null; observer to inform of parsing */ + /** {@code non-null;} observer to inform of parsing */ private final ParseObserver observer; /** * Constructs an instance. * - * @param bytes non-null; actual array of bytecode - * @param observer non-null; observer to inform of parsing + * @param bytes {@code non-null;} actual array of bytecode + * @param observer {@code non-null;} observer to inform of parsing */ public CodeObserver(ByteArray bytes, ParseObserver observer) { if (bytes == null) { @@ -218,8 +218,8 @@ public class CodeObserver implements BytecodeArray.Visitor { } /** - * Helper for {code #visitConstant} where the constant is an - * <code>int</code>. + * Helper for {@link #visitConstant} where the constant is an + * {@code int}. * * @param opcode the opcode * @param offset offset to the instruction @@ -245,8 +245,8 @@ public class CodeObserver implements BytecodeArray.Visitor { } /** - * Helper for {code #visitConstant} where the constant is a - * <code>long</code>. + * Helper for {@link #visitConstant} where the constant is a + * {@code long}. * * @param opcode the opcode * @param offset offset to the instruction @@ -269,8 +269,8 @@ public class CodeObserver implements BytecodeArray.Visitor { } /** - * Helper for {code #visitConstant} where the constant is a - * <code>float</code>. + * Helper for {@link #visitConstant} where the constant is a + * {@code float}. * * @param opcode the opcode * @param offset offset to the instruction @@ -287,8 +287,8 @@ public class CodeObserver implements BytecodeArray.Visitor { } /** - * Helper for {code #visitConstant} where the constant is a - * <code>double</code>. + * Helper for {@link #visitConstant} where the constant is a + * {@code double}. * * @param opcode the opcode * @param offset offset to the instruction diff --git a/dx/src/com/android/dx/cf/direct/DirectClassFile.java b/dx/src/com/android/dx/cf/direct/DirectClassFile.java index e4751a4cc..ac227fadb 100644 --- a/dx/src/com/android/dx/cf/direct/DirectClassFile.java +++ b/dx/src/com/android/dx/cf/direct/DirectClassFile.java @@ -38,14 +38,14 @@ import com.android.dx.util.ByteArray; import com.android.dx.util.Hex; /** - * Class file with info taken from a <code>byte[]</code> or slice thereof. + * Class file with info taken from a {@code byte[]} or slice thereof. */ public class DirectClassFile implements ClassFile { /** the expected value of the ClassFile.magic field */ private static final int CLASS_FILE_MAGIC = 0xcafebabe; /** - * minimum <code>.class</code> file major version + * minimum {@code .class} file major version * * The class file definition (vmspec/2nd-edition) says: * @@ -64,92 +64,92 @@ public class DirectClassFile implements ClassFile { */ private static final int CLASS_FILE_MIN_MAJOR_VERSION = 45; - /** maximum <code>.class</code> file major version */ + /** maximum {@code .class} file major version */ private static final int CLASS_FILE_MAX_MAJOR_VERSION = 50; - /** maximum <code>.class</code> file minor version */ + /** maximum {@code .class} file minor version */ private static final int CLASS_FILE_MAX_MINOR_VERSION = 0; /** - * non-null; the file path for the class, excluding any base directory + * {@code non-null;} the file path for the class, excluding any base directory * specification */ private final String filePath; - /** non-null; the bytes of the file */ + /** {@code non-null;} the bytes of the file */ private final ByteArray bytes; /** * whether to be strict about parsing; if - * <code>false</code>, this avoids doing checks that only exist + * {@code false}, this avoids doing checks that only exist * for purposes of verification (such as magic number matching and * path-package consistency checking) */ private final boolean strictParse; /** - * null-ok; the constant pool; only ever <code>null</code> + * {@code null-ok;} the constant pool; only ever {@code null} * before the constant pool is successfully parsed */ private StdConstantPool pool; /** - * the class file field <code>access_flags</code>; will be <code>-1</code> + * the class file field {@code access_flags}; will be {@code -1} * before the file is successfully parsed */ private int accessFlags; /** - * null-ok; the class file field <code>this_class</code>, - * interpreted as a type constant; only ever <code>null</code> + * {@code null-ok;} the class file field {@code this_class}, + * interpreted as a type constant; only ever {@code null} * before the file is successfully parsed */ private CstType thisClass; /** - * null-ok; the class file field <code>super_class</code>, interpreted + * {@code null-ok;} the class file field {@code super_class}, interpreted * as a type constant if non-zero */ private CstType superClass; /** - * null-ok; the class file field <code>interfaces</code>; only - * ever <code>null</code> before the file is successfully + * {@code null-ok;} the class file field {@code interfaces}; only + * ever {@code null} before the file is successfully * parsed */ private TypeList interfaces; /** - * null-ok; the class file field <code>fields</code>; only ever - * <code>null</code> before the file is successfully parsed + * {@code null-ok;} the class file field {@code fields}; only ever + * {@code null} before the file is successfully parsed */ private FieldList fields; /** - * null-ok; the class file field <code>methods</code>; only ever - * <code>null</code> before the file is successfully parsed + * {@code null-ok;} the class file field {@code methods}; only ever + * {@code null} before the file is successfully parsed */ private MethodList methods; /** - * null-ok; the class file field <code>attributes</code>; only - * ever <code>null</code> before the file is successfully + * {@code null-ok;} the class file field {@code attributes}; only + * ever {@code null} before the file is successfully * parsed */ private StdAttributeList attributes; - /** null-ok; attribute factory, if any */ + /** {@code null-ok;} attribute factory, if any */ private AttributeFactory attributeFactory; - /** null-ok; parse observer, if any */ + /** {@code null-ok;} parse observer, if any */ private ParseObserver observer; /** - * Returns the string form of an object or <code>"(none)"</code> - * (rather than <code>"null"</code>) for <code>null</code>. + * Returns the string form of an object or {@code "(none)"} + * (rather than {@code "null"}) for {@code null}. * - * @param obj null-ok; the object to stringify - * @return non-null; the appropriate string form + * @param obj {@code null-ok;} the object to stringify + * @return {@code non-null;} the appropriate string form */ public static String stringOrNone(Object obj) { if (obj == null) { @@ -162,11 +162,11 @@ public class DirectClassFile implements ClassFile { /** * Constructs an instance. * - * @param bytes non-null; the bytes of the file - * @param filePath non-null; the file path for the class, + * @param bytes {@code non-null;} the bytes of the file + * @param filePath {@code non-null;} the file path for the class, * excluding any base directory specification * @param strictParse whether to be strict about parsing; if - * <code>false</code>, this avoids doing checks that only exist + * {@code false}, this avoids doing checks that only exist * for purposes of verification (such as magic number matching and * path-package consistency checking) */ @@ -189,11 +189,11 @@ public class DirectClassFile implements ClassFile { /** * Constructs an instance. * - * @param bytes non-null; the bytes of the file - * @param filePath non-null; the file path for the class, + * @param bytes {@code non-null;} the bytes of the file + * @param filePath {@code non-null;} the file path for the class, * excluding any base directory specification * @param strictParse whether to be strict about parsing; if - * <code>false</code>, this avoids doing checks that only exist + * {@code false}, this avoids doing checks that only exist * for purposes of verification (such as magic number matching and * path-package consistency checking) */ @@ -205,7 +205,7 @@ public class DirectClassFile implements ClassFile { /** * Sets the parse observer for this instance. * - * @param observer null-ok; the observer + * @param observer {@code null-ok;} the observer */ public void setObserver(ParseObserver observer) { this.observer = observer; @@ -214,7 +214,7 @@ public class DirectClassFile implements ClassFile { /** * Sets the attribute factory to use. * - * @param attributeFactory non-null; the attribute factory + * @param attributeFactory {@code non-null;} the attribute factory */ public void setAttributeFactory(AttributeFactory attributeFactory) { if (attributeFactory == null) { @@ -227,7 +227,7 @@ public class DirectClassFile implements ClassFile { /** * Gets the {@link ByteArray} that this instance's data comes from. * - * @return non-null; the bytes + * @return {@code non-null;} the bytes */ public ByteArray getBytes() { return bytes; @@ -317,12 +317,12 @@ public class DirectClassFile implements ClassFile { * list of constant pool indices for classes, which are in turn * translated to type constants. Instance construction will fail * if any of the (alleged) indices turn out not to refer to - * constant pool entries of type <code>Class</code>. + * constant pool entries of type {@code Class}. * * @param offset offset into {@link #bytes} for the start of the * data * @param size number of elements in the list (not number of bytes) - * @return non-null; an appropriately-constructed class list + * @return {@code non-null;} an appropriately-constructed class list */ public TypeList makeTypeList(int offset, int size) { if (size == 0) { @@ -337,7 +337,7 @@ public class DirectClassFile implements ClassFile { } /** - * Gets the class file field <code>magic</code>, but without doing any + * Gets the class file field {@code magic}, but without doing any * checks or parsing first. * * @return the magic value @@ -347,7 +347,7 @@ public class DirectClassFile implements ClassFile { } /** - * Gets the class file field <code>minor_version</code>, but + * Gets the class file field {@code minor_version}, but * without doing any checks or parsing first. * * @return the minor version @@ -357,7 +357,7 @@ public class DirectClassFile implements ClassFile { } /** - * Gets the class file field <code>major_version</code>, but + * Gets the class file field {@code major_version}, but * without doing any checks or parsing first. * * @return the major version @@ -554,27 +554,27 @@ public class DirectClassFile implements ClassFile { * which are in turn returned as type constants. Instance * construction will fail if any of the (alleged) indices turn out * not to refer to constant pool entries of type - * <code>Class</code>. + * {@code Class}. */ private static class DcfTypeList implements TypeList { - /** non-null; array containing the data */ + /** {@code non-null;} array containing the data */ private final ByteArray bytes; /** number of elements in the list (not number of bytes) */ private final int size; - /** non-null; the constant pool */ + /** {@code non-null;} the constant pool */ private final StdConstantPool pool; /** * Constructs an instance. * - * @param bytes non-null; original classfile's bytes + * @param bytes {@code non-null;} original classfile's bytes * @param offset offset into {@link #bytes} for the start of the * data * @param size number of elements in the list (not number of bytes) - * @param pool non-null; the constant pool to use - * @param observer null-ok; parse observer to use, if any + * @param pool {@code non-null;} the constant pool to use + * @param observer {@code null-ok;} parse observer to use, if any */ public DcfTypeList(ByteArray bytes, int offset, int size, StdConstantPool pool, ParseObserver observer) { diff --git a/dx/src/com/android/dx/cf/direct/FieldListParser.java b/dx/src/com/android/dx/cf/direct/FieldListParser.java index 06dcc4127..24ba7e0e3 100644 --- a/dx/src/com/android/dx/cf/direct/FieldListParser.java +++ b/dx/src/com/android/dx/cf/direct/FieldListParser.java @@ -28,16 +28,16 @@ import com.android.dx.rop.cst.CstType; * Parser for lists of fields in a class file. */ final /*package*/ class FieldListParser extends MemberListParser { - /** non-null; list in progress */ + /** {@code non-null;} list in progress */ private final StdFieldList fields; /** * Constructs an instance. * - * @param cf non-null; the class file to parse from - * @param definer non-null; class being defined - * @param offset offset in <code>bytes</code> to the start of the list - * @param attributeFactory non-null; attribute factory to use + * @param cf {@code non-null;} the class file to parse from + * @param definer {@code non-null;} class being defined + * @param offset offset in {@code bytes} to the start of the list + * @param attributeFactory {@code non-null;} attribute factory to use */ public FieldListParser(DirectClassFile cf, CstType definer, int offset, AttributeFactory attributeFactory) { @@ -48,7 +48,7 @@ final /*package*/ class FieldListParser extends MemberListParser { /** * Gets the parsed list. * - * @return non-null; the parsed list + * @return {@code non-null;} the parsed list */ public StdFieldList getList() { parseIfNecessary(); diff --git a/dx/src/com/android/dx/cf/direct/MemberListParser.java b/dx/src/com/android/dx/cf/direct/MemberListParser.java index 3c0bfa837..a0023c658 100644 --- a/dx/src/com/android/dx/cf/direct/MemberListParser.java +++ b/dx/src/com/android/dx/cf/direct/MemberListParser.java @@ -32,32 +32,32 @@ import com.android.dx.util.Hex; * Parser for lists of class file members (that is, fields and methods). */ abstract /*package*/ class MemberListParser { - /** non-null; the class file to parse from */ + /** {@code non-null;} the class file to parse from */ private final DirectClassFile cf; - /** non-null; class being defined */ + /** {@code non-null;} class being defined */ private final CstType definer; /** offset in the byte array of the classfile to the start of the list */ private final int offset; - /** non-null; attribute factory to use */ + /** {@code non-null;} attribute factory to use */ private final AttributeFactory attributeFactory; - /** >= -1; the end offset of this list in the byte array of the - * classfile, or <code>-1</code> if not yet parsed */ + /** {@code >= -1;} the end offset of this list in the byte array of the + * classfile, or {@code -1} if not yet parsed */ private int endOffset; - /** null-ok; parse observer, if any */ + /** {@code null-ok;} parse observer, if any */ private ParseObserver observer; /** * Constructs an instance. * - * @param cf non-null; the class file to parse from - * @param definer non-null; class being defined - * @param offset offset in <code>bytes</code> to the start of the list - * @param attributeFactory non-null; attribute factory to use + * @param cf {@code non-null;} the class file to parse from + * @param definer {@code non-null;} class being defined + * @param offset offset in {@code bytes} to the start of the list + * @param attributeFactory {@code non-null;} attribute factory to use */ public MemberListParser(DirectClassFile cf, CstType definer, int offset, AttributeFactory attributeFactory) { @@ -81,10 +81,10 @@ abstract /*package*/ class MemberListParser { } /** - * Gets the end offset of this constant pool in the <code>byte[]</code> + * Gets the end offset of this constant pool in the {@code byte[]} * which it came from. * - * @return >= 0; the end offset + * @return {@code >= 0;} the end offset */ public int getEndOffset() { parseIfNecessary(); @@ -94,7 +94,7 @@ abstract /*package*/ class MemberListParser { /** * Sets the parse observer for this instance. * - * @param observer null-ok; the observer + * @param observer {@code null-ok;} the observer */ public final void setObserver(ParseObserver observer) { this.observer = observer; @@ -122,7 +122,7 @@ abstract /*package*/ class MemberListParser { /** * Gets the class file being defined. * - * @return non-null; the class + * @return {@code non-null;} the class */ protected final CstType getDefiner() { return definer; @@ -132,7 +132,7 @@ abstract /*package*/ class MemberListParser { * Gets the human-oriented name for what this instance is parsing. * Subclasses must override this method. * - * @return non-null; the human oriented name + * @return {@code non-null;} the human oriented name */ protected abstract String humanName(); @@ -141,15 +141,15 @@ abstract /*package*/ class MemberListParser { * Subclasses must override this method. * * @param accessFlags the flags - * @return non-null; the string form + * @return {@code non-null;} the string form */ protected abstract String humanAccessFlags(int accessFlags); /** - * Gets the <code>CTX_*</code> constant to use when parsing attributes. + * Gets the {@code CTX_*} constant to use when parsing attributes. * Subclasses must override this method. * - * @return non-null; the human oriented name + * @return {@code non-null;} the human oriented name */ protected abstract int getAttributeContext(); @@ -157,11 +157,11 @@ abstract /*package*/ class MemberListParser { * Sets an element in the list. Subclasses must override this method. * * @param n which element - * @param accessFlags the <code>access_flags</code> + * @param accessFlags the {@code access_flags} * @param nat the interpreted name and type (based on the two - * <code>*_index</code> fields) + * {@code *_index} fields) * @param attributes list of parsed attributes - * @return non-null; the constructed member + * @return {@code non-null;} the constructed member */ protected abstract Member set(int n, int accessFlags, CstNat nat, AttributeList attributes); diff --git a/dx/src/com/android/dx/cf/direct/MethodListParser.java b/dx/src/com/android/dx/cf/direct/MethodListParser.java index 9ca8ba6b8..6ab1abaad 100644 --- a/dx/src/com/android/dx/cf/direct/MethodListParser.java +++ b/dx/src/com/android/dx/cf/direct/MethodListParser.java @@ -28,16 +28,16 @@ import com.android.dx.rop.cst.CstType; * Parser for lists of methods in a class file. */ final /*package*/ class MethodListParser extends MemberListParser { - /** non-null; list in progress */ + /** {@code non-null;} list in progress */ final private StdMethodList methods; /** * Constructs an instance. * - * @param cf non-null; the class file to parse from - * @param definer non-null; class being defined - * @param offset offset in <code>bytes</code> to the start of the list - * @param attributeFactory non-null; attribute factory to use + * @param cf {@code non-null;} the class file to parse from + * @param definer {@code non-null;} class being defined + * @param offset offset in {@code bytes} to the start of the list + * @param attributeFactory {@code non-null;} attribute factory to use */ public MethodListParser(DirectClassFile cf, CstType definer, int offset, AttributeFactory attributeFactory) { @@ -48,7 +48,7 @@ final /*package*/ class MethodListParser extends MemberListParser { /** * Gets the parsed list. * - * @return non-null; the parsed list + * @return {@code non-null;} the parsed list */ public StdMethodList getList() { parseIfNecessary(); diff --git a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java index ab0e2f7fd..da12a4e5a 100644 --- a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java +++ b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java @@ -65,7 +65,7 @@ import java.io.IOException; */ public class StdAttributeFactory extends AttributeFactory { - /** non-null; shared instance of this class */ + /** {@code non-null;} shared instance of this class */ public static final StdAttributeFactory THE_ONE = new StdAttributeFactory(); @@ -191,7 +191,7 @@ public class StdAttributeFactory } /** - * Parses an <code>AnnotationDefault</code> attribute. + * Parses an {@code AnnotationDefault} attribute. */ private Attribute annotationDefault(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -207,7 +207,7 @@ public class StdAttributeFactory } /** - * Parses a <code>Code</code> attribute. + * Parses a {@code Code} attribute. */ private Attribute code(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -311,7 +311,7 @@ public class StdAttributeFactory } /** - * Parses a <code>ConstantValue</code> attribute. + * Parses a {@code ConstantValue} attribute. */ private Attribute constantValue(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -333,7 +333,7 @@ public class StdAttributeFactory } /** - * Parses a <code>Deprecated</code> attribute. + * Parses a {@code Deprecated} attribute. */ private Attribute deprecated(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -345,7 +345,7 @@ public class StdAttributeFactory } /** - * Parses an <code>EnclosingMethod</code> attribute. + * Parses an {@code EnclosingMethod} attribute. */ private Attribute enclosingMethod(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -374,7 +374,7 @@ public class StdAttributeFactory } /** - * Parses an <code>Exceptions</code> attribute. + * Parses an {@code Exceptions} attribute. */ private Attribute exceptions(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -402,7 +402,7 @@ public class StdAttributeFactory } /** - * Parses an <code>InnerClasses</code> attribute. + * Parses an {@code InnerClasses} attribute. */ private Attribute innerClasses(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -459,7 +459,7 @@ public class StdAttributeFactory } /** - * Parses a <code>LineNumberTable</code> attribute. + * Parses a {@code LineNumberTable} attribute. */ private Attribute lineNumberTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -500,7 +500,7 @@ public class StdAttributeFactory } /** - * Parses a <code>LocalVariableTable</code> attribute. + * Parses a {@code LocalVariableTable} attribute. */ private Attribute localVariableTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -523,7 +523,7 @@ public class StdAttributeFactory } /** - * Parses a <code>LocalVariableTypeTable</code> attribute. + * Parses a {@code LocalVariableTypeTable} attribute. */ private Attribute localVariableTypeTable(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -546,15 +546,15 @@ public class StdAttributeFactory } /** - * Parse the table part of either a <code>LocalVariableTable</code> - * or a <code>LocalVariableTypeTable</code>. + * Parse the table part of either a {@code LocalVariableTable} + * or a {@code LocalVariableTypeTable}. * - * @param bytes non-null; bytes to parse, which should <i>only</i> + * @param bytes {@code non-null;} bytes to parse, which should <i>only</i> * contain the table data (no header) - * @param pool non-null; constant pool to use - * @param count >= 0; the number of entries - * @param typeTable <code>true</code> iff this is for a type table - * @return non-null; the constructed list + * @param pool {@code non-null;} constant pool to use + * @param count {@code >= 0;} the number of entries + * @param typeTable {@code true} iff this is for a type table + * @return {@code non-null;} the constructed list */ private LocalVariableList parseLocalVariables(ByteArray bytes, ConstantPool pool, ParseObserver observer, int count, @@ -604,7 +604,7 @@ public class StdAttributeFactory } /** - * Parses a <code>RuntimeInvisibleAnnotations</code> attribute. + * Parses a {@code RuntimeInvisibleAnnotations} attribute. */ private Attribute runtimeInvisibleAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -621,7 +621,7 @@ public class StdAttributeFactory } /** - * Parses a <code>RuntimeVisibleAnnotations</code> attribute. + * Parses a {@code RuntimeVisibleAnnotations} attribute. */ private Attribute runtimeVisibleAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -638,7 +638,7 @@ public class StdAttributeFactory } /** - * Parses a <code>RuntimeInvisibleParameterAnnotations</code> attribute. + * Parses a {@code RuntimeInvisibleParameterAnnotations} attribute. */ private Attribute runtimeInvisibleParameterAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -655,7 +655,7 @@ public class StdAttributeFactory } /** - * Parses a <code>RuntimeVisibleParameterAnnotations</code> attribute. + * Parses a {@code RuntimeVisibleParameterAnnotations} attribute. */ private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -672,7 +672,7 @@ public class StdAttributeFactory } /** - * Parses a <code>Signature</code> attribute. + * Parses a {@code Signature} attribute. */ private Attribute signature(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -694,7 +694,7 @@ public class StdAttributeFactory } /** - * Parses a <code>SourceFile</code> attribute. + * Parses a {@code SourceFile} attribute. */ private Attribute sourceFile(DirectClassFile cf, int offset, int length, ParseObserver observer) { @@ -716,7 +716,7 @@ public class StdAttributeFactory } /** - * Parses a <code>Synthetic</code> attribute. + * Parses a {@code Synthetic} attribute. */ private Attribute synthetic(DirectClassFile cf, int offset, int length, ParseObserver observer) { diff --git a/dx/src/com/android/dx/cf/iface/Attribute.java b/dx/src/com/android/dx/cf/iface/Attribute.java index f28f51e24..b075251db 100644 --- a/dx/src/com/android/dx/cf/iface/Attribute.java +++ b/dx/src/com/android/dx/cf/iface/Attribute.java @@ -23,16 +23,16 @@ public interface Attribute { /** * Get the name of the attribute. * - * @return non-null; the name + * @return {@code non-null;} the name */ public String getName(); /** * Get the total length of the attribute in bytes, including the * header. Since the header is always six bytes, the result of - * this method is always at least <code>6</code>. + * this method is always at least {@code 6}. * - * @return >= 6; the total length, in bytes + * @return {@code >= 6;} the total length, in bytes */ public int byteLength(); } diff --git a/dx/src/com/android/dx/cf/iface/AttributeList.java b/dx/src/com/android/dx/cf/iface/AttributeList.java index a72965abd..f7a1d2705 100644 --- a/dx/src/com/android/dx/cf/iface/AttributeList.java +++ b/dx/src/com/android/dx/cf/iface/AttributeList.java @@ -22,11 +22,11 @@ package com.android.dx.cf.iface; public interface AttributeList { /** * Get whether this instance is mutable. Note that the - * <code>AttributeList</code> interface itself doesn't provide any means + * {@code AttributeList} interface itself doesn't provide any means * of mutation, but that doesn't mean that there isn't a non-interface * way of mutating an instance. * - * @return <code>true</code> iff this instance is somehow mutable + * @return {@code true} iff this instance is somehow mutable */ public boolean isMutable(); @@ -38,28 +38,28 @@ public interface AttributeList { public int size(); /** - * Get the <code>n</code>th attribute. + * Get the {@code n}th attribute. * - * @param n <code>n >= 0, n < size()</code>; which attribute - * @return non-null; the attribute in question + * @param n {@code n >= 0, n < size();} which attribute + * @return {@code non-null;} the attribute in question */ public Attribute get(int n); /** * Get the total length of this list in bytes, when part of a * class file. The returned value includes the two bytes for the - * <code>attributes_count</code> length indicator. + * {@code attributes_count} length indicator. * - * @return >= 2; the total length, in bytes + * @return {@code >= 2;} the total length, in bytes */ public int byteLength(); /** * Get the first attribute in the list with the given name, if any. * - * @param name non-null; attribute name - * @return null-ok; first attribute in the list with the given name, - * or <code>null</code> if there is none + * @param name {@code non-null;} attribute name + * @return {@code null-ok;} first attribute in the list with the given name, + * or {@code null} if there is none */ public Attribute findFirst(String name); @@ -67,9 +67,9 @@ public interface AttributeList { * Get the next attribute in the list after the given one, with the same * name, if any. * - * @param attrib non-null; attribute to start looking after - * @return null-ok; next attribute after <code>attrib</code> with the - * same name as <code>attrib</code> + * @param attrib {@code non-null;} attribute to start looking after + * @return {@code null-ok;} next attribute after {@code attrib} with the + * same name as {@code attrib} */ public Attribute findNext(Attribute attrib); } diff --git a/dx/src/com/android/dx/cf/iface/ClassFile.java b/dx/src/com/android/dx/cf/iface/ClassFile.java index 36a5f7415..e37fec03a 100644 --- a/dx/src/com/android/dx/cf/iface/ClassFile.java +++ b/dx/src/com/android/dx/cf/iface/ClassFile.java @@ -26,98 +26,98 @@ import com.android.dx.rop.type.TypeList; * facsimiles thereof. * * <p><b>Note:</b> The fields referred to in this documentation are of the - * <code>ClassFile</code> structure defined in vmspec-2 sec4.1. + * {@code ClassFile} structure defined in vmspec-2 sec4.1. */ public interface ClassFile { /** - * Gets the field <code>magic</code>. + * Gets the field {@code magic}. * * @return the value in question */ public int getMagic(); /** - * Gets the field <code>minor_version</code>. + * Gets the field {@code minor_version}. * * @return the value in question */ public int getMinorVersion(); /** - * Gets the field <code>major_version</code>. + * Gets the field {@code major_version}. * * @return the value in question */ public int getMajorVersion(); /** - * Gets the field <code>access_flags</code>. + * Gets the field {@code access_flags}. * * @return the value in question */ public int getAccessFlags(); /** - * Gets the field <code>this_class</code>, interpreted as a type constant. + * Gets the field {@code this_class}, interpreted as a type constant. * - * @return non-null; the value in question + * @return {@code non-null;} the value in question */ public CstType getThisClass(); /** - * Gets the field <code>super_class</code>, interpreted as a type constant + * Gets the field {@code super_class}, interpreted as a type constant * if non-zero. * - * @return null-ok; the value in question + * @return {@code null-ok;} the value in question */ public CstType getSuperclass(); /** - * Gets the field <code>constant_pool</code> (along with - * <code>constant_pool_count</code>). + * Gets the field {@code constant_pool} (along with + * {@code constant_pool_count}). * - * @return non-null; the constant pool + * @return {@code non-null;} the constant pool */ public ConstantPool getConstantPool(); /** - * Gets the field <code>interfaces<code> (along with - * interfaces_count</code>). + * Gets the field {@code interfaces} (along with + * {@code interfaces_count}). * - * @return non-null; the list of interfaces + * @return {@code non-null;} the list of interfaces */ public TypeList getInterfaces(); /** - * Gets the field <code>fields</code> (along with - * <code>fields_count</code>). + * Gets the field {@code fields} (along with + * {@code fields_count}). * - * @return non-null; the list of fields + * @return {@code non-null;} the list of fields */ public FieldList getFields(); /** - * Gets the field <code>methods</code> (along with - * <code>methods_count</code>). + * Gets the field {@code methods} (along with + * {@code methods_count}). * - * @return non-null; the list of fields + * @return {@code non-null;} the list of fields */ public MethodList getMethods(); /** - * Gets the field <code>attributes</code> (along with - * <code>attributes_count</code>). + * Gets the field {@code attributes} (along with + * {@code attributes_count}). * - * @return non-null; the list of attributes + * @return {@code non-null;} the list of attributes */ public AttributeList getAttributes(); /** - * Gets the name out of the <code>SourceFile</code> attribute of this + * Gets the name out of the {@code SourceFile} attribute of this * file, if any. This is a convenient shorthand for scrounging around * the class's attributes. * - * @return non-null; the constant pool + * @return {@code non-null;} the constant pool */ public CstUtf8 getSourceFile(); } diff --git a/dx/src/com/android/dx/cf/iface/Field.java b/dx/src/com/android/dx/cf/iface/Field.java index d1694fc32..e3002bcd0 100644 --- a/dx/src/com/android/dx/cf/iface/Field.java +++ b/dx/src/com/android/dx/cf/iface/Field.java @@ -25,10 +25,10 @@ public interface Field extends Member { /** * Get the constant value for this field, if any. This only returns - * non-<code>null</code> for a <code>static final</code> field which - * includes a <code>ConstantValue</code> attribute. + * non-{@code null} for a {@code static final} field which + * includes a {@code ConstantValue} attribute. * - * @return null-ok; the constant value, or <code>null</code> if this + * @return {@code null-ok;} the constant value, or {@code null} if this * field isn't a constant */ public TypedConstant getConstantValue(); diff --git a/dx/src/com/android/dx/cf/iface/FieldList.java b/dx/src/com/android/dx/cf/iface/FieldList.java index 80a794fdb..9cd27a311 100644 --- a/dx/src/com/android/dx/cf/iface/FieldList.java +++ b/dx/src/com/android/dx/cf/iface/FieldList.java @@ -23,11 +23,11 @@ public interface FieldList { /** * Get whether this instance is mutable. Note that the - * <code>FieldList</code> interface itself doesn't provide any means + * {@code FieldList} interface itself doesn't provide any means * of mutation, but that doesn't mean that there isn't a non-interface * way of mutating an instance. * - * @return <code>true</code> iff this instance is somehow mutable + * @return {@code true} iff this instance is somehow mutable */ public boolean isMutable(); @@ -39,10 +39,10 @@ public interface FieldList public int size(); /** - * Get the <code>n</code>th field. + * Get the {@code n}th field. * - * @param n <code>n >= 0, n < size()</code>; which field - * @return non-null; the field in question + * @param n {@code n >= 0, n < size();} which field + * @return {@code non-null;} the field in question */ public Field get(int n); } diff --git a/dx/src/com/android/dx/cf/iface/Member.java b/dx/src/com/android/dx/cf/iface/Member.java index b305e09b6..0453a6f60 100644 --- a/dx/src/com/android/dx/cf/iface/Member.java +++ b/dx/src/com/android/dx/cf/iface/Member.java @@ -27,48 +27,48 @@ public interface Member { /** * Get the defining class. * - * @return non-null; the defining class + * @return {@code non-null;} the defining class */ public CstType getDefiningClass(); /** - * Get the field <code>access_flags</code>. + * Get the field {@code access_flags}. * * @return the access flags */ public int getAccessFlags(); /** - * Get the field <code>name_index</code> of the member. This is - * just a convenient shorthand for <code>getNat().getName()</code>. + * Get the field {@code name_index} of the member. This is + * just a convenient shorthand for {@code getNat().getName()}. * - * @return non-null; the name + * @return {@code non-null;} the name */ public CstUtf8 getName(); /** - * Get the field <code>descriptor_index</code> of the member. This is - * just a convenient shorthand for <code>getNat().getDescriptor()</code>. + * Get the field {@code descriptor_index} of the member. This is + * just a convenient shorthand for {@code getNat().getDescriptor()}. * - * @return non-null; the descriptor + * @return {@code non-null;} the descriptor */ public CstUtf8 getDescriptor(); /** * Get the name and type associated with this member. This is a - * combination of the fields <code>name_index</code> and - * <code>descriptor_index</code> in the original classfile, interpreted + * combination of the fields {@code name_index} and + * {@code descriptor_index} in the original classfile, interpreted * via the constant pool. * - * @return non-null; the name and type + * @return {@code non-null;} the name and type */ public CstNat getNat(); /** - * Get the field <code>attributes</code> (along with - * <code>attributes_count</code>). + * Get the field {@code attributes} (along with + * {@code attributes_count}). * - * @return non-null; the constant pool + * @return {@code non-null;} the constant pool */ public AttributeList getAttributes(); } diff --git a/dx/src/com/android/dx/cf/iface/Method.java b/dx/src/com/android/dx/cf/iface/Method.java index 424400a2b..18b9af64f 100644 --- a/dx/src/com/android/dx/cf/iface/Method.java +++ b/dx/src/com/android/dx/cf/iface/Method.java @@ -26,9 +26,9 @@ public interface Method { /** * Get the <i>effective</i> method descriptor, which includes, if - * necessary, a first <code>this</code> parameter. + * necessary, a first {@code this} parameter. * - * @return non-null; the effective method descriptor + * @return {@code non-null;} the effective method descriptor */ public Prototype getEffectiveDescriptor(); } diff --git a/dx/src/com/android/dx/cf/iface/MethodList.java b/dx/src/com/android/dx/cf/iface/MethodList.java index a7a395cbe..dfa6528a6 100644 --- a/dx/src/com/android/dx/cf/iface/MethodList.java +++ b/dx/src/com/android/dx/cf/iface/MethodList.java @@ -22,11 +22,11 @@ package com.android.dx.cf.iface; public interface MethodList { /** * Get whether this instance is mutable. Note that the - * <code>MethodList</code> interface itself doesn't provide any means + * {@code MethodList} interface itself doesn't provide any means * of mutation, but that doesn't mean that there isn't a non-interface * way of mutating an instance. * - * @return <code>true</code> iff this instance is somehow mutable + * @return {@code true} iff this instance is somehow mutable */ public boolean isMutable(); @@ -38,10 +38,10 @@ public interface MethodList { public int size(); /** - * Get the <code>n</code>th method. + * Get the {@code n}th method. * - * @param n <code>n >= 0, n < size()</code>; which method - * @return non-null; the method in question + * @param n {@code n >= 0, n < size();} which method + * @return {@code non-null;} the method in question */ public Method get(int n); } diff --git a/dx/src/com/android/dx/cf/iface/ParseObserver.java b/dx/src/com/android/dx/cf/iface/ParseObserver.java index 2ad3493c6..98d5a75c2 100644 --- a/dx/src/com/android/dx/cf/iface/ParseObserver.java +++ b/dx/src/com/android/dx/cf/iface/ParseObserver.java @@ -34,11 +34,11 @@ public interface ParseObserver { /** * Indicate that a particular member is now being parsed. * - * @param bytes non-null; the source that is being parsed - * @param offset offset into <code>bytes</code> for the start of the + * @param bytes {@code non-null;} the source that is being parsed + * @param offset offset into {@code bytes} for the start of the * member - * @param name non-null; name of the member - * @param descriptor non-null; descriptor of the member + * @param name {@code non-null;} name of the member + * @param descriptor {@code non-null;} descriptor of the member */ public void startParsingMember(ByteArray bytes, int offset, String name, String descriptor); @@ -46,12 +46,12 @@ public interface ParseObserver { /** * Indicate that a particular member is no longer being parsed. * - * @param bytes non-null; the source that was parsed - * @param offset offset into <code>bytes</code> for the end of the + * @param bytes {@code non-null;} the source that was parsed + * @param offset offset into {@code bytes} for the end of the * member - * @param name non-null; name of the member - * @param descriptor non-null; descriptor of the member - * @param member non-null; the actual member that was parsed + * @param name {@code non-null;} name of the member + * @param descriptor {@code non-null;} descriptor of the member + * @param member {@code non-null;} the actual member that was parsed */ public void endParsingMember(ByteArray bytes, int offset, String name, String descriptor, Member member); @@ -59,10 +59,10 @@ public interface ParseObserver { /** * Indicate that some parsing happened. * - * @param bytes non-null; the source that was parsed - * @param offset offset into <code>bytes</code> for what was parsed + * @param bytes {@code non-null;} the source that was parsed + * @param offset offset into {@code bytes} for what was parsed * @param len number of bytes parsed - * @param human non-null; human form for what was parsed + * @param human {@code non-null;} human form for what was parsed */ public void parsed(ByteArray bytes, int offset, int len, String human); } diff --git a/dx/src/com/android/dx/cf/iface/StdAttributeList.java b/dx/src/com/android/dx/cf/iface/StdAttributeList.java index c29bb08d0..dd5dfd7a8 100644 --- a/dx/src/com/android/dx/cf/iface/StdAttributeList.java +++ b/dx/src/com/android/dx/cf/iface/StdAttributeList.java @@ -25,7 +25,7 @@ import com.android.dx.util.FixedSizeList; public final class StdAttributeList extends FixedSizeList implements AttributeList { /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -95,8 +95,8 @@ public final class StdAttributeList extends FixedSizeList /** * Sets the attribute at the given index. * - * @param n >= 0, < size(); which attribute - * @param attribute null-ok; the attribute object + * @param n {@code >= 0, < size();} which attribute + * @param attribute {@code null-ok;} the attribute object */ public void set(int n, Attribute attribute) { set0(n, attribute); diff --git a/dx/src/com/android/dx/cf/iface/StdField.java b/dx/src/com/android/dx/cf/iface/StdField.java index 3551aee69..c3a4da63a 100644 --- a/dx/src/com/android/dx/cf/iface/StdField.java +++ b/dx/src/com/android/dx/cf/iface/StdField.java @@ -29,10 +29,10 @@ public final class StdField extends StdMember implements Field { /** * Constructs an instance. * - * @param definingClass non-null; the defining class + * @param definingClass {@code non-null;} the defining class * @param accessFlags access flags - * @param nat non-null; member name and type (descriptor) - * @param attributes non-null; list of associated attributes + * @param nat {@code non-null;} member name and type (descriptor) + * @param attributes {@code non-null;} list of associated attributes */ public StdField(CstType definingClass, int accessFlags, CstNat nat, AttributeList attributes) { diff --git a/dx/src/com/android/dx/cf/iface/StdFieldList.java b/dx/src/com/android/dx/cf/iface/StdFieldList.java index 0f8654b20..044d6b78d 100644 --- a/dx/src/com/android/dx/cf/iface/StdFieldList.java +++ b/dx/src/com/android/dx/cf/iface/StdFieldList.java @@ -24,7 +24,7 @@ import com.android.dx.util.FixedSizeList; */ public final class StdFieldList extends FixedSizeList implements FieldList { /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -40,8 +40,8 @@ public final class StdFieldList extends FixedSizeList implements FieldList { /** * Sets the field at the given index. * - * @param n >= 0, < size(); which field - * @param field null-ok; the field object + * @param n {@code >= 0, < size();} which field + * @param field {@code null-ok;} the field object */ public void set(int n, Field field) { set0(n, field); diff --git a/dx/src/com/android/dx/cf/iface/StdMember.java b/dx/src/com/android/dx/cf/iface/StdMember.java index eaf949ef0..dfe45c329 100644 --- a/dx/src/com/android/dx/cf/iface/StdMember.java +++ b/dx/src/com/android/dx/cf/iface/StdMember.java @@ -25,25 +25,25 @@ import com.android.dx.rop.cst.CstUtf8; * all the associated data. */ public abstract class StdMember implements Member { - /** non-null; the defining class */ + /** {@code non-null;} the defining class */ private final CstType definingClass; /** access flags */ private final int accessFlags; - /** non-null; member name and type */ + /** {@code non-null;} member name and type */ private final CstNat nat; - /** non-null; list of associated attributes */ + /** {@code non-null;} list of associated attributes */ private final AttributeList attributes; /** * Constructs an instance. * - * @param definingClass non-null; the defining class + * @param definingClass {@code non-null;} the defining class * @param accessFlags access flags - * @param nat non-null; member name and type (descriptor) - * @param attributes non-null; list of associated attributes + * @param nat {@code non-null;} member name and type (descriptor) + * @param attributes {@code non-null;} list of associated attributes */ public StdMember(CstType definingClass, int accessFlags, CstNat nat, AttributeList attributes) { diff --git a/dx/src/com/android/dx/cf/iface/StdMethod.java b/dx/src/com/android/dx/cf/iface/StdMethod.java index a4acbaa7f..15fd6e1fc 100644 --- a/dx/src/com/android/dx/cf/iface/StdMethod.java +++ b/dx/src/com/android/dx/cf/iface/StdMethod.java @@ -26,16 +26,16 @@ import com.android.dx.rop.type.Prototype; * all the associated data. */ public final class StdMethod extends StdMember implements Method { - /** non-null; the effective method descriptor */ + /** {@code non-null;} the effective method descriptor */ private final Prototype effectiveDescriptor; /** * Constructs an instance. * - * @param definingClass non-null; the defining class + * @param definingClass {@code non-null;} the defining class * @param accessFlags access flags - * @param nat non-null; member name and type (descriptor) - * @param attributes non-null; list of associated attributes + * @param nat {@code non-null;} member name and type (descriptor) + * @param attributes {@code non-null;} list of associated attributes */ public StdMethod(CstType definingClass, int accessFlags, CstNat nat, AttributeList attributes) { diff --git a/dx/src/com/android/dx/cf/iface/StdMethodList.java b/dx/src/com/android/dx/cf/iface/StdMethodList.java index ef0ff3153..521021ec0 100644 --- a/dx/src/com/android/dx/cf/iface/StdMethodList.java +++ b/dx/src/com/android/dx/cf/iface/StdMethodList.java @@ -24,7 +24,7 @@ import com.android.dx.util.FixedSizeList; */ public final class StdMethodList extends FixedSizeList implements MethodList { /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -40,8 +40,8 @@ public final class StdMethodList extends FixedSizeList implements MethodList { /** * Sets the method at the given index. * - * @param n >= 0, < size(); which method - * @param method null-ok; the method object + * @param n {@code >= 0, < size();} which method + * @param method {@code null-ok;} the method object */ public void set(int n, Method method) { set0(n, method); diff --git a/dx/src/com/android/dx/command/DxConsole.java b/dx/src/com/android/dx/command/DxConsole.java index 982e6593c..9ce9836ef 100644 --- a/dx/src/com/android/dx/command/DxConsole.java +++ b/dx/src/com/android/dx/command/DxConsole.java @@ -20,18 +20,18 @@ import java.io.PrintStream; /** * Provides standard and error PrintStream object to output information.<br> - * By default the PrintStream objects link to <code>System.out</code> and - * <code>System.err</code> but they can be changed to link to other + * By default the PrintStream objects link to {@code System.out} and + * {@code System.err} but they can be changed to link to other * PrintStream. */ public class DxConsole { /** - * Standard output stream. Links to <code>System.out</code> by default. + * Standard output stream. Links to {@code System.out} by default. */ public static PrintStream out = System.out; /** - * Error output stream. Links to <code>System.err</code> by default. + * Error output stream. Links to {@code System.err} by default. */ public static PrintStream err = System.err; } diff --git a/dx/src/com/android/dx/command/Main.java b/dx/src/com/android/dx/command/Main.java index 17f5db386..281a83ee3 100644 --- a/dx/src/com/android/dx/command/Main.java +++ b/dx/src/com/android/dx/command/Main.java @@ -43,10 +43,12 @@ public class Main { " options: none, important, lines.\n" + " dx --annotool --annotation=<class> [--element=<element types>]\n" + " [--print=<print types>]\n" + - " dx --dump [--debug] [--strict] [--bytes] [--basic-blocks | " + - "--rop-blocks]\n" + + " dx --dump [--debug] [--strict] [--bytes] [--optimize]\n" + + " [--basic-blocks | --rop-blocks | --ssa-blocks | --dot] " + + "[--ssa-step=<step>]\n" + " [--width=<n>] [<file>.class | <file>.txt] ...\n" + - " Dump classfiles in a human-oriented format.\n" + + " Dump classfiles, or transformations thereof, in a " + + "human-oriented format.\n" + " dx --junit [-wait] <TestClass>\n" + " Run the indicated unit test.\n" + " dx -J<option> ... <arguments, in one of the above " + @@ -156,9 +158,9 @@ public class Main { * Returns a copy of the given args array, but without the indicated * element. * - * @param orig non-null; original array + * @param orig {@code non-null;} original array * @param n which element to omit - * @return non-null; new array + * @return {@code non-null;} new array */ private static String[] without(String[] orig, int n) { int len = orig.length - 1; diff --git a/dx/src/com/android/dx/command/annotool/AnnotationLister.java b/dx/src/com/android/dx/command/annotool/AnnotationLister.java index 78f5d64d2..d3fb27c42 100644 --- a/dx/src/com/android/dx/command/annotool/AnnotationLister.java +++ b/dx/src/com/android/dx/command/annotool/AnnotationLister.java @@ -34,10 +34,9 @@ import java.util.HashSet; /** * Greps annotations on a set of class files and prints matching elements * to stdout. What counts as a match and what should be printed is controlled - * by the <code>Main.Arguments</code> instance. + * by the {@code Main.Arguments} instance. */ class AnnotationLister { - /** * The string name of the pseudo-class that * contains package-wide annotations @@ -59,7 +58,7 @@ class AnnotationLister { /** Processes based on configuration specified in constructor. */ void process() { - for (String path: args.files) { + for (String path : args.files) { ClassPathOpener opener; opener = new ClassPathOpener(path, true, @@ -137,8 +136,8 @@ class AnnotationLister { /** * Inspects a class annotation. * - * @param cf non-null; class file - * @param ann non-null; annotation + * @param cf {@code non-null;} class file + * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { @@ -147,7 +146,7 @@ class AnnotationLister { return; } - for (Annotation anAnn: ann.getAnnotations().getAnnotations()) { + for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { @@ -159,8 +158,8 @@ class AnnotationLister { /** * Inspects a package annotation * - * @param cf non-null; class file of "package-info" pseudo-class - * @param ann non-null; annotation + * @param cf {@code non-null;} class file of "package-info" pseudo-class + * @param ann {@code non-null;} annotation */ private void visitPackageAnnotation( DirectClassFile cf, BaseAnnotations ann) { @@ -181,7 +180,7 @@ class AnnotationLister { } - for (Annotation anAnn: ann.getAnnotations().getAnnotations()) { + for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { @@ -195,10 +194,10 @@ class AnnotationLister { * Prints, or schedules for printing, elements related to a * matching package. * - * @param packageName non-null; name of package + * @param packageName {@code non-null;} name of package */ private void printMatchPackage(String packageName) { - for(Main.PrintType pt: args.printTypes) { + for (Main.PrintType pt : args.printTypes) { switch (pt) { case CLASS: case INNERCLASS: @@ -216,14 +215,15 @@ class AnnotationLister { * Prints, or schedules for printing, elements related to a matching * class. * - * @param cf non-null; matching class + * @param cf {@code non-null;} matching class */ private void printMatch(DirectClassFile cf) { - for(Main.PrintType pt: args.printTypes) { + for (Main.PrintType pt : args.printTypes) { switch (pt) { case CLASS: String classname; - classname = cf.getThisClass().getClassType().getClassName(); + classname = + cf.getThisClass().getClassType().getClassName(); classname = classname.replace('/','.'); System.out.println(classname); break; @@ -244,7 +244,7 @@ class AnnotationLister { * Checks to see if a specified class name should be considered a match * due to previous matches. * - * @param s non-null; class name + * @param s {@code non-null;} class name * @return true if this class should be considered a match */ private boolean isMatchingInnerClass(String s) { @@ -264,7 +264,7 @@ class AnnotationLister { * Checks to see if a specified package should be considered a match due * to previous matches. * - * @param s non-null; package name + * @param s {@code non-null;} package name * @return true if this package should be considered a match */ private boolean isMatchingPackage(String s) { diff --git a/dx/src/com/android/dx/command/annotool/Main.java b/dx/src/com/android/dx/command/annotool/Main.java index 4f1d9a40b..9fd1ac57a 100644 --- a/dx/src/com/android/dx/command/annotool/Main.java +++ b/dx/src/com/android/dx/command/annotool/Main.java @@ -87,17 +87,18 @@ public class Main { String argParam = arg.substring(arg.indexOf('=') + 1); try { - for (String p: argParam.split(",")) { + for (String p : argParam.split(",")) { eTypes.add(ElementType.valueOf(p.toUpperCase())); } } catch (IllegalArgumentException ex) { - throw new InvalidArgumentException("invalid --element"); + throw new InvalidArgumentException( + "invalid --element"); } } else if (arg.startsWith("--print=")) { String argParam = arg.substring(arg.indexOf('=') + 1); try { - for (String p: argParam.split(",")) { + for (String p : argParam.split(",")) { printTypes.add(PrintType.valueOf(p.toUpperCase())); } } catch (IllegalArgumentException ex) { diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java index 19f67b443..5a9f41702 100644 --- a/dx/src/com/android/dx/command/dexer/Main.java +++ b/dx/src/com/android/dx/command/dexer/Main.java @@ -55,26 +55,26 @@ import java.util.jar.Manifest; */ public class Main { /** - * non-null; name for the <code>.dex</code> file that goes into - * <code>.jar</code> files + * {@code non-null;} name for the {@code .dex} file that goes into + * {@code .jar} files */ private static final String DEX_IN_JAR_NAME = "classes.dex"; /** - * non-null; name of the standard manifest file in <code>.jar</code> + * {@code non-null;} name of the standard manifest file in {@code .jar} * files */ private static final String MANIFEST_NAME = "META-INF/MANIFEST.MF"; /** - * non-null; attribute name for the (quasi-standard?) - * <code>Created-By</code> attribute + * {@code non-null;} attribute name for the (quasi-standard?) + * {@code Created-By} attribute */ private static final Attributes.Name CREATED_BY = new Attributes.Name("Created-By"); /** - * non-null; list of <code>javax</code> subpackages that are considered + * {@code non-null;} list of {@code javax} subpackages that are considered * to be "core". <b>Note:</b>: This list must be sorted, since it * is binary-searched. */ @@ -90,15 +90,15 @@ public class Main { /** number of errors during processing */ private static int errors = 0; - /** non-null; parsed command-line arguments */ + /** {@code non-null;} parsed command-line arguments */ private static Arguments args; - /** non-null; output file in-progress */ + /** {@code non-null;} output file in-progress */ private static DexFile outputDex; /** - * null-ok; map of resources to include in the output, or - * <code>null</code> if resources are being ignored + * {@code null-ok;} map of resources to include in the output, or + * {@code null} if resources are being ignored */ private static TreeMap<String, byte[]> outputResources; @@ -215,8 +215,9 @@ public class Main { /** * Processes one pathname element. * - * @param pathname non-null; the pathname to process. May be the path of - * a class file, a jar file, or a directory containing class files. + * @param pathname {@code non-null;} the pathname to process. May + * be the path of a class file, a jar file, or a directory + * containing class files. * @return whether any processing actually happened */ private static boolean processOne(String pathname) { @@ -237,7 +238,8 @@ public class Main { } public void onProcessArchiveStart(File file) { if (args.verbose) { - DxConsole.out.println("processing archive " + file + "..."); + DxConsole.out.println("processing archive " + file + + "..."); } } }); @@ -248,8 +250,8 @@ public class Main { /** * Processes one file, which may be either a class or a resource. * - * @param name non-null; name of the file - * @param bytes non-null; contents of the file + * @param name {@code non-null;} name of the file + * @param bytes {@code non-null;} contents of the file * @return whether processing was successful */ private static boolean processFileBytes(String name, byte[] bytes) { @@ -283,9 +285,9 @@ public class Main { /** * Processes one classfile. * - * @param name non-null; name of the file, clipped such that it + * @param name {@code non-null;} name of the file, clipped such that it * <i>should</i> correspond to the name of the class it contains - * @param bytes non-null; contents of the file + * @param bytes {@code non-null;} contents of the file * @return whether processing was successful */ private static boolean processClass(String name, byte[] bytes) { @@ -316,7 +318,8 @@ public class Main { * class. If there is a problem, this updates the error count and * throws an exception to stop processing. * - * @param name non-null; the fully-qualified internal-form class name + * @param name {@code non-null;} the fully-qualified internal-form + * class name */ private static void checkClassName(String name) { boolean bogus = false; @@ -346,35 +349,60 @@ public class Main { DxConsole.err.println("\ntrouble processing \"" + name + "\":"); DxConsole.err.println("\n" + - "Attempt to include a core VM class in something other " + - "than a core library.\n" + - "It is likely that you have attempted to include the " + - "core library from a desktop\n" + - "virtual machine into an application, which will most " + - "assuredly not work. If\n" + - "you really intend to build a core library -- which is "+ - "only appropriate as\n" + - "part of creating a full virtual machine binary, as " + - "opposed to compiling an\n" + - "application -- then use the \"--core-library\" option " + - "to suppress this error\n" + - "message. If you go ahead and use \"--core-library\" " + - "but are in fact building\n" + - "an application, then please be aware that your build " + - "will still fail at some\n" + - "point; you will simply be denied the pleasure of " + - "reading this helpful error\n" + - "message."); + "Attempt to include a core class (java.* or javax.*) in " + + "something other\n" + + "than a core library. It is likely that you have " + + "attempted to include\n" + + "in an application the core library (or a part thereof) " + + "from a desktop\n" + + "virtual machine. This will most assuredly not work. " + + "At a minimum, it\n" + + "jeopardizes the compatibility of your app with future " + + "versions of the\n" + + "platform. It is also often of questionable legality.\n" + + "\n" + + "If you really intend to build a core library -- which is " + + "only\n" + + "appropriate as part of creating a full virtual machine " + + "distribution,\n" + + "as opposed to compiling an application -- then use the\n" + + "\"--core-library\" option to suppress this error message.\n" + + "\n" + + "If you go ahead and use \"--core-library\" but are in " + + "fact building an\n" + + "application, then be forewarned that your application " + + "will still fail\n" + + "to build or run, at some point. Please be prepared for " + + "angry customers\n" + + "who find, for example, that your application ceases to " + + "function once\n" + + "they upgrade their operating system. You will be to " + + "blame for this\n" + + "problem.\n" + + "\n" + + "If you are legitimately using some code that happens to " + + "be in a core\n" + + "package, then the easiest safe alternative you have is " + + "to repackage\n" + + "that code. That is, move the classes in question into " + + "your own package\n" + + "namespace. This means that they will never be in " + + "conflict with core\n" + + "system classes. If you find that you cannot do this, " + + "then that is an\n" + + "indication that the path you are on will ultimately lead " + + "to pain,\n" + + "suffering, grief, and lamentation.\n"); errors++; throw new StopProcessing(); } /** - * Converts {@link #outputDex} into a <code>byte[]</code>, write + * Converts {@link #outputDex} into a {@code byte[]}, write * it out to the proper file (if any), and also do whatever human-oriented * dumping is required. * - * @return null-ok; the converted <code>byte[]</code> or <code>null</code> + * @return {@code null-ok;} the converted {@code byte[]} or {@code null} * if there was a problem */ private static byte[] writeDex() { @@ -438,8 +466,9 @@ public class Main { /** * Creates a jar file from the resources and given dex file array. * - * @param fileName non-null; name of the file - * @param dexArray non-null; array containing the dex file to include + * @param fileName {@code non-null;} name of the file + * @param dexArray {@code non-null;} array containing the dex file + * to include * @return whether the creation was successful */ private static boolean createJar(String fileName, byte[] dexArray) { @@ -496,7 +525,7 @@ public class Main { * Creates and returns the manifest to use for the output. This may * modify {@link #outputResources} (removing the pre-existing manifest). * - * @return non-null; the manifest + * @return {@code non-null;} the manifest */ private static Manifest makeManifest() throws IOException { byte[] manifestBytes = outputResources.get(MANIFEST_NAME); @@ -531,8 +560,8 @@ public class Main { /** * Opens and returns the named file for writing, treating "-" specially. * - * @param name non-null; the file name - * @return non-null; the opened file + * @param name {@code non-null;} the file name + * @return {@code non-null;} the opened file */ private static OutputStream openOutput(String name) throws IOException { if (name.equals("-") || @@ -547,9 +576,9 @@ public class Main { * Flushes and closes the given output stream, except if it happens to be * {@link System#out} in which case this method does the flush but not * the close. This method will also silently do nothing if given a - * <code>null</code> argument. + * {@code null} argument. * - * @param stream null-ok; what to close + * @param stream {@code null-ok;} what to close */ private static void closeOutput(OutputStream stream) throws IOException { if (stream == null) { @@ -565,18 +594,18 @@ public class Main { /** * Returns the "fixed" version of a given file path, suitable for - * use as a path within a <code>.jar</code> file and for checking + * use as a path within a {@code .jar} file and for checking * against a classfile-internal "this class" name. This looks for - * the last instance of the substring <code>"/./"</code> within + * the last instance of the substring {@code "/./"} within * the path, and if it finds it, it takes the portion after to be * the fixed path. If that isn't found but the path starts with - * <code>"./"</code>, then that prefix is removed and the rest is + * {@code "./"}, then that prefix is removed and the rest is * return. If neither of these is the case, this method returns * its argument. * - * @param path non-null; the path to "fix" - * @return non-null; the fixed version (which might be the same as - * the given <code>path</code>) + * @param path {@code non-null;} the path to "fix" + * @return {@code non-null;} the fixed version (which might be the same as + * the given {@code path}) */ private static String fixPath(String path) { /* @@ -603,9 +632,10 @@ public class Main { /** * Dumps any method with the given name in the given file. * - * @param dex non-null; the dex file - * @param fqName non-null; the fully-qualified name of the method(s) - * @param out non-null; where to dump to + * @param dex {@code non-null;} the dex file + * @param fqName {@code non-null;} the fully-qualified name of the + * method(s) + * @param out {@code non-null;} where to dump to */ private static void dumpMethod(DexFile dex, String fqName, OutputStreamWriter out) { @@ -719,36 +749,36 @@ public class Main { /** whether we are constructing a core library */ public boolean coreLibrary = false; - /** null-ok; particular method to dump */ + /** {@code null-ok;} particular method to dump */ public String methodToDump = null; /** max width for columnar output */ public int dumpWidth = 0; - /** null-ok; output file name for binary file */ + /** {@code null-ok;} output file name for binary file */ public String outName = null; - /** null-ok; output file name for human-oriented dump */ + /** {@code null-ok;} output file name for human-oriented dump */ public String humanOutName = null; /** whether strict file-name-vs-class-name checking should be done */ public boolean strictNameCheck = true; /** - * whether it is okay for there to be no <code>.class</code> files + * whether it is okay for there to be no {@code .class} files * to process */ public boolean emptyOk = false; /** - * whether the binary output is to be a <code>.jar</code> file - * instead of a plain <code>.dex</code> + * whether the binary output is to be a {@code .jar} file + * instead of a plain {@code .dex} */ public boolean jarOutput = false; /** - * when writing a <code>.jar</code> file, whether to still - * keep the <code>.class</code> files + * when writing a {@code .jar} file, whether to still + * keep the {@code .class} files */ public boolean keepClassesInJar = false; @@ -758,7 +788,7 @@ public class Main { /** whether to keep local variable information */ public boolean localInfo = true; - /** non-null after {@link #parse}; file name arguments */ + /** {@code non-null after {@link #parse};} file name arguments */ public String[] fileNames; /** whether to do SSA/register optimization */ @@ -779,7 +809,7 @@ public class Main { /** * Parses the given command-line arguments. * - * @param args non-null; the arguments + * @param args {@code non-null;} the arguments */ public void parse(String[] args) { int at = 0; @@ -866,8 +896,6 @@ public class Main { } int fileCount = args.length - at; - fileNames = new String[fileCount]; - System.arraycopy(args, at, fileNames, 0, fileCount); if (fileCount == 0) { if (!emptyOk) { @@ -876,9 +904,13 @@ public class Main { } } else if (emptyOk) { System.out.println("ignoring input files"); - at = args.length; + at = 0; + fileCount = 0; } + fileNames = new String[fileCount]; + System.arraycopy(args, at, fileNames, 0, fileCount); + if ((humanOutName == null) && (methodToDump != null)) { humanOutName = "-"; } diff --git a/dx/src/com/android/dx/command/dump/BaseDumper.java b/dx/src/com/android/dx/command/dump/BaseDumper.java index f4a8dee1d..d2c1e133a 100644 --- a/dx/src/com/android/dx/command/dump/BaseDumper.java +++ b/dx/src/com/android/dx/command/dump/BaseDumper.java @@ -34,21 +34,21 @@ import java.io.StringWriter; */ public abstract class BaseDumper implements ParseObserver { - /** non-null; array of data being dumped */ + /** {@code non-null;} array of data being dumped */ private final byte[] bytes; /** whether or not to include the raw bytes (in a column on the left) */ private final boolean rawBytes; - /** non-null; where to dump to */ + /** {@code non-null;} where to dump to */ private final PrintStream out; /** width of the output in columns */ private final int width; /** - * non-null; the file path for the class, excluding any base directory - * specification + * {@code non-null;} the file path for the class, excluding any base + * directory specification */ private final String filePath; @@ -61,7 +61,7 @@ public abstract class BaseDumper /** the current level of indentation */ private int indent; - /** non-null; the current column separator string */ + /** {@code non-null;} the current column separator string */ private String separator; /** the offset of the next byte to dump */ @@ -73,10 +73,9 @@ public abstract class BaseDumper /** * Constructs an instance. * - * @param bytes non-null; bytes of the (alleged) class file + * @param bytes {@code non-null;} bytes of the (alleged) class file * on the left) - * @param out non-null; where to dump to - * passed in as <= 0 + * @param out {@code non-null;} where to dump to * @param filePath the file path for the class, excluding any base * directory specification */ @@ -109,7 +108,8 @@ public abstract class BaseDumper * @return width in register-units */ static int computeParamWidth(ConcreteMethod meth, boolean isStatic) { - return meth.getEffectiveDescriptor().getParameterTypes().getWordCount(); + return meth.getEffectiveDescriptor().getParameterTypes(). + getWordCount(); } /** {@inheritDoc} */ @@ -158,7 +158,7 @@ public abstract class BaseDumper * Gets the current dump cursor (that is, the offset of the expected * next byte to dump). * - * @return >= 0; the dump cursor + * @return {@code >= 0;} the dump cursor */ protected final int getAt() { return at; @@ -167,17 +167,17 @@ public abstract class BaseDumper /** * Sets the dump cursor to the indicated offset in the given array. * - * @param arr non-null; array in question - * @param offset >= 0; offset into the array + * @param arr {@code non-null;} array in question + * @param offset {@code >= 0;} offset into the array */ protected final void setAt(ByteArray arr, int offset) { at = arr.underlyingOffset(offset, bytes); } /** - * Gets the array of <code>byte</code>s to process. + * Gets the array of {@code byte}s to process. * - * @return non-null; the bytes + * @return {@code non-null;} the bytes */ protected final byte[] getBytes() { return bytes; @@ -186,7 +186,7 @@ public abstract class BaseDumper /** * Gets the filesystem/jar path of the file being dumped. * - * @return non-null; the path + * @return {@code non-null;} the path */ protected final String getFilePath() { return filePath; @@ -204,7 +204,7 @@ public abstract class BaseDumper /** * Prints the given string to this instance's output stream. * - * @param s null-ok; string to print + * @param s {@code null-ok;} string to print */ protected final void print(String s) { out.print(s); @@ -214,7 +214,7 @@ public abstract class BaseDumper * Prints the given string to this instance's output stream, followed * by a newline. * - * @param s null-ok; string to print + * @param s {@code null-ok;} string to print */ protected final void println(String s) { out.println(s); @@ -230,10 +230,10 @@ public abstract class BaseDumper } /** - * Gets the width of the first column of output. This is <code>0</code> + * Gets the width of the first column of output. This is {@code 0} * unless raw bytes are being included in the output. * - * @return >= 0; the width of the first column + * @return {@code >= 0;} the width of the first column */ protected final int getWidth1() { if (rawBytes) { @@ -246,7 +246,7 @@ public abstract class BaseDumper /** * Gets the width of the second column of output. * - * @return >= 0; the width of the second column + * @return {@code >= 0;} the width of the second column */ protected final int getWidth2() { int w1 = rawBytes ? (getWidth1() + 1) : 0; @@ -258,7 +258,7 @@ public abstract class BaseDumper * * @param offset offset to start dumping at * @param len length to dump - * @return non-null; the dump + * @return {@code non-null;} the dump */ protected final String hexDump(int offset, int len) { return Hex.dump(bytes, offset, len, offset, hexCols, 4); @@ -268,9 +268,9 @@ public abstract class BaseDumper * Combines a pair of strings as two columns, or if this is one-column * output, format the otherwise-second column. * - * @param s1 non-null; the first column's string - * @param s2 non-null; the second column's string - * @return non-null; the combined output + * @param s1 {@code non-null;} the first column's string + * @param s2 {@code non-null;} the second column's string + * @return {@code non-null;} the combined output */ protected final String twoColumns(String s1, String s2) { int w1 = getWidth1(); diff --git a/dx/src/com/android/dx/command/dump/BlockDumper.java b/dx/src/com/android/dx/command/dump/BlockDumper.java index 0be2fb402..0858eabba 100644 --- a/dx/src/com/android/dx/command/dump/BlockDumper.java +++ b/dx/src/com/android/dx/command/dump/BlockDumper.java @@ -54,14 +54,11 @@ public class BlockDumper private boolean rop; /** - * null-ok; the class file object being constructed; becomes non-null - * during {@link #dump} + * {@code null-ok;} the class file object being constructed; + * becomes non-null during {@link #dump} */ protected DirectClassFile classFile; - /** null-ok; most recently parsed code attribute */ - private AttCode codeAtt; - /** whether or not to suppress dumping */ protected boolean suppressDump; @@ -75,9 +72,8 @@ public class BlockDumper * Dumps the given array, interpreting it as a class file and dumping * methods with indications of block-level stuff. * - * @param bytes non-null; bytes of the (alleged) class file - * @param out non-null; where to dump to - * passed in as <= 0 + * @param bytes {@code non-null;} bytes of the (alleged) class file + * @param out {@code non-null;} where to dump to * @param filePath the file path for the class, excluding any base * directory specification * @param rop whether or not to registerize (make rop blocks) @@ -102,7 +98,6 @@ public class BlockDumper this.rop = rop; this.classFile = null; - this.codeAtt = null; this.suppressDump = true; this.first = true; this.optimize = args.optimize; @@ -208,7 +203,7 @@ public class BlockDumper /** * Does a regular basic block dump. * - * @param meth non-null; method data to dump + * @param meth {@code non-null;} method data to dump */ private void regularDump(ConcreteMethod meth) { BytecodeArray code = meth.getCode(); @@ -283,7 +278,7 @@ public class BlockDumper /** * Does a registerizing dump. * - * @param meth non-null; method data to dump + * @param meth {@code non-null;} method data to dump */ private void ropDump(ConcreteMethod meth) { BytecodeArray code = meth.getCode(); diff --git a/dx/src/com/android/dx/command/dump/ClassDumper.java b/dx/src/com/android/dx/command/dump/ClassDumper.java index 10dacf374..e98b6d6ef 100644 --- a/dx/src/com/android/dx/command/dump/ClassDumper.java +++ b/dx/src/com/android/dx/command/dump/ClassDumper.java @@ -30,8 +30,8 @@ public final class ClassDumper /** * Dumps the given array, interpreting it as a class file. * - * @param bytes non-null; bytes of the (alleged) class file - * @param out non-null; where to dump to + * @param bytes {@code non-null;} bytes of the (alleged) class file + * @param out {@code non-null;} where to dump to * passed in as <= 0 * @param filePath the file path for the class, excluding any base * directory specification diff --git a/dx/src/com/android/dx/command/dump/DotDumper.java b/dx/src/com/android/dx/command/dump/DotDumper.java index 87c529816..9de48fc82 100644 --- a/dx/src/com/android/dx/command/dump/DotDumper.java +++ b/dx/src/com/android/dx/command/dump/DotDumper.java @@ -39,16 +39,15 @@ import com.android.dx.util.IntList; * with the popular graph utility "dot". */ public class DotDumper implements ParseObserver { + private DirectClassFile classFile; - DirectClassFile classFile; + private final byte[] bytes; + private final String filePath; + private final boolean strictParse; + private final boolean optimize; + private final Args args; - byte[] bytes; - String filePath; - boolean strictParse; - boolean optimize; - Args args; - - static void dump (byte[] bytes, String filePath, Args args) { + static void dump(byte[] bytes, String filePath, Args args) { new DotDumper(bytes, filePath, args).run(); } @@ -60,7 +59,6 @@ public class DotDumper implements ParseObserver { this.args = args; } - private void run() { ByteArray ba = new ByteArray(bytes); @@ -89,17 +87,17 @@ public class DotDumper implements ParseObserver { } public void changeIndent(int indentDelta) { - + // This space intentionally left blank. } public void parsed(ByteArray bytes, int offset, int len, String human) { - + // This space intentionally left blank. } /** {@inheritDoc} */ public void startParsingMember(ByteArray bytes, int offset, String name, String descriptor) { - + // This space intentionally left blank. } public void endParsingMember(ByteArray bytes, int offset, String name, @@ -165,6 +163,5 @@ public class DotDumper implements ParseObserver { } System.out.println("}"); - } } diff --git a/dx/src/com/android/dx/command/dump/Main.java b/dx/src/com/android/dx/command/dump/Main.java index 1ea26bc94..d6ba3740a 100644 --- a/dx/src/com/android/dx/command/dump/Main.java +++ b/dx/src/com/android/dx/command/dump/Main.java @@ -110,8 +110,8 @@ public class Main { /** * Processes one file. * - * @param name non-null; name of the file - * @param bytes non-null; contents of the file + * @param name {@code non-null;} name of the file + * @param bytes {@code non-null;} contents of the file */ private static void processOne(String name, byte[] bytes) { if (parsedArgs.dotDump) { diff --git a/dx/src/com/android/dx/command/dump/SsaDumper.java b/dx/src/com/android/dx/command/dump/SsaDumper.java index 95442a174..e5e9d97db 100644 --- a/dx/src/com/android/dx/command/dump/SsaDumper.java +++ b/dx/src/com/android/dx/command/dump/SsaDumper.java @@ -40,29 +40,48 @@ import com.android.dx.util.Hex; import com.android.dx.util.IntList; import java.io.PrintStream; +import java.util.ArrayList; import java.util.BitSet; +import java.util.Collections; import java.util.EnumSet; +/** + * Dumper for the SSA-translated blocks of a method. + */ public class SsaDumper extends BlockDumper { - + /** + * Does the dump. + * + * @param bytes {@code non-null;} bytes of the original class file + * @param out {@code non-null;} where to dump to + * @param filePath the file path for the class, excluding any base + * directory specification + * @param args commandline parsedArgs + */ public static void dump(byte[] bytes, PrintStream out, String filePath, Args args) { - - SsaDumper sd = - new SsaDumper(bytes, out, filePath, args); + SsaDumper sd = new SsaDumper(bytes, out, filePath, args); sd.dump(); } - SsaDumper(byte[] bytes, PrintStream out, String filePath, Args args) { - + /** + * Constructs an instance. + * + * @param bytes {@code non-null;} bytes of the original class file + * @param out {@code non-null;} where to dump to + * @param filePath the file path for the class, excluding any base + * directory specification + * @param args commandline parsedArgs + */ + private SsaDumper(byte[] bytes, PrintStream out, String filePath, + Args args) { super(bytes, out, filePath, true, args); - } /** {@inheritDoc} */ @Override public void endParsingMember(ByteArray bytes, int offset, String name, - String descriptor, Member member) { + String descriptor, Member member) { if (!(member instanceof Method)) { return; } @@ -71,17 +90,14 @@ public class SsaDumper extends BlockDumper { return; } - ConcreteMethod meth = new ConcreteMethod((Method) member, classFile, - true, true); - + ConcreteMethod meth = + new ConcreteMethod((Method) member, classFile, true, true); TranslationAdvice advice = DexTranslationAdvice.THE_ONE; - RopMethod rmeth = Ropper.convert(meth, advice); - SsaMethod ssaMeth = null; - boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags()); int paramWidth = computeParamWidth(meth, isStatic); + if (args.ssaStep == null) { ssaMeth = Optimizer.debugNoRegisterAllocation(rmeth, paramWidth, isStatic, true, advice, @@ -106,30 +122,36 @@ public class SsaDumper extends BlockDumper { sb.append(Hex.u2( ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex()))); sb.append('\n'); + + ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); + ArrayList<SsaBasicBlock> sortedBlocks = + (ArrayList<SsaBasicBlock>) blocks.clone(); + Collections.sort(sortedBlocks, SsaBasicBlock.LABEL_COMPARATOR); - for (SsaBasicBlock block : ssaMeth.getBlocks()) { + for (SsaBasicBlock block : sortedBlocks) { sb.append("block ") .append(Hex.u2(block.getRopLabel())).append('\n'); BitSet preds = block.getPredecessors(); - for(int i=preds.nextSetBit(0); i>=0; i=preds.nextSetBit(i+1)) { - sb.append (" pred "); - sb.append (Hex.u2(ssaMeth.blockIndexToRopLabel(i))); + for (int i = preds.nextSetBit(0); i >= 0; + i = preds.nextSetBit(i+1)) { + sb.append(" pred "); + sb.append(Hex.u2(ssaMeth.blockIndexToRopLabel(i))); sb.append('\n'); } - sb.append (" live in:" + block.getLiveInRegs()); - sb.append ("\n"); + sb.append(" live in:" + block.getLiveInRegs()); + sb.append("\n"); - for (SsaInsn insn: block.getInsns()) { + for (SsaInsn insn : block.getInsns()) { sb.append(" "); sb.append(insn.toHuman()); sb.append('\n'); } if (block.getSuccessors().cardinality() == 0) { - sb.append (" returns\n"); + sb.append(" returns\n"); } else { int primary = block.getPrimarySuccessorRopLabel(); @@ -138,18 +160,18 @@ public class SsaDumper extends BlockDumper { int szSuccLabels = succLabelList.size(); for (int i = 0; i < szSuccLabels; i++) { - sb.append (" next "); - sb.append (Hex.u2(succLabelList.get(i))); + sb.append(" next "); + sb.append(Hex.u2(succLabelList.get(i))); if (szSuccLabels != 1 && primary == succLabelList.get(i)) { - sb.append (" *"); + sb.append(" *"); } sb.append('\n'); } } - sb.append (" live out:" + block.getLiveOutRegs()); - sb.append ("\n"); + sb.append(" live out:" + block.getLiveOutRegs()); + sb.append("\n"); } suppressDump = false; diff --git a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java index dab15c9a0..cdd29d73d 100644 --- a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java +++ b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java @@ -51,7 +51,7 @@ import java.util.ArrayList; /** * Utility methods that translate various classfile attributes - * into forms suitable for use in creating <code>dex</code> files. + * into forms suitable for use in creating {@code dex} files. */ /*package*/ class AttributeTranslator { /** @@ -64,8 +64,8 @@ import java.util.ArrayList; /** * Gets the list of thrown exceptions for a given method. * - * @param method non-null; the method in question - * @return non-null; the list of thrown exceptions + * @param method {@code non-null;} the method in question + * @return {@code non-null;} the list of thrown exceptions */ public static TypeList getExceptions(Method method) { AttributeList attribs = method.getAttributes(); @@ -83,10 +83,10 @@ import java.util.ArrayList; * Gets the annotations out of a given {@link AttributeList}. This * combines both visible and invisible annotations into a single * result set and also adds in a system annotation for the - * <code>Signature</code> attribute if present. + * {@code Signature} attribute if present. * - * @param attribs non-null; the attributes list to search in - * @return non-null; the set of annotations, which may be empty + * @param attribs {@code non-null;} the attributes list to search in + * @return {@code non-null;} the set of annotations, which may be empty */ public static Annotations getAnnotations(AttributeList attribs) { Annotations result = getAnnotations0(attribs); @@ -102,15 +102,15 @@ import java.util.ArrayList; /** * Gets the annotations out of a given class, similar to {@link * #getAnnotations}, also including annotations for translations - * of class-level attributes <code>EnclosingMethod</code> and - * <code>InnerClasses</code>, if present. Additionally, if the + * of class-level attributes {@code EnclosingMethod} and + * {@code InnerClasses}, if present. Additionally, if the * class is an annotation class, then this also includes a - * representation of all the <code>AnnotationDefault</code> + * representation of all the {@code AnnotationDefault} * values. * - * @param cf non-null; the class in question - * @param args non-null; the high-level options - * @return non-null; the set of annotations, which may be empty + * @param cf {@code non-null;} the class in question + * @param args {@code non-null;} the high-level options + * @return {@code non-null;} the set of annotations, which may be empty */ public static Annotations getClassAnnotations(DirectClassFile cf, CfOptions args) { @@ -148,10 +148,10 @@ import java.util.ArrayList; /** * Gets the annotations out of a given method, similar to {@link * #getAnnotations}, also including an annotation for the translation - * of the method-specific attribute <code>Exceptions</code>. + * of the method-specific attribute {@code Exceptions}. * - * @param method non-null; the method in question - * @return non-null; the set of annotations, which may be empty + * @param method {@code non-null;} the method in question + * @return {@code non-null;} the set of annotations, which may be empty */ public static Annotations getMethodAnnotations(Method method) { Annotations result = getAnnotations(method.getAttributes()); @@ -170,8 +170,8 @@ import java.util.ArrayList; * Helper method for {@link #getAnnotations} which just gets the * existing annotations, per se. * - * @param attribs non-null; the attributes list to search in - * @return non-null; the set of annotations, which may be empty + * @param attribs {@code non-null;} the attributes list to search in + * @return {@code non-null;} the set of annotations, which may be empty */ private static Annotations getAnnotations0(AttributeList attribs) { AttRuntimeVisibleAnnotations visible = @@ -199,11 +199,11 @@ import java.util.ArrayList; } /** - * Gets the <code>Signature</code> attribute out of a given + * Gets the {@code Signature} attribute out of a given * {@link AttributeList}, if any, translating it to an annotation. * - * @param attribs non-null; the attributes list to search in - * @return null-ok; the converted <code>Signature</code> annotation, + * @param attribs {@code non-null;} the attributes list to search in + * @return {@code null-ok;} the converted {@code Signature} annotation, * if there was an attribute to translate */ private static Annotation getSignature(AttributeList attribs) { @@ -218,15 +218,15 @@ import java.util.ArrayList; } /** - * Gets the <code>EnclosingMethod</code> attribute out of a given + * Gets the {@code EnclosingMethod} attribute out of a given * {@link AttributeList}, if any, translating it to an annotation. * If the class really has an enclosing method, this returns an - * <code>EnclosingMethod</code> annotation; if not, this returns - * an <code>EnclosingClass</code> annotation. + * {@code EnclosingMethod} annotation; if not, this returns + * an {@code EnclosingClass} annotation. * - * @param attribs non-null; the attributes list to search in - * @return null-ok; the converted <code>EnclosingMethod</code> or - * <code>EnclosingClass</code> annotation, if there was an + * @param attribs {@code non-null;} the attributes list to search in + * @return {@code null-ok;} the converted {@code EnclosingMethod} or + * {@code EnclosingClass} annotation, if there was an * attribute to translate */ private static Annotation translateEnclosingMethod(AttributeList attribs) { @@ -256,16 +256,16 @@ import java.util.ArrayList; } /** - * Gets the <code>InnerClasses</code> attribute out of a given + * Gets the {@code InnerClasses} attribute out of a given * {@link AttributeList}, if any, translating it to one or more of an - * <code>InnerClass</code>, <code>EnclosingClass</code>, or - * <code>MemberClasses</code> annotation. + * {@code InnerClass}, {@code EnclosingClass}, or + * {@code MemberClasses} annotation. * - * @param thisClass non-null; type representing the class being processed - * @param attribs non-null; the attributes list to search in + * @param thisClass {@code non-null;} type representing the class being processed + * @param attribs {@code non-null;} the attributes list to search in * @param needEnclosingClass whether to include an - * <code>EnclosingClass</code> annotation - * @return null-ok; the converted list of annotations, if there + * {@code EnclosingClass} annotation + * @return {@code null-ok;} the converted list of annotations, if there * was an attribute to translate */ private static Annotations translateInnerClasses(CstType thisClass, @@ -342,8 +342,8 @@ import java.util.ArrayList; * combines both visible and invisible annotations into a single * result set. * - * @param method non-null; the method in question - * @return non-null; the list of annotation sets, which may be empty + * @param method {@code non-null;} the method in question + * @return {@code non-null;} the list of annotation sets, which may be empty */ public static AnnotationsList getParameterAnnotations(Method method) { AttributeList attribs = method.getAttributes(); @@ -374,14 +374,14 @@ import java.util.ArrayList; } /** - * Gets the <code>AnnotationDefault</code> attributes out of a + * Gets the {@code AnnotationDefault} attributes out of a * given class, if any, reforming them as an - * <code>AnnotationDefault</code> annotation. + * {@code AnnotationDefault} annotation. * - * @param cf non-null; the class in question - * @return null-ok; an appropriately-constructed - * <code>AnnotationDefault</code> annotation, if there were any - * annotation defaults in the class, or <code>null<code> if not + * @param cf {@code non-null;} the class in question + * @return {@code null-ok;} an appropriately-constructed + * {@code AnnotationDefault} annotation, if there were any + * annotation defaults in the class, or {@code null} if not */ private static Annotation translateAnnotationDefaults(DirectClassFile cf) { CstType thisClass = cf.getThisClass(); diff --git a/dx/src/com/android/dx/dex/cf/CfTranslator.java b/dx/src/com/android/dx/dex/cf/CfTranslator.java index c48be53e3..8210e907b 100644 --- a/dx/src/com/android/dx/dex/cf/CfTranslator.java +++ b/dx/src/com/android/dx/dex/cf/CfTranslator.java @@ -55,11 +55,11 @@ import com.android.dx.ssa.Optimizer; import com.android.dx.util.ExceptionWithContext; /** - * Static method that turns <code>byte[]</code>s containing Java + * Static method that turns {@code byte[]}s containing Java * classfiles into {@link ClassDefItem} instances. */ public class CfTranslator { - /** set to <code>true</code> to enable development-time debugging code */ + /** set to {@code true} to enable development-time debugging code */ private static final boolean DEBUG = false; /** @@ -70,14 +70,14 @@ public class CfTranslator { } /** - * Takes a <code>byte[]</code>, interprets it as a Java classfile, and + * Takes a {@code byte[]}, interprets it as a Java classfile, and * translates it into a {@link ClassDefItem}. * - * @param filePath non-null; the file path for the class, + * @param filePath {@code non-null;} the file path for the class, * excluding any base directory specification - * @param bytes non-null; contents of the file + * @param bytes {@code non-null;} contents of the file * @param args command-line arguments - * @return non-null; the translated class + * @return {@code non-null;} the translated class */ public static ClassDefItem translate(String filePath, byte[] bytes, CfOptions args) { @@ -94,11 +94,11 @@ public class CfTranslator { * from {@link #translate} just to keep things a bit simpler in * terms of exception handling. * - * @param filePath non-null; the file path for the class, + * @param filePath {@code non-null;} the file path for the class, * excluding any base directory specification - * @param bytes non-null; contents of the file + * @param bytes {@code non-null;} contents of the file * @param args command-line arguments - * @return non-null; the translated class + * @return {@code non-null;} the translated class */ private static ClassDefItem translate0(String filePath, byte[] bytes, CfOptions args) { @@ -136,8 +136,8 @@ public class CfTranslator { /** * Processes the fields of the given class. * - * @param cf non-null; class being translated - * @param out non-null; output class + * @param cf {@code non-null;} class being translated + * @param out {@code non-null;} output class */ private static void processFields(DirectClassFile cf, ClassDefItem out) { CstType thisClass = cf.getThisClass(); @@ -179,8 +179,8 @@ public class CfTranslator { * Helper for {@link #processFields}, which translates constants into * more specific types if necessary. * - * @param constant non-null; the constant in question - * @param type non-null; the desired type + * @param constant {@code non-null;} the constant in question + * @param type {@code non-null;} the desired type */ private static TypedConstant coerceConstant(TypedConstant constant, Type type) { @@ -213,9 +213,9 @@ public class CfTranslator { /** * Processes the methods of the given class. * - * @param cf non-null; class being translated - * @param args non-null; command-line args - * @param out non-null; output class + * @param cf {@code non-null;} class being translated + * @param args {@code non-null;} command-line args + * @param out {@code non-null;} output class */ private static void processMethods(DirectClassFile cf, CfOptions args, ClassDefItem out) { diff --git a/dx/src/com/android/dx/dex/cf/CodeStatistics.java b/dx/src/com/android/dx/dex/cf/CodeStatistics.java index fa83100bd..b692d77eb 100644 --- a/dx/src/com/android/dx/dex/cf/CodeStatistics.java +++ b/dx/src/com/android/dx/dex/cf/CodeStatistics.java @@ -26,7 +26,7 @@ import java.io.PrintStream; * code. */ public final class CodeStatistics { - /** set to <code>true</code> to enable development-time debugging code */ + /** set to {@code true} to enable development-time debugging code */ private static final boolean DEBUG = false; /** @@ -76,7 +76,7 @@ public final class CodeStatistics { /** * Updates the number of original bytecode bytes processed. * - * @param count >= 0; the number of bytes to add + * @param count {@code >= 0;} the number of bytes to add */ public static void updateOriginalByteCount(int count) { runningOriginalBytes += count; @@ -146,7 +146,7 @@ public final class CodeStatistics { /** * Prints out the collected statistics. * - * @param out non-null; where to output to + * @param out {@code non-null;} where to output to */ public static void dumpStatistics(PrintStream out) { out.printf("Optimizer Delta Rop Insns: %d total: %d " diff --git a/dx/src/com/android/dx/dex/cf/OptimizerOptions.java b/dx/src/com/android/dx/dex/cf/OptimizerOptions.java index 1dc3f76a4..fa606e34b 100644 --- a/dx/src/com/android/dx/dex/cf/OptimizerOptions.java +++ b/dx/src/com/android/dx/dex/cf/OptimizerOptions.java @@ -31,13 +31,14 @@ import java.util.HashSet; */ public class OptimizerOptions { /** - * null-ok; hash set of class name + method names that should be optimized. - * null if this constraint was not specified on the command line + * {@code null-ok;} hash set of class name + method names that + * should be optimized. {@code null} if this constraint was not + * specified on the command line */ private static HashSet<String> optimizeList; /** - * null-ok; hash set of class name + method names that should NOT + * {@code null-ok;} hash set of class name + method names that should NOT * be optimized. null if this constraint was not specified on the * command line */ @@ -97,7 +98,6 @@ public class OptimizerOptions { try { FileReader fr = new FileReader(filename); - BufferedReader bfr = new BufferedReader(fr); String line; @@ -105,6 +105,8 @@ public class OptimizerOptions { while (null != (line = bfr.readLine())) { result.add(line); } + + fr.close(); } catch (IOException ex) { // Let the exception percolate up as a RuntimeException. throw new RuntimeException("Error with optimize list: " + @@ -118,12 +120,12 @@ public class OptimizerOptions { * Compares the output of the optimizer run normally with a run skipping * some optional steps. Results are printed to stderr. * - * @param nonOptRmeth non-null; origional rop method - * @param paramSize >= 0 parameter size of method + * @param nonOptRmeth {@code non-null;} origional rop method + * @param paramSize {@code >= 0;} parameter size of method * @param isStatic true if this method has no 'this' pointer argument. - * @param args non-null; translator arguments - * @param advice non-null; translation advice - * @param rmeth non-null; method with all optimization steps run. + * @param args {@code non-null;} translator arguments + * @param advice {@code non-null;} translation advice + * @param rmeth {@code non-null;} method with all optimization steps run. */ public static void compareOptimizerStep(RopMethod nonOptRmeth, int paramSize, boolean isStatic, CfOptions args, diff --git a/dx/src/com/android/dx/dex/code/ArrayData.java b/dx/src/com/android/dx/dex/code/ArrayData.java index 8476a0361..7698de1ad 100644 --- a/dx/src/com/android/dx/dex/code/ArrayData.java +++ b/dx/src/com/android/dx/dex/code/ArrayData.java @@ -29,12 +29,12 @@ import java.util.ArrayList; */ public final class ArrayData extends VariableSizeInsn { /** - * non-null; address representing the instruction that uses this + * {@code non-null;} address representing the instruction that uses this * instance */ private final CodeAddress user; - /** non-null; initial values to be filled into an array */ + /** {@code non-null;} initial values to be filled into an array */ private final ArrayList<Constant> values; /** non-null: type of constant that initializes the array */ @@ -48,12 +48,12 @@ public final class ArrayData extends VariableSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param user non-null; address representing the instruction that + * @param position {@code non-null;} source position + * @param user {@code non-null;} address representing the instruction that * uses this instance - * @param values non-null; initial values to be filled into an array + * @param values {@code non-null;} initial values to be filled into an array */ public ArrayData(SourcePosition position, CodeAddress user, ArrayList<Constant> values, @@ -107,7 +107,6 @@ public final class ArrayData extends VariableSizeInsn { /** {@inheritDoc} */ @Override public void writeTo(AnnotatedOutput out) { - int baseAddress = user.getAddress(); int sz = values.size(); out.writeShort(0x300 | DalvOps.NOP); diff --git a/dx/src/com/android/dx/dex/code/BlockAddresses.java b/dx/src/com/android/dx/dex/code/BlockAddresses.java index 9fea66c62..e55f89379 100644 --- a/dx/src/com/android/dx/dex/code/BlockAddresses.java +++ b/dx/src/com/android/dx/dex/code/BlockAddresses.java @@ -28,15 +28,15 @@ import com.android.dx.rop.code.SourcePosition; * start address, end address, and last instruction address. */ public final class BlockAddresses { - /** non-null; array containing addresses for the start of each basic + /** {@code non-null;} array containing addresses for the start of each basic * block (indexed by basic block label) */ private final CodeAddress[] starts; - /** non-null; array containing addresses for the final instruction + /** {@code non-null;} array containing addresses for the final instruction * of each basic block (indexed by basic block label) */ private final CodeAddress[] lasts; - /** non-null; array containing addresses for the end (just past the + /** {@code non-null;} array containing addresses for the end (just past the * final instruction) of each basic block (indexed by basic block * label) */ private final CodeAddress[] ends; @@ -44,7 +44,7 @@ public final class BlockAddresses { /** * Constructs an instance. * - * @param method non-null; the method to have block addresses for + * @param method {@code non-null;} the method to have block addresses for */ public BlockAddresses(RopMethod method) { BasicBlockList blocks = method.getBlocks(); @@ -60,8 +60,8 @@ public final class BlockAddresses { /** * Gets the instance for the start of the given block. * - * @param block non-null; the block in question - * @return non-null; the appropriate instance + * @param block {@code non-null;} the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getStart(BasicBlock block) { return starts[block.getLabel()]; @@ -70,8 +70,8 @@ public final class BlockAddresses { /** * Gets the instance for the start of the block with the given label. * - * @param label non-null; the label of the block in question - * @return non-null; the appropriate instance + * @param label {@code non-null;} the label of the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getStart(int label) { return starts[label]; @@ -80,8 +80,8 @@ public final class BlockAddresses { /** * Gets the instance for the final instruction of the given block. * - * @param block non-null; the block in question - * @return non-null; the appropriate instance + * @param block {@code non-null;} the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getLast(BasicBlock block) { return lasts[block.getLabel()]; @@ -91,8 +91,8 @@ public final class BlockAddresses { * Gets the instance for the final instruction of the block with * the given label. * - * @param label non-null; the label of the block in question - * @return non-null; the appropriate instance + * @param label {@code non-null;} the label of the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getLast(int label) { return lasts[label]; @@ -102,8 +102,8 @@ public final class BlockAddresses { * Gets the instance for the end (address after the final instruction) * of the given block. * - * @param block non-null; the block in question - * @return non-null; the appropriate instance + * @param block {@code non-null;} the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getEnd(BasicBlock block) { return ends[block.getLabel()]; @@ -113,8 +113,8 @@ public final class BlockAddresses { * Gets the instance for the end (address after the final instruction) * of the block with the given label. * - * @param label non-null; the label of the block in question - * @return non-null; the appropriate instance + * @param label {@code non-null;} the label of the block in question + * @return {@code non-null;} the appropriate instance */ public CodeAddress getEnd(int label) { return ends[label]; diff --git a/dx/src/com/android/dx/dex/code/CatchBuilder.java b/dx/src/com/android/dx/dex/code/CatchBuilder.java index 8bc963b5b..d2ec3d74f 100644 --- a/dx/src/com/android/dx/dex/code/CatchBuilder.java +++ b/dx/src/com/android/dx/dex/code/CatchBuilder.java @@ -27,7 +27,7 @@ public interface CatchBuilder { /** * Builds and returns the catch table for this instance. * - * @return non-null; the constructed table + * @return {@code non-null;} the constructed table */ public CatchTable build(); @@ -42,7 +42,7 @@ public interface CatchBuilder { /** * Gets the set of catch types associated with this instance. * - * @return non-null; the set of catch types + * @return {@code non-null;} the set of catch types */ public HashSet<Type> getCatchTypes(); } diff --git a/dx/src/com/android/dx/dex/code/CatchHandlerList.java b/dx/src/com/android/dx/dex/code/CatchHandlerList.java index 862586c8b..a8a97be20 100644 --- a/dx/src/com/android/dx/dex/code/CatchHandlerList.java +++ b/dx/src/com/android/dx/dex/code/CatchHandlerList.java @@ -25,13 +25,13 @@ import com.android.dx.util.Hex; */ public final class CatchHandlerList extends FixedSizeList implements Comparable<CatchHandlerList> { - /** non-null; empty instance */ + /** {@code non-null;} empty instance */ public static final CatchHandlerList EMPTY = new CatchHandlerList(0); /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * - * @param size >= 0; the size of the list + * @param size {@code >= 0;} the size of the list */ public CatchHandlerList(int size) { super(size); @@ -40,10 +40,10 @@ public final class CatchHandlerList extends FixedSizeList /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Entry get(int n) { return (Entry) get0(n); @@ -58,10 +58,10 @@ public final class CatchHandlerList extends FixedSizeList * Get the human form of this instance, prefixed on each line * with the string. * - * @param prefix non-null; the prefix for every line - * @param header non-null; the header for the first line (after the + * @param prefix {@code non-null;} the prefix for every line + * @param header {@code non-null;} the header for the first line (after the * first prefix) - * @return non-null; the human form + * @return {@code non-null;} the human form */ public String toHuman(String prefix, String header) { StringBuilder sb = new StringBuilder(100); @@ -97,8 +97,8 @@ public final class CatchHandlerList extends FixedSizeList * Returns whether or not this instance ends with a "catch-all" * handler. * - * @return <code>true</code> if this instance ends with a "catch-all" - * handler or <code>false</code> if not + * @return {@code true} if this instance ends with a "catch-all" + * handler or {@code false} if not */ public boolean catchesAll() { int size = size(); @@ -114,9 +114,9 @@ public final class CatchHandlerList extends FixedSizeList /** * Sets the entry at the given index. * - * @param n >= 0, < size(); which index - * @param exceptionType non-null; type of exception handled - * @param handler >= 0; exception handler address + * @param n {@code >= 0, < size();} which index + * @param exceptionType {@code non-null;} type of exception handled + * @param handler {@code >= 0;} exception handler address */ public void set(int n, CstType exceptionType, int handler) { set0(n, new Entry(exceptionType, handler)); @@ -125,8 +125,8 @@ public final class CatchHandlerList extends FixedSizeList /** * Sets the entry at the given index. * - * @param n >= 0, < size(); which index - * @param entry non-null; the entry to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param entry {@code non-null;} the entry to set at {@code n} */ public void set(int n, Entry entry) { set0(n, entry); @@ -165,17 +165,17 @@ public final class CatchHandlerList extends FixedSizeList * Entry in the list. */ public static class Entry implements Comparable<Entry> { - /** non-null; type of exception handled */ + /** {@code non-null;} type of exception handled */ private final CstType exceptionType; - /** >= 0; exception handler address */ + /** {@code >= 0;} exception handler address */ private final int handler; /** * Constructs an instance. * - * @param exceptionType non-null; type of exception handled - * @param handler >= 0; exception handler address + * @param exceptionType {@code non-null;} type of exception handled + * @param handler {@code >= 0;} exception handler address */ public Entry(CstType exceptionType, int handler) { if (handler < 0) { @@ -220,7 +220,7 @@ public final class CatchHandlerList extends FixedSizeList /** * Gets the exception type handled. * - * @return non-null; the exception type + * @return {@code non-null;} the exception type */ public CstType getExceptionType() { return exceptionType; @@ -229,7 +229,7 @@ public final class CatchHandlerList extends FixedSizeList /** * Gets the handler address. * - * @return >= 0; the handler address + * @return {@code >= 0;} the handler address */ public int getHandler() { return handler; diff --git a/dx/src/com/android/dx/dex/code/CatchTable.java b/dx/src/com/android/dx/dex/code/CatchTable.java index 86f9c588b..fd8e3a7fa 100644 --- a/dx/src/com/android/dx/dex/code/CatchTable.java +++ b/dx/src/com/android/dx/dex/code/CatchTable.java @@ -26,13 +26,13 @@ import com.android.dx.util.FixedSizeList; */ public final class CatchTable extends FixedSizeList implements Comparable<CatchTable> { - /** non-null; empty instance */ + /** {@code non-null;} empty instance */ public static final CatchTable EMPTY = new CatchTable(0); /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * - * @param size >= 0; the size of the table + * @param size {@code >= 0;} the size of the table */ public CatchTable(int size) { super(size); @@ -41,10 +41,10 @@ public final class CatchTable extends FixedSizeList /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Entry get(int n) { return (Entry) get0(n); @@ -53,8 +53,8 @@ public final class CatchTable extends FixedSizeList /** * Sets the entry at the given index. * - * @param n >= 0, < size(); which index - * @param entry non-null; the entry to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param entry {@code non-null;} the entry to set at {@code n} */ public void set(int n, Entry entry) { set0(n, entry); @@ -93,21 +93,21 @@ public final class CatchTable extends FixedSizeList * Entry in a catch list. */ public static class Entry implements Comparable<Entry> { - /** >= 0; start address */ + /** {@code >= 0;} start address */ private final int start; - /** > start; end address (exclusive) */ + /** {@code > start;} end address (exclusive) */ private final int end; - /** non-null; list of catch handlers */ + /** {@code non-null;} list of catch handlers */ private final CatchHandlerList handlers; /** * Constructs an instance. * - * @param start >= 0; start address - * @param end > start; end address (exclusive) - * @param handlers non-null; list of catch handlers + * @param start {@code >= 0;} start address + * @param end {@code > start;} end address (exclusive) + * @param handlers {@code non-null;} list of catch handlers */ public Entry(int start, int end, CatchHandlerList handlers) { if (start < 0) { @@ -165,7 +165,7 @@ public final class CatchTable extends FixedSizeList /** * Gets the start address. * - * @return >= 0; the start address + * @return {@code >= 0;} the start address */ public int getStart() { return start; @@ -174,7 +174,7 @@ public final class CatchTable extends FixedSizeList /** * Gets the end address (exclusive). * - * @return > start; the end address (exclusive) + * @return {@code > start;} the end address (exclusive) */ public int getEnd() { return end; @@ -183,7 +183,7 @@ public final class CatchTable extends FixedSizeList /** * Gets the handlers. * - * @return non-null; the handlers + * @return {@code non-null;} the handlers */ public CatchHandlerList getHandlers() { return handlers; diff --git a/dx/src/com/android/dx/dex/code/CodeAddress.java b/dx/src/com/android/dx/dex/code/CodeAddress.java index 97309137b..f25718e14 100644 --- a/dx/src/com/android/dx/dex/code/CodeAddress.java +++ b/dx/src/com/android/dx/dex/code/CodeAddress.java @@ -29,9 +29,9 @@ import com.android.dx.rop.code.SourcePosition; public final class CodeAddress extends ZeroSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position + * @param position {@code non-null;} source position */ public CodeAddress(SourcePosition position) { super(position); diff --git a/dx/src/com/android/dx/dex/code/CstInsn.java b/dx/src/com/android/dx/dex/code/CstInsn.java index 1bc9021ac..a579c5ec8 100644 --- a/dx/src/com/android/dx/dex/code/CstInsn.java +++ b/dx/src/com/android/dx/dex/code/CstInsn.java @@ -25,31 +25,31 @@ import com.android.dx.rop.cst.Constant; * to all the normal instruction information. */ public final class CstInsn extends FixedSizeInsn { - /** non-null; the constant argument for this instruction */ + /** {@code non-null;} the constant argument for this instruction */ private final Constant constant; /** - * >= -1; the constant pool index for {@link #constant}, or - * <code>-1</code> if not yet set + * {@code >= -1;} the constant pool index for {@link #constant}, or + * {@code -1} if not yet set */ private int index; /** - * >= -1; the constant pool index for the class reference in - * {@link #constant} if any, or <code>-1</code> if not yet set + * {@code >= -1;} the constant pool index for the class reference in + * {@link #constant} if any, or {@code -1} if not yet set */ private int classIndex; /** * Constructs an instance. The output address of this instance is - * initially unknown (<code>-1</code>) as is the constant pool index. + * initially unknown ({@code -1}) as is the constant pool index. * * @param opcode the opcode; one of the constants from {@link Dops} - * @param position non-null; source position - * @param registers non-null; register list, including a + * @param position {@code non-null;} source position + * @param registers {@code non-null;} register list, including a * result register if appropriate (that is, registers may be either * ins or outs) - * @param constant non-null; constant argument + * @param constant {@code non-null;} constant argument */ public CstInsn(Dop opcode, SourcePosition position, RegisterSpecList registers, Constant constant) { @@ -101,7 +101,7 @@ public final class CstInsn extends FixedSizeInsn { /** * Gets the constant argument. * - * @return non-null; the constant argument + * @return {@code non-null;} the constant argument */ public Constant getConstant() { return constant; @@ -111,7 +111,7 @@ public final class CstInsn extends FixedSizeInsn { * Gets the constant's index. It is only valid to call this after * {@link #setIndex} has been called. * - * @return >= 0; the constant pool index + * @return {@code >= 0;} the constant pool index */ public int getIndex() { if (index < 0) { @@ -126,7 +126,7 @@ public final class CstInsn extends FixedSizeInsn { * * @see #setIndex * - * @return <code>true</code> iff the index has been set + * @return {@code true} iff the index has been set */ public boolean hasIndex() { return (index >= 0); @@ -136,7 +136,7 @@ public final class CstInsn extends FixedSizeInsn { * Sets the constant's index. It is only valid to call this method once * per instance. * - * @param index >= 0; the constant pool index + * @param index {@code >= 0;} the constant pool index */ public void setIndex(int index) { if (index < 0) { @@ -154,7 +154,7 @@ public final class CstInsn extends FixedSizeInsn { * Gets the constant's class index. It is only valid to call this after * {@link #setClassIndex} has been called. * - * @return >= 0; the constant's class's constant pool index + * @return {@code >= 0;} the constant's class's constant pool index */ public int getClassIndex() { if (classIndex < 0) { @@ -170,7 +170,7 @@ public final class CstInsn extends FixedSizeInsn { * * @see #setClassIndex * - * @return <code>true</code> iff the index has been set + * @return {@code true} iff the index has been set */ public boolean hasClassIndex() { return (classIndex >= 0); @@ -183,7 +183,7 @@ public final class CstInsn extends FixedSizeInsn { * with reference constants that this method should ever be * called. It is only valid to call this method once per instance. * - * @param index >= 0; the constant's class's constant pool index + * @param index {@code >= 0;} the constant's class's constant pool index */ public void setClassIndex(int index) { if (index < 0) { diff --git a/dx/src/com/android/dx/dex/code/DalvCode.java b/dx/src/com/android/dx/dex/code/DalvCode.java index cf6af099b..f91191291 100644 --- a/dx/src/com/android/dx/dex/code/DalvCode.java +++ b/dx/src/com/android/dx/dex/code/DalvCode.java @@ -23,7 +23,7 @@ import java.util.HashSet; /** * Container for all the pieces of a concrete method. Each instance - * corresponds to a <code>code</code> structure in a <code>.dex</code> file. + * corresponds to a {@code code} structure in a {@code .dex} file. */ public final class DalvCode { /** @@ -33,37 +33,37 @@ public final class DalvCode { private final int positionInfo; /** - * null-ok; the instruction list, ready for final processing; + * {@code null-ok;} the instruction list, ready for final processing; * nulled out in {@link #finishProcessingIfNecessary} */ private OutputFinisher unprocessedInsns; /** - * non-null; unprocessed catch table; + * {@code non-null;} unprocessed catch table; * nulled out in {@link #finishProcessingIfNecessary} */ private CatchBuilder unprocessedCatches; /** - * null-ok; catch table; set in + * {@code null-ok;} catch table; set in * {@link #finishProcessingIfNecessary} */ private CatchTable catches; /** - * null-ok; source positions list; set in + * {@code null-ok;} source positions list; set in * {@link #finishProcessingIfNecessary} */ private PositionList positions; /** - * null-ok; local variable list; set in + * {@code null-ok;} local variable list; set in * {@link #finishProcessingIfNecessary} */ private LocalList locals; /** - * null-ok; the processed instruction list; set in + * {@code null-ok;} the processed instruction list; set in * {@link #finishProcessingIfNecessary} */ private DalvInsnList insns; @@ -73,9 +73,9 @@ public final class DalvCode { * * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} - * @param unprocessedInsns non-null; the instruction list, ready + * @param unprocessedInsns {@code non-null;} the instruction list, ready * for final processing - * @param unprocessedCatches non-null; unprocessed catch + * @param unprocessedCatches {@code non-null;} unprocessed catch * (exception handler) table */ public DalvCode(int positionInfo, OutputFinisher unprocessedInsns, @@ -120,7 +120,7 @@ public final class DalvCode { * given callback to perform lookups. This must be called before * {@link #getInsns}. * - * @param callback non-null; callback object + * @param callback {@code non-null;} callback object */ public void assignIndices(AssignIndicesCallback callback) { unprocessedInsns.assignIndices(callback); @@ -129,7 +129,7 @@ public final class DalvCode { /** * Gets whether this instance has any position data to represent. * - * @return <code>true</code> iff this instance has any position + * @return {@code true} iff this instance has any position * data to represent */ public boolean hasPositions() { @@ -140,7 +140,7 @@ public final class DalvCode { /** * Gets whether this instance has any local variable data to represent. * - * @return <code>true</code> iff this instance has any local variable + * @return {@code true} iff this instance has any local variable * data to represent */ public boolean hasLocals() { @@ -160,7 +160,7 @@ public final class DalvCode { /** * Gets the set of catch types handled anywhere in the code. * - * @return non-null; the set of catch types + * @return {@code non-null;} the set of catch types */ public HashSet<Type> getCatchTypes() { return unprocessedCatches.getCatchTypes(); @@ -170,7 +170,7 @@ public final class DalvCode { * Gets the set of all constants referred to by instructions in * the code. * - * @return non-null; the set of constants + * @return {@code non-null;} the set of constants */ public HashSet<Constant> getInsnConstants() { return unprocessedInsns.getAllConstants(); @@ -179,7 +179,7 @@ public final class DalvCode { /** * Gets the list of instructions. * - * @return non-null; the instruction list + * @return {@code non-null;} the instruction list */ public DalvInsnList getInsns() { finishProcessingIfNecessary(); @@ -189,7 +189,7 @@ public final class DalvCode { /** * Gets the catch (exception handler) table. * - * @return non-null; the catch table + * @return {@code non-null;} the catch table */ public CatchTable getCatches() { finishProcessingIfNecessary(); @@ -199,7 +199,7 @@ public final class DalvCode { /** * Gets the source positions list. * - * @return non-null; the source positions list + * @return {@code non-null;} the source positions list */ public PositionList getPositions() { finishProcessingIfNecessary(); @@ -209,7 +209,7 @@ public final class DalvCode { /** * Gets the source positions list. * - * @return non-null; the source positions list + * @return {@code non-null;} the source positions list */ public LocalList getLocals() { finishProcessingIfNecessary(); @@ -223,8 +223,8 @@ public final class DalvCode { /** * Gets the index for the given constant. * - * @param cst non-null; the constant - * @return >= -1; the index or <code>-1</code> if the constant + * @param cst {@code non-null;} the constant + * @return {@code >= -1;} the index or {@code -1} if the constant * shouldn't actually be reified with an index */ public int getIndex(Constant cst); diff --git a/dx/src/com/android/dx/dex/code/DalvInsn.java b/dx/src/com/android/dx/dex/code/DalvInsn.java index d92219341..11ee55d5d 100644 --- a/dx/src/com/android/dx/dex/code/DalvInsn.java +++ b/dx/src/com/android/dx/dex/code/DalvInsn.java @@ -29,26 +29,26 @@ import com.android.dx.util.TwoColumnOutput; public abstract class DalvInsn { /** * the actual output address of this instance, if known, or - * <code>-1</code> if not + * {@code -1} if not */ private int address; /** the opcode; one of the constants from {@link Dops} */ private final Dop opcode; - /** non-null; source position */ + /** {@code non-null;} source position */ private final SourcePosition position; - /** non-null; list of register arguments */ + /** {@code non-null;} list of register arguments */ private final RegisterSpecList registers; /** * Makes a move instruction, appropriate and ideal for the given arguments. * - * @param position non-null; source position information - * @param dest non-null; destination register - * @param src non-null; source register - * @return non-null; an appropriately-constructed instance + * @param position {@code non-null;} source position information + * @param dest {@code non-null;} destination register + * @param src {@code non-null;} source register + * @return {@code non-null;} an appropriately-constructed instance */ public static SimpleInsn makeMove(SourcePosition position, RegisterSpec dest, RegisterSpec src) { @@ -75,17 +75,17 @@ public abstract class DalvInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * * <p><b>Note:</b> In the unlikely event that an instruction takes - * absolutely no registers (e.g., a <code>nop</code> or a + * absolutely no registers (e.g., a {@code nop} or a * no-argument no-result static method call), then the given * register list may be passed as {@link * RegisterSpecList#EMPTY}.</p> * * @param opcode the opcode; one of the constants from {@link Dops} - * @param position non-null; source position - * @param registers non-null; register list, including a + * @param position {@code non-null;} source position + * @param registers {@code non-null;} register list, including a * result register if appropriate (that is, registers may be either * ins and outs) */ @@ -151,11 +151,11 @@ public abstract class DalvInsn { /** * Gets the output address of this instruction, if it is known. This throws - * a <code>RuntimeException</code> if it has not yet been set. + * a {@code RuntimeException} if it has not yet been set. * * @see #setAddress * - * @return >= 0; the output address + * @return {@code >= 0;} the output address */ public final int getAddress() { if (address < 0) { @@ -168,7 +168,7 @@ public abstract class DalvInsn { /** * Gets the opcode. * - * @return non-null; the opcode + * @return {@code non-null;} the opcode */ public final Dop getOpcode() { return opcode; @@ -177,7 +177,7 @@ public abstract class DalvInsn { /** * Gets the source position. * - * @return non-null; the source position + * @return {@code non-null;} the source position */ public final SourcePosition getPosition() { return position; @@ -186,7 +186,7 @@ public abstract class DalvInsn { /** * Gets the register list for this instruction. * - * @return non-null; the registers + * @return {@code non-null;} the registers */ public final RegisterSpecList getRegisters() { return registers; @@ -195,9 +195,9 @@ public abstract class DalvInsn { /** * Returns whether this instance's opcode uses a result register. * This method is a convenient shorthand for - * <code>getOpcode().hasResult()</code>. + * {@code getOpcode().hasResult()}. * - * @return <code>true</code> iff this opcode uses a result register + * @return {@code true} iff this opcode uses a result register */ public final boolean hasResult() { return opcode.hasResult(); @@ -210,7 +210,7 @@ public abstract class DalvInsn { * (to be explicit here) category-2 values take up two consecutive * registers. * - * @return >= 0; the minimum distinct register requirement + * @return {@code >= 0;} the minimum distinct register requirement */ public final int getMinimumRegisterRequirement() { boolean hasResult = hasResult(); @@ -231,7 +231,7 @@ public abstract class DalvInsn { * * @see #hrVersion * - * @return null-ok; the prefix, if any + * @return {@code null-ok;} the prefix, if any */ public DalvInsn hrPrefix() { RegisterSpecList regs = registers; @@ -255,7 +255,7 @@ public abstract class DalvInsn { * * @see #hrVersion * - * @return null-ok; the suffix, if any + * @return {@code null-ok;} the suffix, if any */ public DalvInsn hrSuffix() { if (hasResult()) { @@ -268,8 +268,8 @@ public abstract class DalvInsn { /** * Gets the instruction that is equivalent to this one, except that - * uses sequential registers starting at <code>0</code> (storing - * the result, if any, in register <code>0</code> as well). The + * uses sequential registers starting at {@code 0} (storing + * the result, if any, in register {@code 0} as well). The * sequence of instructions from {@link #hrPrefix} and {@link * #hrSuffix} (if non-null) surrounding the result of a call to * this method are the high register transformation of this @@ -277,7 +277,7 @@ public abstract class DalvInsn { * used will be the number returned by {@link * #getMinimumRegisterRequirement}. * - * @return non-null; the replacement + * @return {@code non-null;} the replacement */ public DalvInsn hrVersion() { RegisterSpecList regs = @@ -289,7 +289,7 @@ public abstract class DalvInsn { * Gets the short identifier for this instruction. This is its * address, if assigned, or its identity hashcode if not. * - * @return non-null; the identifier + * @return {@code non-null;} the identifier */ public final String identifierString() { if (address != -1) { @@ -301,16 +301,16 @@ public abstract class DalvInsn { /** * Returns the string form of this instance suitable for inclusion in - * a human-oriented listing dump. This method will return <code>null</code> + * a human-oriented listing dump. This method will return {@code null} * if this instance should not appear in a listing. * - * @param prefix non-null; prefix before the address; each follow-on + * @param prefix {@code non-null;} prefix before the address; each follow-on * line will be indented to match as well - * @param width >= 0; the width of the output or <code>0</code> for + * @param width {@code >= 0;} the width of the output or {@code 0} for * unlimited width * @param noteIndices whether to include an explicit notation of * constant pool indices - * @return null-ok; the string form or <code>null</code> if this + * @return {@code null-ok;} the string form or {@code null} if this * instance should not appear in a listing */ public final String listingString(String prefix, int width, @@ -331,7 +331,7 @@ public abstract class DalvInsn { /** * Sets the output address. * - * @param address >= 0; the output address + * @param address {@code >= 0;} the output address */ public final void setAddress(int address) { if (address < 0) { @@ -347,7 +347,7 @@ public abstract class DalvInsn { * to the address plus the length of the instruction format of this * instance's opcode. * - * @return >= 0; the next address + * @return {@code >= 0;} the next address */ public final int getNextAddress() { return getAddress() + codeSize(); @@ -356,7 +356,7 @@ public abstract class DalvInsn { /** * Gets the size of this instruction, in 16-bit code units. * - * @return >= 0; the code size of this instruction + * @return {@code >= 0;} the code size of this instruction */ public abstract int codeSize(); @@ -364,7 +364,7 @@ public abstract class DalvInsn { * Writes this instance to the given output. This method should * never annotate the output. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public abstract void writeTo(AnnotatedOutput out); @@ -372,8 +372,8 @@ public abstract class DalvInsn { * Returns an instance that is just like this one, except that its * opcode is replaced by the one given, and its address is reset. * - * @param opcode non-null; the new opcode - * @return non-null; an appropriately-constructed instance + * @param opcode {@code non-null;} the new opcode + * @return {@code non-null;} an appropriately-constructed instance */ public abstract DalvInsn withOpcode(Dop opcode); @@ -383,7 +383,7 @@ public abstract class DalvInsn { * address is reset. * * @param delta the amount to offset register references by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public abstract DalvInsn withRegisterOffset(int delta); @@ -392,8 +392,8 @@ public abstract class DalvInsn { * register list is replaced by the given one, and its address is * reset. * - * @param registers non-null; new register list - * @return non-null; an appropriately-constructed instance + * @param registers {@code non-null;} new register list + * @return {@code non-null;} an appropriately-constructed instance */ public abstract DalvInsn withRegisters(RegisterSpecList registers); @@ -401,8 +401,8 @@ public abstract class DalvInsn { * Gets the string form for any arguments to this instance. Subclasses * must override this. * - * @return null-ok; the string version of any arguments or - * <code>null</code> if there are none + * @return {@code null-ok;} the string version of any arguments or + * {@code null} if there are none */ protected abstract String argString(); @@ -411,12 +411,12 @@ public abstract class DalvInsn { * form of this instance suitable for inclusion in a * human-oriented listing dump, not including the instruction * address and without respect for any output formatting. This - * method should return <code>null</code> if this instance should + * method should return {@code null} if this instance should * not appear in a listing. * * @param noteIndices whether to include an explicit notation of * constant pool indices - * @return null-ok; the listing string + * @return {@code null-ok;} the listing string */ protected abstract String listingString0(boolean noteIndices); } diff --git a/dx/src/com/android/dx/dex/code/DalvInsnList.java b/dx/src/com/android/dx/dex/code/DalvInsnList.java index 2cd15c6dd..5cf22f250 100644 --- a/dx/src/com/android/dx/dex/code/DalvInsnList.java +++ b/dx/src/com/android/dx/dex/code/DalvInsnList.java @@ -46,10 +46,10 @@ public final class DalvInsnList extends FixedSizeList { * Constructs and returns an immutable instance whose elements are * identical to the ones in the given list, in the same order. * - * @param list non-null; the list to use for elements + * @param list {@code non-null;} the list to use for elements * @param regCount count, in register-units, of the number of registers * this code block requires. - * @return non-null; an appropriately-constructed instance of this + * @return {@code non-null;} an appropriately-constructed instance of this * class */ public static DalvInsnList makeImmutable(ArrayList<DalvInsn> list, @@ -66,7 +66,7 @@ public final class DalvInsnList extends FixedSizeList { } /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -78,10 +78,10 @@ public final class DalvInsnList extends FixedSizeList { /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public DalvInsn get(int n) { return (DalvInsn) get0(n); @@ -90,8 +90,8 @@ public final class DalvInsnList extends FixedSizeList { /** * Sets the instruction at the given index. * - * @param n >= 0, < size(); which index - * @param insn non-null; the instruction to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param insn {@code non-null;} the instruction to set at {@code n} */ public void set(int n, DalvInsn insn) { set0(n, insn); @@ -102,7 +102,7 @@ public final class DalvInsnList extends FixedSizeList { * return a meaningful result if the instructions in this instance all * have valid addresses. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int codeSize() { int sz = size(); @@ -119,7 +119,7 @@ public final class DalvInsnList extends FixedSizeList { * Writes all the instructions in this instance to the given output * destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public void writeTo(AnnotatedOutput out) { int startCursor = out.getCursor(); @@ -170,7 +170,7 @@ public final class DalvInsnList extends FixedSizeList { * Gets the minimum required register count implied by this * instance. This includes any unused parameters that could * potentially be at the top of the register space. - * @return >= 0; the required registers size + * @return {@code >= 0;} the required registers size */ public int getRegistersSize() { return regCount; @@ -181,7 +181,7 @@ public final class DalvInsnList extends FixedSizeList { * method. This is equal to the largest argument word count of any * method referred to by this instance. * - * @return >= 0; the required outgoing arguments size + * @return {@code >= 0;} the required outgoing arguments size */ public int getOutsSize() { int sz = size(); @@ -216,8 +216,8 @@ public final class DalvInsnList extends FixedSizeList { /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump - * @param prefix non-null; prefix to attach to each line of output + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} prefix to attach to each line of output * @param verbose whether to be verbose; verbose output includes * lines for zero-size instructions and explicit constant pool indices */ @@ -250,8 +250,8 @@ public final class DalvInsnList extends FixedSizeList { /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump - * @param prefix non-null; prefix to attach to each line of output + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} prefix to attach to each line of output * @param verbose whether to be verbose; verbose output includes * lines for zero-size instructions */ diff --git a/dx/src/com/android/dx/dex/code/Dop.java b/dx/src/com/android/dx/dex/code/Dop.java index 6914fcae6..d1f92bfb7 100644 --- a/dx/src/com/android/dx/dex/code/Dop.java +++ b/dx/src/com/android/dx/dex/code/Dop.java @@ -26,25 +26,25 @@ public final class Dop { /** DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family */ private final int family; - /** non-null; the instruction format */ + /** {@code non-null;} the instruction format */ private final InsnFormat format; /** whether this opcode uses a result register */ private final boolean hasResult; - /** non-null; the name */ + /** {@code non-null;} the name */ private final String name; /** * Constructs an instance. * - * @param opcode DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode + * @param opcode {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode * value itself - * @param family DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family - * @param format non-null; the instruction format + * @param family {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family + * @param format {@code non-null;} the instruction format * @param hasResult whether the opcode has a result register; if so it * is always the first register - * @param name non-null; the name + * @param name {@code non-null;} the name */ public Dop(int opcode, int family, InsnFormat format, boolean hasResult, String name) { @@ -80,7 +80,7 @@ public final class Dop { /** * Gets the opcode value. * - * @return DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value + * @return {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value */ public int getOpcode() { return opcode; @@ -90,7 +90,7 @@ public final class Dop { * Gets the opcode family. The opcode family is the unmarked (no * "/...") opcode that has equivalent semantics to this one. * - * @return DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family + * @return {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family */ public int getFamily() { return family; @@ -99,7 +99,7 @@ public final class Dop { /** * Gets the instruction format. * - * @return non-null; the instruction format + * @return {@code non-null;} the instruction format */ public InsnFormat getFormat() { return format; @@ -108,7 +108,7 @@ public final class Dop { /** * Returns whether this opcode uses a result register. * - * @return <code>true</code> iff this opcode uses a result register + * @return {@code true} iff this opcode uses a result register */ public boolean hasResult() { return hasResult; @@ -117,7 +117,7 @@ public final class Dop { /** * Gets the opcode name. * - * @return non-null; the opcode name + * @return {@code non-null;} the opcode name */ public String getName() { return name; @@ -127,7 +127,7 @@ public final class Dop { * Gets the opcode for the opposite test of this instance. This is only * valid for opcodes which are in fact tests. * - * @return non-null; the opposite test + * @return {@code non-null;} the opposite test */ public Dop getOppositeTest() { switch (opcode) { diff --git a/dx/src/com/android/dx/dex/code/Dops.java b/dx/src/com/android/dx/dex/code/Dops.java index 8923c59bf..dfdaa7378 100644 --- a/dx/src/com/android/dx/dex/code/Dops.java +++ b/dx/src/com/android/dx/dex/code/Dops.java @@ -47,7 +47,7 @@ import com.android.dx.dex.code.form.SpecialFormat; * them. */ public final class Dops { - /** non-null; array containing all the standard instances */ + /** {@code non-null;} array containing all the standard instances */ private static final Dop[] DOPS; /** @@ -1172,8 +1172,8 @@ public final class Dops { /** * Gets the {@link Dop} for the given opcode value. * - * @param opcode DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value - * @return non-null; the associated opcode instance + * @param opcode {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value + * @return {@code non-null;} the associated opcode instance */ public static Dop get(int opcode) { int idx = opcode - DalvOps.MIN_VALUE; @@ -1194,9 +1194,9 @@ public final class Dops { * Gets the {@link Dop} with the given family/format combination, if * any. * - * @param family DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family - * @param format non-null; the opcode's instruction format - * @return null-ok; the corresponding opcode, or <code>null</code> if + * @param family {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family + * @param format {@code non-null;} the opcode's instruction format + * @return {@code null-ok;} the corresponding opcode, or {@code null} if * there is none */ public static Dop getOrNull(int family, InsnFormat format) { @@ -1222,7 +1222,7 @@ public final class Dops { /** * Puts the given opcode into the table of all ops. * - * @param opcode non-null; the opcode + * @param opcode {@code non-null;} the opcode */ private static void set(Dop opcode) { int idx = opcode.getOpcode() - DalvOps.MIN_VALUE; diff --git a/dx/src/com/android/dx/dex/code/FixedSizeInsn.java b/dx/src/com/android/dx/dex/code/FixedSizeInsn.java index 63c9d2407..147937f9e 100644 --- a/dx/src/com/android/dx/dex/code/FixedSizeInsn.java +++ b/dx/src/com/android/dx/dex/code/FixedSizeInsn.java @@ -28,17 +28,17 @@ import com.android.dx.util.AnnotatedOutput; public abstract class FixedSizeInsn extends DalvInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * * <p><b>Note:</b> In the unlikely event that an instruction takes - * absolutely no registers (e.g., a <code>nop</code> or a + * absolutely no registers (e.g., a {@code nop} or a * no-argument no-result * static method call), then the given * register list may be passed as {@link * RegisterSpecList#EMPTY}.</p> * * @param opcode the opcode; one of the constants from {@link Dops} - * @param position non-null; source position - * @param registers non-null; register list, including a + * @param position {@code non-null;} source position + * @param registers {@code non-null;} register list, including a * result register if appropriate (that is, registers may be either * ins or outs) */ diff --git a/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java b/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java index 458bc893d..915536795 100644 --- a/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java +++ b/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java @@ -24,21 +24,21 @@ import com.android.dx.util.AnnotatedOutput; /** * Combination instruction which turns into a variable number of - * <code>move*</code> instructions to move a set of registers into - * registers starting at <code>0</code> sequentially. This is used + * {@code move*} instructions to move a set of registers into + * registers starting at {@code 0} sequentially. This is used * in translating an instruction whose register requirements cannot * be met using a straightforward choice of a single opcode. */ public final class HighRegisterPrefix extends VariableSizeInsn { - /** null-ok; cached instructions, if constructed */ + /** {@code null-ok;} cached instructions, if constructed */ private SimpleInsn[] insns; /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param registers non-null; source registers + * @param position {@code non-null;} source position + * @param registers {@code non-null;} source registers */ public HighRegisterPrefix(SourcePosition position, RegisterSpecList registers) { @@ -135,9 +135,9 @@ public final class HighRegisterPrefix extends VariableSizeInsn { * Returns the proper move instruction for the given source spec * and destination index. * - * @param src non-null; the source register spec - * @param destIndex >= 0; the destination register index - * @return non-null; the appropriate move instruction + * @param src {@code non-null;} the source register spec + * @param destIndex {@code >= 0;} the destination register index + * @return {@code non-null;} the appropriate move instruction */ private static SimpleInsn moveInsnFor(RegisterSpec src, int destIndex) { return DalvInsn.makeMove(SourcePosition.NO_INFO, diff --git a/dx/src/com/android/dx/dex/code/InsnFormat.java b/dx/src/com/android/dx/dex/code/InsnFormat.java index ed4137b3f..ca6688bd3 100644 --- a/dx/src/com/android/dx/dex/code/InsnFormat.java +++ b/dx/src/com/android/dx/dex/code/InsnFormat.java @@ -37,10 +37,10 @@ public abstract class InsnFormat { * dump, of the given instruction. The instruction must be of this * instance's format for proper operation. * - * @param insn non-null; the instruction + * @param insn {@code non-null;} the instruction * @param noteIndices whether to include an explicit notation of * constant pool indices - * @return non-null; the string form + * @return {@code non-null;} the string form */ public final String listingString(DalvInsn insn, boolean noteIndices) { String op = insn.getOpcode().getName(); @@ -66,28 +66,28 @@ public abstract class InsnFormat { /** * Returns the string form of the arguments to the given instruction. * The instruction must be of this instance's format. If the instruction - * has no arguments, then the result should be <code>""</code>, not - * <code>null</code>. + * has no arguments, then the result should be {@code ""}, not + * {@code null}. * * <p>Subclasses must override this method.</p> * - * @param insn non-null; the instruction - * @return non-null; the string form + * @param insn {@code non-null;} the instruction + * @return {@code non-null;} the string form */ public abstract String insnArgString(DalvInsn insn); /** * Returns the associated comment for the given instruction, if any. * The instruction must be of this instance's format. If the instruction - * has no comment, then the result should be <code>""</code>, not - * <code>null</code>. + * has no comment, then the result should be {@code ""}, not + * {@code null}. * * <p>Subclasses must override this method.</p> * - * @param insn non-null; the instruction + * @param insn {@code non-null;} the instruction * @param noteIndices whether to include an explicit notation of * constant pool indices - * @return non-null; the string form + * @return {@code non-null;} the string form */ public abstract String insnCommentString(DalvInsn insn, boolean noteIndices); @@ -97,7 +97,7 @@ public abstract class InsnFormat { * size is a number of 16-bit code units, not bytes. This should * throw an exception if this format is of variable size. * - * @return >= 0; the instruction length in 16-bit code units + * @return {@code >= 0;} the instruction length in 16-bit code units */ public abstract int codeSize(); @@ -112,24 +112,24 @@ public abstract class InsnFormat { * * <p>Subclasses must override this method.</p> * - * @param insn non-null; the instruction to check - * @return <code>true</code> iff the instruction's arguments are - * appropriate for this instance, or <code>false</code> if not + * @param insn {@code non-null;} the instruction to check + * @return {@code true} iff the instruction's arguments are + * appropriate for this instance, or {@code false} if not */ public abstract boolean isCompatible(DalvInsn insn); /** * Returns whether or not the given instruction's branch offset will - * fit in this instance's format. This always returns <code>false</code> + * fit in this instance's format. This always returns {@code false} * for formats that don't include a branch offset. * * <p>The default implementation of this method always returns - * <code>false</code>. Subclasses must override this method if they + * {@code false}. Subclasses must override this method if they * include branch offsets.</p> * - * @param insn non-null; the instruction to check - * @return <code>true</code> iff the instruction's branch offset is - * appropriate for this instance, or <code>false</code> if not + * @param insn {@code non-null;} the instruction to check + * @return {@code true} iff the instruction's branch offset is + * appropriate for this instance, or {@code false} if not */ public boolean branchFits(TargetInsn insn) { return false; @@ -141,7 +141,7 @@ public abstract class InsnFormat { * * <p>Subclasses must override this method.</p> * - * @return null-ok; the next format to try, or <code>null</code> if + * @return {@code null-ok;} the next format to try, or {@code null} if * there are no suitable alternatives */ public abstract InsnFormat nextUp(); @@ -152,16 +152,16 @@ public abstract class InsnFormat { * * <p>Subclasses must override this method.</p> * - * @param out non-null; the output destination to write to - * @param insn non-null; the instruction to write + * @param out {@code non-null;} the output destination to write to + * @param insn {@code non-null;} the instruction to write */ public abstract void writeTo(AnnotatedOutput out, DalvInsn insn); /** * Helper method to return a register list string. * - * @param list non-null; the list of registers - * @return non-null; the string form + * @param list {@code non-null;} the list of registers + * @return {@code non-null;} the string form */ protected static String regListString(RegisterSpecList list) { int sz = list.size(); @@ -185,7 +185,7 @@ public abstract class InsnFormat { * Helper method to return a literal bits argument string. * * @param value the value - * @return non-null; the string form + * @return {@code non-null;} the string form */ protected static String literalBitsString(CstLiteralBits value) { StringBuffer sb = new StringBuffer(100); @@ -208,8 +208,8 @@ public abstract class InsnFormat { * * @param value the value * @param width the width of the constant, in bits (used for displaying - * the uninterpreted bits; one of: <code>4 8 16 32 64</code> - * @return non-null; the comment + * the uninterpreted bits; one of: {@code 4 8 16 32 64} + * @return {@code non-null;} the comment */ protected static String literalBitsComment(CstLiteralBits value, int width) { @@ -242,8 +242,8 @@ public abstract class InsnFormat { /** * Helper method to return a branch address string. * - * @param insn non-null; the instruction in question - * @return non-null; the string form of the instruction's branch target + * @param insn {@code non-null;} the instruction in question + * @return {@code non-null;} the string form of the instruction's branch target */ protected static String branchString(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; @@ -255,8 +255,8 @@ public abstract class InsnFormat { /** * Helper method to return the comment for a branch. * - * @param insn non-null; the instruction in question - * @return non-null; the comment + * @param insn {@code non-null;} the instruction in question + * @return {@code non-null;} the comment */ protected static String branchComment(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; @@ -268,8 +268,8 @@ public abstract class InsnFormat { /** * Helper method to return a constant string. * - * @param insn non-null; a constant-bearing instruction - * @return non-null; the string form of the contained constant + * @param insn {@code non-null;} a constant-bearing instruction + * @return {@code non-null;} the string form of the contained constant */ protected static String cstString(DalvInsn insn) { CstInsn ci = (CstInsn) insn; @@ -281,8 +281,8 @@ public abstract class InsnFormat { /** * Helper method to return an instruction comment for a constant. * - * @param insn non-null; a constant-bearing instruction - * @return non-null; comment string representing the constant + * @param insn {@code non-null;} a constant-bearing instruction + * @return {@code non-null;} comment string representing the constant */ protected static String cstComment(DalvInsn insn) { CstInsn ci = (CstInsn) insn; @@ -310,7 +310,7 @@ public abstract class InsnFormat { * Helper method to determine if a signed int value fits in a nibble. * * @param value the value in question - * @return <code>true</code> iff it's in the range -8..+7 + * @return {@code true} iff it's in the range -8..+7 */ protected static boolean signedFitsInNibble(int value) { return (value >= -8) && (value <= 7); @@ -320,7 +320,7 @@ public abstract class InsnFormat { * Helper method to determine if an unsigned int value fits in a nibble. * * @param value the value in question - * @return <code>true</code> iff it's in the range 0..0xf + * @return {@code true} iff it's in the range 0..0xf */ protected static boolean unsignedFitsInNibble(int value) { return value == (value & 0xf); @@ -330,7 +330,7 @@ public abstract class InsnFormat { * Helper method to determine if a signed int value fits in a byte. * * @param value the value in question - * @return <code>true</code> iff it's in the range -0x80..+0x7f + * @return {@code true} iff it's in the range -0x80..+0x7f */ protected static boolean signedFitsInByte(int value) { return (byte) value == value; @@ -340,7 +340,7 @@ public abstract class InsnFormat { * Helper method to determine if an unsigned int value fits in a byte. * * @param value the value in question - * @return <code>true</code> iff it's in the range 0..0xff + * @return {@code true} iff it's in the range 0..0xff */ protected static boolean unsignedFitsInByte(int value) { return value == (value & 0xff); @@ -350,7 +350,7 @@ public abstract class InsnFormat { * Helper method to determine if a signed int value fits in a short. * * @param value the value in question - * @return <code>true</code> iff it's in the range -0x8000..+0x7fff + * @return {@code true} iff it's in the range -0x8000..+0x7fff */ protected static boolean signedFitsInShort(int value) { return (short) value == value; @@ -360,7 +360,7 @@ public abstract class InsnFormat { * Helper method to determine if an unsigned int value fits in a short. * * @param value the value in question - * @return <code>true</code> iff it's in the range 0..0xffff + * @return {@code true} iff it's in the range 0..0xffff */ protected static boolean unsignedFitsInShort(int value) { return value == (value & 0xffff); @@ -370,7 +370,7 @@ public abstract class InsnFormat { * Helper method to determine if a signed int value fits in three bytes. * * @param value the value in question - * @return <code>true</code> iff it's in the range -0x800000..+0x7fffff + * @return {@code true} iff it's in the range -0x800000..+0x7fffff */ protected static boolean signedFitsIn3Bytes(int value) { return value == ((value << 8) >> 8); @@ -380,8 +380,8 @@ public abstract class InsnFormat { * Helper method to extract the callout-argument index from an * appropriate instruction. * - * @param insn non-null; the instruction - * @return >= 0; the callout argument index + * @param insn {@code non-null;} the instruction + * @return {@code >= 0;} the callout argument index */ protected static int argIndex(DalvInsn insn) { int arg = ((CstInteger) ((CstInsn) insn).getConstant()).getValue(); @@ -397,8 +397,8 @@ public abstract class InsnFormat { * Helper method to combine an opcode and a second byte of data into * the appropriate form for emitting into a code buffer. * - * @param insn non-null; the instruction containing the opcode - * @param arg 0..255; arbitrary other byte value + * @param insn {@code non-null;} the instruction containing the opcode + * @param arg {@code 0..255;} arbitrary other byte value * @return combined value */ protected static short opcodeUnit(DalvInsn insn, int arg) { @@ -418,8 +418,8 @@ public abstract class InsnFormat { /** * Helper method to combine two bytes into a code unit. * - * @param low 0..255; low byte - * @param high 0..255; high byte + * @param low {@code 0..255;} low byte + * @param high {@code 0..255;} high byte * @return combined value */ protected static short codeUnit(int low, int high) { @@ -437,10 +437,10 @@ public abstract class InsnFormat { /** * Helper method to combine four nibbles into a code unit. * - * @param n0 0..15; low nibble - * @param n1 0..15; medium-low nibble - * @param n2 0..15; medium-high nibble - * @param n3 0..15; high nibble + * @param n0 {@code 0..15;} low nibble + * @param n1 {@code 0..15;} medium-low nibble + * @param n2 {@code 0..15;} medium-high nibble + * @param n3 {@code 0..15;} high nibble * @return combined value */ protected static short codeUnit(int n0, int n1, int n2, int n3) { @@ -466,9 +466,9 @@ public abstract class InsnFormat { /** * Helper method to combine two nibbles into a byte. * - * @param low 0..15; low nibble - * @param high 0..15; high nibble - * @return 0..255; combined value + * @param low {@code 0..15;} low nibble + * @param high {@code 0..15;} high nibble + * @return {@code 0..255;} combined value */ protected static int makeByte(int low, int high) { if ((low & 0xf) != low) { @@ -485,7 +485,7 @@ public abstract class InsnFormat { /** * Writes one code unit to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write */ protected static void write(AnnotatedOutput out, short c0) { @@ -495,7 +495,7 @@ public abstract class InsnFormat { /** * Writes two code units to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write * @param c1 code unit to write */ @@ -507,7 +507,7 @@ public abstract class InsnFormat { /** * Writes three code units to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write * @param c1 code unit to write * @param c2 code unit to write @@ -522,7 +522,7 @@ public abstract class InsnFormat { /** * Writes four code units to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write * @param c1 code unit to write * @param c2 code unit to write @@ -539,7 +539,7 @@ public abstract class InsnFormat { /** * Writes five code units to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write * @param c1 code unit to write * @param c2 code unit to write @@ -558,7 +558,7 @@ public abstract class InsnFormat { /** * Writes six code units to the given output destination. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to * @param c0 code unit to write * @param c1 code unit to write * @param c2 code unit to write diff --git a/dx/src/com/android/dx/dex/code/LocalEnd.java b/dx/src/com/android/dx/dex/code/LocalEnd.java index c19a8dcec..360a55cde 100644 --- a/dx/src/com/android/dx/dex/code/LocalEnd.java +++ b/dx/src/com/android/dx/dex/code/LocalEnd.java @@ -28,7 +28,7 @@ import com.android.dx.rop.code.SourcePosition; */ public final class LocalEnd extends ZeroSizeInsn { /** - * non-null; register spec representing the local variable ended + * {@code non-null;} register spec representing the local variable ended * by this instance. <b>Note:</b> Technically, only the register * number needs to be recorded here as the rest of the information * is implicit in the ambient local variable state, but other code @@ -38,10 +38,10 @@ public final class LocalEnd extends ZeroSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param local non-null; register spec representing the local + * @param position {@code non-null;} source position + * @param local {@code non-null;} register spec representing the local * variable introduced by this instance */ public LocalEnd(SourcePosition position, RegisterSpec local) { @@ -70,7 +70,7 @@ public final class LocalEnd extends ZeroSizeInsn { * Gets the register spec representing the local variable ended * by this instance. * - * @return non-null; the register spec + * @return {@code non-null;} the register spec */ public RegisterSpec getLocal() { return local; diff --git a/dx/src/com/android/dx/dex/code/LocalList.java b/dx/src/com/android/dx/dex/code/LocalList.java index 4614fc41e..93e7c3f61 100644 --- a/dx/src/com/android/dx/dex/code/LocalList.java +++ b/dx/src/com/android/dx/dex/code/LocalList.java @@ -33,16 +33,16 @@ import java.util.Arrays; * and a type. */ public final class LocalList extends FixedSizeList { - /** non-null; empty instance */ + /** {@code non-null;} empty instance */ public static final LocalList EMPTY = new LocalList(0); /** whether to run the self-check code */ private static final boolean DEBUG = false; - + /** - * Constructs an instance. All indices initially contain <code>null</code>. - * - * @param size >= 0; the size of the list + * Constructs an instance. All indices initially contain {@code null}. + * + * @param size {@code >= 0;} the size of the list */ public LocalList(int size) { super(size); @@ -51,10 +51,10 @@ public final class LocalList extends FixedSizeList { /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. - * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * do that, this will throw {@code NullPointerException}. + * + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Entry get(int n) { return (Entry) get0(n); @@ -62,9 +62,9 @@ public final class LocalList extends FixedSizeList { /** * Sets the entry at the given index. - * - * @param n >= 0, < size(); which index - * @param entry non-null; the entry to set at <code>n</code> + * + * @param n {@code >= 0, < size();} which index + * @param entry {@code non-null;} the entry to set at {@code n} */ public void set(int n, Entry entry) { set0(n, entry); @@ -72,9 +72,9 @@ public final class LocalList extends FixedSizeList { /** * Does a human-friendly dump of this instance. - * - * @param out non-null; where to dump - * @param prefix non-null; prefix to attach to each line of output + * + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} prefix to attach to each line of output */ public void debugPrint(PrintStream out, String prefix) { int sz = size(); @@ -90,7 +90,7 @@ public final class LocalList extends FixedSizeList { */ public static enum Disposition { /** local started (introduced) */ - START, + START, /** local ended without being replaced */ END_SIMPLY, @@ -118,24 +118,25 @@ public final class LocalList extends FixedSizeList { * Entry in a local list. */ public static class Entry implements Comparable<Entry> { - /** >= 0; address */ + /** {@code >= 0;} address */ private final int address; - /** non-null; disposition of the local */ + /** {@code non-null;} disposition of the local */ private final Disposition disposition; - /** non-null; register spec representing the variable */ + /** {@code non-null;} register spec representing the variable */ private final RegisterSpec spec; - /** non-null; variable type (derived from {@code spec}) */ + /** {@code non-null;} variable type (derived from {@code spec}) */ private final CstType type; - + /** * Constructs an instance. - * - * @param address >= 0; address - * @param disposition non-null; disposition of the local - * @param spec non-null; register spec representing the variable + * + * @param address {@code >= 0;} address + * @param disposition {@code non-null;} disposition of the local + * @param spec {@code non-null;} register spec representing + * the variable */ public Entry(int address, Disposition disposition, RegisterSpec spec) { if (address < 0) { @@ -181,9 +182,9 @@ public final class LocalList extends FixedSizeList { * Compares by (in priority order) address, end then start * disposition (variants of end are all consistered * equivalent), and spec. - * - * @param other non-null; entry to compare to - * @return {@code -1..1}; standard result of comparison + * + * @param other {@code non-null;} entry to compare to + * @return {@code -1..1;} standard result of comparison */ public int compareTo(Entry other) { if (address < other.address) { @@ -194,7 +195,7 @@ public final class LocalList extends FixedSizeList { boolean thisIsStart = isStart(); boolean otherIsStart = other.isStart(); - + if (thisIsStart != otherIsStart) { return thisIsStart ? 1 : -1; } @@ -204,8 +205,8 @@ public final class LocalList extends FixedSizeList { /** * Gets the address. - * - * @return >= 0; the address + * + * @return {@code >= 0;} the address */ public int getAddress() { return address; @@ -213,8 +214,8 @@ public final class LocalList extends FixedSizeList { /** * Gets the disposition. - * - * @return non-null; the disposition + * + * @return {@code non-null;} the disposition */ public Disposition getDisposition() { return disposition; @@ -223,7 +224,7 @@ public final class LocalList extends FixedSizeList { /** * Gets whether this is a local start. This is just shorthand for * {@code getDisposition() == Disposition.START}. - * + * * @return {@code true} iff this is a start */ public boolean isStart() { @@ -232,8 +233,8 @@ public final class LocalList extends FixedSizeList { /** * Gets the variable name. - * - * @return null-ok; the variable name + * + * @return {@code null-ok;} the variable name */ public CstUtf8 getName() { return spec.getLocalItem().getName(); @@ -242,7 +243,7 @@ public final class LocalList extends FixedSizeList { /** * Gets the variable signature. * - * @return null-ok; the variable signature + * @return {@code null-ok;} the variable signature */ public CstUtf8 getSignature() { return spec.getLocalItem().getSignature(); @@ -250,8 +251,8 @@ public final class LocalList extends FixedSizeList { /** * Gets the variable's type. - * - * @return non-null; the type + * + * @return {@code non-null;} the type */ public CstType getType() { return type; @@ -259,8 +260,9 @@ public final class LocalList extends FixedSizeList { /** * Gets the number of the register holding the variable. - * - * @return >= 0; the number fo the register holding the variable + * + * @return {@code >= 0;} the number of the register holding + * the variable */ public int getRegister() { return spec.getReg(); @@ -269,7 +271,7 @@ public final class LocalList extends FixedSizeList { /** * Gets the RegisterSpec of the register holding the variable. * - * @return non-null; RegisterSpec of the holding register. + * @return {@code non-null;} RegisterSpec of the holding register. */ public RegisterSpec getRegisterSpec() { return spec; @@ -277,10 +279,10 @@ public final class LocalList extends FixedSizeList { /** * Returns whether or not this instance matches the given spec. - * - * @param spec non-null; the spec in question - * @return <code>true</code> iff this instance matches - * <code>spec</code> + * + * @param spec {@code non-null;} the spec in question + * @return {@code true} iff this instance matches + * {@code spec} */ public boolean matches(RegisterSpec otherSpec) { return spec.equalsUsingSimpleType(otherSpec); @@ -290,9 +292,9 @@ public final class LocalList extends FixedSizeList { * Returns whether or not this instance matches the spec in * the given instance. * - * @param other non-null; another entry - * @return <code>true</code> iff this instance's spec matches - * <code>other</code> + * @param other {@code non-null;} another entry + * @return {@code true} iff this instance's spec matches + * {@code other} */ public boolean matches(Entry other) { return matches(other.spec); @@ -300,26 +302,26 @@ public final class LocalList extends FixedSizeList { /** * Returns an instance just like this one but with the disposition - * set as given - * - * @param disposition non-null; the new disposition - * @return non-null; an appropriately-constructed instance + * set as given. + * + * @param disposition {@code non-null;} the new disposition + * @return {@code non-null;} an appropriately-constructed instance */ public Entry withDisposition(Disposition disposition) { if (disposition == this.disposition) { return this; } - + return new Entry(address, disposition, spec); } } - + /** * Constructs an instance for the given method, based on the given * block order and intermediate local information. - * - * @param insns non-null; instructions to convert - * @return non-null; the constructed list + * + * @param insns {@code non-null;} instructions to convert + * @return {@code non-null;} the constructed list */ public static LocalList make(DalvInsnList insns) { int sz = insns.size(); @@ -330,8 +332,8 @@ public final class LocalList extends FixedSizeList { * into separate per-variable starts, adding explicit ends * wherever a variable is replaced or moved, and collecting * these and all the other local variable "activity" - * together into an output list (without the other insns). - * + * together into an output list (without the other insns). + * * Note: As of this writing, this method won't be handed any * insn lists that contain local ends, but I (danfuzz) expect * that to change at some point, when we start feeding that @@ -382,9 +384,9 @@ public final class LocalList extends FixedSizeList { } throw ex; } - + } - + /** * Helper for {@link #debugVerify} which does most of the work. */ @@ -411,7 +413,7 @@ public final class LocalList extends FixedSizeList { throw new RuntimeException("redundant end at " + Integer.toHexString(e.getAddress())); } - + int addr = e.getAddress(); boolean foundStart = false; @@ -433,7 +435,7 @@ public final class LocalList extends FixedSizeList { throw new RuntimeException( "redundant end at " + Integer.toHexString(addr)); - } + } } } @@ -443,7 +445,7 @@ public final class LocalList extends FixedSizeList { "improper end replacement claim at " + Integer.toHexString(addr)); } - + active[reg] = null; } } @@ -453,31 +455,25 @@ public final class LocalList extends FixedSizeList { * Intermediate state when constructing a local list. */ public static class MakeState { - /** non-null; result being collected */ + /** {@code non-null;} result being collected */ private final ArrayList<Entry> result; /** - * >= 0; running count of nulled result entries, to help with + * {@code >= 0;} running count of nulled result entries, to help with * sizing the final list */ private int nullResultCount; - /** null-ok; current register mappings */ + /** {@code null-ok;} current register mappings */ private RegisterSpecSet regs; - /** null-ok; result indices where local ends are stored */ + /** {@code null-ok;} result indices where local ends are stored */ private int[] endIndices; - /** >= 0; last address seen */ + /** {@code >= 0;} last address seen */ private int lastAddress; /** - * >= 0; result index where the first element for the most - * recent address is stored - */ - private int startIndexForAddress; - - /** * Constructs an instance. */ public MakeState(int initialSize) { @@ -486,19 +482,18 @@ public final class LocalList extends FixedSizeList { regs = null; endIndices = null; lastAddress = 0; - startIndexForAddress = 0; } /** * Checks the address and other vitals as a prerequisite to * further processing. * - * @param address >= 0; address about to be processed - * @param reg >= 0; register number about to be processed + * @param address {@code >= 0;} address about to be processed + * @param reg {@code >= 0;} register number about to be processed */ private void aboutToProcess(int address, int reg) { boolean first = (endIndices == null); - + if ((address == lastAddress) && !first) { return; } @@ -534,11 +529,15 @@ public final class LocalList extends FixedSizeList { * Sets the local state at the given address to the given snapshot. * The first call on this instance must be to this method, so that * the register state can be properly sized. - * - * @param address >= 0; the address - * @param specs non-null; spec set representing the locals + * + * @param address {@code >= 0;} the address + * @param specs {@code non-null;} spec set representing the locals */ public void snapshot(int address, RegisterSpecSet specs) { + if (DEBUG) { + System.err.printf("%04x snapshot %s\n", address, specs); + } + int sz = specs.getMaxSize(); aboutToProcess(address, sz - 1); @@ -557,15 +556,24 @@ public final class LocalList extends FixedSizeList { startLocal(address, newSpec); } } + + if (DEBUG) { + System.err.printf("%04x snapshot done\n", address); + } } - + /** * Starts a local at the given address. - * - * @param address >= 0; the address - * @param startedLocal non-null; spec representing the started local + * + * @param address {@code >= 0;} the address + * @param startedLocal {@code non-null;} spec representing the + * started local */ public void startLocal(int address, RegisterSpec startedLocal) { + if (DEBUG) { + System.err.printf("%04x start %s\n", address, startedLocal); + } + int regNum = startedLocal.getReg(); startedLocal = filterSpec(startedLocal); @@ -588,7 +596,7 @@ public final class LocalList extends FixedSizeList { } int endAt = endIndices[regNum]; - + if (existingLocal != null) { /* * There is an existing (but non-matching) local. @@ -633,8 +641,8 @@ public final class LocalList extends FixedSizeList { } } } - - /* + + /* * The code above didn't find and remove an unnecessary * local end, so we now have to add one or more entries to * the output to capture the transition. @@ -672,17 +680,36 @@ public final class LocalList extends FixedSizeList { * if any (that is, if the local migrates from vX to vY, * we should note that as a local end in vX). */ - + add(address, Disposition.START, startedLocal); } /** - * Ends a local at the given address. + * Ends a local at the given address, using the disposition + * {@code END_SIMPLY}. * - * @param address >= 0; the address - * @param endedLocal non-null; spec representing the local being ended + * @param address {@code >= 0;} the address + * @param endedLocal {@code non-null;} spec representing the + * local being ended */ public void endLocal(int address, RegisterSpec endedLocal) { + endLocal(address, endedLocal, Disposition.END_SIMPLY); + } + + /** + * Ends a local at the given address. + * + * @param address {@code >= 0;} the address + * @param endedLocal {@code non-null;} spec representing the + * local being ended + * @param disposition reason for the end + */ + public void endLocal(int address, RegisterSpec endedLocal, + Disposition disposition) { + if (DEBUG) { + System.err.printf("%04x end %s\n", address, endedLocal); + } + int regNum = endedLocal.getReg(); endedLocal = filterSpec(endedLocal); @@ -703,7 +730,7 @@ public final class LocalList extends FixedSizeList { return; } - add(address, Disposition.END_SIMPLY, endedLocal); + add(address, disposition, endedLocal); } /** @@ -714,9 +741,10 @@ public final class LocalList extends FixedSizeList { * active), update the {@link #endIndices} to be accurate, and * if needed update the newly-active end to reflect an altered * disposition. - * - * @param address >= 0; the address - * @param endedLocal non-null; spec representing the local being ended + * + * @param address {@code >= 0;} the address + * @param endedLocal {@code non-null;} spec representing the + * local being ended * @return {@code true} iff this method found the case in question * and adjusted things accordingly */ @@ -747,7 +775,7 @@ public final class LocalList extends FixedSizeList { * In fact, we found that the endedLocal had started at the * same address, so do all the requisite cleanup. */ - + regs.remove(endedLocal); result.set(at, null); nullResultCount++; @@ -773,7 +801,7 @@ public final class LocalList extends FixedSizeList { if (found) { // We found an end for the same register. endIndices[regNum] = at; - + if (entry.getAddress() == address) { /* * It's still the same address, so update the @@ -793,13 +821,13 @@ public final class LocalList extends FixedSizeList { * null" type into simply {@code Object}. This method needs to * be called for any spec that is on its way into a locals * list. - * + * * <p>This isn't necessarily the cleanest way to achieve the * goal of not representing known nulls in a locals list, but * it gets the job done.</p> - * - * @param orig null-ok; the original spec - * @return null-ok; an appropriately modified spec, or the + * + * @param orig {@code null-ok;} the original spec + * @return {@code null-ok;} an appropriately modified spec, or the * original if nothing needs to be done */ private static RegisterSpec filterSpec(RegisterSpec orig) { @@ -814,9 +842,9 @@ public final class LocalList extends FixedSizeList { * Adds an entry to the result, updating the adjunct tables * accordingly. * - * @param address >= 0; the address - * @param disposition non-null; the disposition - * @param spec non-null; spec representing the local + * @param address {@code >= 0;} the address + * @param disposition {@code non-null;} the disposition + * @param spec {@code non-null;} spec representing the local */ private void add(int address, Disposition disposition, RegisterSpec spec) { @@ -834,11 +862,13 @@ public final class LocalList extends FixedSizeList { } /** - * Adds or updates an end local (changing its disposition). - * - * @param address >= 0; the address - * @param disposition non-null; the disposition - * @param spec non-null; spec representing the local + * Adds or updates an end local (changing its disposition). If + * this would cause an empty range for a local, this instead + * removes the local entirely. + * + * @param address {@code >= 0;} the address + * @param disposition {@code non-null;} the disposition + * @param spec {@code non-null;} spec representing the local */ private void addOrUpdateEnd(int address, Disposition disposition, RegisterSpec spec) { @@ -850,29 +880,34 @@ public final class LocalList extends FixedSizeList { int endAt = endIndices[regNum]; if (endAt >= 0) { + // There is a previous end. Entry endEntry = result.get(endAt); if ((endEntry.getAddress() == address) && endEntry.getRegisterSpec().equals(spec)) { + /* + * The end is for the right address and variable, so + * update it. + */ result.set(endAt, endEntry.withDisposition(disposition)); - regs.remove(spec); + regs.remove(spec); // TODO: Is this line superfluous? return; } } - - add(address, disposition, spec); + + endLocal(address, spec, disposition); } /** * Finishes processing altogether and gets the result. - * - * @return non-null; the result list + * + * @return {@code non-null;} the result list */ public LocalList finish() { aboutToProcess(Integer.MAX_VALUE, 0); int resultSz = result.size(); int finalSz = resultSz - nullResultCount; - + if (finalSz == 0) { return EMPTY; } @@ -909,5 +944,5 @@ public final class LocalList extends FixedSizeList { resultList.setImmutable(); return resultList; } - } + } } diff --git a/dx/src/com/android/dx/dex/code/LocalSnapshot.java b/dx/src/com/android/dx/dex/code/LocalSnapshot.java index 19a9baa35..409ad15bd 100644 --- a/dx/src/com/android/dx/dex/code/LocalSnapshot.java +++ b/dx/src/com/android/dx/dex/code/LocalSnapshot.java @@ -27,15 +27,15 @@ import com.android.dx.rop.code.SourcePosition; * the instance in an instruction array. */ public final class LocalSnapshot extends ZeroSizeInsn { - /** non-null; local state associated with this instance */ + /** {@code non-null;} local state associated with this instance */ private final RegisterSpecSet locals; /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param locals non-null; associated local variable state + * @param position {@code non-null;} source position + * @param locals {@code non-null;} associated local variable state */ public LocalSnapshot(SourcePosition position, RegisterSpecSet locals) { super(position); @@ -62,7 +62,7 @@ public final class LocalSnapshot extends ZeroSizeInsn { /** * Gets the local state associated with this instance. * - * @return non-null; the state + * @return {@code non-null;} the state */ public RegisterSpecSet getLocals() { return locals; diff --git a/dx/src/com/android/dx/dex/code/LocalStart.java b/dx/src/com/android/dx/dex/code/LocalStart.java index 22e20f80d..ec70e3011 100644 --- a/dx/src/com/android/dx/dex/code/LocalStart.java +++ b/dx/src/com/android/dx/dex/code/LocalStart.java @@ -28,7 +28,7 @@ import com.android.dx.rop.code.SourcePosition; */ public final class LocalStart extends ZeroSizeInsn { /** - * non-null; register spec representing the local variable introduced + * {@code non-null;} register spec representing the local variable introduced * by this instance */ private final RegisterSpec local; @@ -36,8 +36,8 @@ public final class LocalStart extends ZeroSizeInsn { /** * Returns the local variable listing string for a single register spec. * - * @param spec non-null; the spec to convert - * @return non-null; the string form + * @param spec {@code non-null;} the spec to convert + * @return {@code non-null;} the string form */ public static String localString(RegisterSpec spec) { return spec.regString() + ' ' + spec.getLocalItem().toString() + ": " + @@ -46,10 +46,10 @@ public final class LocalStart extends ZeroSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param local non-null; register spec representing the local + * @param position {@code non-null;} source position + * @param local {@code non-null;} register spec representing the local * variable introduced by this instance */ public LocalStart(SourcePosition position, RegisterSpec local) { @@ -78,7 +78,7 @@ public final class LocalStart extends ZeroSizeInsn { * Gets the register spec representing the local variable introduced * by this instance. * - * @return non-null; the register spec + * @return {@code non-null;} the register spec */ public RegisterSpec getLocal() { return local; diff --git a/dx/src/com/android/dx/dex/code/OddSpacer.java b/dx/src/com/android/dx/dex/code/OddSpacer.java index f99df3629..727def04b 100644 --- a/dx/src/com/android/dx/dex/code/OddSpacer.java +++ b/dx/src/com/android/dx/dex/code/OddSpacer.java @@ -21,7 +21,7 @@ import com.android.dx.rop.code.SourcePosition; import com.android.dx.util.AnnotatedOutput; /** - * Pseudo-instruction which either turns into a <code>nop</code> or + * Pseudo-instruction which either turns into a {@code nop} or * nothingness, in order to make the subsequent instruction have an * even address. This is used to align (subsequent) instructions that * require it. @@ -29,9 +29,9 @@ import com.android.dx.util.AnnotatedOutput; public final class OddSpacer extends VariableSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position + * @param position {@code non-null;} source position */ public OddSpacer(SourcePosition position) { super(position, RegisterSpecList.EMPTY); diff --git a/dx/src/com/android/dx/dex/code/OutputCollector.java b/dx/src/com/android/dx/dex/code/OutputCollector.java index 98d8a9cd0..264337378 100644 --- a/dx/src/com/android/dx/dex/code/OutputCollector.java +++ b/dx/src/com/android/dx/dex/code/OutputCollector.java @@ -28,13 +28,13 @@ import java.util.ArrayList; */ public final class OutputCollector { /** - * non-null; the associated finisher (which holds the instruction + * {@code non-null;} the associated finisher (which holds the instruction * list in-progress) */ private final OutputFinisher finisher; /** - * null-ok; suffix for the output, or <code>null</code> if the suffix + * {@code null-ok;} suffix for the output, or {@code null} if the suffix * has been appended to the main output (by {@link #appendSuffixToOutput}) */ private ArrayList<DalvInsn> suffix; @@ -42,10 +42,10 @@ public final class OutputCollector { /** * Constructs an instance. * - * @param initialCapacity >= 0; initial capacity of the output list - * @param suffixInitialCapacity >= 0; initial capacity of the output + * @param initialCapacity {@code >= 0;} initial capacity of the output list + * @param suffixInitialCapacity {@code >= 0;} initial capacity of the output * suffix - * @param regCount >= 0; register count for the method + * @param regCount {@code >= 0;} register count for the method */ public OutputCollector(int initialCapacity, int suffixInitialCapacity, int regCount) { @@ -56,7 +56,7 @@ public final class OutputCollector { /** * Adds an instruction to the output. * - * @param insn non-null; the instruction to add + * @param insn {@code non-null;} the instruction to add */ public void add(DalvInsn insn) { finisher.add(insn); @@ -68,9 +68,9 @@ public final class OutputCollector { * indicated instruction really is a reversible branch. * * @param which how many instructions back to find the branch; - * <code>0</code> is the most recently added instruction, - * <code>1</code> is the instruction before that, etc. - * @param newTarget non-null; the new target for the reversed branch + * {@code 0} is the most recently added instruction, + * {@code 1} is the instruction before that, etc. + * @param newTarget {@code non-null;} the new target for the reversed branch */ public void reverseBranch(int which, CodeAddress newTarget) { finisher.reverseBranch(which, newTarget); @@ -79,7 +79,7 @@ public final class OutputCollector { /** * Adds an instruction to the output suffix. * - * @param insn non-null; the instruction to add + * @param insn {@code non-null;} the instruction to add */ public void addSuffix(DalvInsn insn) { suffix.add(insn); @@ -89,7 +89,7 @@ public final class OutputCollector { * Gets the results of all the calls on this instance, in the form of * an {@link OutputFinisher}. * - * @return non-null; the output finisher + * @return {@code non-null;} the output finisher * @throws UnsupportedOperationException if this method has * already been called */ diff --git a/dx/src/com/android/dx/dex/code/OutputFinisher.java b/dx/src/com/android/dx/dex/code/OutputFinisher.java index 73eecf82e..5b1d53313 100644 --- a/dx/src/com/android/dx/dex/code/OutputFinisher.java +++ b/dx/src/com/android/dx/dex/code/OutputFinisher.java @@ -37,12 +37,12 @@ import java.util.HashSet; */ public final class OutputFinisher { /** - * >= 0; register count for the method, not including any extra + * {@code >= 0;} register count for the method, not including any extra * "reserved" registers needed to translate "difficult" instructions */ private final int unreservedRegCount; - /** non-null; the list of instructions, per se */ + /** {@code non-null;} the list of instructions, per se */ private ArrayList<DalvInsn> insns; /** whether any instruction has position info */ @@ -52,7 +52,7 @@ public final class OutputFinisher { private boolean hasAnyLocalInfo; /** - * >= 0; the count of reserved registers (low-numbered + * {@code >= 0;} the count of reserved registers (low-numbered * registers used when expanding instructions that can't be * represented simply); becomes valid after a call to {@link * #massageInstructions} @@ -62,8 +62,8 @@ public final class OutputFinisher { /** * Constructs an instance. It initially contains no instructions. * - * @param regCount >= 0; register count for the method - * @param initialCapacity >= 0; initial capacity of the instructions + * @param regCount {@code >= 0;} register count for the method + * @param initialCapacity {@code >= 0;} initial capacity of the instructions * list */ public OutputFinisher(int initialCapacity, int regCount) { @@ -98,8 +98,8 @@ public final class OutputFinisher { * Helper for {@link #add} which scrutinizes a single * instruction for local variable information. * - * @param insn non-null; instruction to scrutinize - * @return <code>true</code> iff the instruction refers to any + * @param insn {@code non-null;} instruction to scrutinize + * @return {@code true} iff the instruction refers to any * named locals */ private static boolean hasLocalInfo(DalvInsn insn) { @@ -125,8 +125,8 @@ public final class OutputFinisher { * Helper for {@link #hasAnyLocalInfo} which scrutinizes a single * register spec. * - * @param spec non-null; spec to scrutinize - * @return <code>true</code> iff the spec refers to any + * @param spec {@code non-null;} spec to scrutinize + * @return {@code true} iff the spec refers to any * named locals */ private static boolean hasLocalInfo(RegisterSpec spec) { @@ -138,7 +138,7 @@ public final class OutputFinisher { * Returns the set of all constants referred to by instructions added * to this instance. * - * @return non-null; the set of constants + * @return {@code non-null;} the set of constants */ public HashSet<Constant> getAllConstants() { HashSet<Constant> result = new HashSet<Constant>(20); @@ -154,8 +154,8 @@ public final class OutputFinisher { * Helper for {@link #getAllConstants} which adds all the info for * a single instruction. * - * @param result non-null; result set to add to - * @param insn non-null; instruction to scrutinize + * @param result {@code non-null;} result set to add to + * @param insn {@code non-null;} instruction to scrutinize */ private static void addConstants(HashSet<Constant> result, DalvInsn insn) { @@ -176,10 +176,10 @@ public final class OutputFinisher { /** * Helper for {@link #getAllConstants} which adds all the info for - * a single <code>RegisterSpec</code>. + * a single {@code RegisterSpec}. * - * @param result non-null; result set to add to - * @param spec null-ok; register spec to add + * @param result {@code non-null;} result set to add to + * @param spec {@code null-ok;} register spec to add */ private static void addConstants(HashSet<Constant> result, RegisterSpec spec) { @@ -208,7 +208,7 @@ public final class OutputFinisher { /** * Adds an instruction to the output. * - * @param insn non-null; the instruction to add + * @param insn {@code non-null;} the instruction to add */ public void add(DalvInsn insn) { insns.add(insn); @@ -218,8 +218,8 @@ public final class OutputFinisher { /** * Inserts an instruction in the output at the given offset. * - * @param at >= 0; what index to insert at - * @param insn non-null; the instruction to insert + * @param at {@code >= 0;} what index to insert at + * @param insn {@code non-null;} the instruction to insert */ public void insert(int at, DalvInsn insn) { insns.add(at, insn); @@ -230,7 +230,7 @@ public final class OutputFinisher { * Helper for {@link #add} and {@link #insert}, * which updates the position and local info flags. * - * @param insn non-null; an instruction that was just introduced + * @param insn {@code non-null;} an instruction that was just introduced */ private void updateInfo(DalvInsn insn) { if (! hasAnyPositionInfo) { @@ -253,9 +253,9 @@ public final class OutputFinisher { * indicated instruction really is a reversible branch. * * @param which how many instructions back to find the branch; - * <code>0</code> is the most recently added instruction, - * <code>1</code> is the instruction before that, etc. - * @param newTarget non-null; the new target for the reversed branch + * {@code 0} is the most recently added instruction, + * {@code 1} is the instruction before that, etc. + * @param newTarget {@code non-null;} the new target for the reversed branch */ public void reverseBranch(int which, CodeAddress newTarget) { int size = insns.size(); @@ -284,7 +284,7 @@ public final class OutputFinisher { * given callback to perform lookups. This should be called before * calling {@link #finishProcessingAndGetList}. * - * @param callback non-null; callback object + * @param callback {@code non-null;} callback object */ public void assignIndices(DalvCode.AssignIndicesCallback callback) { for (DalvInsn insn : insns) { @@ -298,8 +298,8 @@ public final class OutputFinisher { * Helper for {@link #assignIndices} which does assignment for one * instruction. * - * @param insn non-null; the instruction - * @param callback non-null; the callback + * @param insn {@code non-null;} the instruction + * @param callback {@code non-null;} the callback */ private static void assignIndices(CstInsn insn, DalvCode.AssignIndicesCallback callback) { @@ -336,7 +336,7 @@ public final class OutputFinisher { * <p><b>Note:</b> This method may only be called once per instance * of this class.</p> * - * @return non-null; the output list + * @return {@code non-null;} the output list * @throws UnsupportedOperationException if this method has * already been called */ @@ -359,7 +359,7 @@ public final class OutputFinisher { * the format out of each instruction into a separate array, to be * further manipulated as things progress. * - * @return non-null; the array of formats + * @return {@code non-null;} the array of formats */ private InsnFormat[] makeFormatsArray() { int size = insns.size(); @@ -375,11 +375,11 @@ public final class OutputFinisher { /** * Helper for {@link #finishProcessingAndGetList}, which figures * out how many reserved registers are required and then reserving - * them. It also updates the given <code>formats</code> array so + * them. It also updates the given {@code formats} array so * as to avoid extra work when constructing the massaged * instruction list. * - * @param formats non-null; array of per-instruction format selections + * @param formats {@code non-null;} array of per-instruction format selections */ private void reserveRegisters(InsnFormat[] formats) { int oldReservedCount = (reservedCount < 0) ? 0 : reservedCount; @@ -425,11 +425,11 @@ public final class OutputFinisher { * Helper for {@link #reserveRegisters}, which does one * pass over the instructions, calculating the number of * registers that need to be reserved. It also updates the - * <code>formats</code> list to help avoid extra work in future + * {@code formats} list to help avoid extra work in future * register reservation passes. * - * @param formats non-null; array of per-instruction format selections - * @return >= 0; the count of reserved registers + * @param formats {@code non-null;} array of per-instruction format selections + * @return {@code >= 0;} the count of reserved registers */ private int calculateReservedCount(InsnFormat[] formats) { int size = insns.size(); @@ -470,16 +470,16 @@ public final class OutputFinisher { /** * Attempts to fit the given instruction into a format, returning - * either a format that the instruction fits into or <code>null</code> + * either a format that the instruction fits into or {@code null} * to indicate that the instruction will need to be expanded. This * fitting process starts with the given format as a first "best * guess" and then pessimizes from there if necessary. * - * @param insn non-null; the instruction in question - * @param format null-ok; the current guess as to the best instruction - * format to use; <code>null</code> means that no simple format fits - * @return null-ok; a possibly-different format, which is either a - * good fit or <code>null</code> to indicate that no simple format + * @param insn {@code non-null;} the instruction in question + * @param format {@code null-ok;} the current guess as to the best instruction + * format to use; {@code null} means that no simple format fits + * @return {@code null-ok;} a possibly-different format, which is either a + * good fit or {@code null} to indicate that no simple format * fits */ private InsnFormat findFormatForInsn(DalvInsn insn, InsnFormat format) { @@ -527,7 +527,7 @@ public final class OutputFinisher { * final addresses aren't known at the point that this method is * called.</p> * - * @param formats non-null; array of per-instruction format selections + * @param formats {@code non-null;} array of per-instruction format selections */ private void massageInstructions(InsnFormat[] formats) { if (reservedCount == 0) { @@ -566,8 +566,8 @@ public final class OutputFinisher { * problems) is expanded into a series of instances that together * perform the proper function. * - * @param formats non-null; array of per-instruction format selections - * @return non-null; the replacement list + * @param formats {@code non-null;} array of per-instruction format selections + * @return {@code non-null;} the replacement list */ private ArrayList<DalvInsn> performExpansion(InsnFormat[] formats) { int size = insns.size(); @@ -651,9 +651,9 @@ public final class OutputFinisher { * Helper for {@link #assignAddressesAndFixBranches}, which checks * the branch target size requirement of each branch instruction * to make sure it fits. For instructions that don't fit, this - * rewrites them to use a <code>goto</code> of some sort. In the + * rewrites them to use a {@code goto} of some sort. In the * case of a conditional branch that doesn't fit, the sense of the - * test is reversed in order to branch around a <code>goto</code> + * test is reversed in order to branch around a {@code goto} * to the original target. * * @return whether any branches had to be fixed diff --git a/dx/src/com/android/dx/dex/code/PositionList.java b/dx/src/com/android/dx/dex/code/PositionList.java index d8f76ebd4..41e36678a 100644 --- a/dx/src/com/android/dx/dex/code/PositionList.java +++ b/dx/src/com/android/dx/dex/code/PositionList.java @@ -24,7 +24,7 @@ import com.android.dx.util.FixedSizeList; * method to extract an instance out of a {@link DalvInsnList}. */ public final class PositionList extends FixedSizeList { - /** non-null; empty instance */ + /** {@code non-null;} empty instance */ public static final PositionList EMPTY = new PositionList(0); /** @@ -50,10 +50,10 @@ public final class PositionList extends FixedSizeList { * Extracts and returns the source position information out of an * instruction list. * - * @param insns non-null; instructions to convert + * @param insns {@code non-null;} instructions to convert * @param howMuch how much information should be included; one of the * static constants defined by this class - * @return non-null; the positions list + * @return {@code non-null;} the positions list */ public static PositionList make(DalvInsnList insns, int howMuch) { switch (howMuch) { @@ -112,9 +112,9 @@ public final class PositionList extends FixedSizeList { } /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * - * @param size >= 0; the size of the list + * @param size {@code >= 0;} the size of the list */ public PositionList(int size) { super(size); @@ -123,10 +123,10 @@ public final class PositionList extends FixedSizeList { /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Entry get(int n) { return (Entry) get0(n); @@ -135,8 +135,8 @@ public final class PositionList extends FixedSizeList { /** * Sets the entry at the given index. * - * @param n >= 0, < size(); which index - * @param entry non-null; the entry to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param entry {@code non-null;} the entry to set at {@code n} */ public void set(int n, Entry entry) { set0(n, entry); @@ -146,17 +146,17 @@ public final class PositionList extends FixedSizeList { * Entry in a position list. */ public static class Entry { - /** >= 0; address of this entry */ + /** {@code >= 0;} address of this entry */ private final int address; - /** non-null; corresponding source position information */ + /** {@code non-null;} corresponding source position information */ private final SourcePosition position; /** * Constructs an instance. * - * @param address >= 0; address of this entry - * @param position non-null; corresponding source position information + * @param address {@code >= 0;} address of this entry + * @param position {@code non-null;} corresponding source position information */ public Entry (int address, SourcePosition position) { if (address < 0) { @@ -174,7 +174,7 @@ public final class PositionList extends FixedSizeList { /** * Gets the address. * - * @return >= 0; the address + * @return {@code >= 0;} the address */ public int getAddress() { return address; @@ -183,7 +183,7 @@ public final class PositionList extends FixedSizeList { /** * Gets the source position information. * - * @return non-null; the position information + * @return {@code non-null;} the position information */ public SourcePosition getPosition() { return position; diff --git a/dx/src/com/android/dx/dex/code/RopToDop.java b/dx/src/com/android/dx/dex/code/RopToDop.java index 8ad0e64a8..0385467e4 100644 --- a/dx/src/com/android/dx/dex/code/RopToDop.java +++ b/dx/src/com/android/dx/dex/code/RopToDop.java @@ -35,7 +35,7 @@ import java.util.HashMap; * {@link Dop} instances. */ public final class RopToDop { - /** non-null; map from all the common rops to dalvik opcodes */ + /** {@code non-null;} map from all the common rops to dalvik opcodes */ private static final HashMap<Rop, Dop> MAP; /** @@ -278,7 +278,7 @@ public final class RopToDop { * Returns the dalvik opcode appropriate for the given register-based * instruction. * - * @param insn non-null; the original instruction + * @param insn {@code non-null;} the original instruction * @return the corresponding dalvik opcode; one of the constants in * {@link Dops} */ diff --git a/dx/src/com/android/dx/dex/code/RopTranslator.java b/dx/src/com/android/dx/dex/code/RopTranslator.java index f3dfe0b19..9f47b13be 100644 --- a/dx/src/com/android/dx/dex/code/RopTranslator.java +++ b/dx/src/com/android/dx/dex/code/RopTranslator.java @@ -46,7 +46,7 @@ import java.util.ArrayList; * #translate} method is the thing to call on this class. */ public final class RopTranslator { - /** non-null; method to translate */ + /** {@code non-null;} method to translate */ private final RopMethod method; /** @@ -55,22 +55,22 @@ public final class RopTranslator { */ private final int positionInfo; - /** null-ok; local variable info to use */ + /** {@code null-ok;} local variable info to use */ private final LocalVariableInfo locals; - /** non-null; container for all the address objects for the method */ + /** {@code non-null;} container for all the address objects for the method */ private final BlockAddresses addresses; - /** non-null; list of output instructions in-progress */ + /** {@code non-null;} list of output instructions in-progress */ private final OutputCollector output; - /** non-null; visitor to use during translation */ + /** {@code non-null;} visitor to use during translation */ private final TranslationVisitor translationVisitor; - /** >= 0; register count for the method */ + /** {@code >= 0;} register count for the method */ private final int regCount; - /** null-ok; block output order; becomes non-null in {@link #pickOrder} */ + /** {@code null-ok;} block output order; becomes non-null in {@link #pickOrder} */ private int[] order; /** size, in register units, of all the parameters to this method */ @@ -86,13 +86,13 @@ public final class RopTranslator { * Translates a {@link RopMethod}. This may modify the given * input. * - * @param method non-null; the original method + * @param method {@code non-null;} the original method * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} - * @param locals null-ok; local variable information to use + * @param locals {@code null-ok;} local variable information to use * @param paramSize size, in register units, of all the parameters to * this method - * @return non-null; the translated version + * @return {@code non-null;} the translated version */ public static DalvCode translate(RopMethod method, int positionInfo, LocalVariableInfo locals, int paramSize) { @@ -105,10 +105,10 @@ public final class RopTranslator { /** * Constructs an instance. This method is private. Use {@link #translate}. * - * @param method non-null; the original method + * @param method {@code non-null;} the original method * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} - * @param locals null-ok; local variable information to use + * @param locals {@code null-ok;} local variable information to use * @param paramSize size, in register units, of all the parameters to * this method */ @@ -177,7 +177,7 @@ public final class RopTranslator { /* * We almost could just check the first block here, but the - * <code>cf</code> layer will put in a second move-param in a + * {@code cf} layer will put in a second move-param in a * subsequent block in the case of synchronized methods. */ method.getBlocks().forEachInsn(new Insn.BaseVisitor() { @@ -199,7 +199,7 @@ public final class RopTranslator { /** * Does the translation and returns the result. * - * @return non-null; the result + * @return {@code non-null;} the result */ private DalvCode translateAndGetResult() { pickOrder(); @@ -232,9 +232,9 @@ public final class RopTranslator { * Helper for {@link #outputInstructions}, which does the processing * and output of one block. * - * @param block non-null; the block to process and output - * @param nextLabel >= -1; the next block that will be processed, or - * <code>-1</code> if there is no next block + * @param block {@code non-null;} the block to process and output + * @param nextLabel {@code >= -1;} the next block that will be processed, or + * {@code -1} if there is no next block */ private void outputBlock(BasicBlock block, int nextLabel) { // Append the code address for this block. @@ -440,8 +440,8 @@ public final class RopTranslator { * two register sources, and have a source equal to the result, * place that source first. * - * @param insn non-null; instruction in question - * @return non-null; the instruction's complete register list + * @param insn {@code non-null;} instruction in question + * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn) { return getRegs(insn, insn.getResult()); @@ -453,9 +453,9 @@ public final class RopTranslator { * two register sources, and have a source equal to the result, * place that source first. * - * @param insn non-null; instruction in question - * @param resultReg null-ok; the real result to use (ignore the insn's) - * @return non-null; the instruction's complete register list + * @param insn {@code non-null;} instruction in question + * @param resultReg {@code null-ok;} the real result to use (ignore the insn's) + * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn, RegisterSpec resultReg) { @@ -486,14 +486,14 @@ public final class RopTranslator { * Instruction visitor class for doing the instruction translation per se. */ private class TranslationVisitor implements Insn.Visitor { - /** non-null; list of output instructions in-progress */ + /** {@code non-null;} list of output instructions in-progress */ private final OutputCollector output; - /** non-null; basic block being worked on */ + /** {@code non-null;} basic block being worked on */ private BasicBlock block; /** - * null-ok; code address for the salient last instruction of the + * {@code null-ok;} code address for the salient last instruction of the * block (used before switches and throwing instructions) */ private CodeAddress lastAddress; @@ -501,7 +501,7 @@ public final class RopTranslator { /** * Constructs an instance. * - * @param output non-null; destination for instruction output + * @param output {@code non-null;} destination for instruction output */ public TranslationVisitor(OutputCollector output) { this.output = output; @@ -510,8 +510,8 @@ public final class RopTranslator { /** * Sets the block currently being worked on. * - * @param block non-null; the block - * @param lastAddress non-null; code address for the salient + * @param block {@code non-null;} the block + * @param lastAddress {@code non-null;} code address for the salient * last instruction of the block */ public void setBlock(BasicBlock block, CodeAddress lastAddress) { @@ -654,7 +654,7 @@ public final class RopTranslator { * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * - * @return null-ok; result of move-result-pseudo at the beginning of + * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() @@ -783,7 +783,7 @@ public final class RopTranslator { /** * Adds to the output. * - * @param insn non-null; instruction to add + * @param insn {@code non-null;} instruction to add */ protected void addOutput(DalvInsn insn) { output.add(insn); @@ -792,7 +792,7 @@ public final class RopTranslator { /** * Adds to the output suffix. * - * @param insn non-null; instruction to add + * @param insn {@code non-null;} instruction to add */ protected void addOutputSuffix(DalvInsn insn) { output.addSuffix(insn); @@ -805,14 +805,14 @@ public final class RopTranslator { */ private class LocalVariableAwareTranslationVisitor extends TranslationVisitor { - /** non-null; local variable info */ + /** {@code non-null;} local variable info */ private LocalVariableInfo locals; /** * Constructs an instance. * - * @param output non-null; destination for instruction output - * @param locals non-null; the local variable info + * @param output {@code non-null;} destination for instruction output + * @param locals {@code non-null;} the local variable info */ public LocalVariableAwareTranslationVisitor(OutputCollector output, LocalVariableInfo locals) { @@ -859,7 +859,7 @@ public final class RopTranslator { * Adds a {@link LocalStart} to the output if the given * instruction in fact introduces a local variable. * - * @param insn non-null; instruction in question + * @param insn {@code non-null;} instruction in question */ public void addIntroductionIfNecessary(Insn insn) { RegisterSpec spec = locals.getAssignment(insn); diff --git a/dx/src/com/android/dx/dex/code/SimpleInsn.java b/dx/src/com/android/dx/dex/code/SimpleInsn.java index ba204090b..5e7b2591a 100644 --- a/dx/src/com/android/dx/dex/code/SimpleInsn.java +++ b/dx/src/com/android/dx/dex/code/SimpleInsn.java @@ -26,11 +26,11 @@ import com.android.dx.rop.code.SourcePosition; public final class SimpleInsn extends FixedSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * * @param opcode the opcode; one of the constants from {@link Dops} - * @param position non-null; source position - * @param registers non-null; register list, including a + * @param position {@code non-null;} source position + * @param registers {@code non-null;} register list, including a * result register if appropriate (that is, registers may be either * ins or outs) */ diff --git a/dx/src/com/android/dx/dex/code/StdCatchBuilder.java b/dx/src/com/android/dx/dex/code/StdCatchBuilder.java index 1240f3f7d..6e3a169b4 100644 --- a/dx/src/com/android/dx/dex/code/StdCatchBuilder.java +++ b/dx/src/com/android/dx/dex/code/StdCatchBuilder.java @@ -35,22 +35,22 @@ public final class StdCatchBuilder implements CatchBuilder { /** the maximum range of a single catch handler, in code units */ private static final int MAX_CATCH_RANGE = 65535; - /** non-null; method to build the list for */ + /** {@code non-null;} method to build the list for */ private final RopMethod method; - /** non-null; block output order */ + /** {@code non-null;} block output order */ private final int[] order; - /** non-null; address objects for each block */ + /** {@code non-null;} address objects for each block */ private final BlockAddresses addresses; /** * Constructs an instance. It merely holds onto its parameters for * a subsequent call to {@link #build}. * - * @param method non-null; method to build the list for - * @param order non-null; block output order - * @param addresses non-null; address objects for each block + * @param method {@code non-null;} method to build the list for + * @param order {@code non-null;} block output order + * @param addresses {@code non-null;} address objects for each block */ public StdCatchBuilder(RopMethod method, int[] order, BlockAddresses addresses) { @@ -78,7 +78,6 @@ public final class StdCatchBuilder implements CatchBuilder { /** {@inheritDoc} */ public boolean hasAnyCatches() { - HashSet<Type> result = new HashSet<Type>(20); BasicBlockList blocks = method.getBlocks(); int size = blocks.size(); @@ -115,10 +114,10 @@ public final class StdCatchBuilder implements CatchBuilder { /** * Builds and returns the catch table for a given method. * - * @param method non-null; method to build the list for - * @param order non-null; block output order - * @param addresses non-null; address objects for each block - * @return non-null; the constructed table + * @param method {@code non-null;} method to build the list for + * @param order {@code non-null;} block output order + * @param addresses {@code non-null;} address objects for each block + * @return {@code non-null;} the constructed table */ public static CatchTable build(RopMethod method, int[] order, BlockAddresses addresses) { @@ -210,9 +209,9 @@ public final class StdCatchBuilder implements CatchBuilder { /** * Makes the {@link CatchHandlerList} for the given basic block. * - * @param block non-null; block to get entries for - * @param addresses non-null; address objects for each block - * @return non-null; array of entries + * @param block {@code non-null;} block to get entries for + * @param addresses {@code non-null;} address objects for each block + * @return {@code non-null;} array of entries */ private static CatchHandlerList handlersFor(BasicBlock block, BlockAddresses addresses) { @@ -267,10 +266,10 @@ public final class StdCatchBuilder implements CatchBuilder { * Makes a {@link CatchTable#Entry} for the given block range and * handlers. * - * @param start non-null; the start block for the range (inclusive) - * @param end non-null; the start block for the range (also inclusive) - * @param handlers non-null; the handlers for the range - * @param addresses non-null; address objects for each block + * @param start {@code non-null;} the start block for the range (inclusive) + * @param end {@code non-null;} the start block for the range (also inclusive) + * @param handlers {@code non-null;} the handlers for the range + * @param addresses {@code non-null;} address objects for each block */ private static CatchTable.Entry makeEntry(BasicBlock start, BasicBlock end, CatchHandlerList handlers, @@ -293,10 +292,10 @@ public final class StdCatchBuilder implements CatchBuilder { * for a catch handler. This is true as long as the covered range is * under 65536 code units. * - * @param start non-null; the start block for the range (inclusive) - * @param end non-null; the start block for the range (also inclusive) - * @param addresses non-null; address objects for each block - * @return <code>true</code> if the range is valid as a catch range + * @param start {@code non-null;} the start block for the range (inclusive) + * @param end {@code non-null;} the start block for the range (also inclusive) + * @param addresses {@code non-null;} address objects for each block + * @return {@code true} if the range is valid as a catch range */ private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses) { diff --git a/dx/src/com/android/dx/dex/code/SwitchData.java b/dx/src/com/android/dx/dex/code/SwitchData.java index 1aaafa951..e5a8da4ac 100644 --- a/dx/src/com/android/dx/dex/code/SwitchData.java +++ b/dx/src/com/android/dx/dex/code/SwitchData.java @@ -29,16 +29,16 @@ import com.android.dx.util.IntList; */ public final class SwitchData extends VariableSizeInsn { /** - * non-null; address representing the instruction that uses this + * {@code non-null;} address representing the instruction that uses this * instance */ private final CodeAddress user; - /** non-null; sorted list of switch cases (keys) */ + /** {@code non-null;} sorted list of switch cases (keys) */ private final IntList cases; /** - * non-null; corresponding list of code addresses; the branch + * {@code non-null;} corresponding list of code addresses; the branch * target for each case */ private final CodeAddress[] targets; @@ -48,13 +48,13 @@ public final class SwitchData extends VariableSizeInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param user non-null; address representing the instruction that + * @param position {@code non-null;} source position + * @param user {@code non-null;} address representing the instruction that * uses this instance - * @param cases non-null; sorted list of switch cases (keys) - * @param targets non-null; corresponding list of code addresses; the + * @param cases {@code non-null;} sorted list of switch cases (keys) + * @param targets {@code non-null;} corresponding list of code addresses; the * branch target for each case */ public SwitchData(SourcePosition position, CodeAddress user, @@ -151,7 +151,7 @@ public final class SwitchData extends VariableSizeInsn { /** * Returns whether or not this instance's data will be output as packed. * - * @return <code>true</code> iff the data is to be packed + * @return {@code true} iff the data is to be packed */ public boolean isPacked() { return packed; @@ -202,8 +202,8 @@ public final class SwitchData extends VariableSizeInsn { * Gets the size of a packed table for the given cases, in 16-bit code * units. * - * @param cases non-null; sorted list of cases - * @return >= -1; the packed table size or <code>-1</code> if the + * @param cases {@code non-null;} sorted list of cases + * @return {@code >= -1;} the packed table size or {@code -1} if the * cases couldn't possibly be represented as a packed table */ private static long packedCodeSize(IntList cases) { @@ -219,8 +219,8 @@ public final class SwitchData extends VariableSizeInsn { * Gets the size of a sparse table for the given cases, in 16-bit code * units. * - * @param cases non-null; sorted list of cases - * @return > 0; the sparse table size + * @param cases {@code non-null;} sorted list of cases + * @return {@code > 0;} the sparse table size */ private static long sparseCodeSize(IntList cases) { int sz = cases.size(); @@ -231,8 +231,8 @@ public final class SwitchData extends VariableSizeInsn { /** * Determines whether the given list of cases warrant being packed. * - * @param cases non-null; sorted list of cases - * @return <code>true</code> iff the table encoding the cases + * @param cases {@code non-null;} sorted list of cases + * @return {@code true} iff the table encoding the cases * should be packed */ private static boolean shouldPack(IntList cases) { diff --git a/dx/src/com/android/dx/dex/code/TargetInsn.java b/dx/src/com/android/dx/dex/code/TargetInsn.java index 5620795d3..0faaadada 100644 --- a/dx/src/com/android/dx/dex/code/TargetInsn.java +++ b/dx/src/com/android/dx/dex/code/TargetInsn.java @@ -23,20 +23,20 @@ import com.android.dx.rop.code.SourcePosition; * Instruction which has a single branch target. */ public final class TargetInsn extends FixedSizeInsn { - /** non-null; the branch target */ + /** {@code non-null;} the branch target */ private CodeAddress target; /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>), and the target is initially - * <code>null</code>. + * unknown ({@code -1}), and the target is initially + * {@code null}. * * @param opcode the opcode; one of the constants from {@link Dops} - * @param position non-null; source position - * @param registers non-null; register list, including a + * @param position {@code non-null;} source position + * @param registers {@code non-null;} register list, including a * result register if appropriate (that is, registers may be either * ins or outs) - * @param target non-null; the branch target + * @param target {@code non-null;} the branch target */ public TargetInsn(Dop opcode, SourcePosition position, RegisterSpecList registers, CodeAddress target) { @@ -64,12 +64,12 @@ public final class TargetInsn extends FixedSizeInsn { /** * Returns an instance that is just like this one, except that its * opcode has the opposite sense (as a test; e.g. a - * <code>lt</code> test becomes a <code>ge</code>), and its branch + * {@code lt} test becomes a {@code ge}), and its branch * target is replaced by the one given, and all set-once values * associated with the class (such as its address) are reset. * - * @param target non-null; the new branch target - * @return non-null; an appropriately-constructed instance + * @param target {@code non-null;} the new branch target + * @return {@code non-null;} an appropriately-constructed instance */ public TargetInsn withNewTargetAndReversed(CodeAddress target) { Dop opcode = getOpcode().getOppositeTest(); @@ -80,7 +80,7 @@ public final class TargetInsn extends FixedSizeInsn { /** * Gets the unique branch target of this instruction. * - * @return non-null; the branch target + * @return {@code non-null;} the branch target */ public CodeAddress getTarget() { return target; @@ -90,9 +90,9 @@ public final class TargetInsn extends FixedSizeInsn { * Gets the target address of this instruction. This is only valid * to call if the target instruction has been assigned an address, * and it is merely a convenient shorthand for - * <code>getTarget().getAddress()</code>. + * {@code getTarget().getAddress()}. * - * @return >= 0; the target address + * @return {@code >= 0;} the target address */ public int getTargetAddress() { return target.getAddress(); @@ -102,7 +102,7 @@ public final class TargetInsn extends FixedSizeInsn { * Gets the branch offset of this instruction. This is only valid to * call if both this and the target instruction each has been assigned * an address, and it is merely a convenient shorthand for - * <code>getTargetAddress() - getAddress()</code>. + * {@code getTargetAddress() - getAddress()}. * * @return the branch offset */ @@ -113,8 +113,8 @@ public final class TargetInsn extends FixedSizeInsn { /** * Returns whether the target offset is known. * - * @return <code>true</code> if the target offset is known or - * <code>false</code> if not + * @return {@code true} if the target offset is known or + * {@code false} if not */ public boolean hasTargetOffset() { return hasAddress() && target.hasAddress(); diff --git a/dx/src/com/android/dx/dex/code/VariableSizeInsn.java b/dx/src/com/android/dx/dex/code/VariableSizeInsn.java index 788424901..889a50ced 100644 --- a/dx/src/com/android/dx/dex/code/VariableSizeInsn.java +++ b/dx/src/com/android/dx/dex/code/VariableSizeInsn.java @@ -25,10 +25,10 @@ import com.android.dx.rop.code.SourcePosition; public abstract class VariableSizeInsn extends DalvInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position - * @param registers non-null; source registers + * @param position {@code non-null;} source position + * @param registers {@code non-null;} source registers */ public VariableSizeInsn(SourcePosition position, RegisterSpecList registers) { diff --git a/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java b/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java index 2ddb181e0..198bebf1e 100644 --- a/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java +++ b/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java @@ -28,9 +28,9 @@ import com.android.dx.util.AnnotatedOutput; public abstract class ZeroSizeInsn extends DalvInsn { /** * Constructs an instance. The output address of this instance is initially - * unknown (<code>-1</code>). + * unknown ({@code -1}). * - * @param position non-null; source position + * @param position {@code non-null;} source position */ public ZeroSizeInsn(SourcePosition position) { super(Dops.SPECIAL_FORMAT, position, RegisterSpecList.EMPTY); diff --git a/dx/src/com/android/dx/dex/code/form/Form10t.java b/dx/src/com/android/dx/dex/code/form/Form10t.java index 8551012de..82b731d6f 100644 --- a/dx/src/com/android/dx/dex/code/form/Form10t.java +++ b/dx/src/com/android/dx/dex/code/form/Form10t.java @@ -22,11 +22,11 @@ import com.android.dx.dex.code.TargetInsn; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>10t</code>. See the instruction format spec + * Instruction format {@code 10t}. See the instruction format spec * for details. */ public final class Form10t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form10t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form10x.java b/dx/src/com/android/dx/dex/code/form/Form10x.java index 7dc7c43b8..c7a22a618 100644 --- a/dx/src/com/android/dx/dex/code/form/Form10x.java +++ b/dx/src/com/android/dx/dex/code/form/Form10x.java @@ -22,11 +22,11 @@ import com.android.dx.dex.code.SimpleInsn; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>10x</code>. See the instruction format spec + * Instruction format {@code 10x}. See the instruction format spec * for details. */ public final class Form10x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form10x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form11n.java b/dx/src/com/android/dx/dex/code/form/Form11n.java index b94038bb2..d63fc6fad 100644 --- a/dx/src/com/android/dx/dex/code/form/Form11n.java +++ b/dx/src/com/android/dx/dex/code/form/Form11n.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>11n</code>. See the instruction format spec + * Instruction format {@code 11n}. See the instruction format spec * for details. */ public final class Form11n extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form11n(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form11x.java b/dx/src/com/android/dx/dex/code/form/Form11x.java index d6561472d..b4acc1a35 100644 --- a/dx/src/com/android/dx/dex/code/form/Form11x.java +++ b/dx/src/com/android/dx/dex/code/form/Form11x.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>11x</code>. See the instruction format spec + * Instruction format {@code 11x}. See the instruction format spec * for details. */ public final class Form11x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form11x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form12x.java b/dx/src/com/android/dx/dex/code/form/Form12x.java index 3ed8ce99c..c7754be69 100644 --- a/dx/src/com/android/dx/dex/code/form/Form12x.java +++ b/dx/src/com/android/dx/dex/code/form/Form12x.java @@ -25,11 +25,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>12x</code>. See the instruction format spec + * Instruction format {@code 12x}. See the instruction format spec * for details. */ public final class Form12x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form12x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form20t.java b/dx/src/com/android/dx/dex/code/form/Form20t.java index 341bef3a0..0b5a3b26b 100644 --- a/dx/src/com/android/dx/dex/code/form/Form20t.java +++ b/dx/src/com/android/dx/dex/code/form/Form20t.java @@ -22,11 +22,11 @@ import com.android.dx.dex.code.TargetInsn; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>20t</code>. See the instruction format spec + * Instruction format {@code 20t}. See the instruction format spec * for details. */ public final class Form20t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form20t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form21c.java b/dx/src/com/android/dx/dex/code/form/Form21c.java index 5695e7a1f..ed1ec3c40 100644 --- a/dx/src/com/android/dx/dex/code/form/Form21c.java +++ b/dx/src/com/android/dx/dex/code/form/Form21c.java @@ -28,11 +28,11 @@ import com.android.dx.rop.cst.CstType; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>21c</code>. See the instruction format spec + * Instruction format {@code 21c}. See the instruction format spec * for details. */ public final class Form21c extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form21c(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form21h.java b/dx/src/com/android/dx/dex/code/form/Form21h.java index cf4b4714f..e0bd7515a 100644 --- a/dx/src/com/android/dx/dex/code/form/Form21h.java +++ b/dx/src/com/android/dx/dex/code/form/Form21h.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>21h</code>. See the instruction format spec + * Instruction format {@code 21h}. See the instruction format spec * for details. */ public final class Form21h extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form21h(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form21s.java b/dx/src/com/android/dx/dex/code/form/Form21s.java index df10f80a7..a03ee4349 100644 --- a/dx/src/com/android/dx/dex/code/form/Form21s.java +++ b/dx/src/com/android/dx/dex/code/form/Form21s.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>21s</code>. See the instruction format spec + * Instruction format {@code 21s}. See the instruction format spec * for details. */ public final class Form21s extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form21s(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form21t.java b/dx/src/com/android/dx/dex/code/form/Form21t.java index 03f2ddfbd..f0ce64465 100644 --- a/dx/src/com/android/dx/dex/code/form/Form21t.java +++ b/dx/src/com/android/dx/dex/code/form/Form21t.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>21t</code>. See the instruction format spec + * Instruction format {@code 21t}. See the instruction format spec * for details. */ public final class Form21t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form21t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form22b.java b/dx/src/com/android/dx/dex/code/form/Form22b.java index e2a777fcc..2884fbb76 100644 --- a/dx/src/com/android/dx/dex/code/form/Form22b.java +++ b/dx/src/com/android/dx/dex/code/form/Form22b.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>22b</code>. See the instruction format spec + * Instruction format {@code 22b}. See the instruction format spec * for details. */ public final class Form22b extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form22b(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form22c.java b/dx/src/com/android/dx/dex/code/form/Form22c.java index 547eea858..e77677fd5 100644 --- a/dx/src/com/android/dx/dex/code/form/Form22c.java +++ b/dx/src/com/android/dx/dex/code/form/Form22c.java @@ -27,11 +27,11 @@ import com.android.dx.rop.cst.CstType; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>22c</code>. See the instruction format spec + * Instruction format {@code 22c}. See the instruction format spec * for details. */ public final class Form22c extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form22c(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form22s.java b/dx/src/com/android/dx/dex/code/form/Form22s.java index 3ed173f22..596421728 100644 --- a/dx/src/com/android/dx/dex/code/form/Form22s.java +++ b/dx/src/com/android/dx/dex/code/form/Form22s.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>22s</code>. See the instruction format spec + * Instruction format {@code 22s}. See the instruction format spec * for details. */ public final class Form22s extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form22s(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form22t.java b/dx/src/com/android/dx/dex/code/form/Form22t.java index 1034b925c..1577803d2 100644 --- a/dx/src/com/android/dx/dex/code/form/Form22t.java +++ b/dx/src/com/android/dx/dex/code/form/Form22t.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>22t</code>. See the instruction format spec + * Instruction format {@code 22t}. See the instruction format spec * for details. */ public final class Form22t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form22t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form22x.java b/dx/src/com/android/dx/dex/code/form/Form22x.java index ee91e85a2..b7ce4e746 100644 --- a/dx/src/com/android/dx/dex/code/form/Form22x.java +++ b/dx/src/com/android/dx/dex/code/form/Form22x.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>22x</code>. See the instruction format spec + * Instruction format {@code 22x}. See the instruction format spec * for details. */ public final class Form22x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form22x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form23x.java b/dx/src/com/android/dx/dex/code/form/Form23x.java index c0a4482e8..64dd6b051 100644 --- a/dx/src/com/android/dx/dex/code/form/Form23x.java +++ b/dx/src/com/android/dx/dex/code/form/Form23x.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>23x</code>. See the instruction format spec + * Instruction format {@code 23x}. See the instruction format spec * for details. */ public final class Form23x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form23x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form30t.java b/dx/src/com/android/dx/dex/code/form/Form30t.java index 32e2efa2a..af0a699d3 100644 --- a/dx/src/com/android/dx/dex/code/form/Form30t.java +++ b/dx/src/com/android/dx/dex/code/form/Form30t.java @@ -22,11 +22,11 @@ import com.android.dx.dex.code.TargetInsn; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>30t</code>. See the instruction format spec + * Instruction format {@code 30t}. See the instruction format spec * for details. */ public final class Form30t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form30t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form31c.java b/dx/src/com/android/dx/dex/code/form/Form31c.java index 5837009e5..0c983c570 100644 --- a/dx/src/com/android/dx/dex/code/form/Form31c.java +++ b/dx/src/com/android/dx/dex/code/form/Form31c.java @@ -28,11 +28,11 @@ import com.android.dx.rop.cst.CstType; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>31c</code>. See the instruction format spec + * Instruction format {@code 31c}. See the instruction format spec * for details. */ public final class Form31c extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form31c(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form31i.java b/dx/src/com/android/dx/dex/code/form/Form31i.java index 2855bcb38..c893a12fc 100644 --- a/dx/src/com/android/dx/dex/code/form/Form31i.java +++ b/dx/src/com/android/dx/dex/code/form/Form31i.java @@ -25,11 +25,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>31i</code>. See the instruction format spec + * Instruction format {@code 31i}. See the instruction format spec * for details. */ public final class Form31i extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form31i(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form31t.java b/dx/src/com/android/dx/dex/code/form/Form31t.java index 5472687be..682408c6d 100644 --- a/dx/src/com/android/dx/dex/code/form/Form31t.java +++ b/dx/src/com/android/dx/dex/code/form/Form31t.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>31t</code>. See the instruction format spec + * Instruction format {@code 31t}. See the instruction format spec * for details. */ public final class Form31t extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form31t(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form32x.java b/dx/src/com/android/dx/dex/code/form/Form32x.java index 9c52d9334..4a981eebe 100644 --- a/dx/src/com/android/dx/dex/code/form/Form32x.java +++ b/dx/src/com/android/dx/dex/code/form/Form32x.java @@ -23,11 +23,11 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>32x</code>. See the instruction format spec + * Instruction format {@code 32x}. See the instruction format spec * for details. */ public final class Form32x extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form32x(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form35c.java b/dx/src/com/android/dx/dex/code/form/Form35c.java index 6be55fc5c..411e3c322 100644 --- a/dx/src/com/android/dx/dex/code/form/Form35c.java +++ b/dx/src/com/android/dx/dex/code/form/Form35c.java @@ -28,11 +28,11 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>35c</code>. See the instruction format spec + * Instruction format {@code 35c}. See the instruction format spec * for details. */ public final class Form35c extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form35c(); /** Maximal number of operands */ @@ -120,12 +120,12 @@ public final class Form35c extends InsnFormat { /** * Gets the number of words required for the given register list, where - * category-2 values count as two words. Return <code>-1</code> if the + * category-2 values count as two words. Return {@code -1} if the * list requires more than five words or contains registers that need * more than a nibble to identify them. * - * @param regs non-null; the register list in question - * @return >= -1; the number of words required, or <code>-1</code> + * @param regs {@code non-null;} the register list in question + * @return {@code >= -1;} the number of words required, or {@code -1} * if the list couldn't possibly fit in this format */ private static int wordCount(RegisterSpecList regs) { @@ -161,8 +161,8 @@ public final class Form35c extends InsnFormat { * entries. This returns the original list if no modification is * required * - * @param orig non-null; the original list - * @return non-null; the list with the described transformation + * @param orig {@code non-null;} the original list + * @return {@code non-null;} the list with the described transformation */ private static RegisterSpecList explicitize(RegisterSpecList orig) { int wordCount = wordCount(orig); diff --git a/dx/src/com/android/dx/dex/code/form/Form3rc.java b/dx/src/com/android/dx/dex/code/form/Form3rc.java index 0accbc226..2d185cf00 100644 --- a/dx/src/com/android/dx/dex/code/form/Form3rc.java +++ b/dx/src/com/android/dx/dex/code/form/Form3rc.java @@ -27,11 +27,11 @@ import com.android.dx.rop.cst.CstType; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>3rc</code>. See the instruction format spec + * Instruction format {@code 3rc}. See the instruction format spec * for details. */ public final class Form3rc extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form3rc(); /** diff --git a/dx/src/com/android/dx/dex/code/form/Form51l.java b/dx/src/com/android/dx/dex/code/form/Form51l.java index 09a32f619..9e3ab6aae 100644 --- a/dx/src/com/android/dx/dex/code/form/Form51l.java +++ b/dx/src/com/android/dx/dex/code/form/Form51l.java @@ -26,11 +26,11 @@ import com.android.dx.rop.cst.CstLiteralBits; import com.android.dx.util.AnnotatedOutput; /** - * Instruction format <code>51l</code>. See the instruction format spec + * Instruction format {@code 51l}. See the instruction format spec * for details. */ public final class Form51l extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new Form51l(); /** diff --git a/dx/src/com/android/dx/dex/code/form/SpecialFormat.java b/dx/src/com/android/dx/dex/code/form/SpecialFormat.java index 79efd670b..8a2e5edf6 100644 --- a/dx/src/com/android/dx/dex/code/form/SpecialFormat.java +++ b/dx/src/com/android/dx/dex/code/form/SpecialFormat.java @@ -27,10 +27,10 @@ import com.android.dx.util.AnnotatedOutput; * lists. Most of the overridden methods on this class end up throwing * exceptions, as code should know (implicitly or explicitly) to avoid * using this class. The one exception is {@link #isCompatible}, which - * always returns <code>true</code>. + * always returns {@code true}. */ public final class SpecialFormat extends InsnFormat { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final InsnFormat THE_ONE = new SpecialFormat(); /** diff --git a/dx/src/com/android/dx/dex/file/AnnotationItem.java b/dx/src/com/android/dx/dex/file/AnnotationItem.java index 43ac36266..08422bc6a 100644 --- a/dx/src/com/android/dx/dex/file/AnnotationItem.java +++ b/dx/src/com/android/dx/dex/file/AnnotationItem.java @@ -46,20 +46,20 @@ public final class AnnotationItem extends OffsettedItem { /** the required alignment for instances of this class */ private static final int ALIGNMENT = 1; - /** non-null; unique instance of {@link #TypeIdSorter} */ + /** {@code non-null;} unique instance of {@link #TypeIdSorter} */ private static final TypeIdSorter TYPE_ID_SORTER = new TypeIdSorter(); - /** non-null; the annotation to represent */ + /** {@code non-null;} the annotation to represent */ private final Annotation annotation; /** - * null-ok; type reference for the annotation type; set during + * {@code null-ok;} type reference for the annotation type; set during * {@link #addContents} */ private TypeIdItem type; /** - * null-ok; encoded form, ready for writing to a file; set during + * {@code null-ok;} encoded form, ready for writing to a file; set during * {@link #place0} */ private byte[] encodedForm; @@ -88,7 +88,7 @@ public final class AnnotationItem extends OffsettedItem { * ignoring all other aspects of the elements. This is only valid * to use after type id indices are known. * - * @param array non-null; array to sort + * @param array {@code non-null;} array to sort */ public static void sortByTypeIdIndex(AnnotationItem[] array) { Arrays.sort(array, TYPE_ID_SORTER); @@ -97,7 +97,7 @@ public final class AnnotationItem extends OffsettedItem { /** * Constructs an instance. * - * @param annotation non-null; annotation to represent + * @param annotation {@code non-null;} annotation to represent */ public AnnotationItem(Annotation annotation) { /* @@ -167,8 +167,8 @@ public final class AnnotationItem extends OffsettedItem { * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * - * @param out non-null; where to output to - * @param prefix non-null; prefix for each line of output + * @param out {@code non-null;} where to output to + * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + diff --git a/dx/src/com/android/dx/dex/file/AnnotationSetItem.java b/dx/src/com/android/dx/dex/file/AnnotationSetItem.java index f03cc08d1..2ff005ac8 100644 --- a/dx/src/com/android/dx/dex/file/AnnotationSetItem.java +++ b/dx/src/com/android/dx/dex/file/AnnotationSetItem.java @@ -28,14 +28,14 @@ public final class AnnotationSetItem extends OffsettedItem { /** the required alignment for instances of this class */ private static final int ALIGNMENT = 4; - /** the size of an entry int the set: one <code>uint</code> */ + /** the size of an entry int the set: one {@code uint} */ private static final int ENTRY_WRITE_SIZE = 4; - /** non-null; the set of annotations */ + /** {@code non-null;} the set of annotations */ private final Annotations annotations; /** - * non-null; set of annotations as individual items in an array. + * {@code non-null;} set of annotations as individual items in an array. * <b>Note:</b> The contents have to get sorted by type id before * writing. */ @@ -44,7 +44,7 @@ public final class AnnotationSetItem extends OffsettedItem { /** * Constructs an instance. * - * @param annotations non-null; set of annotations + * @param annotations {@code non-null;} set of annotations */ public AnnotationSetItem(Annotations annotations) { super(ALIGNMENT, writeSize(annotations)); @@ -62,8 +62,8 @@ public final class AnnotationSetItem extends OffsettedItem { /** * Gets the write size for the given set. * - * @param annotations non-null; the set - * @return > 0; the write size + * @param annotations {@code non-null;} the set + * @return {@code > 0;} the write size */ private static int writeSize(Annotations annotations) { // This includes an int size at the start of the list. @@ -79,7 +79,7 @@ public final class AnnotationSetItem extends OffsettedItem { /** * Gets the underlying annotations of this instance * - * @return non-null; the annotations + * @return {@code non-null;} the annotations */ public Annotations getAnnotations() { return annotations; diff --git a/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java b/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java index 422e2f019..1427e6a05 100644 --- a/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java +++ b/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java @@ -29,13 +29,13 @@ public final class AnnotationSetRefItem extends OffsettedItem { /** write size of this class, in bytes */ private static final int WRITE_SIZE = 4; - /** non-null; the annotation set to refer to */ + /** {@code non-null;} the annotation set to refer to */ private AnnotationSetItem annotations; /** * Constructs an instance. * - * @param annotations non-null; the annotation set to refer to + * @param annotations {@code non-null;} the annotation set to refer to */ public AnnotationSetRefItem(AnnotationSetItem annotations) { super(ALIGNMENT, WRITE_SIZE); diff --git a/dx/src/com/android/dx/dex/file/AnnotationUtils.java b/dx/src/com/android/dx/dex/file/AnnotationUtils.java index c9d796843..8431d3511 100644 --- a/dx/src/com/android/dx/dex/file/AnnotationUtils.java +++ b/dx/src/com/android/dx/dex/file/AnnotationUtils.java @@ -38,41 +38,41 @@ import static com.android.dx.rop.annotation.AnnotationVisibility.*; * Utility class for dealing with annotations. */ public final class AnnotationUtils { - /** non-null; type for <code>AnnotationDefault</code> annotations */ + /** {@code non-null;} type for {@code AnnotationDefault} annotations */ private static final CstType ANNOTATION_DEFAULT_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/AnnotationDefault;")); - /** non-null; type for <code>EnclosingClass</code> annotations */ + /** {@code non-null;} type for {@code EnclosingClass} annotations */ private static final CstType ENCLOSING_CLASS_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/EnclosingClass;")); - /** non-null; type for <code>EnclosingMethod</code> annotations */ + /** {@code non-null;} type for {@code EnclosingMethod} annotations */ private static final CstType ENCLOSING_METHOD_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/EnclosingMethod;")); - /** non-null; type for <code>InnerClass</code> annotations */ + /** {@code non-null;} type for {@code InnerClass} annotations */ private static final CstType INNER_CLASS_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/InnerClass;")); - /** non-null; type for <code>MemberClasses</code> annotations */ + /** {@code non-null;} type for {@code MemberClasses} annotations */ private static final CstType MEMBER_CLASSES_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/MemberClasses;")); - /** non-null; type for <code>Signature</code> annotations */ + /** {@code non-null;} type for {@code Signature} annotations */ private static final CstType SIGNATURE_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/Signature;")); - /** non-null; type for <code>Throws</code> annotations */ + /** {@code non-null;} type for {@code Throws} annotations */ private static final CstType THROWS_TYPE = CstType.intern(Type.intern("Ldalvik/annotation/Throws;")); - /** non-null; the UTF-8 constant <code>"accessFlags"</code> */ + /** {@code non-null;} the UTF-8 constant {@code "accessFlags"} */ private static final CstUtf8 ACCESS_FLAGS_UTF = new CstUtf8("accessFlags"); - /** non-null; the UTF-8 constant <code>"name"</code> */ + /** {@code non-null;} the UTF-8 constant {@code "name"} */ private static final CstUtf8 NAME_UTF = new CstUtf8("name"); - /** non-null; the UTF-8 constant <code>"value"</code> */ + /** {@code non-null;} the UTF-8 constant {@code "value"} */ private static final CstUtf8 VALUE_UTF = new CstUtf8("value"); /** @@ -83,10 +83,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>AnnotationDefault</code> annotation. + * Constructs a standard {@code AnnotationDefault} annotation. * - * @param defaults non-null; the defaults, itself as an annotation - * @return non-null; the constructed annotation + * @param defaults {@code non-null;} the defaults, itself as an annotation + * @return {@code non-null;} the constructed annotation */ public static Annotation makeAnnotationDefault(Annotation defaults) { Annotation result = new Annotation(ANNOTATION_DEFAULT_TYPE, SYSTEM); @@ -97,10 +97,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>EnclosingClass</code> annotation. + * Constructs a standard {@code EnclosingClass} annotation. * - * @param clazz non-null; the enclosing class - * @return non-null; the annotation + * @param clazz {@code non-null;} the enclosing class + * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingClass(CstType clazz) { Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM); @@ -111,10 +111,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>EnclosingMethod</code> annotation. + * Constructs a standard {@code EnclosingMethod} annotation. * - * @param method non-null; the enclosing method - * @return non-null; the annotation + * @param method {@code non-null;} the enclosing method + * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); @@ -125,12 +125,12 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>InnerClass</code> annotation. + * Constructs a standard {@code InnerClass} annotation. * - * @param name null-ok; the original name of the class, or - * <code>null</code> to represent an anonymous class + * @param name {@code null-ok;} the original name of the class, or + * {@code null} to represent an anonymous class * @param accessFlags the original access flags - * @return non-null; the annotation + * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstUtf8 name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); @@ -145,10 +145,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>MemberClasses</code> annotation. + * Constructs a standard {@code MemberClasses} annotation. * - * @param types non-null; the list of (the types of) the member classes - * @return non-null; the annotation + * @param types {@code non-null;} the list of (the types of) the member classes + * @return {@code non-null;} the annotation */ public static Annotation makeMemberClasses(TypeList types) { CstArray array = makeCstArray(types); @@ -159,10 +159,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>Signature</code> annotation. + * Constructs a standard {@code Signature} annotation. * - * @param signature non-null; the signature string - * @return non-null; the annotation + * @param signature {@code non-null;} the signature string + * @return {@code non-null;} the annotation */ public static Annotation makeSignature(CstUtf8 signature) { Annotation result = new Annotation(SIGNATURE_TYPE, SYSTEM); @@ -221,10 +221,10 @@ public final class AnnotationUtils { } /** - * Constructs a standard <code>Throws</code> annotation. + * Constructs a standard {@code Throws} annotation. * - * @param types non-null; the list of thrown types - * @return non-null; the annotation + * @param types {@code non-null;} the list of thrown types + * @return {@code non-null;} the annotation */ public static Annotation makeThrows(TypeList types) { CstArray array = makeCstArray(types); @@ -237,8 +237,8 @@ public final class AnnotationUtils { /** * Converts a {@link TypeList} to a {@link CstArray}. * - * @param types non-null; the type list - * @return non-null; the corresponding array constant + * @param types {@code non-null;} the type list + * @return {@code non-null;} the corresponding array constant */ private static CstArray makeCstArray(TypeList types) { int size = types.size(); diff --git a/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java b/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java index 4521e4c5b..d55195f97 100644 --- a/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java +++ b/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java @@ -40,16 +40,16 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { /** write size of a list element, in bytes */ private static final int ELEMENT_SIZE = 8; - /** null-ok; the class-level annotations, if any */ + /** {@code null-ok;} the class-level annotations, if any */ private AnnotationSetItem classAnnotations; - /** null-ok; the annotated fields, if any */ + /** {@code null-ok;} the annotated fields, if any */ private ArrayList<FieldAnnotationStruct> fieldAnnotations; - /** null-ok; the annotated methods, if any */ + /** {@code null-ok;} the annotated methods, if any */ private ArrayList<MethodAnnotationStruct> methodAnnotations; - /** null-ok; the annotated parameters, if any */ + /** {@code null-ok;} the annotated parameters, if any */ private ArrayList<ParameterAnnotationStruct> parameterAnnotations; /** @@ -73,7 +73,7 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { /** * Returns whether this item is empty (has no contents). * - * @return <code>true</code> if this item is empty, or <code>false</code> + * @return {@code true} if this item is empty, or {@code false} * if not */ public boolean isEmpty() { @@ -88,8 +88,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { * interning candidates are ones that <i>only</i> have a non-null * set of class annotations, with no other lists. * - * @return <code>true</code> if this is an interning candidate, or - * <code>false</code> if not + * @return {@code true} if this is an interning candidate, or + * {@code false} if not */ public boolean isInternable() { return (classAnnotations != null) && @@ -132,7 +132,7 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { * made on the class, per se, as opposed to on one of its members. * It is only valid to call this method at most once per instance. * - * @param annotations non-null; annotations to set for this class + * @param annotations {@code non-null;} annotations to set for this class */ public void setClassAnnotations(Annotations annotations) { if (annotations == null) { @@ -150,8 +150,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { /** * Adds a field annotations item to this instance. * - * @param field non-null; field in question - * @param annotations non-null; associated annotations to add + * @param field {@code non-null;} field in question + * @param annotations {@code non-null;} associated annotations to add */ public void addFieldAnnotations(CstFieldRef field, Annotations annotations) { @@ -166,8 +166,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { /** * Adds a method annotations item to this instance. * - * @param method non-null; method in question - * @param annotations non-null; associated annotations to add + * @param method {@code non-null;} method in question + * @param annotations {@code non-null;} associated annotations to add */ public void addMethodAnnotations(CstMethodRef method, Annotations annotations) { @@ -182,8 +182,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { /** * Adds a parameter annotations item to this instance. * - * @param method non-null; method in question - * @param list non-null; associated list of annotation sets to add + * @param method {@code non-null;} method in question + * @param list {@code non-null;} associated list of annotation sets to add */ public void addParameterAnnotations(CstMethodRef method, AnnotationsList list) { @@ -198,8 +198,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { * Gets the method annotations for a given method, if any. This is * meant for use by debugging / dumping code. * - * @param method non-null; the method - * @return null-ok; the method annotations, if any + * @param method {@code non-null;} the method + * @return {@code null-ok;} the method annotations, if any */ public Annotations getMethodAnnotations(CstMethodRef method) { if (methodAnnotations == null) { @@ -219,8 +219,8 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { * Gets the parameter annotations for a given method, if any. This is * meant for use by debugging / dumping code. * - * @param method non-null; the method - * @return null-ok; the parameter annotations, if any + * @param method {@code non-null;} the method + * @return {@code null-ok;} the parameter annotations, if any */ public AnnotationsList getParameterAnnotations(CstMethodRef method) { if (parameterAnnotations == null) { @@ -336,11 +336,11 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { } /** - * Gets the list size of the given list, or <code>0</code> if given - * <code>null</code>. + * Gets the list size of the given list, or {@code 0} if given + * {@code null}. * - * @param list null-ok; the list in question - * @return >= 0; its size + * @param list {@code null-ok;} the list in question + * @return {@code >= 0;} its size */ private static int listSize(ArrayList<?> list) { if (list == null) { @@ -354,7 +354,7 @@ public final class AnnotationsDirectoryItem extends OffsettedItem { * Prints out the contents of this instance, in a debugging-friendly * way. This is meant to be called from {@link ClassDefItem#debugPrint}. * - * @param out non-null; where to output to + * @param out {@code non-null;} where to output to */ /*package*/ void debugPrint(PrintWriter out) { if (classAnnotations != null) { diff --git a/dx/src/com/android/dx/dex/file/CatchStructs.java b/dx/src/com/android/dx/dex/file/CatchStructs.java index b7abc3f53..341201538 100644 --- a/dx/src/com/android/dx/dex/file/CatchStructs.java +++ b/dx/src/com/android/dx/dex/file/CatchStructs.java @@ -32,27 +32,27 @@ import java.util.TreeMap; /** * List of exception handlers (tuples of covered range, catch type, * handler address) for a particular piece of code. Instances of this - * class correspond to a <code>try_item[]</code> and a - * <code>catch_handler_item[]</code>. + * class correspond to a {@code try_item[]} and a + * {@code catch_handler_item[]}. */ public final class CatchStructs { /** - * the size of a <code>try_item</code>: a <code>uint</code> - * and two <code>ushort</code>s + * the size of a {@code try_item}: a {@code uint} + * and two {@code ushort}s */ private static final int TRY_ITEM_WRITE_SIZE = 4 + (2 * 2); - /** non-null; code that contains the catches */ + /** {@code non-null;} code that contains the catches */ private final DalvCode code; /** - * null-ok; the underlying table; set in + * {@code null-ok;} the underlying table; set in * {@link #finishProcessingIfNecessary} */ private CatchTable table; /** - * null-ok; the encoded handler list, if calculated; set in + * {@code null-ok;} the encoded handler list, if calculated; set in * {@link #encode} */ private byte[] encodedHandlers; @@ -64,7 +64,7 @@ public final class CatchStructs { private int encodedHandlerHeaderSize; /** - * null-ok; map from handler lists to byte offsets, if calculated; set in + * {@code null-ok;} map from handler lists to byte offsets, if calculated; set in * {@link #encode} */ private TreeMap<CatchHandlerList, Integer> handlerOffsets; @@ -72,7 +72,7 @@ public final class CatchStructs { /** * Constructs an instance. * - * @param code non-null; code that contains the catches + * @param code {@code non-null;} code that contains the catches */ public CatchStructs(DalvCode code) { this.code = code; @@ -94,7 +94,7 @@ public final class CatchStructs { /** * Gets the size of the tries list, in entries. * - * @return >= 0; the tries list size + * @return {@code >= 0;} the tries list size */ public int triesSize() { finishProcessingIfNecessary(); @@ -104,8 +104,8 @@ public final class CatchStructs { /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump - * @param prefix non-null; prefix to attach to each line of output + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} prefix to attach to each line of output */ public void debugPrint(PrintWriter out, String prefix) { annotateEntries(prefix, out, null); @@ -114,7 +114,7 @@ public final class CatchStructs { /** * Encodes the handler lists. * - * @param file non-null; file this instance is part of + * @param file {@code non-null;} file this instance is part of */ public void encode(DexFile file) { finishProcessingIfNecessary(); @@ -179,7 +179,7 @@ public final class CatchStructs { /** * Gets the write size of this instance, in bytes. * - * @return >= 0; the write size + * @return {@code >= 0;} the write size */ public int writeSize() { return (triesSize() * TRY_ITEM_WRITE_SIZE) + @@ -189,20 +189,17 @@ public final class CatchStructs { /** * Writes this instance to the given stream. * - * @param file non-null; file this instance is part of - * @param out non-null; where to write to + * @param file {@code non-null;} file this instance is part of + * @param out {@code non-null;} where to write to */ public void writeTo(DexFile file, AnnotatedOutput out) { finishProcessingIfNecessary(); - TypeIdsSection typeIds = file.getTypeIds(); - int tableSize = table.size(); - int handlersSize = handlerOffsets.size(); - if (out.annotates()) { annotateEntries(" ", null, out); } + int tableSize = table.size(); for (int i = 0; i < tableSize; i++) { CatchTable.Entry one = table.get(i); int start = one.getStart(); @@ -225,12 +222,12 @@ public final class CatchStructs { /** * Helper method to annotate or simply print the exception handlers. - * Only one of <code>printTo</code> or <code>annotateTo</code> should + * Only one of {@code printTo} or {@code annotateTo} should * be non-null. * - * @param prefix non-null; prefix for each line - * @param printTo null-ok; where to print to - * @param annotateTo null-ok; where to consume bytes and annotate to + * @param prefix {@code non-null;} prefix for each line + * @param printTo {@code null-ok;} where to print to + * @param annotateTo {@code null-ok;} where to consume bytes and annotate to */ private void annotateEntries(String prefix, PrintWriter printTo, AnnotatedOutput annotateTo) { @@ -299,12 +296,12 @@ public final class CatchStructs { * Helper for {@link #annotateEntries} to annotate a catch handler list * while consuming it. * - * @param handlers non-null; handlers to annotate - * @param offset >= 0; the offset of this handler - * @param size >= 1; the number of bytes the handlers consume - * @param prefix non-null; prefix for each line - * @param printTo null-ok; where to print to - * @param annotateTo non-null; where to annotate to + * @param handlers {@code non-null;} handlers to annotate + * @param offset {@code >= 0;} the offset of this handler + * @param size {@code >= 1;} the number of bytes the handlers consume + * @param prefix {@code non-null;} prefix for each line + * @param printTo {@code null-ok;} where to print to + * @param annotateTo {@code non-null;} where to annotate to */ private static void annotateAndConsumeHandlers(CatchHandlerList handlers, int offset, int size, String prefix, PrintWriter printTo, diff --git a/dx/src/com/android/dx/dex/file/ClassDataItem.java b/dx/src/com/android/dx/dex/file/ClassDataItem.java index 638daed21..4823f9f5f 100644 --- a/dx/src/com/android/dx/dex/file/ClassDataItem.java +++ b/dx/src/com/android/dx/dex/file/ClassDataItem.java @@ -38,32 +38,32 @@ import java.util.HashMap; * Representation of all the parts of a Dalvik class that are generally * "inflated" into an in-memory representation at runtime. Instances of * this class are represented in a compact streamable form in a - * <code>dex</code> file, as opposed to a random-access form. + * {@code dex} file, as opposed to a random-access form. */ public final class ClassDataItem extends OffsettedItem { - /** non-null; what class this data is for, just for listing generation */ + /** {@code non-null;} what class this data is for, just for listing generation */ private final CstType thisClass; - /** non-null; list of static fields */ + /** {@code non-null;} list of static fields */ private final ArrayList<EncodedField> staticFields; - /** non-null; list of initial values for static fields */ + /** {@code non-null;} list of initial values for static fields */ private final HashMap<EncodedField, Constant> staticValues; - /** non-null; list of instance fields */ + /** {@code non-null;} list of instance fields */ private final ArrayList<EncodedField> instanceFields; - /** non-null; list of direct methods */ + /** {@code non-null;} list of direct methods */ private final ArrayList<EncodedMethod> directMethods; - /** non-null; list of virtual methods */ + /** {@code non-null;} list of virtual methods */ private final ArrayList<EncodedMethod> virtualMethods; - /** null-ok; static initializer list; set in {@link #addContents} */ + /** {@code null-ok;} static initializer list; set in {@link #addContents} */ private CstArray staticValuesConstant; /** - * null-ok; encoded form, ready for writing to a file; set during + * {@code null-ok;} encoded form, ready for writing to a file; set during * {@link #place0} */ private byte[] encodedForm; @@ -72,7 +72,7 @@ public final class ClassDataItem extends OffsettedItem { * Constructs an instance. Its sets of members are initially * empty. * - * @param thisClass non-null; what class this data is for, just + * @param thisClass {@code non-null;} what class this data is for, just * for listing generation */ public ClassDataItem(CstType thisClass) { @@ -106,8 +106,8 @@ public final class ClassDataItem extends OffsettedItem { /** * Returns whether this instance is empty. * - * @return <code>true</code> if this instance is empty or - * <code>false</code> if at least one element has been added to it + * @return {@code true} if this instance is empty or + * {@code false} if at least one element has been added to it */ public boolean isEmpty() { return staticFields.isEmpty() && instanceFields.isEmpty() @@ -117,8 +117,8 @@ public final class ClassDataItem extends OffsettedItem { /** * Adds a static field. * - * @param field non-null; the field to add - * @param value null-ok; initial value for the field, if any + * @param field {@code non-null;} the field to add + * @param value {@code null-ok;} initial value for the field, if any */ public void addStaticField(EncodedField field, Constant value) { if (field == null) { @@ -137,7 +137,7 @@ public final class ClassDataItem extends OffsettedItem { /** * Adds an instance field. * - * @param field non-null; the field to add + * @param field {@code non-null;} the field to add */ public void addInstanceField(EncodedField field) { if (field == null) { @@ -148,9 +148,9 @@ public final class ClassDataItem extends OffsettedItem { } /** - * Adds a direct (<code>static</code> and/or <code>private</code>) method. + * Adds a direct ({@code static} and/or {@code private}) method. * - * @param method non-null; the method to add + * @param method {@code non-null;} the method to add */ public void addDirectMethod(EncodedMethod method) { if (method == null) { @@ -163,7 +163,7 @@ public final class ClassDataItem extends OffsettedItem { /** * Adds a virtual method. * - * @param method non-null; the method to add + * @param method {@code non-null;} the method to add */ public void addVirtualMethod(EncodedMethod method) { if (method == null) { @@ -178,7 +178,7 @@ public final class ClassDataItem extends OffsettedItem { * in any way to the underlying lists contained in this instance, but * the objects contained in the list are shared. * - * @return non-null; list of all methods + * @return {@code non-null;} list of all methods */ public ArrayList<EncodedMethod> getMethods() { int sz = directMethods.size() + virtualMethods.size(); @@ -195,7 +195,7 @@ public final class ClassDataItem extends OffsettedItem { * Prints out the contents of this instance, in a debugging-friendly * way. * - * @param out non-null; where to output to + * @param out {@code non-null;} where to output to * @param verbose whether to be verbose with the output */ public void debugPrint(Writer out, boolean verbose) { @@ -258,9 +258,9 @@ public final class ClassDataItem extends OffsettedItem { /** * Gets a {@link CstArray} corresponding to {@link #staticValues} if - * it contains any non-zero non-<code>null</code> values. + * it contains any non-zero non-{@code null} values. * - * @return null-ok; the corresponding constant or <code>null</code> if + * @return {@code null-ok;} the corresponding constant or {@code null} if * there are no values to encode */ public CstArray getStaticValuesConstant() { @@ -273,9 +273,9 @@ public final class ClassDataItem extends OffsettedItem { /** * Gets a {@link CstArray} corresponding to {@link #staticValues} if - * it contains any non-zero non-<code>null</code> values. + * it contains any non-zero non-{@code null} values. * - * @return null-ok; the corresponding constant or <code>null</code> if + * @return {@code null-ok;} the corresponding constant or {@code null} if * there are no values to encode */ private CstArray makeStaticValuesConstant() { @@ -337,13 +337,11 @@ public final class ClassDataItem extends OffsettedItem { /** * Writes out the encoded form of this instance. * - * @param file non-null; file this instance is part of - * @param out non-null; where to write to + * @param file {@code non-null;} file this instance is part of + * @param out {@code non-null;} where to write to */ private void encodeOutput(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); - int svSize = (staticValuesConstant == null) ? 0 : - staticValuesConstant.getList().size(); if (annotates) { out.annotate(0, offsetString() + " class data for " + @@ -369,10 +367,10 @@ public final class ClassDataItem extends OffsettedItem { * Helper for {@link #encodeOutput}, which writes out the given * size value, annotating it as well (if annotations are enabled). * - * @param file non-null; file this instance is part of - * @param out non-null; where to write to - * @param label non-null; the label for the purposes of annotation - * @param size >= 0; the size to write + * @param file {@code non-null;} file this instance is part of + * @param out {@code non-null;} where to write to + * @param label {@code non-null;} the label for the purposes of annotation + * @param size {@code >= 0;} the size to write */ private static void encodeSize(DexFile file, AnnotatedOutput out, String label, int size) { @@ -389,10 +387,10 @@ public final class ClassDataItem extends OffsettedItem { * list. It also annotates the items (if any and if annotations * are enabled). * - * @param file non-null; file this instance is part of - * @param out non-null; where to write to - * @param label non-null; the label for the purposes of annotation - * @param list non-null; the list in question + * @param file {@code non-null;} file this instance is part of + * @param out {@code non-null;} where to write to + * @param label {@code non-null;} the label for the purposes of annotation + * @param list {@code non-null;} the list in question */ private static void encodeList(DexFile file, AnnotatedOutput out, String label, ArrayList<? extends EncodedMember> list) { diff --git a/dx/src/com/android/dx/dex/file/ClassDefItem.java b/dx/src/com/android/dx/dex/file/ClassDefItem.java index 5a0b27c90..acd8cf515 100644 --- a/dx/src/com/android/dx/dex/file/ClassDefItem.java +++ b/dx/src/com/android/dx/dex/file/ClassDefItem.java @@ -45,47 +45,47 @@ public final class ClassDefItem extends IndexedItem { /** size of instances when written out to a file, in bytes */ public static final int WRITE_SIZE = 32; - /** non-null; type constant for this class */ + /** {@code non-null;} type constant for this class */ private final CstType thisClass; /** access flags */ private final int accessFlags; /** - * null-ok; superclass or <code>null</code> if this class is a/the + * {@code null-ok;} superclass or {@code null} if this class is a/the * root class */ private final CstType superclass; - /** null-ok; list of implemented interfaces */ + /** {@code null-ok;} list of implemented interfaces */ private TypeListItem interfaces; - /** null-ok; source file name or <code>null</code> if unknown */ + /** {@code null-ok;} source file name or {@code null} if unknown */ private final CstUtf8 sourceFile; - /** non-null; associated class data object */ + /** {@code non-null;} associated class data object */ private final ClassDataItem classData; /** - * null-ok; item wrapper for the static values, initialized + * {@code null-ok;} item wrapper for the static values, initialized * in {@link #addContents} */ private EncodedArrayItem staticValuesItem; - /** non-null; annotations directory */ + /** {@code non-null;} annotations directory */ private AnnotationsDirectoryItem annotationsDirectory; /** * Constructs an instance. Its sets of members and annotations are * initially empty. * - * @param thisClass non-null; type constant for this class + * @param thisClass {@code non-null;} type constant for this class * @param accessFlags access flags - * @param superclass null-ok; superclass or <code>null</code> if + * @param superclass {@code null-ok;} superclass or {@code null} if * this class is a/the root class - * @param interfaces non-null; list of implemented interfaces - * @param sourceFile null-ok; source file name or - * <code>null</code> if unknown + * @param interfaces {@code non-null;} list of implemented interfaces + * @param sourceFile {@code null-ok;} source file name or + * {@code null} if unknown */ public ClassDefItem(CstType thisClass, int accessFlags, CstType superclass, TypeList interfaces, CstUtf8 sourceFile) { @@ -223,7 +223,7 @@ public final class ClassDefItem extends IndexedItem { /** * Gets the constant corresponding to this class. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public CstType getThisClass() { return thisClass; @@ -241,7 +241,7 @@ public final class ClassDefItem extends IndexedItem { /** * Gets the superclass. * - * @return null-ok; the superclass or <code>null</code> if + * @return {@code null-ok;} the superclass or {@code null} if * this class is a/the root class */ public CstType getSuperclass() { @@ -251,7 +251,7 @@ public final class ClassDefItem extends IndexedItem { /** * Gets the list of interfaces implemented. * - * @return non-null; the interfaces list + * @return {@code non-null;} the interfaces list */ public TypeList getInterfaces() { if (interfaces == null) { @@ -264,7 +264,7 @@ public final class ClassDefItem extends IndexedItem { /** * Gets the source file name. * - * @return null-ok; the source file name or <code>null</code> if unknown + * @return {@code null-ok;} the source file name or {@code null} if unknown */ public CstUtf8 getSourceFile() { return sourceFile; @@ -273,8 +273,8 @@ public final class ClassDefItem extends IndexedItem { /** * Adds a static field. * - * @param field non-null; the field to add - * @param value null-ok; initial value for the field, if any + * @param field {@code non-null;} the field to add + * @param value {@code null-ok;} initial value for the field, if any */ public void addStaticField(EncodedField field, Constant value) { classData.addStaticField(field, value); @@ -283,16 +283,16 @@ public final class ClassDefItem extends IndexedItem { /** * Adds an instance field. * - * @param field non-null; the field to add + * @param field {@code non-null;} the field to add */ public void addInstanceField(EncodedField field) { classData.addInstanceField(field); } /** - * Adds a direct (<code>static</code> and/or <code>private</code>) method. + * Adds a direct ({@code static} and/or {@code private}) method. * - * @param method non-null; the method to add + * @param method {@code non-null;} the method to add */ public void addDirectMethod(EncodedMethod method) { classData.addDirectMethod(method); @@ -301,7 +301,7 @@ public final class ClassDefItem extends IndexedItem { /** * Adds a virtual method. * - * @param method non-null; the method to add + * @param method {@code non-null;} the method to add */ public void addVirtualMethod(EncodedMethod method) { classData.addVirtualMethod(method); @@ -312,7 +312,7 @@ public final class ClassDefItem extends IndexedItem { * in any way to the underlying lists contained in this instance, but * the objects contained in the list are shared. * - * @return non-null; list of all methods + * @return {@code non-null;} list of all methods */ public ArrayList<EncodedMethod> getMethods() { return classData.getMethods(); @@ -323,7 +323,7 @@ public final class ClassDefItem extends IndexedItem { * made on the class, per se, as opposed to on one of its members. * It is only valid to call this method at most once per instance. * - * @param annotations non-null; annotations to set for this class + * @param annotations {@code non-null;} annotations to set for this class */ public void setClassAnnotations(Annotations annotations) { annotationsDirectory.setClassAnnotations(annotations); @@ -332,8 +332,8 @@ public final class ClassDefItem extends IndexedItem { /** * Adds a field annotations item to this class. * - * @param field non-null; field in question - * @param annotations non-null; associated annotations to add + * @param field {@code non-null;} field in question + * @param annotations {@code non-null;} associated annotations to add */ public void addFieldAnnotations(CstFieldRef field, Annotations annotations) { @@ -343,8 +343,8 @@ public final class ClassDefItem extends IndexedItem { /** * Adds a method annotations item to this class. * - * @param method non-null; method in question - * @param annotations non-null; associated annotations to add + * @param method {@code non-null;} method in question + * @param annotations {@code non-null;} associated annotations to add */ public void addMethodAnnotations(CstMethodRef method, Annotations annotations) { @@ -354,8 +354,8 @@ public final class ClassDefItem extends IndexedItem { /** * Adds a parameter annotations item to this class. * - * @param method non-null; method in question - * @param list non-null; associated list of annotation sets to add + * @param method {@code non-null;} method in question + * @param list {@code non-null;} associated list of annotation sets to add */ public void addParameterAnnotations(CstMethodRef method, AnnotationsList list) { @@ -366,8 +366,8 @@ public final class ClassDefItem extends IndexedItem { * Gets the method annotations for a given method, if any. This is * meant for use by debugging / dumping code. * - * @param method non-null; the method - * @return null-ok; the method annotations, if any + * @param method {@code non-null;} the method + * @return {@code null-ok;} the method annotations, if any */ public Annotations getMethodAnnotations(CstMethodRef method) { return annotationsDirectory.getMethodAnnotations(method); @@ -377,8 +377,8 @@ public final class ClassDefItem extends IndexedItem { * Gets the parameter annotations for a given method, if any. This is * meant for use by debugging / dumping code. * - * @param method non-null; the method - * @return null-ok; the parameter annotations, if any + * @param method {@code non-null;} the method + * @return {@code null-ok;} the parameter annotations, if any */ public AnnotationsList getParameterAnnotations(CstMethodRef method) { return annotationsDirectory.getParameterAnnotations(method); @@ -388,7 +388,7 @@ public final class ClassDefItem extends IndexedItem { * Prints out the contents of this instance, in a debugging-friendly * way. * - * @param out non-null; where to output to + * @param out {@code non-null;} where to output to * @param verbose whether to be verbose with the output */ public void debugPrint(Writer out, boolean verbose) { diff --git a/dx/src/com/android/dx/dex/file/ClassDefsSection.java b/dx/src/com/android/dx/dex/file/ClassDefsSection.java index cf61b4732..e8efd5745 100644 --- a/dx/src/com/android/dx/dex/file/ClassDefsSection.java +++ b/dx/src/com/android/dx/dex/file/ClassDefsSection.java @@ -28,22 +28,22 @@ import java.util.Collection; import java.util.TreeMap; /** - * Class definitions list section of a <code>.dex</code> file. + * Class definitions list section of a {@code .dex} file. */ public final class ClassDefsSection extends UniformItemSection { /** - * non-null; map from type constants for classes to {@link + * {@code non-null;} map from type constants for classes to {@link * ClassDefItem} instances that define those classes */ private final TreeMap<Type, ClassDefItem> classDefs; - /** null-ok; ordered list of classes; set in {@link #orderItems} */ + /** {@code null-ok;} ordered list of classes; set in {@link #orderItems} */ private ArrayList<ClassDefItem> orderedDefs; /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public ClassDefsSection(DexFile file) { super("class_defs", file, 4); @@ -84,7 +84,7 @@ public final class ClassDefsSection extends UniformItemSection { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -105,7 +105,7 @@ public final class ClassDefsSection extends UniformItemSection { * Adds an element to this instance. It is illegal to attempt to add more * than one class with the same name. * - * @param clazz non-null; the class def to add + * @param clazz {@code non-null;} the class def to add */ public void add(ClassDefItem clazz) { Type type; @@ -149,11 +149,11 @@ public final class ClassDefsSection extends UniformItemSection { * Helper for {@link #orderItems}, which recursively assigns indices * to classes. * - * @param type null-ok; type ref to assign, if any - * @param idx >= 0; the next index to assign + * @param type {@code null-ok;} type ref to assign, if any + * @param idx {@code >= 0;} the next index to assign * @param maxDepth maximum recursion depth; if negative, this will * throw an exception indicating class definition circularity - * @return >= 0; the next index to assign + * @return {@code >= 0;} the next index to assign */ private int orderItems0(Type type, int idx, int maxDepth) { ClassDefItem c = classDefs.get(type); diff --git a/dx/src/com/android/dx/dex/file/CodeItem.java b/dx/src/com/android/dx/dex/file/CodeItem.java index dc0bb5272..ab7abbebb 100644 --- a/dx/src/com/android/dx/dex/file/CodeItem.java +++ b/dx/src/com/android/dx/dex/file/CodeItem.java @@ -39,7 +39,7 @@ import java.util.HashSet; /** * Representation of all the parts needed for concrete methods in a - * <code>dex</code> file. + * {@code dex} file. */ public final class CodeItem extends OffsettedItem { /** file alignment of this class, in bytes */ @@ -48,26 +48,26 @@ public final class CodeItem extends OffsettedItem { /** write size of the header of this class, in bytes */ private static final int HEADER_SIZE = 16; - /** non-null; method that this code implements */ + /** {@code non-null;} method that this code implements */ private final CstMethodRef ref; - /** non-null; the bytecode instructions and associated data */ + /** {@code non-null;} the bytecode instructions and associated data */ private final DalvCode code; - /** null-ok; the catches, if needed; set in {@link #addContents} */ + /** {@code null-ok;} the catches, if needed; set in {@link #addContents} */ private CatchStructs catches; - /** whether this instance is for a <code>static</code> method */ + /** whether this instance is for a {@code static} method */ private final boolean isStatic; /** - * non-null; list of possibly-thrown exceptions; just used in + * {@code non-null;} list of possibly-thrown exceptions; just used in * generating debugging output (listings) */ private final TypeList throwsList; /** - * null-ok; the debug info or <code>null</code> if there is none; + * {@code null-ok;} the debug info or {@code null} if there is none; * set in {@link #addContents} */ private DebugInfoItem debugInfo; @@ -75,11 +75,11 @@ public final class CodeItem extends OffsettedItem { /** * Constructs an instance. * - * @param ref non-null; method that this code implements - * @param code non-null; the underlying code - * @param isStatic whether this instance is for a <code>static</code> + * @param ref {@code non-null;} method that this code implements + * @param code {@code non-null;} the underlying code + * @param isStatic whether this instance is for a {@code static} * method - * @param throwsList non-null; list of possibly-thrown exceptions, + * @param throwsList {@code non-null;} list of possibly-thrown exceptions, * just used in generating debugging output (listings) */ public CodeItem(CstMethodRef ref, DalvCode code, boolean isStatic, @@ -114,7 +114,6 @@ public final class CodeItem extends OffsettedItem { /** {@inheritDoc} */ public void addContents(DexFile file) { - MixedItemSection wordData = file.getWordData(); MixedItemSection byteData = file.getByteData(); TypeIdsSection typeIds = file.getTypeIds(); @@ -150,7 +149,7 @@ public final class CodeItem extends OffsettedItem { /** * Gets the reference to the method this instance implements. * - * @return non-null; the method reference + * @return {@code non-null;} the method reference */ public CstMethodRef getRef() { return ref; @@ -159,8 +158,8 @@ public final class CodeItem extends OffsettedItem { /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump - * @param prefix non-null; per-line prefix to use + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} per-line prefix to use * @param verbose whether to be verbose with the output */ public void debugPrint(PrintWriter out, String prefix, boolean verbose) { @@ -292,8 +291,8 @@ public final class CodeItem extends OffsettedItem { /** * Helper for {@link #writeTo0} which writes out the actual bytecode. * - * @param file non-null; file we are part of - * @param out non-null; where to write to + * @param file {@code non-null;} file we are part of + * @param out {@code non-null;} where to write to */ private void writeCodes(DexFile file, AnnotatedOutput out) { DalvInsnList insns = code.getInsns(); diff --git a/dx/src/com/android/dx/dex/file/DebugInfoConstants.java b/dx/src/com/android/dx/dex/file/DebugInfoConstants.java index 010acb434..78b6b049d 100644 --- a/dx/src/com/android/dx/dex/file/DebugInfoConstants.java +++ b/dx/src/com/android/dx/dex/file/DebugInfoConstants.java @@ -110,8 +110,8 @@ public interface DebugInfoConstants { * next position entry that is added should be considered the end of * a method prologue (an appropriate place for a method breakpoint).<p> * - * The prologue_end register is cleared by any special (>= OPCODE_BASE) - * opcode. + * The prologue_end register is cleared by any special + * ({@code >= OPCODE_BASE}) opcode. */ static final int DBG_SET_PROLOGUE_END = 0x07; @@ -121,8 +121,8 @@ public interface DebugInfoConstants { * a method epilogue (an appropriate place to suspend execution before * method exit).<p> * - * The epilogue_begin register is cleared by any special (>= OPCODE_BASE) - * opcode. + * The epilogue_begin register is cleared by any special + * ({@code >= OPCODE_BASE}) opcode. */ static final int DBG_SET_EPILOGUE_BEGIN = 0x08; diff --git a/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java b/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java index 3ffd27696..cd2005526 100644 --- a/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java +++ b/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java @@ -38,7 +38,7 @@ import static com.android.dx.dex.file.DebugInfoConstants.*; /** * A decoder for the dex debug info state machine format. * This code exists mostly as a reference implementation and test for - * for the <code>DebugInfoEncoder</code> + * for the {@code DebugInfoEncoder} */ public class DebugInfoDecoder { /** encoded debug info */ @@ -180,7 +180,7 @@ public class DebugInfoDecoder { /** * Gets the decoded positions list. - * Valid after calling <code>decode</code>. + * Valid after calling {@code decode}. * * @return positions list in ascending address order. */ @@ -190,7 +190,7 @@ public class DebugInfoDecoder { /** * Gets the decoded locals list, in ascending start-address order. - * Valid after calling <code>decode</code>. + * Valid after calling {@code decode}. * * @return locals list in ascending address order. */ @@ -227,7 +227,7 @@ public class DebugInfoDecoder { /** * Gets the register that begins the method's parameter range (including * the 'this' parameter for non-static methods). The range continues until - * <code>regSize</code> + * {@code regSize} * * @return register as noted above. */ @@ -416,9 +416,9 @@ public class DebugInfoDecoder { * encoder. * * @param info encoded debug info - * @param file non-null; file to refer to during decoding - * @param ref non-null; method whose info is being decoded - * @param code non-null; original code object that was encoded + * @param file {@code non-null;} file to refer to during decoding + * @param ref {@code non-null;} method whose info is being decoded + * @param code {@code non-null;} original code object that was encoded * @param isStatic whether the method is static */ public static void validateEncode(byte[] info, DexFile file, diff --git a/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java b/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java index 780e18d5b..08b663793 100644 --- a/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java +++ b/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java @@ -46,19 +46,19 @@ import static com.android.dx.dex.file.DebugInfoConstants.*; * <li> signed LEB128: initial value for line register. * <li> n instances of signed LEB128: string indicies (offset by 1) * for each method argument in left-to-right order - * with <code>this</code> excluded. A value of '0' indicates "no name" + * with {@code this} excluded. A value of '0' indicates "no name" * <li> A sequence of special or normal opcodes as defined in - * <code>DebugInfoConstants</code>. - * <li> A single terminating <code>OP_END_SEQUENCE</code> + * {@code DebugInfoConstants}. + * <li> A single terminating {@code OP_END_SEQUENCE} * </ol> */ public final class DebugInfoEncoder { private static final boolean DEBUG = false; - /** null-ok; positions (line numbers) to encode */ + /** {@code null-ok;} positions (line numbers) to encode */ private final PositionList positions; - /** null-ok; local variables to encode */ + /** {@code null-ok;} local variables to encode */ private final LocalList locals; private final ByteArrayAnnotatedOutput output; @@ -96,33 +96,32 @@ public final class DebugInfoEncoder { /** * Creates an instance. * - * @param pl null-ok; positions (line numbers) to encode - * @param ll null-ok; local variables to encode - * @param file null-ok; may only be <code>null</code> if simply using + * @param positions {@code null-ok;} positions (line numbers) to encode + * @param locals {@code null-ok;} local variables to encode + * @param file {@code null-ok;} may only be {@code null} if simply using * this class to do a debug print * @param codeSize * @param regSize * @param isStatic * @param ref */ - public DebugInfoEncoder(PositionList pl, LocalList ll, + public DebugInfoEncoder(PositionList positions, LocalList locals, DexFile file, int codeSize, int regSize, boolean isStatic, CstMethodRef ref) { - this.positions = pl; - this.locals = ll; + this.positions = positions; + this.locals = locals; this.file = file; - output = new ByteArrayAnnotatedOutput(); this.desc = ref.getPrototype(); this.isStatic = isStatic; - this.codeSize = codeSize; this.regSize = regSize; + output = new ByteArrayAnnotatedOutput(); lastEntryForReg = new LocalList.Entry[regSize]; } /** - * Annotates or writes a message to the <code>debugPrint</code> writer + * Annotates or writes a message to the {@code debugPrint} writer * if applicable. * * @param length the number of bytes associated with this message @@ -146,8 +145,8 @@ public final class DebugInfoEncoder { * Converts this (PositionList, LocalList) pair into a state machine * sequence. * - * @return encoded byte sequence without padding and - * terminated with a <code>'\00'</code> + * @return {@code non-null;} encoded byte sequence without padding and + * terminated with a {@code 0x00} byte */ public byte[] convert() { try { @@ -169,15 +168,15 @@ public final class DebugInfoEncoder { /** * Converts and produces annotations on a stream. Does not write - * actual bits to the <code>AnnotatedOutput</code>. + * actual bits to the {@code AnnotatedOutput}. * - * @param prefix null-ok; prefix to attach to each line of output - * @param debugPrint null-ok; if specified, an alternate output for + * @param prefix {@code null-ok;} prefix to attach to each line of output + * @param debugPrint {@code null-ok;} if specified, an alternate output for * annotations - * @param out null-ok; if specified, where annotations should go + * @param out {@code null-ok;} if specified, where annotations should go * @param consume whether to claim to have consumed output for - * <code>out</code> - * @return output sequence + * {@code out} + * @return {@code non-null;} encoded output */ public byte[] convertAndAnnotate(String prefix, PrintWriter debugPrint, AnnotatedOutput out, boolean consume) { @@ -190,7 +189,7 @@ public final class DebugInfoEncoder { return result; } - + private byte[] convert0() throws IOException { ArrayList<PositionList.Entry> sortedPositions = buildSortedPositions(); ArrayList<LocalList.Entry> methodArgs = extractMethodArguments(); @@ -204,21 +203,22 @@ public final class DebugInfoEncoder { annotate(1, String.format("%04x: prologue end",address)); } - int szp = sortedPositions.size(); - int szl = locals.size(); + int positionsSz = sortedPositions.size(); + int localsSz = locals.size(); // Current index in sortedPositions - int curp = 0; + int curPositionIdx = 0; // Current index in locals - int curl = 0; + int curLocalIdx = 0; for (;;) { /* * Emit any information for the current address. */ - curl = emitLocalsAtAddress(curl); - curp = emitPositionsAtAddress(curp, sortedPositions); + curLocalIdx = emitLocalsAtAddress(curLocalIdx); + curPositionIdx = + emitPositionsAtAddress(curPositionIdx, sortedPositions); /* * Figure out what the next important address is. @@ -227,12 +227,12 @@ public final class DebugInfoEncoder { int nextAddrL = Integer.MAX_VALUE; // local variable int nextAddrP = Integer.MAX_VALUE; // position (line number) - if (curl < szl) { - nextAddrL = locals.get(curl).getAddress(); + if (curLocalIdx < localsSz) { + nextAddrL = locals.get(curLocalIdx).getAddress(); } - if (curp < szp) { - nextAddrP = sortedPositions.get(curp).getAddress(); + if (curPositionIdx < positionsSz) { + nextAddrP = sortedPositions.get(curPositionIdx).getAddress(); } int next = Math.min(nextAddrP, nextAddrL); @@ -249,12 +249,12 @@ public final class DebugInfoEncoder { if (next == codeSize && nextAddrL == Integer.MAX_VALUE && nextAddrP == Integer.MAX_VALUE) { - break; + break; } if (next == nextAddrP) { // Combined advance PC + position entry - emitPosition(sortedPositions.get(curp++)); + emitPosition(sortedPositions.get(curPositionIdx++)); } else { emitAdvancePc(next - address); } @@ -271,96 +271,96 @@ public final class DebugInfoEncoder { * locals} and including all subsequent activity at the same * address. * - * @param curl Current index in locals - * @return new value for <code>curl</code> + * @param curLocalIdx Current index in locals + * @return new value for {@code curLocalIdx} * @throws IOException */ - private int emitLocalsAtAddress(int curl) + private int emitLocalsAtAddress(int curLocalIdx) throws IOException { int sz = locals.size(); // TODO: Don't emit ends implied by starts. - while ((curl < sz) - && (locals.get(curl).getAddress() == address)) { - LocalList.Entry lle = locals.get(curl++); - int reg = lle.getRegister(); - LocalList.Entry prevlle = lastEntryForReg[reg]; + while ((curLocalIdx < sz) + && (locals.get(curLocalIdx).getAddress() == address)) { + LocalList.Entry entry = locals.get(curLocalIdx++); + int reg = entry.getRegister(); + LocalList.Entry prevEntry = lastEntryForReg[reg]; - if (lle == prevlle) { + if (entry == prevEntry) { /* * Here we ignore locals entries for parameters, * which have already been represented and placed in the * lastEntryForReg array. */ continue; - } + } // At this point we have a new entry one way or another. - lastEntryForReg[reg] = lle; + lastEntryForReg[reg] = entry; - if (lle.isStart()) { - if ((prevlle != null) && lle.matches(prevlle)) { + if (entry.isStart()) { + if ((prevEntry != null) && entry.matches(prevEntry)) { /* * The previous local in this register has the same * name and type as the one being introduced now, so * use the more efficient "restart" form. */ - if (prevlle.isStart()) { + if (prevEntry.isStart()) { /* * We should never be handed a start when a * a matching local is already active. */ throw new RuntimeException("shouldn't happen"); } - emitLocalRestart(lle); + emitLocalRestart(entry); } else { - emitLocalStart(lle); + emitLocalStart(entry); } } else { /* * Only emit a local end if it is *not* due to a direct * replacement. Direct replacements imply an end of the * previous local in the same register. - * + * * TODO: Make sure the runtime can deal with implied * local ends from category-2 interactions, and when so, * also stop emitting local ends for those cases. */ - if (lle.getDisposition() + if (entry.getDisposition() != LocalList.Disposition.END_REPLACED) { - emitLocalEnd(lle); + emitLocalEnd(entry); } } } - return curl; + return curLocalIdx; } /** - * Emits all positions that occur at the current <code>address</code> + * Emits all positions that occur at the current {@code address} * - * @param curp Current index in sortedPositions + * @param curPositionIdx Current index in sortedPositions * @param sortedPositions positions, sorted by ascending address - * @return new value for <code>curp</code> + * @return new value for {@code curPositionIdx} * @throws IOException */ - private int emitPositionsAtAddress(int curp, + private int emitPositionsAtAddress(int curPositionIdx, ArrayList<PositionList.Entry> sortedPositions) throws IOException { - - int szp = sortedPositions.size(); - while (curp < szp - && sortedPositions.get(curp).getAddress() == address) { - emitPosition(sortedPositions.get(curp++)); + int positionsSz = sortedPositions.size(); + while ((curPositionIdx < positionsSz) + && (sortedPositions.get(curPositionIdx).getAddress() + == address)) { + emitPosition(sortedPositions.get(curPositionIdx++)); } - return curp; + return curPositionIdx; } /** * Emits the header sequence, which consists of LEB128-encoded initial * line number and string indicies for names of all non-"this" arguments. - * + * * @param sortedPositions positions, sorted by ascending address * @param methodArgs local list entries for method argumens arguments, * in left-to-right order omitting "this" @@ -392,7 +392,7 @@ public final class DebugInfoEncoder { * entry for the 'this' pointer. */ if (!isStatic) { - for (LocalList.Entry arg: methodArgs) { + for (LocalList.Entry arg : methodArgs) { if (curParam == arg.getRegister()) { lastEntryForReg[curParam] = arg; break; @@ -406,7 +406,7 @@ public final class DebugInfoEncoder { output.writeUnsignedLeb128(szParamTypes); if (annotate) { - annotate(output.getCursor() - mark, + annotate(output.getCursor() - mark, String.format("parameters_size: %04x", szParamTypes)); } @@ -420,7 +420,7 @@ public final class DebugInfoEncoder { mark = output.getCursor(); - for (LocalList.Entry arg: methodArgs) { + for (LocalList.Entry arg : methodArgs) { if (curParam == arg.getRegister()) { found = arg; @@ -507,7 +507,7 @@ public final class DebugInfoEncoder { /** * Gets the register that begins the method's parameter range (including * the 'this' parameter for non-static methods). The range continues until - * <code>regSize</code> + * {@code regSize} * * @return register as noted above */ @@ -521,7 +521,7 @@ public final class DebugInfoEncoder { * from the input list and sorted by ascending register in the * returned list. * - * @return list of non-<code>this</code> method argument locals, + * @return list of non-{@code this} method argument locals, * sorted by ascending register */ private ArrayList<LocalList.Entry> extractMethodArguments() { @@ -566,8 +566,8 @@ public final class DebugInfoEncoder { * Returns a string representation of this LocalList entry that is * appropriate for emitting as an annotation. * - * @param e non-null; entry - * @return non-null; annotation string + * @param e {@code non-null;} entry + * @return {@code non-null;} annotation string */ private String entryAnnotationString(LocalList.Entry e) { StringBuilder sb = new StringBuilder(); @@ -633,7 +633,7 @@ public final class DebugInfoEncoder { * null symbol is used in some cases by the parameter name list * at the beginning of the sequence. * - * @param string null-ok; string to emit + * @param string {@code null-ok;} string to emit * @throws IOException */ private void emitStringIndex(CstUtf8 string) throws IOException { @@ -654,7 +654,7 @@ public final class DebugInfoEncoder { * Emits a type index as an unsigned LEB128. The actual value written * is shifted by 1, so that the '0' value is reserved for "null". * - * @param type null-ok; type to emit + * @param type {@code null-ok;} type to emit * @throws IOException */ private void emitTypeIndex(CstType type) throws IOException { @@ -739,7 +739,7 @@ public final class DebugInfoEncoder { /** * Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence. * - * @param entry entry non-null; entry associated with end. + * @param entry {@code entry non-null;} entry associated with end. * @throws IOException */ private void emitLocalEnd(LocalList.Entry entry) @@ -823,16 +823,17 @@ public final class DebugInfoEncoder { * Essentially the same as described in "DWARF Debugging Format Version 3" * section 6.2.5.1. * - * @param deltaLines >= DBG_LINE_BASE and <= DBG_LINE_BASE + - * DBG_LINE_RANGE, the line change to encode - * @param deltaAddress >= 0; the address change to encode - * @return <= 0xff if in range, otherwise parameters are out of range + * @param deltaLines {@code >= DBG_LINE_BASE, <= DBG_LINE_BASE + + * DBG_LINE_RANGE;} the line change to encode + * @param deltaAddress {@code >= 0;} the address change to encode + * @return {@code <= 0xff} if in range, otherwise parameters are out + * of range */ private static int computeOpcode(int deltaLines, int deltaAddress) { if (deltaLines < DBG_LINE_BASE || deltaLines > (DBG_LINE_BASE + DBG_LINE_RANGE -1)) { - throw new RuntimeException("Parameter out of range"); + throw new RuntimeException("Parameter out of range"); } return (deltaLines - DBG_LINE_BASE) @@ -864,10 +865,10 @@ public final class DebugInfoEncoder { } /** - * Emits an {@link DebugInfoConstants#DBG_ADVANCE_PC DBG_ADVANCE_PC} + * Emits an {@link DebugInfoConstants#DBG_ADVANCE_PC DBG_ADVANCE_PC} * sequence. * - * @param deltaAddress >= 0 amount to change program counter by + * @param deltaAddress {@code >= 0;} amount to change program counter by * @throws IOException */ private void emitAdvancePc(int deltaAddress) throws IOException { @@ -890,8 +891,9 @@ public final class DebugInfoEncoder { /** * Emits an unsigned LEB128 value. * - * @param n >= 0 vallue to emit. Note that, although this can represent - * integers larger than Integer.MAX_VALUE, we currently don't allow that. + * @param n {@code >= 0;} value to emit. Note that, although this can + * represent integers larger than Integer.MAX_VALUE, we currently don't + * allow that. * @throws IOException */ private void emitUnsignedLeb128(int n) throws IOException { @@ -901,7 +903,7 @@ public final class DebugInfoEncoder { "Signed value where unsigned required: " + n); } - output.writeSignedLeb128(n); + output.writeUnsignedLeb128(n); } /** diff --git a/dx/src/com/android/dx/dex/file/DebugInfoItem.java b/dx/src/com/android/dx/dex/file/DebugInfoItem.java index 0e4329b14..1c32bd7a0 100644 --- a/dx/src/com/android/dx/dex/file/DebugInfoItem.java +++ b/dx/src/com/android/dx/dex/file/DebugInfoItem.java @@ -34,7 +34,7 @@ public class DebugInfoItem extends OffsettedItem { private static final boolean ENABLE_ENCODER_SELF_CHECK = false; - /** non-null; the code this item represents */ + /** {@code non-null;} the code this item represents */ private final DalvCode code; private byte[] encoded; @@ -93,9 +93,9 @@ public class DebugInfoItem extends OffsettedItem { * directly after a code dump (with the real local list actually * existing elsewhere in the output). * - * @param file non-null; the file to use for referencing other sections - * @param out non-null; where to annotate to - * @param prefix null-ok; prefix to attach to each line of output + * @param file {@code non-null;} the file to use for referencing other sections + * @param out {@code non-null;} where to annotate to + * @param prefix {@code null-ok;} prefix to attach to each line of output */ public void annotateTo(DexFile file, AnnotatedOutput out, String prefix) { encode(file, prefix, null, out, false); @@ -104,8 +104,8 @@ public class DebugInfoItem extends OffsettedItem { /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump - * @param prefix non-null; prefix to attach to each line of output + * @param out {@code non-null;} where to dump + * @param prefix {@code non-null;} prefix to attach to each line of output */ public void debugPrint(PrintWriter out, String prefix) { encode(null, prefix, out, null, false); @@ -130,14 +130,14 @@ public class DebugInfoItem extends OffsettedItem { /** * Performs debug info encoding. * - * @param file null-ok; file to refer to during encoding - * @param prefix null-ok; prefix to attach to each line of output - * @param debugPrint null-ok; if specified, an alternate output for + * @param file {@code null-ok;} file to refer to during encoding + * @param prefix {@code null-ok;} prefix to attach to each line of output + * @param debugPrint {@code null-ok;} if specified, an alternate output for * annotations - * @param out null-ok; if specified, where annotations should go + * @param out {@code null-ok;} if specified, where annotations should go * @param consume whether to claim to have consumed output for - * <code>out</code> - * @return non-null; the encoded array + * {@code out} + * @return {@code non-null;} the encoded array */ private byte[] encode(DexFile file, String prefix, PrintWriter debugPrint, AnnotatedOutput out, boolean consume) { @@ -161,14 +161,14 @@ public class DebugInfoItem extends OffsettedItem { /** * Helper for {@link #encode} to do most of the work. * - * @param file null-ok; file to refer to during encoding - * @param prefix null-ok; prefix to attach to each line of output - * @param debugPrint null-ok; if specified, an alternate output for + * @param file {@code null-ok;} file to refer to during encoding + * @param prefix {@code null-ok;} prefix to attach to each line of output + * @param debugPrint {@code null-ok;} if specified, an alternate output for * annotations - * @param out null-ok; if specified, where annotations should go + * @param out {@code null-ok;} if specified, where annotations should go * @param consume whether to claim to have consumed output for - * <code>out</code> - * @return non-null; the encoded array + * {@code out} + * @return {@code non-null;} the encoded array */ private byte[] encode0(DexFile file, String prefix, PrintWriter debugPrint, AnnotatedOutput out, boolean consume) { diff --git a/dx/src/com/android/dx/dex/file/DexFile.java b/dx/src/com/android/dx/dex/file/DexFile.java index 8a4075d67..a829fed82 100644 --- a/dx/src/com/android/dx/dex/file/DexFile.java +++ b/dx/src/com/android/dx/dex/file/DexFile.java @@ -38,67 +38,67 @@ import java.util.zip.Adler32; import static com.android.dx.dex.file.MixedItemSection.SortType; /** - * Representation of an entire <code>.dex</code> (Dalvik EXecutable) + * Representation of an entire {@code .dex} (Dalvik EXecutable) * file, which itself consists of a set of Dalvik classes. */ public final class DexFile { - /** non-null; word data section */ + /** {@code non-null;} word data section */ private final MixedItemSection wordData; /** - * non-null; type lists section. This is word data, but separating + * {@code non-null;} type lists section. This is word data, but separating * it from {@link #wordData} helps break what would otherwise be a * circular dependency between the that and {@link #protoIds}. */ private final MixedItemSection typeLists; /** - * non-null; map section. The map needs to be in a section by itself + * {@code non-null;} map section. The map needs to be in a section by itself * for the self-reference mechanics to work in a reasonably * straightforward way. See {@link MapItem#addMap} for more detail. */ private final MixedItemSection map; - /** non-null; string data section */ + /** {@code non-null;} string data section */ private final MixedItemSection stringData; - /** non-null; string identifiers section */ + /** {@code non-null;} string identifiers section */ private final StringIdsSection stringIds; - /** non-null; type identifiers section */ + /** {@code non-null;} type identifiers section */ private final TypeIdsSection typeIds; - /** non-null; prototype identifiers section */ + /** {@code non-null;} prototype identifiers section */ private final ProtoIdsSection protoIds; - /** non-null; field identifiers section */ + /** {@code non-null;} field identifiers section */ private final FieldIdsSection fieldIds; - /** non-null; method identifiers section */ + /** {@code non-null;} method identifiers section */ private final MethodIdsSection methodIds; - /** non-null; class definitions section */ + /** {@code non-null;} class definitions section */ private final ClassDefsSection classDefs; - /** non-null; class data section */ + /** {@code non-null;} class data section */ private final MixedItemSection classData; - /** non-null; byte data section */ + /** {@code non-null;} byte data section */ private final MixedItemSection byteData; - /** non-null; file header */ + /** {@code non-null;} file header */ private final HeaderSection header; /** - * non-null; array of sections in the order they will appear in the + * {@code non-null;} array of sections in the order they will appear in the * final output file */ private final Section[] sections; - /** >= -1; total file size or <code>-1</code> if unknown */ + /** {@code >= -1;} total file size or {@code -1} if unknown */ private int fileSize; - /** >= 40; maximum width of the file dump */ + /** {@code >= 40;} maximum width of the file dump */ private int dumpWidth; /** @@ -137,7 +137,7 @@ public final class DexFile { * Adds a class to this instance. It is illegal to attempt to add more * than one class with the same name. * - * @param clazz non-null; the class to add + * @param clazz {@code non-null;} the class to add */ public void add(ClassDefItem clazz) { classDefs.add(clazz); @@ -146,8 +146,8 @@ public final class DexFile { /** * Gets the class definition with the given name, if any. * - * @param name non-null; the class name to look for - * @return null-ok; the class with the given name, or <code>null</code> + * @param name {@code non-null;} the class name to look for + * @return {@code null-ok;} the class with the given name, or {@code null} * if there is no such class */ public ClassDefItem getClassOrNull(String name) { @@ -164,8 +164,8 @@ public final class DexFile { * Writes the contents of this instance as either a binary or a * human-readable form, or both. * - * @param out null-ok; where to write to - * @param humanOut null-ok; where to write human-oriented output to + * @param out {@code null-ok;} where to write to + * @param humanOut {@code null-ok;} where to write human-oriented output to * @param verbose whether to be verbose when writing human-oriented output */ public void writeTo(OutputStream out, Writer humanOut, boolean verbose) @@ -183,12 +183,12 @@ public final class DexFile { } /** - * Returns the contents of this instance as a <code>.dex</code> file, - * in <code>byte[]</code> form. + * Returns the contents of this instance as a {@code .dex} file, + * in {@code byte[]} form. * - * @param humanOut null-ok; where to write human-oriented output to + * @param humanOut {@code null-ok;} where to write human-oriented output to * @param verbose whether to be verbose when writing human-oriented output - * @return non-null; a <code>.dex</code> file for this instance + * @return {@code non-null;} a {@code .dex} file for this instance */ public byte[] toDex(Writer humanOut, boolean verbose) throws IOException { @@ -205,7 +205,7 @@ public final class DexFile { /** * Sets the maximum width of the human-oriented dump of the instance. * - * @param dumpWidth >= 40; the width + * @param dumpWidth {@code >= 40;} the width */ public void setDumpWidth(int dumpWidth) { if (dumpWidth < 40) { @@ -221,7 +221,7 @@ public final class DexFile { * <p>This is package-scope in order to allow * the {@link HeaderSection} to set itself up properly.</p> * - * @return >= 0; the total file size + * @return {@code >= 0;} the total file size * @throws RuntimeException thrown if the file size is not yet known */ /*package*/ int getFileSize() { @@ -239,7 +239,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the string data section + * @return {@code non-null;} the string data section */ /*package*/ MixedItemSection getStringData() { return stringData; @@ -252,7 +252,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the word data section + * @return {@code non-null;} the word data section */ /*package*/ MixedItemSection getWordData() { return wordData; @@ -265,7 +265,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the word data section + * @return {@code non-null;} the word data section */ /*package*/ MixedItemSection getTypeLists() { return typeLists; @@ -277,7 +277,7 @@ public final class DexFile { * <p>This is package-scope in order to allow the header section * to query it.</p> * - * @return non-null; the map section + * @return {@code non-null;} the map section */ /*package*/ MixedItemSection getMap() { return map; @@ -290,7 +290,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the string identifiers section + * @return {@code non-null;} the string identifiers section */ /*package*/ StringIdsSection getStringIds() { return stringIds; @@ -303,7 +303,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the class definitions section + * @return {@code non-null;} the class definitions section */ /*package*/ ClassDefsSection getClassDefs() { return classDefs; @@ -316,7 +316,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the class data section + * @return {@code non-null;} the class data section */ /*package*/ MixedItemSection getClassData() { return classData; @@ -329,7 +329,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the class identifiers section + * @return {@code non-null;} the class identifiers section */ /*package*/ TypeIdsSection getTypeIds() { return typeIds; @@ -342,7 +342,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the prototype identifiers section + * @return {@code non-null;} the prototype identifiers section */ /*package*/ ProtoIdsSection getProtoIds() { return protoIds; @@ -355,7 +355,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the field identifiers section + * @return {@code non-null;} the field identifiers section */ /*package*/ FieldIdsSection getFieldIds() { return fieldIds; @@ -368,7 +368,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the method identifiers section + * @return {@code non-null;} the method identifiers section */ /*package*/ MethodIdsSection getMethodIds() { return methodIds; @@ -381,7 +381,7 @@ public final class DexFile { * the various {@link Item} instances to add items to the * instance.</p> * - * @return non-null; the byte data section + * @return {@code non-null;} the byte data section */ /*package*/ MixedItemSection getByteData() { return byteData; @@ -394,7 +394,7 @@ public final class DexFile { * <p>This is package-scope in order to allow the header section * to query it.</p> * - * @return non-null; the section + * @return {@code non-null;} the section */ /*package*/ Section getFirstDataSection() { return wordData; @@ -407,7 +407,7 @@ public final class DexFile { * <p>This is package-scope in order to allow the header section * to query it.</p> * - * @return non-null; the section + * @return {@code non-null;} the section */ /*package*/ Section getLastDataSection() { return map; @@ -418,7 +418,7 @@ public final class DexFile { * instance, or do nothing if the given constant isn't the sort * that should be interned. * - * @param cst non-null; constant to possibly intern + * @param cst {@code non-null;} constant to possibly intern */ /*package*/ void internIfAppropriate(Constant cst) { if (cst instanceof CstString) { @@ -441,13 +441,13 @@ public final class DexFile { /** * Gets the {@link IndexedItem} corresponding to the given constant, * if it is a constant that has such a correspondence, or return - * <code>null</code> if it isn't such a constant. This will throw + * {@code null} if it isn't such a constant. This will throw * an exception if the given constant <i>should</i> have been found * but wasn't. * - * @param cst non-null; the constant to look up - * @return null-ok; its corresponding item, if it has a corresponding - * item, or <code>null</code> if it's not that sort of constant + * @param cst {@code non-null;} the constant to look up + * @return {@code null-ok;} its corresponding item, if it has a corresponding + * item, or {@code null} if it's not that sort of constant */ /*package*/ IndexedItem findItemOrNull(Constant cst) { IndexedItem item; @@ -466,12 +466,12 @@ public final class DexFile { } /** - * Returns the contents of this instance as a <code>.dex</code> file, + * Returns the contents of this instance as a {@code .dex} file, * in a {@link ByteArrayAnnotatedOutput} instance. * * @param annotate whether or not to keep annotations * @param verbose if annotating, whether to be verbose - * @return non-null; a <code>.dex</code> file for this instance + * @return {@code non-null;} a {@code .dex} file for this instance */ private ByteArrayAnnotatedOutput toDex0(boolean annotate, boolean verbose) { @@ -586,7 +586,7 @@ public final class DexFile { /** * Generates and returns statistics for all the items in the file. * - * @return non-null; the statistics + * @return {@code non-null;} the statistics */ public Statistics getStatistics() { Statistics stats = new Statistics(); @@ -599,10 +599,10 @@ public final class DexFile { } /** - * Calculates the signature for the <code>.dex</code> file in the + * Calculates the signature for the {@code .dex} file in the * given array, and modify the array to contain it. * - * @param bytes non-null; the bytes of the file + * @param bytes {@code non-null;} the bytes of the file */ private static void calcSignature(byte[] bytes) { MessageDigest md; @@ -627,10 +627,10 @@ public final class DexFile { } /** - * Calculates the checksum for the <code>.dex</code> file in the + * Calculates the checksum for the {@code .dex} file in the * given array, and modify the array to contain it. * - * @param bytes non-null; the bytes of the file + * @param bytes {@code non-null;} the bytes of the file */ private static void calcChecksum(byte[] bytes) { Adler32 a32 = new Adler32(); diff --git a/dx/src/com/android/dx/dex/file/EncodedArrayItem.java b/dx/src/com/android/dx/dex/file/EncodedArrayItem.java index 9ec72fa42..c55c6f503 100644 --- a/dx/src/com/android/dx/dex/file/EncodedArrayItem.java +++ b/dx/src/com/android/dx/dex/file/EncodedArrayItem.java @@ -36,11 +36,11 @@ public final class EncodedArrayItem extends OffsettedItem { /** the required alignment for instances of this class */ private static final int ALIGNMENT = 1; - /** non-null; the array to represent */ + /** {@code non-null;} the array to represent */ private final CstArray array; /** - * null-ok; encoded form, ready for writing to a file; set during + * {@code null-ok;} encoded form, ready for writing to a file; set during * {@link #place0} */ private byte[] encodedForm; @@ -48,7 +48,7 @@ public final class EncodedArrayItem extends OffsettedItem { /** * Constructs an instance. * - * @param array non-null; array to represent + * @param array {@code non-null;} array to represent */ public EncodedArrayItem(CstArray array) { /* diff --git a/dx/src/com/android/dx/dex/file/EncodedField.java b/dx/src/com/android/dx/dex/file/EncodedField.java index 62a5789d4..146a60452 100644 --- a/dx/src/com/android/dx/dex/file/EncodedField.java +++ b/dx/src/com/android/dx/dex/file/EncodedField.java @@ -30,13 +30,13 @@ import java.io.PrintWriter; */ public final class EncodedField extends EncodedMember implements Comparable<EncodedField> { - /** non-null; constant for the field */ + /** {@code non-null;} constant for the field */ private final CstFieldRef field; /** * Constructs an instance. * - * @param field non-null; constant for the field + * @param field {@code non-null;} constant for the field * @param accessFlags access flags */ public EncodedField(CstFieldRef field, int accessFlags) { @@ -122,7 +122,7 @@ public final class EncodedField extends EncodedMember /** * Gets the constant for the field. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public CstFieldRef getRef() { return field; diff --git a/dx/src/com/android/dx/dex/file/EncodedMember.java b/dx/src/com/android/dx/dex/file/EncodedMember.java index 3ae0d0902..68119f3d4 100644 --- a/dx/src/com/android/dx/dex/file/EncodedMember.java +++ b/dx/src/com/android/dx/dex/file/EncodedMember.java @@ -51,14 +51,14 @@ public abstract class EncodedMember implements ToHuman { /** * Gets the name. * - * @return non-null; the name + * @return {@code non-null;} the name */ public abstract CstUtf8 getName(); /** * Does a human-friendly dump of this instance. * - * @param out non-null; where to dump + * @param out {@code non-null;} where to dump * @param verbose whether to be verbose with the output */ public abstract void debugPrint(PrintWriter out, boolean verbose); @@ -66,20 +66,20 @@ public abstract class EncodedMember implements ToHuman { /** * Populates a {@link DexFile} with items from within this instance. * - * @param file non-null; the file to populate + * @param file {@code non-null;} the file to populate */ public abstract void addContents(DexFile file); /** * Encodes this instance to the given output. * - * @param file non-null; file this instance is part of - * @param out non-null; where to write to - * @param lastIndex >= 0; the previous member index value encoded, or - * <code>0</code> if this is the first element to encode - * @param dumpSeq >= 0; sequence number of this instance for + * @param file {@code non-null;} file this instance is part of + * @param out {@code non-null;} where to write to + * @param lastIndex {@code >= 0;} the previous member index value encoded, or + * {@code 0} if this is the first element to encode + * @param dumpSeq {@code >= 0;} sequence number of this instance for * annotation purposes - * @return >= 0; the member index value that was encoded + * @return {@code >= 0;} the member index value that was encoded */ public abstract int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq); diff --git a/dx/src/com/android/dx/dex/file/EncodedMethod.java b/dx/src/com/android/dx/dex/file/EncodedMethod.java index 319fbb72b..dff1a0732 100644 --- a/dx/src/com/android/dx/dex/file/EncodedMethod.java +++ b/dx/src/com/android/dx/dex/file/EncodedMethod.java @@ -32,23 +32,23 @@ import java.io.PrintWriter; */ public final class EncodedMethod extends EncodedMember implements Comparable<EncodedMethod> { - /** non-null; constant for the method */ + /** {@code non-null;} constant for the method */ private final CstMethodRef method; /** - * null-ok; code for the method, if the method is neither - * <code>abstract</code> nor <code>native</code> + * {@code null-ok;} code for the method, if the method is neither + * {@code abstract} nor {@code native} */ private final CodeItem code; /** * Constructs an instance. * - * @param method non-null; constant for the method + * @param method {@code non-null;} constant for the method * @param accessFlags access flags - * @param code null-ok; code for the method, if it is neither - * <code>abstract</code> nor <code>native</code> - * @param throwsList non-null; list of possibly-thrown exceptions, + * @param code {@code null-ok;} code for the method, if it is neither + * {@code abstract} nor {@code native} + * @param throwsList {@code non-null;} list of possibly-thrown exceptions, * just used in generating debugging output (listings) */ public EncodedMethod(CstMethodRef method, int accessFlags, @@ -148,7 +148,7 @@ public final class EncodedMethod extends EncodedMember /** * Gets the constant for the method. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public final CstMethodRef getRef() { return method; diff --git a/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java b/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java index e6169bd21..6a76ca926 100644 --- a/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java +++ b/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java @@ -27,17 +27,17 @@ import com.android.dx.util.ToHuman; */ public final class FieldAnnotationStruct implements ToHuman, Comparable<FieldAnnotationStruct> { - /** non-null; the field in question */ + /** {@code non-null;} the field in question */ private final CstFieldRef field; - /** non-null; the associated annotations */ + /** {@code non-null;} the associated annotations */ private AnnotationSetItem annotations; /** * Constructs an instance. * - * @param field non-null; the field in question - * @param annotations non-null; the associated annotations + * @param field {@code non-null;} the field in question + * @param annotations {@code non-null;} the associated annotations */ public FieldAnnotationStruct(CstFieldRef field, AnnotationSetItem annotations) { @@ -105,7 +105,7 @@ public final class FieldAnnotationStruct /** * Gets the field this item is for. * - * @return non-null; the field + * @return {@code non-null;} the field */ public CstFieldRef getField() { return field; @@ -114,7 +114,7 @@ public final class FieldAnnotationStruct /** * Gets the associated annotations. * - * @return non-null; the annotations + * @return {@code non-null;} the annotations */ public Annotations getAnnotations() { return annotations.getAnnotations(); diff --git a/dx/src/com/android/dx/dex/file/FieldIdItem.java b/dx/src/com/android/dx/dex/file/FieldIdItem.java index d098d52ab..d6d01d518 100644 --- a/dx/src/com/android/dx/dex/file/FieldIdItem.java +++ b/dx/src/com/android/dx/dex/file/FieldIdItem.java @@ -25,7 +25,7 @@ public final class FieldIdItem extends MemberIdItem { /** * Constructs an instance. * - * @param field non-null; the constant for the field + * @param field {@code non-null;} the constant for the field */ public FieldIdItem(CstFieldRef field) { super(field); @@ -49,7 +49,7 @@ public final class FieldIdItem extends MemberIdItem { /** * Gets the field constant. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public CstFieldRef getFieldRef() { return (CstFieldRef) getRef(); diff --git a/dx/src/com/android/dx/dex/file/FieldIdsSection.java b/dx/src/com/android/dx/dex/file/FieldIdsSection.java index fddf55f47..59ef2294a 100644 --- a/dx/src/com/android/dx/dex/file/FieldIdsSection.java +++ b/dx/src/com/android/dx/dex/file/FieldIdsSection.java @@ -25,11 +25,11 @@ import java.util.Collection; import java.util.TreeMap; /** - * Field refs list section of a <code>.dex</code> file. + * Field refs list section of a {@code .dex} file. */ public final class FieldIdsSection extends MemberIdsSection { /** - * non-null; map from field constants to {@link + * {@code non-null;} map from field constants to {@link * FieldIdItem} instances */ private final TreeMap<CstFieldRef, FieldIdItem> fieldIds; @@ -37,7 +37,7 @@ public final class FieldIdsSection extends MemberIdsSection { /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public FieldIdsSection(DexFile file) { super("field_ids", file); @@ -72,7 +72,7 @@ public final class FieldIdsSection extends MemberIdsSection { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -92,8 +92,8 @@ public final class FieldIdsSection extends MemberIdsSection { /** * Interns an element into this instance. * - * @param field non-null; the reference to intern - * @return non-null; the interned reference + * @param field {@code non-null;} the reference to intern + * @return {@code non-null;} the interned reference */ public FieldIdItem intern(CstFieldRef field) { if (field == null) { @@ -116,8 +116,8 @@ public final class FieldIdsSection extends MemberIdsSection { * Gets the index of the given reference, which must have been added * to this instance. * - * @param ref non-null; the reference to look up - * @return >= 0; the reference's index + * @param ref {@code non-null;} the reference to look up + * @return {@code >= 0;} the reference's index */ public int indexOf(CstFieldRef ref) { if (ref == null) { diff --git a/dx/src/com/android/dx/dex/file/HeaderItem.java b/dx/src/com/android/dx/dex/file/HeaderItem.java index 55c1f1c5f..65938599d 100644 --- a/dx/src/com/android/dx/dex/file/HeaderItem.java +++ b/dx/src/com/android/dx/dex/file/HeaderItem.java @@ -21,11 +21,11 @@ import com.android.dx.util.AnnotatedOutput; import com.android.dx.util.Hex; /** - * File header section of a <code>.dex</code> file. + * File header section of a {@code .dex} file. */ public final class HeaderItem extends IndexedItem { /** - * non-null; the file format magic number, represented as the + * {@code non-null;} the file format magic number, represented as the * low-order bytes of a string */ private static final String MAGIC = "dex\n035\0"; diff --git a/dx/src/com/android/dx/dex/file/HeaderSection.java b/dx/src/com/android/dx/dex/file/HeaderSection.java index 9022e0f2b..5bc627819 100644 --- a/dx/src/com/android/dx/dex/file/HeaderSection.java +++ b/dx/src/com/android/dx/dex/file/HeaderSection.java @@ -23,16 +23,16 @@ import java.util.Collections; import java.util.List; /** - * File header section of a <code>.dex</code> file. + * File header section of a {@code .dex} file. */ public final class HeaderSection extends UniformItemSection { - /** non-null; the list of the one item in the section */ + /** {@code non-null;} the list of the one item in the section */ private final List<HeaderItem> list; /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public HeaderSection(DexFile file) { super(null, file, 4); diff --git a/dx/src/com/android/dx/dex/file/IdItem.java b/dx/src/com/android/dx/dex/file/IdItem.java index 8342514be..5d7c9e320 100644 --- a/dx/src/com/android/dx/dex/file/IdItem.java +++ b/dx/src/com/android/dx/dex/file/IdItem.java @@ -23,7 +23,7 @@ import com.android.dx.rop.cst.CstType; */ public abstract class IdItem extends IndexedItem { /** - * non-null; the type constant for the defining class of + * {@code non-null;} the type constant for the defining class of * the reference */ private final CstType type; @@ -31,7 +31,7 @@ public abstract class IdItem extends IndexedItem { /** * Constructs an instance. * - * @param type non-null; the type constant for the defining + * @param type {@code non-null;} the type constant for the defining * class of the reference */ public IdItem(CstType type) { @@ -53,7 +53,7 @@ public abstract class IdItem extends IndexedItem { * Gets the type constant for the defining class of the * reference. * - * @return non-null; the type constant + * @return {@code non-null;} the type constant */ public final CstType getDefiningClass() { return type; diff --git a/dx/src/com/android/dx/dex/file/IndexedItem.java b/dx/src/com/android/dx/dex/file/IndexedItem.java index 9bf7fd29a..32d69eaea 100644 --- a/dx/src/com/android/dx/dex/file/IndexedItem.java +++ b/dx/src/com/android/dx/dex/file/IndexedItem.java @@ -20,7 +20,7 @@ package com.android.dx.dex.file; * An item in a Dalvik file which is referenced by index. */ public abstract class IndexedItem extends Item { - /** >= -1; assigned index of the item, or <code>-1</code> if not + /** {@code >= -1;} assigned index of the item, or {@code -1} if not * yet assigned */ private int index; @@ -34,7 +34,7 @@ public abstract class IndexedItem extends Item { /** * Gets whether or not this instance has been assigned an index. * - * @return <code>true</code> iff this instance has been assigned an index + * @return {@code true} iff this instance has been assigned an index */ public final boolean hasIndex() { return (index >= 0); @@ -43,7 +43,7 @@ public abstract class IndexedItem extends Item { /** * Gets the item index. * - * @return >= 0; the index + * @return {@code >= 0;} the index * @throws RuntimeException thrown if the item index is not yet assigned */ public final int getIndex() { @@ -56,10 +56,10 @@ public abstract class IndexedItem extends Item { /** * Sets the item index. This method may only ever be called once - * per instance, and this will throw a <code>RuntimeException</code> if + * per instance, and this will throw a {@code RuntimeException} if * called a second (or subsequent) time. * - * @param index >= 0; the item index + * @param index {@code >= 0;} the item index */ public final void setIndex(int index) { if (this.index != -1) { @@ -73,7 +73,7 @@ public abstract class IndexedItem extends Item { * Gets the index of this item as a string, suitable for including in * annotations. * - * @return non-null; the index string + * @return {@code non-null;} the index string */ public final String indexString() { return '[' + Integer.toHexString(index) + ']'; diff --git a/dx/src/com/android/dx/dex/file/Item.java b/dx/src/com/android/dx/dex/file/Item.java index 3708d4561..057f218b2 100644 --- a/dx/src/com/android/dx/dex/file/Item.java +++ b/dx/src/com/android/dx/dex/file/Item.java @@ -33,7 +33,7 @@ public abstract class Item { /** * Returns the item type for this instance. * - * @return non-null; the item type + * @return {@code non-null;} the item type */ public abstract ItemType itemType(); @@ -41,7 +41,7 @@ public abstract class Item { * Returns the human name for the particular type of item this * instance is. * - * @return non-null; the name + * @return {@code non-null;} the name */ public final String typeName() { return itemType().toHuman(); @@ -50,7 +50,7 @@ public abstract class Item { /** * Gets the size of this instance when written, in bytes. * - * @return >= 0; the write size + * @return {@code >= 0;} the write size */ public abstract int writeSize(); @@ -62,7 +62,7 @@ public abstract class Item { * <p><b>Note:</b> Subclasses must override this to do something * appropriate.</p> * - * @param file non-null; the file to populate + * @param file {@code non-null;} the file to populate */ public abstract void addContents(DexFile file); @@ -73,8 +73,8 @@ public abstract class Item { * note the written offset and will also throw an exception if this * instance has already been written. * - * @param file non-null; the file to use for reference - * @param out non-null; where to write to + * @param file {@code non-null;} the file to use for reference + * @param out {@code non-null;} where to write to */ public abstract void writeTo(DexFile file, AnnotatedOutput out); } diff --git a/dx/src/com/android/dx/dex/file/ItemType.java b/dx/src/com/android/dx/dex/file/ItemType.java index ffa65735f..83843b7a4 100644 --- a/dx/src/com/android/dx/dex/file/ItemType.java +++ b/dx/src/com/android/dx/dex/file/ItemType.java @@ -48,17 +48,17 @@ public enum ItemType implements ToHuman { /** value when represented in a {@link MapItem} */ private final int mapValue; - /** non-null; name of the type */ + /** {@code non-null;} name of the type */ private final String typeName; - /** non-null; the short human name */ + /** {@code non-null;} the short human name */ private final String humanName; /** * Constructs an instance. * * @param mapValue value when represented in a {@link MapItem} - * @param typeName non-null; name of the type + * @param typeName {@code non-null;} name of the type */ private ItemType(int mapValue, String typeName) { this.mapValue = mapValue; @@ -84,7 +84,7 @@ public enum ItemType implements ToHuman { /** * Gets the type name. * - * @return non-null; the type name + * @return {@code non-null;} the type name */ public String getTypeName() { return typeName; diff --git a/dx/src/com/android/dx/dex/file/MapItem.java b/dx/src/com/android/dx/dex/file/MapItem.java index 5e7465ce0..c728dd7cd 100644 --- a/dx/src/com/android/dx/dex/file/MapItem.java +++ b/dx/src/com/android/dx/dex/file/MapItem.java @@ -28,29 +28,29 @@ public final class MapItem extends OffsettedItem { /** file alignment of this class, in bytes */ private static final int ALIGNMENT = 4; - /** write size of this class, in bytes: three <code>uint</code>s */ + /** write size of this class, in bytes: three {@code uint}s */ private static final int WRITE_SIZE = (4 * 3); - /** non-null; item type this instance covers */ + /** {@code non-null;} item type this instance covers */ private final ItemType type; - /** non-null; section this instance covers */ + /** {@code non-null;} section this instance covers */ private final Section section; /** - * null-ok; first item covered or <code>null</code> if this is + * {@code null-ok;} first item covered or {@code null} if this is * a self-reference */ private final Item firstItem; /** - * null-ok; last item covered or <code>null</code> if this is + * {@code null-ok;} last item covered or {@code null} if this is * a self-reference */ private final Item lastItem; /** - * > 0; count of items covered; <code>1</code> if this + * {@code > 0;} count of items covered; {@code 1} if this * is a self-reference */ private final int itemCount; @@ -60,8 +60,8 @@ public final class MapItem extends OffsettedItem { * the contents of the given array of sections, adding it to the * given map section. * - * @param sections non-null; the sections - * @param mapSection non-null; the section that the resulting map + * @param sections {@code non-null;} the sections + * @param mapSection {@code non-null;} the section that the resulting map * should be added to; it should be empty on entry to this method */ public static void addMap(Section[] sections, @@ -115,11 +115,11 @@ public final class MapItem extends OffsettedItem { /** * Constructs an instance. * - * @param type non-null; item type this instance covers - * @param section non-null; section this instance covers - * @param firstItem non-null; first item covered - * @param lastItem non-null; last item covered - * @param itemCount > 0; count of items covered + * @param type {@code non-null;} item type this instance covers + * @param section {@code non-null;} section this instance covers + * @param firstItem {@code non-null;} first item covered + * @param lastItem {@code non-null;} last item covered + * @param itemCount {@code > 0;} count of items covered */ private MapItem(ItemType type, Section section, Item firstItem, Item lastItem, int itemCount) { @@ -154,9 +154,9 @@ public final class MapItem extends OffsettedItem { /** * Constructs a self-referential instance. This instance is meant to - * represent the section containing the <code>map_list</code>. + * represent the section containing the {@code map_list}. * - * @param section non-null; section this instance covers + * @param section {@code non-null;} section this instance covers */ private MapItem(Section section) { super(ALIGNMENT, WRITE_SIZE); diff --git a/dx/src/com/android/dx/dex/file/MemberIdItem.java b/dx/src/com/android/dx/dex/file/MemberIdItem.java index d43715259..574d41395 100644 --- a/dx/src/com/android/dx/dex/file/MemberIdItem.java +++ b/dx/src/com/android/dx/dex/file/MemberIdItem.java @@ -29,13 +29,13 @@ public abstract class MemberIdItem extends IdItem { /** size of instances when written out to a file, in bytes */ public static final int WRITE_SIZE = 8; - /** non-null; the constant for the member */ + /** {@code non-null;} the constant for the member */ private final CstMemberRef cst; /** * Constructs an instance. * - * @param cst non-null; the constant for the member + * @param cst {@code non-null;} the constant for the member */ public MemberIdItem(CstMemberRef cst) { super(cst.getDefiningClass()); @@ -86,7 +86,7 @@ public abstract class MemberIdItem extends IdItem { * this item, in order that it may be written out. Subclasses must * override this to get whatever it is they need to store. * - * @param file non-null; the file being written + * @param file {@code non-null;} the file being written * @return the index in question */ protected abstract int getTypoidIdx(DexFile file); @@ -96,14 +96,14 @@ public abstract class MemberIdItem extends IdItem { * this item, for listing-generating purposes. Subclasses must override * this. * - * @return non-null; the name in question + * @return {@code non-null;} the name in question */ protected abstract String getTypoidName(); /** * Gets the member constant. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public final CstMemberRef getRef() { return cst; diff --git a/dx/src/com/android/dx/dex/file/MemberIdsSection.java b/dx/src/com/android/dx/dex/file/MemberIdsSection.java index 885b5590a..20b160551 100644 --- a/dx/src/com/android/dx/dex/file/MemberIdsSection.java +++ b/dx/src/com/android/dx/dex/file/MemberIdsSection.java @@ -17,15 +17,15 @@ package com.android.dx.dex.file; /** - * Member (field or method) refs list section of a <code>.dex</code> file. + * Member (field or method) refs list section of a {@code .dex} file. */ public abstract class MemberIdsSection extends UniformItemSection { /** * Constructs an instance. The file offset is initially unknown. * - * @param name null-ok; the name of this instance, for annotation + * @param name {@code null-ok;} the name of this instance, for annotation * purposes - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public MemberIdsSection(String name, DexFile file) { super(name, file, 4); diff --git a/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java b/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java index 175c1d29d..3c254a199 100644 --- a/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java +++ b/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java @@ -27,17 +27,17 @@ import com.android.dx.util.ToHuman; */ public final class MethodAnnotationStruct implements ToHuman, Comparable<MethodAnnotationStruct> { - /** non-null; the method in question */ + /** {@code non-null;} the method in question */ private final CstMethodRef method; - /** non-null; the associated annotations */ + /** {@code non-null;} the associated annotations */ private AnnotationSetItem annotations; /** * Constructs an instance. * - * @param method non-null; the method in question - * @param annotations non-null; the associated annotations + * @param method {@code non-null;} the method in question + * @param annotations {@code non-null;} the associated annotations */ public MethodAnnotationStruct(CstMethodRef method, AnnotationSetItem annotations) { @@ -105,7 +105,7 @@ public final class MethodAnnotationStruct /** * Gets the method this item is for. * - * @return non-null; the method + * @return {@code non-null;} the method */ public CstMethodRef getMethod() { return method; @@ -114,7 +114,7 @@ public final class MethodAnnotationStruct /** * Gets the associated annotations. * - * @return non-null; the annotations + * @return {@code non-null;} the annotations */ public Annotations getAnnotations() { return annotations.getAnnotations(); diff --git a/dx/src/com/android/dx/dex/file/MethodIdItem.java b/dx/src/com/android/dx/dex/file/MethodIdItem.java index 5d78e961c..bbd6c932b 100644 --- a/dx/src/com/android/dx/dex/file/MethodIdItem.java +++ b/dx/src/com/android/dx/dex/file/MethodIdItem.java @@ -25,7 +25,7 @@ public final class MethodIdItem extends MemberIdItem { /** * Constructs an instance. * - * @param method non-null; the constant for the method + * @param method {@code non-null;} the constant for the method */ public MethodIdItem(CstBaseMethodRef method) { super(method); @@ -49,7 +49,7 @@ public final class MethodIdItem extends MemberIdItem { /** * Gets the method constant. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public CstBaseMethodRef getMethodRef() { return (CstBaseMethodRef) getRef(); diff --git a/dx/src/com/android/dx/dex/file/MethodIdsSection.java b/dx/src/com/android/dx/dex/file/MethodIdsSection.java index 6ba7cac95..f3e7deefd 100644 --- a/dx/src/com/android/dx/dex/file/MethodIdsSection.java +++ b/dx/src/com/android/dx/dex/file/MethodIdsSection.java @@ -25,11 +25,11 @@ import java.util.Collection; import java.util.TreeMap; /** - * Method refs list section of a <code>.dex</code> file. + * Method refs list section of a {@code .dex} file. */ public final class MethodIdsSection extends MemberIdsSection { /** - * non-null; map from method constants to {@link + * {@code non-null;} map from method constants to {@link * MethodIdItem} instances */ private final TreeMap<CstBaseMethodRef, MethodIdItem> methodIds; @@ -37,7 +37,7 @@ public final class MethodIdsSection extends MemberIdsSection { /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public MethodIdsSection(DexFile file) { super("method_ids", file); @@ -72,7 +72,7 @@ public final class MethodIdsSection extends MemberIdsSection { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -92,8 +92,8 @@ public final class MethodIdsSection extends MemberIdsSection { /** * Interns an element into this instance. * - * @param method non-null; the reference to intern - * @return non-null; the interned reference + * @param method {@code non-null;} the reference to intern + * @return {@code non-null;} the interned reference */ public MethodIdItem intern(CstBaseMethodRef method) { if (method == null) { @@ -116,8 +116,8 @@ public final class MethodIdsSection extends MemberIdsSection { * Gets the index of the given reference, which must have been added * to this instance. * - * @param ref non-null; the reference to look up - * @return >= 0; the reference's index + * @param ref {@code non-null;} the reference to look up + * @return {@code >= 0;} the reference's index */ public int indexOf(CstBaseMethodRef ref) { if (ref == null) { diff --git a/dx/src/com/android/dx/dex/file/MixedItemSection.java b/dx/src/com/android/dx/dex/file/MixedItemSection.java index f03a9a387..0929fe761 100644 --- a/dx/src/com/android/dx/dex/file/MixedItemSection.java +++ b/dx/src/com/android/dx/dex/file/MixedItemSection.java @@ -31,7 +31,7 @@ import java.util.NoSuchElementException; import java.util.TreeMap; /** - * A section of a <code>.dex</code> file which consists of a sequence of + * A section of a {@code .dex} file which consists of a sequence of * {@link OffsettedItem} objects, which may each be of a different concrete * class and/or size. * @@ -50,7 +50,7 @@ public final class MixedItemSection extends Section { INSTANCE; }; - /** non-null; sorter which sorts instances by type */ + /** {@code non-null;} sorter which sorts instances by type */ private static final Comparator<OffsettedItem> TYPE_SORTER = new Comparator<OffsettedItem>() { public int compare(OffsettedItem item1, OffsettedItem item2) { @@ -60,17 +60,17 @@ public final class MixedItemSection extends Section { } }; - /** non-null; the items in this part */ + /** {@code non-null;} the items in this part */ private final ArrayList<OffsettedItem> items; - /** non-null; items that have been explicitly interned */ + /** {@code non-null;} items that have been explicitly interned */ private final HashMap<OffsettedItem, OffsettedItem> interns; - /** non-null; how to sort the items */ + /** {@code non-null;} how to sort the items */ private final SortType sort; /** - * >= -1; the current size of this part, in bytes, or <code>-1</code> + * {@code >= -1;} the current size of this part, in bytes, or {@code -1} * if not yet calculated */ private int writeSize; @@ -78,10 +78,10 @@ public final class MixedItemSection extends Section { /** * Constructs an instance. The file offset is initially unknown. * - * @param name null-ok; the name of this instance, for annotation + * @param name {@code null-ok;} the name of this instance, for annotation * purposes - * @param file non-null; file that this instance is part of - * @param alignment > 0; alignment requirement for the final output; + * @param file {@code non-null;} file that this instance is part of + * @param alignment {@code > 0;} alignment requirement for the final output; * must be a power of 2 * @param sort how the items should be sorted in the final output */ @@ -118,7 +118,7 @@ public final class MixedItemSection extends Section { /** * Gets the size of this instance, in items. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int size() { return items.size(); @@ -127,7 +127,7 @@ public final class MixedItemSection extends Section { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -164,7 +164,7 @@ public final class MixedItemSection extends Section { * same item to more than one instance, nor to add the same items * multiple times to a single instance. * - * @param item non-null; the item to add + * @param item {@code non-null;} the item to add */ public void add(OffsettedItem item) { throwIfPrepared(); @@ -187,8 +187,8 @@ public final class MixedItemSection extends Section { * (which may not be the one passed in). This will add the item if no * equal item has been added. * - * @param item non-null; the item to intern - * @return non-null; the equivalent interned instance + * @param item {@code non-null;} the item to intern + * @return {@code non-null;} the equivalent interned instance */ public <T extends OffsettedItem> T intern(T item) { throwIfPrepared(); @@ -207,8 +207,8 @@ public final class MixedItemSection extends Section { /** * Gets an item which was previously interned. * - * @param item non-null; the item to look for - * @return non-null; the equivalent already-interned instance + * @param item {@code non-null;} the item to look for + * @return {@code non-null;} the equivalent already-interned instance */ public <T extends OffsettedItem> T get(T item) { throwIfNotPrepared(); @@ -227,9 +227,9 @@ public final class MixedItemSection extends Section { * given type. If there are none, this writes nothing. If there are any, * then the index is preceded by the given intro string. * - * @param out non-null; where to write to - * @param itemType non-null; the item type of interest - * @param intro non-null; the introductory string for non-empty indices + * @param out {@code non-null;} where to write to + * @param itemType {@code non-null;} the item type of interest + * @param intro {@code non-null;} the introductory string for non-empty indices */ public void writeIndexAnnotation(AnnotatedOutput out, ItemType itemType, String intro) { @@ -285,7 +285,7 @@ public final class MixedItemSection extends Section { /** * Places all the items in this instance at particular offsets. This * will call {@link OffsettedItem#place} on each item. If an item - * does not know its write size before the call to <code>place</code>, + * does not know its write size before the call to {@code place}, * it is that call which is responsible for setting the write size. * This method may only be called once per instance; subsequent calls * will throw an exception. diff --git a/dx/src/com/android/dx/dex/file/OffsettedItem.java b/dx/src/com/android/dx/dex/file/OffsettedItem.java index 030c37089..c8e2d747b 100644 --- a/dx/src/com/android/dx/dex/file/OffsettedItem.java +++ b/dx/src/com/android/dx/dex/file/OffsettedItem.java @@ -24,32 +24,32 @@ import com.android.dx.util.ExceptionWithContext; */ public abstract class OffsettedItem extends Item implements Comparable<OffsettedItem> { - /** > 0; alignment requirement */ + /** {@code > 0;} alignment requirement */ private final int alignment; - /** >= -1; the size of this instance when written, in bytes, or - * <code>-1</code> if not yet known */ + /** {@code >= -1;} the size of this instance when written, in bytes, or + * {@code -1} if not yet known */ private int writeSize; /** - * null-ok; section the item was added to, or <code>null</code> if + * {@code null-ok;} section the item was added to, or {@code null} if * not yet added */ private Section addedTo; /** - * >= -1; assigned offset of the item from the start of its section, - * or <code>-1</code> if not yet assigned + * {@code >= -1;} assigned offset of the item from the start of its section, + * or {@code -1} if not yet assigned */ private int offset; /** - * Gets the absolute offset of the given item, returning <code>0</code> - * if handed <code>null</code>. + * Gets the absolute offset of the given item, returning {@code 0} + * if handed {@code null}. * - * @param item null-ok; the item in question - * @return >= 0; the item's absolute offset, or <code>0</code> - * if <code>item == null</code> + * @param item {@code null-ok;} the item in question + * @return {@code >= 0;} the item's absolute offset, or {@code 0} + * if {@code item == null} */ public static int getAbsoluteOffsetOr0(OffsettedItem item) { if (item == null) { @@ -62,10 +62,10 @@ public abstract class OffsettedItem extends Item /** * Constructs an instance. The offset is initially unassigned. * - * @param alignment > 0; output alignment requirement; must be a + * @param alignment {@code > 0;} output alignment requirement; must be a * power of 2 - * @param writeSize >= -1; the size of this instance when written, - * in bytes, or <code>-1</code> if not immediately known + * @param writeSize {@code >= -1;} the size of this instance when written, + * in bytes, or {@code -1} if not immediately known */ public OffsettedItem(int alignment, int writeSize) { Section.validateAlignment(alignment); @@ -131,7 +131,7 @@ public abstract class OffsettedItem extends Item * per instance, and only if the size was unknown upon instance * creation. * - * @param writeSize > 0; the write size, in bytes + * @param writeSize {@code > 0;} the write size, in bytes */ public final void setWriteSize(int writeSize) { if (writeSize < 0) { @@ -182,7 +182,7 @@ public abstract class OffsettedItem extends Item * Gets the relative item offset. The offset is from the start of * the section which the instance was written to. * - * @return >= 0; the offset + * @return {@code >= 0;} the offset * @throws RuntimeException thrown if the offset is not yet known */ public final int getRelativeOffset() { @@ -197,7 +197,7 @@ public abstract class OffsettedItem extends Item * Gets the absolute item offset. The offset is from the start of * the file which the instance was written to. * - * @return >= 0; the offset + * @return {@code >= 0;} the offset * @throws RuntimeException thrown if the offset is not yet known */ public final int getAbsoluteOffset() { @@ -213,10 +213,11 @@ public abstract class OffsettedItem extends Item * the given offset. It is only valid to call this method once per * instance. * - * @param addedTo non-null; the section this instance has been added to - * @param offset >= 0; the desired offset from the start of the + * @param addedTo {@code non-null;} the section this instance has + * been added to + * @param offset {@code >= 0;} the desired offset from the start of the * section where this instance was placed - * @return >= 0; the offset that this instance should be placed at + * @return {@code >= 0;} the offset that this instance should be placed at * in order to meet its alignment constraint */ public final int place(Section addedTo, int offset) { @@ -247,7 +248,7 @@ public abstract class OffsettedItem extends Item * Gets the alignment requirement of this instance. An instance should * only be written when so aligned. * - * @return > 0; the alignment requirement; must be a power of 2 + * @return {@code > 0;} the alignment requirement; must be a power of 2 */ public final int getAlignment() { return alignment; @@ -257,7 +258,7 @@ public abstract class OffsettedItem extends Item * Gets the absolute offset of this item as a string, suitable for * including in annotations. * - * @return non-null; the offset string + * @return {@code non-null;} the offset string */ public final String offsetString() { return '[' + Integer.toHexString(getAbsoluteOffset()) + ']'; @@ -266,7 +267,7 @@ public abstract class OffsettedItem extends Item /** * Gets a short human-readable string representing this instance. * - * @return non-null; the human form + * @return {@code non-null;} the human form */ public abstract String toHuman(); @@ -277,8 +278,8 @@ public abstract class OffsettedItem extends Item * class needs to actually sort, then it should override this * method. * - * @param other non-null; instance to compare to - * @return <code>-1</code>, <code>0</code>, or <code>1</code>, depending + * @param other {@code non-null;} instance to compare to + * @return {@code -1}, {@code 0}, or {@code 1}, depending * on the sort order of this instance and the other */ protected int compareTo0(OffsettedItem other) { @@ -293,8 +294,8 @@ public abstract class OffsettedItem extends Item * know its write size up-front, then this method is responsible * for setting it. * - * @param addedTo non-null; the section this instance has been added to - * @param offset >= 0; the offset from the start of the + * @param addedTo {@code non-null;} the section this instance has been added to + * @param offset {@code >= 0;} the offset from the start of the * section where this instance was placed */ protected void place0(Section addedTo, int offset) { @@ -306,8 +307,8 @@ public abstract class OffsettedItem extends Item * the given data section. This is called by {@link #writeTo}, * which will have taken care of ensuring alignment. * - * @param file non-null; the file to use for reference - * @param out non-null; where to write to + * @param file {@code non-null;} the file to use for reference + * @param out {@code non-null;} where to write to */ protected abstract void writeTo0(DexFile file, AnnotatedOutput out); } diff --git a/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java b/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java index 0c2d28692..46d045012 100644 --- a/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java +++ b/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java @@ -30,20 +30,20 @@ import java.util.ArrayList; */ public final class ParameterAnnotationStruct implements ToHuman, Comparable<ParameterAnnotationStruct> { - /** non-null; the method in question */ + /** {@code non-null;} the method in question */ private final CstMethodRef method; - /** non-null; the associated annotations list */ + /** {@code non-null;} the associated annotations list */ private final AnnotationsList annotationsList; - /** non-null; the associated annotations list, as an item */ + /** {@code non-null;} the associated annotations list, as an item */ private final UniformListItem<AnnotationSetRefItem> annotationsItem; /** * Constructs an instance. * - * @param method non-null; the method in question - * @param annotationsList non-null; the associated annotations list + * @param method {@code non-null;} the method in question + * @param annotationsList {@code non-null;} the associated annotations list */ public ParameterAnnotationStruct(CstMethodRef method, AnnotationsList annotationsList) { @@ -144,7 +144,7 @@ public final class ParameterAnnotationStruct /** * Gets the method this item is for. * - * @return non-null; the method + * @return {@code non-null;} the method */ public CstMethodRef getMethod() { return method; @@ -153,7 +153,7 @@ public final class ParameterAnnotationStruct /** * Gets the associated annotations list. * - * @return non-null; the annotations list + * @return {@code non-null;} the annotations list */ public AnnotationsList getAnnotationsList() { return annotationsList; diff --git a/dx/src/com/android/dx/dex/file/ProtoIdItem.java b/dx/src/com/android/dx/dex/file/ProtoIdItem.java index a144c304e..afc227c2d 100644 --- a/dx/src/com/android/dx/dex/file/ProtoIdItem.java +++ b/dx/src/com/android/dx/dex/file/ProtoIdItem.java @@ -31,14 +31,14 @@ public final class ProtoIdItem extends IndexedItem { /** size of instances when written out to a file, in bytes */ public static final int WRITE_SIZE = 12; - /** non-null; the wrapped prototype */ + /** {@code non-null;} the wrapped prototype */ private final Prototype prototype; - /** non-null; the short-form of the prototype */ + /** {@code non-null;} the short-form of the prototype */ private final CstUtf8 shortForm; /** - * null-ok; the list of parameter types or <code>null</code> if this + * {@code null-ok;} the list of parameter types or {@code null} if this * prototype has no parameters */ private TypeListItem parameterTypes; @@ -46,7 +46,7 @@ public final class ProtoIdItem extends IndexedItem { /** * Constructs an instance. * - * @param prototype non-null; the constant for the prototype + * @param prototype {@code non-null;} the constant for the prototype */ public ProtoIdItem(Prototype prototype) { if (prototype == null) { @@ -64,8 +64,8 @@ public final class ProtoIdItem extends IndexedItem { /** * Creates the short-form of the given prototype. * - * @param prototype non-null; the prototype - * @return non-null; the short form + * @param prototype {@code non-null;} the prototype + * @return {@code non-null;} the short form */ private static CstUtf8 makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); @@ -84,7 +84,7 @@ public final class ProtoIdItem extends IndexedItem { /** * Gets the short-form character for the given type. * - * @param type non-null; the type + * @param type {@code non-null;} the type * @return the corresponding short-form character */ private static char shortFormCharFor(Type type) { diff --git a/dx/src/com/android/dx/dex/file/ProtoIdsSection.java b/dx/src/com/android/dx/dex/file/ProtoIdsSection.java index 852ab9d5f..8a95434fd 100644 --- a/dx/src/com/android/dx/dex/file/ProtoIdsSection.java +++ b/dx/src/com/android/dx/dex/file/ProtoIdsSection.java @@ -26,18 +26,18 @@ import java.util.TreeMap; /** * Proto (method prototype) identifiers list section of a - * <code>.dex</code> file. + * {@code .dex} file. */ public final class ProtoIdsSection extends UniformItemSection { /** - * non-null; map from method prototypes to {@link ProtoIdItem} instances + * {@code non-null;} map from method prototypes to {@link ProtoIdItem} instances */ private final TreeMap<Prototype, ProtoIdItem> protoIds; /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public ProtoIdsSection(DexFile file) { super("proto_ids", file, 4); @@ -60,7 +60,7 @@ public final class ProtoIdsSection extends UniformItemSection { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -84,8 +84,8 @@ public final class ProtoIdsSection extends UniformItemSection { /** * Interns an element into this instance. * - * @param prototype non-null; the prototype to intern - * @return non-null; the interned reference + * @param prototype {@code non-null;} the prototype to intern + * @return {@code non-null;} the interned reference */ public ProtoIdItem intern(Prototype prototype) { if (prototype == null) { @@ -108,8 +108,8 @@ public final class ProtoIdsSection extends UniformItemSection { * Gets the index of the given prototype, which must have * been added to this instance. * - * @param prototype non-null; the prototype to look up - * @return >= 0; the reference's index + * @param prototype {@code non-null;} the prototype to look up + * @return {@code >= 0;} the reference's index */ public int indexOf(Prototype prototype) { if (prototype == null) { diff --git a/dx/src/com/android/dx/dex/file/Section.java b/dx/src/com/android/dx/dex/file/Section.java index 9f7657c6c..f5b43af8e 100644 --- a/dx/src/com/android/dx/dex/file/Section.java +++ b/dx/src/com/android/dx/dex/file/Section.java @@ -21,22 +21,22 @@ import com.android.dx.util.AnnotatedOutput; import java.util.Collection; /** - * A section of a <code>.dex</code> file. Each section consists of a list + * A section of a {@code .dex} file. Each section consists of a list * of items of some sort or other. */ public abstract class Section { - /** null-ok; name of this part, for annotation purposes */ + /** {@code null-ok;} name of this part, for annotation purposes */ private final String name; - /** non-null; file that this instance is part of */ + /** {@code non-null;} file that this instance is part of */ private final DexFile file; - /** > 0; alignment requirement for the final output; + /** {@code > 0;} alignment requirement for the final output; * must be a power of 2 */ private final int alignment; - /** >= -1; offset from the start of the file to this part, or - * <code>-1</code> if not yet known */ + /** {@code >= -1;} offset from the start of the file to this part, or + * {@code -1} if not yet known */ private int fileOffset; /** whether {@link #prepare} has been called successfully on this @@ -47,7 +47,7 @@ public abstract class Section { * Validates an alignment. * * @param alignment the alignment - * @throws IllegalArgumentException thrown if <code>alignment</code> + * @throws IllegalArgumentException thrown if {@code alignment} * isn't a positive power of 2 */ public static void validateAlignment(int alignment) { @@ -60,10 +60,10 @@ public abstract class Section { /** * Constructs an instance. The file offset is initially unknown. * - * @param name null-ok; the name of this instance, for annotation + * @param name {@code null-ok;} the name of this instance, for annotation * purposes - * @param file non-null; file that this instance is part of - * @param alignment > 0; alignment requirement for the final output; + * @param file {@code non-null;} file that this instance is part of + * @param alignment {@code > 0;} alignment requirement for the final output; * must be a power of 2 */ public Section(String name, DexFile file, int alignment) { @@ -83,7 +83,7 @@ public abstract class Section { /** * Gets the file that this instance is part of. * - * @return non-null; the file + * @return {@code non-null;} the file */ public final DexFile getFile() { return file; @@ -92,7 +92,7 @@ public abstract class Section { /** * Gets the alignment for this instance's final output. * - * @return > 0; the alignment + * @return {@code > 0;} the alignment */ public final int getAlignment() { return alignment; @@ -102,7 +102,7 @@ public abstract class Section { * Gets the offset from the start of the file to this part. This * throws an exception if the offset has not yet been set. * - * @return >= 0; the file offset + * @return {@code >= 0;} the file offset */ public final int getFileOffset() { if (fileOffset < 0) { @@ -116,9 +116,9 @@ public abstract class Section { * Sets the file offset. It is only valid to call this method once * once per instance. * - * @param fileOffset >= 0; the desired offset from the start of the + * @param fileOffset {@code >= 0;} the desired offset from the start of the * file where this for this instance - * @return >= 0; the offset that this instance should be placed at + * @return {@code >= 0;} the offset that this instance should be placed at * in order to meet its alignment constraint */ public final int setFileOffset(int fileOffset) { @@ -141,7 +141,7 @@ public abstract class Section { /** * Writes this instance to the given raw data object. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public final void writeTo(AnnotatedOutput out) { throwIfNotPrepared(); @@ -174,8 +174,8 @@ public abstract class Section { * once this instance has been assigned a file offset (via {@link * #setFileOffset}). * - * @param relative >= 0; the relative offset - * @return >= 0; the corresponding absolute file offset + * @param relative {@code >= 0;} the relative offset + * @return {@code >= 0;} the corresponding absolute file offset */ public final int getAbsoluteOffset(int relative) { if (relative < 0) { @@ -198,8 +198,8 @@ public abstract class Section { * <p><b>Note:</b> Subclasses must implement this as appropriate for * their contents.</p> * - * @param item non-null; the item in question - * @return >= 0; the item's absolute file offset + * @param item {@code non-null;} the item in question + * @return {@code >= 0;} the item's absolute file offset */ public abstract int getAbsoluteItemOffset(Item item); @@ -219,7 +219,7 @@ public abstract class Section { * Gets the collection of all the items in this section. * It is not valid to attempt to change the returned list. * - * @return non-null; the items + * @return {@code non-null;} the items */ public abstract Collection<? extends Item> items(); @@ -231,7 +231,7 @@ public abstract class Section { /** * Gets the size of this instance when output, in bytes. * - * @return >= 0; the size of this instance, in bytes + * @return {@code >= 0;} the size of this instance, in bytes */ public abstract int writeSize(); @@ -258,7 +258,7 @@ public abstract class Section { /** * Aligns the output of the given data to the alignment of this instance. * - * @param out non-null; the output to align + * @param out {@code non-null;} the output to align */ protected final void align(AnnotatedOutput out) { out.alignTo(alignment); @@ -267,19 +267,19 @@ public abstract class Section { /** * Writes this instance to the given raw data object. This gets * called by {@link #writeTo} after aligning the cursor of - * <code>out</code> and verifying that either the assigned file - * offset matches the actual cursor <code>out</code> or that the + * {@code out} and verifying that either the assigned file + * offset matches the actual cursor {@code out} or that the * file offset was not previously assigned, in which case it gets - * assigned to <code>out</code>'s cursor. + * assigned to {@code out}'s cursor. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ protected abstract void writeTo0(AnnotatedOutput out); /** * Returns the name of this section, for annotation purposes. * - * @return null-ok; name of this part, for annotation purposes + * @return {@code null-ok;} name of this part, for annotation purposes */ protected final String getName() { return name; diff --git a/dx/src/com/android/dx/dex/file/Statistics.java b/dx/src/com/android/dx/dex/file/Statistics.java index b11ab6eb1..9a2efb3b0 100644 --- a/dx/src/com/android/dx/dex/file/Statistics.java +++ b/dx/src/com/android/dx/dex/file/Statistics.java @@ -26,7 +26,7 @@ import java.util.TreeMap; * Statistics about the contents of a file. */ public final class Statistics { - /** non-null; data about each type of item */ + /** {@code non-null;} data about each type of item */ private final HashMap<String, Data> dataMap; /** @@ -39,7 +39,7 @@ public final class Statistics { /** * Adds the given item to the statistics. * - * @param item non-null; the item to add + * @param item {@code non-null;} the item to add */ public void add(Item item) { String typeName = item.typeName(); @@ -55,7 +55,7 @@ public final class Statistics { /** * Adds the given list of items to the statistics. * - * @param list non-null; the list of items to add + * @param list {@code non-null;} the list of items to add */ public void addAll(Section list) { Collection<? extends Item> items = list.items(); @@ -67,7 +67,7 @@ public final class Statistics { /** * Writes the statistics as an annotation. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public final void writeAnnotation(AnnotatedOutput out) { if (dataMap.size() == 0) { @@ -109,26 +109,26 @@ public final class Statistics { * Statistical data about a particular class. */ private static class Data { - /** non-null; name to use as a label */ + /** {@code non-null;} name to use as a label */ private final String name; - /** >= 0; number of instances */ + /** {@code >= 0;} number of instances */ private int count; - /** >= 0; total size of instances in bytes */ + /** {@code >= 0;} total size of instances in bytes */ private int totalSize; - /** >= 0; largest size of any individual item */ + /** {@code >= 0;} largest size of any individual item */ private int largestSize; - /** >= 0; smallest size of any individual item */ + /** {@code >= 0;} smallest size of any individual item */ private int smallestSize; /** * Constructs an instance for the given item. * - * @param item non-null; item in question - * @param name non-null; type name to use + * @param item {@code non-null;} item in question + * @param name {@code non-null;} type name to use */ public Data(Item item, String name) { int size = item.writeSize(); @@ -143,7 +143,7 @@ public final class Statistics { /** * Incorporates a new item. This assumes the type name matches. * - * @param item non-null; item to incorporate + * @param item {@code non-null;} item to incorporate */ public void add(Item item) { int size = item.writeSize(); @@ -163,7 +163,7 @@ public final class Statistics { /** * Writes this instance as an annotation. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public void writeAnnotation(AnnotatedOutput out) { out.annotate(toHuman()); diff --git a/dx/src/com/android/dx/dex/file/StringDataItem.java b/dx/src/com/android/dx/dex/file/StringDataItem.java index 49eea5757..b9eeb9bfb 100644 --- a/dx/src/com/android/dx/dex/file/StringDataItem.java +++ b/dx/src/com/android/dx/dex/file/StringDataItem.java @@ -26,13 +26,13 @@ import com.android.dx.util.Leb128Utils; * Representation of string data for a particular string, in a Dalvik file. */ public final class StringDataItem extends OffsettedItem { - /** non-null; the string value */ + /** {@code non-null;} the string value */ private final CstUtf8 value; /** * Constructs an instance. * - * @param value non-null; the string value + * @param value {@code non-null;} the string value */ public StringDataItem(CstUtf8 value) { super(1, writeSize(value)); @@ -43,8 +43,8 @@ public final class StringDataItem extends OffsettedItem { /** * Gets the write size for a given value. * - * @param value non-null; the string value - * @return >= 2 the write size, in bytes + * @param value {@code non-null;} the string value + * @return {@code >= 2}; the write size, in bytes */ private static int writeSize(CstUtf8 value) { int utf16Size = value.getUtf16Size(); diff --git a/dx/src/com/android/dx/dex/file/StringIdItem.java b/dx/src/com/android/dx/dex/file/StringIdItem.java index e80a7f877..401a0bef0 100644 --- a/dx/src/com/android/dx/dex/file/StringIdItem.java +++ b/dx/src/com/android/dx/dex/file/StringIdItem.java @@ -28,16 +28,16 @@ public final class StringIdItem /** size of instances when written out to a file, in bytes */ public static final int WRITE_SIZE = 4; - /** non-null; the string value */ + /** {@code non-null;} the string value */ private final CstUtf8 value; - /** null-ok; associated string data object, if known */ + /** {@code null-ok;} associated string data object, if known */ private StringDataItem data; /** * Constructs an instance. * - * @param value non-null; the string value + * @param value {@code non-null;} the string value */ public StringIdItem(CstUtf8 value) { if (value == null) { @@ -110,7 +110,7 @@ public final class StringIdItem /** * Gets the string value. * - * @return non-null; the value + * @return {@code non-null;} the value */ public CstUtf8 getValue() { return value; @@ -119,7 +119,7 @@ public final class StringIdItem /** * Gets the associated data object for this instance, if known. * - * @return null-ok; the associated data object or <code>null</code> + * @return {@code null-ok;} the associated data object or {@code null} * if not yet known */ public StringDataItem getData() { diff --git a/dx/src/com/android/dx/dex/file/StringIdsSection.java b/dx/src/com/android/dx/dex/file/StringIdsSection.java index 17fbb578b..b2e8683ed 100644 --- a/dx/src/com/android/dx/dex/file/StringIdsSection.java +++ b/dx/src/com/android/dx/dex/file/StringIdsSection.java @@ -27,12 +27,12 @@ import java.util.Collection; import java.util.TreeMap; /** - * Strings list section of a <code>.dex</code> file. + * Strings list section of a {@code .dex} file. */ public final class StringIdsSection extends UniformItemSection { /** - * non-null; map from string constants to {@link + * {@code non-null;} map from string constants to {@link * StringIdItem} instances */ private final TreeMap<CstUtf8, StringIdItem> strings; @@ -40,7 +40,7 @@ public final class StringIdsSection /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public StringIdsSection(DexFile file) { super("string_ids", file, 4); @@ -79,7 +79,7 @@ public final class StringIdsSection /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -99,9 +99,9 @@ public final class StringIdsSection /** * Interns an element into this instance. * - * @param string non-null; the string to intern, as a regular Java - * <code>String</code> - * @return non-null; the interned string + * @param string {@code non-null;} the string to intern, as a regular Java + * {@code String} + * @return {@code non-null;} the interned string */ public StringIdItem intern(String string) { CstUtf8 utf8 = new CstUtf8(string); @@ -111,8 +111,8 @@ public final class StringIdsSection /** * Interns an element into this instance. * - * @param string non-null; the string to intern, as a {@link CstString} - * @return non-null; the interned string + * @param string {@code non-null;} the string to intern, as a {@link CstString} + * @return {@code non-null;} the interned string */ public StringIdItem intern(CstString string) { CstUtf8 utf8 = string.getString(); @@ -122,8 +122,8 @@ public final class StringIdsSection /** * Interns an element into this instance. * - * @param string non-null; the string to intern, as a constant - * @return non-null; the interned string + * @param string {@code non-null;} the string to intern, as a constant + * @return {@code non-null;} the interned string */ public StringIdItem intern(CstUtf8 string) { return intern(new StringIdItem(string)); @@ -132,8 +132,8 @@ public final class StringIdsSection /** * Interns an element into this instance. * - * @param string non-null; the string to intern - * @return non-null; the interned string + * @param string {@code non-null;} the string to intern + * @return {@code non-null;} the interned string */ public StringIdItem intern(StringIdItem string) { if (string == null) { @@ -156,7 +156,7 @@ public final class StringIdsSection /** * Interns the components of a name-and-type into this instance. * - * @param nat non-null; the name-and-type + * @param nat {@code non-null;} the name-and-type */ public void intern(CstNat nat) { intern(nat.getName()); @@ -167,8 +167,8 @@ public final class StringIdsSection * Gets the index of the given string, which must have been added * to this instance. * - * @param string non-null; the string to look up - * @return >= 0; the string's index + * @param string {@code non-null;} the string to look up + * @return {@code >= 0;} the string's index */ public int indexOf(CstUtf8 string) { if (string == null) { @@ -190,8 +190,8 @@ public final class StringIdsSection * Gets the index of the given string, which must have been added * to this instance. * - * @param string non-null; the string to look up - * @return >= 0; the string's index + * @param string {@code non-null;} the string to look up + * @return {@code >= 0;} the string's index */ public int indexOf(CstString string) { return indexOf(string.getString()); diff --git a/dx/src/com/android/dx/dex/file/TypeIdItem.java b/dx/src/com/android/dx/dex/file/TypeIdItem.java index f3402e643..01b1417c0 100644 --- a/dx/src/com/android/dx/dex/file/TypeIdItem.java +++ b/dx/src/com/android/dx/dex/file/TypeIdItem.java @@ -31,7 +31,7 @@ public final class TypeIdItem extends IdItem { /** * Constructs an instance. * - * @param type non-null; the constant for the type + * @param type {@code non-null;} the constant for the type */ public TypeIdItem(CstType type) { super(type); diff --git a/dx/src/com/android/dx/dex/file/TypeIdsSection.java b/dx/src/com/android/dx/dex/file/TypeIdsSection.java index 296263f09..b1b9c58a3 100644 --- a/dx/src/com/android/dx/dex/file/TypeIdsSection.java +++ b/dx/src/com/android/dx/dex/file/TypeIdsSection.java @@ -26,18 +26,18 @@ import java.util.Collection; import java.util.TreeMap; /** - * Type identifiers list section of a <code>.dex</code> file. + * Type identifiers list section of a {@code .dex} file. */ public final class TypeIdsSection extends UniformItemSection { /** - * non-null; map from types to {@link TypeIdItem} instances + * {@code non-null;} map from types to {@link TypeIdItem} instances */ private final TreeMap<Type, TypeIdItem> typeIds; /** * Constructs an instance. The file offset is initially unknown. * - * @param file non-null; file that this instance is part of + * @param file {@code non-null;} file that this instance is part of */ public TypeIdsSection(DexFile file) { super("type_ids", file, 4); @@ -73,7 +73,7 @@ public final class TypeIdsSection extends UniformItemSection { /** * Writes the portion of the file header that refers to this instance. * - * @param out non-null; where to write + * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); @@ -97,8 +97,8 @@ public final class TypeIdsSection extends UniformItemSection { /** * Interns an element into this instance. * - * @param type non-null; the type to intern - * @return non-null; the interned reference + * @param type {@code non-null;} the type to intern + * @return {@code non-null;} the interned reference */ public TypeIdItem intern(Type type) { if (type == null) { @@ -120,8 +120,8 @@ public final class TypeIdsSection extends UniformItemSection { /** * Interns an element into this instance. * - * @param type non-null; the type to intern - * @return non-null; the interned reference + * @param type {@code non-null;} the type to intern + * @return {@code non-null;} the interned reference */ public TypeIdItem intern(CstType type) { if (type == null) { @@ -145,8 +145,8 @@ public final class TypeIdsSection extends UniformItemSection { * Gets the index of the given type, which must have * been added to this instance. * - * @param type non-null; the type to look up - * @return >= 0; the reference's index + * @param type {@code non-null;} the type to look up + * @return {@code >= 0;} the reference's index */ public int indexOf(Type type) { if (type == null) { @@ -168,8 +168,8 @@ public final class TypeIdsSection extends UniformItemSection { * Gets the index of the given type, which must have * been added to this instance. * - * @param type non-null; the type to look up - * @return >= 0; the reference's index + * @param type {@code non-null;} the type to look up + * @return {@code >= 0;} the reference's index */ public int indexOf(CstType type) { if (type == null) { diff --git a/dx/src/com/android/dx/dex/file/TypeListItem.java b/dx/src/com/android/dx/dex/file/TypeListItem.java index 6557ca415..3278aefff 100644 --- a/dx/src/com/android/dx/dex/file/TypeListItem.java +++ b/dx/src/com/android/dx/dex/file/TypeListItem.java @@ -36,13 +36,13 @@ public final class TypeListItem extends OffsettedItem { /** header size in bytes */ private static final int HEADER_SIZE = 4; - /** non-null; the actual list */ + /** {@code non-null;} the actual list */ private final TypeList list; /** * Constructs an instance. * - * @param list non-null; the actual list + * @param list {@code non-null;} the actual list */ public TypeListItem(TypeList list) { super(ALIGNMENT, (list.size() * ELEMENT_SIZE) + HEADER_SIZE); @@ -81,7 +81,7 @@ public final class TypeListItem extends OffsettedItem { /** * Gets the underlying list. * - * @return non-null; the list + * @return {@code non-null;} the list */ public TypeList getList() { return list; diff --git a/dx/src/com/android/dx/dex/file/UniformItemSection.java b/dx/src/com/android/dx/dex/file/UniformItemSection.java index 602bc2dcb..e18243898 100644 --- a/dx/src/com/android/dx/dex/file/UniformItemSection.java +++ b/dx/src/com/android/dx/dex/file/UniformItemSection.java @@ -22,7 +22,7 @@ import com.android.dx.util.AnnotatedOutput; import java.util.Collection; /** - * A section of a <code>.dex</code> file which consists of a sequence of + * A section of a {@code .dex} file which consists of a sequence of * {@link Item} objects. Each of the items must have the same size in * the output. */ @@ -30,10 +30,10 @@ public abstract class UniformItemSection extends Section { /** * Constructs an instance. The file offset is initially unknown. * - * @param name null-ok; the name of this instance, for annotation + * @param name {@code null-ok;} the name of this instance, for annotation * purposes - * @param file non-null; file that this instance is part of - * @param alignment > 0; alignment requirement for the final output; + * @param file {@code non-null;} file that this instance is part of + * @param alignment {@code > 0;} alignment requirement for the final output; * must be a power of 2 */ public UniformItemSection(String name, DexFile file, int alignment) { @@ -60,8 +60,8 @@ public abstract class UniformItemSection extends Section { * if this instance isn't the sort that maps constants to {@link * IndexedItem} instances. * - * @param cst non-null; constant to look for - * @return non-null; the corresponding item found in this instance + * @param cst {@code non-null;} constant to look for + * @return {@code non-null;} the corresponding item found in this instance */ public abstract IndexedItem get(Constant cst); diff --git a/dx/src/com/android/dx/dex/file/UniformListItem.java b/dx/src/com/android/dx/dex/file/UniformListItem.java index 3af39428a..3c1f4d366 100644 --- a/dx/src/com/android/dx/dex/file/UniformListItem.java +++ b/dx/src/com/android/dx/dex/file/UniformListItem.java @@ -28,8 +28,8 @@ import java.util.List; * alignment. * * <p>This class inherits its alignment from its items, bumped up to - * <code>4</code> if the items have a looser alignment requirement. If - * it is more than <code>4</code>, then there will be a gap after the + * {@code 4} if the items have a looser alignment requirement. If + * it is more than {@code 4}, then there will be a gap after the * output list size (which is four bytes) and before the first item.</p> * * @param <T> type of element contained in an instance @@ -39,18 +39,18 @@ public final class UniformListItem<T extends OffsettedItem> /** the size of the list header */ private static final int HEADER_SIZE = 4; - /** non-null; the item type */ + /** {@code non-null;} the item type */ private final ItemType itemType; - /** non-null; the contents */ + /** {@code non-null;} the contents */ private final List<T> items; /** * Constructs an instance. It is illegal to modify the given list once * it is used to construct an instance of this class. * - * @param itemType non-null; the type of the item - * @param items non-null and non-empty; list of items to represent + * @param itemType {@code non-null;} the type of the item + * @param items {@code non-null and non-empty;} list of items to represent */ public UniformListItem(ItemType itemType, List<T> items) { super(getAlignment(items), writeSize(items)); @@ -68,8 +68,8 @@ public final class UniformListItem<T extends OffsettedItem> * requirement implied by the given list. See the header comment for * more details. * - * @param items non-null; list of items being represented - * @return >= 4; the alignment requirement + * @param items {@code non-null;} list of items being represented + * @return {@code >= 4;} the alignment requirement */ private static int getAlignment(List<? extends OffsettedItem> items) { try { @@ -87,8 +87,8 @@ public final class UniformListItem<T extends OffsettedItem> /** * Calculates the write size for the given list. * - * @param items non-null; the list in question - * @return >= 0; the write size + * @param items {@code non-null;} the list in question + * @return {@code >= 0;} the write size */ private static int writeSize(List<? extends OffsettedItem> items) { /* @@ -148,7 +148,7 @@ public final class UniformListItem<T extends OffsettedItem> /** * Gets the underlying list of items. * - * @return non-null; the list + * @return {@code non-null;} the list */ public final List<T> getItems() { return items; @@ -204,7 +204,7 @@ public final class UniformListItem<T extends OffsettedItem> /** * Get the size of the header of this list. * - * @return >= 0; the header size + * @return {@code >= 0;} the header size */ private int headerSize() { /* diff --git a/dx/src/com/android/dx/dex/file/ValueEncoder.java b/dx/src/com/android/dx/dex/file/ValueEncoder.java index 02a34194f..f7e364aa7 100644 --- a/dx/src/com/android/dx/dex/file/ValueEncoder.java +++ b/dx/src/com/android/dx/dex/file/ValueEncoder.java @@ -43,69 +43,69 @@ import com.android.dx.util.Hex; import java.util.Collection; /** - * Handler for writing out <code>encoded_values</code> and parts + * Handler for writing out {@code encoded_values} and parts * thereof. */ public final class ValueEncoder { - /** annotation value type constant: <code>byte</code> */ + /** annotation value type constant: {@code byte} */ private static final int VALUE_BYTE = 0x00; - /** annotation value type constant: <code>short</code> */ + /** annotation value type constant: {@code short} */ private static final int VALUE_SHORT = 0x02; - /** annotation value type constant: <code>char</code> */ + /** annotation value type constant: {@code char} */ private static final int VALUE_CHAR = 0x03; - /** annotation value type constant: <code>int</code> */ + /** annotation value type constant: {@code int} */ private static final int VALUE_INT = 0x04; - /** annotation value type constant: <code>long</code> */ + /** annotation value type constant: {@code long} */ private static final int VALUE_LONG = 0x06; - /** annotation value type constant: <code>float</code> */ + /** annotation value type constant: {@code float} */ private static final int VALUE_FLOAT = 0x10; - /** annotation value type constant: <code>double</code> */ + /** annotation value type constant: {@code double} */ private static final int VALUE_DOUBLE = 0x11; - /** annotation value type constant: <code>string</code> */ + /** annotation value type constant: {@code string} */ private static final int VALUE_STRING = 0x17; - /** annotation value type constant: <code>type</code> */ + /** annotation value type constant: {@code type} */ private static final int VALUE_TYPE = 0x18; - /** annotation value type constant: <code>field</code> */ + /** annotation value type constant: {@code field} */ private static final int VALUE_FIELD = 0x19; - /** annotation value type constant: <code>method</code> */ + /** annotation value type constant: {@code method} */ private static final int VALUE_METHOD = 0x1a; - /** annotation value type constant: <code>enum</code> */ + /** annotation value type constant: {@code enum} */ private static final int VALUE_ENUM = 0x1b; - /** annotation value type constant: <code>array</code> */ + /** annotation value type constant: {@code array} */ private static final int VALUE_ARRAY = 0x1c; - /** annotation value type constant: <code>annotation</code> */ + /** annotation value type constant: {@code annotation} */ private static final int VALUE_ANNOTATION = 0x1d; - /** annotation value type constant: <code>null</code> */ + /** annotation value type constant: {@code null} */ private static final int VALUE_NULL = 0x1e; - /** annotation value type constant: <code>boolean</code> */ + /** annotation value type constant: {@code boolean} */ private static final int VALUE_BOOLEAN = 0x1f; - /** non-null; file being written */ + /** {@code non-null;} file being written */ private final DexFile file; - /** non-null; output stream to write to */ + /** {@code non-null;} output stream to write to */ private final AnnotatedOutput out; /** * Construct an instance. * - * @param file non-null; file being written - * @param out non-null; output stream to write to + * @param file {@code non-null;} file being written + * @param out {@code non-null;} output stream to write to */ public ValueEncoder(DexFile file, AnnotatedOutput out) { if (file == null) { @@ -123,7 +123,7 @@ public final class ValueEncoder { /** * Writes out the encoded form of the given constant. * - * @param cst non-null; the constant to write + * @param cst {@code non-null;} the constant to write */ public void writeConstant(Constant cst) { int type = constantToValueType(cst); @@ -209,8 +209,8 @@ public final class ValueEncoder { /** * Gets the value type for the given constant. * - * @param cst non-null; the constant - * @return the value type; one of the <code>VALUE_*</code> constants + * @param cst {@code non-null;} the constant + * @return the value type; one of the {@code VALUE_*} constants * defined by this class */ private static int constantToValueType(Constant cst) { @@ -257,15 +257,15 @@ public final class ValueEncoder { /** * Writes out the encoded form of the given array, that is, as - * an <code>encoded_array</code> and not including a - * <code>value_type</code> prefix. If the output stream keeps - * (debugging) annotations and <code>topLevel</code> is - * <code>true</code>, then this method will write (debugging) + * an {@code encoded_array} and not including a + * {@code value_type} prefix. If the output stream keeps + * (debugging) annotations and {@code topLevel} is + * {@code true}, then this method will write (debugging) * annotations. * - * @param array non-null; array instance to write - * @param topLevel <code>true</code> iff the given annotation is the - * top-level annotation or <code>false</code> if it is a sub-annotation + * @param array {@code non-null;} array instance to write + * @param topLevel {@code true} iff the given annotation is the + * top-level annotation or {@code false} if it is a sub-annotation * of some other annotation */ public void writeArray(CstArray array, boolean topLevel) { @@ -295,15 +295,15 @@ public final class ValueEncoder { /** * Writes out the encoded form of the given annotation, that is, - * as an <code>encoded_annotation</code> and not including a - * <code>value_type</code> prefix. If the output stream keeps - * (debugging) annotations and <code>topLevel</code> is - * <code>true</code>, then this method will write (debugging) + * as an {@code encoded_annotation} and not including a + * {@code value_type} prefix. If the output stream keeps + * (debugging) annotations and {@code topLevel} is + * {@code true}, then this method will write (debugging) * annotations. * - * @param annotation non-null; annotation instance to write - * @param topLevel <code>true</code> iff the given annotation is the - * top-level annotation or <code>false</code> if it is a sub-annotation + * @param annotation {@code non-null;} annotation instance to write + * @param topLevel {@code true} iff the given annotation is the + * top-level annotation or {@code false} if it is a sub-annotation * of some other annotation */ public void writeAnnotation(Annotation annotation, boolean topLevel) { @@ -361,8 +361,8 @@ public final class ValueEncoder { * Gets the colloquial type name and human form of the type of the * given constant, when used as an encoded value. * - * @param cst non-null; the constant - * @return non-null; its type name and human form + * @param cst {@code non-null;} the constant + * @return {@code non-null;} its type name and human form */ public static String constantToHuman(Constant cst) { int type = constantToValueType(cst); @@ -385,7 +385,7 @@ public final class ValueEncoder { * for any signed integral type. * * @param type the type constant - * @param value <code>long</code> bits of the value + * @param value {@code long} bits of the value */ private void writeSignedIntegralValue(int type, long value) { /* @@ -422,7 +422,7 @@ public final class ValueEncoder { * for any unsigned integral type. * * @param type the type constant - * @param value <code>long</code> bits of the value + * @param value {@code long} bits of the value */ private void writeUnsignedIntegralValue(int type, long value) { // Figure out how many bits are needed to represent the value. @@ -453,7 +453,7 @@ public final class ValueEncoder { * right-zero-extended value. * * @param type the type constant - * @param value <code>long</code> bits of the value + * @param value {@code long} bits of the value */ private void writeRightZeroExtendedValue(int type, long value) { // Figure out how many bits are needed to represent the value. @@ -484,12 +484,12 @@ public final class ValueEncoder { /** - * Helper for <code>addContents()</code> methods, which adds + * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * - * @param file non-null; the file to add to - * @param annotation non-null; the annotation to add contents for + * @param file {@code non-null;} the file to add to + * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); @@ -504,19 +504,16 @@ public final class ValueEncoder { } /** - * Helper for <code>addContents()</code> methods, which adds + * Helper for {@code addContents()} methods, which adds * contents for a particular constant, calling itself recursively * should it encounter a {@link CstArray} and calling {@link * #addContents(DexFile,Annotation)} recursively should it * encounter a {@link CstAnnotation}. * - * @param file non-null; the file to add to - * @param cst non-null; the constant to add contents for + * @param file {@code non-null;} the file to add to + * @param cst {@code non-null;} the constant to add contents for */ public static void addContents(DexFile file, Constant cst) { - TypeIdsSection typeIds = file.getTypeIds(); - StringIdsSection stringIds = file.getStringIds(); - if (cst instanceof CstAnnotation) { addContents(file, ((CstAnnotation) cst).getAnnotation()); } else if (cst instanceof CstArray) { diff --git a/dx/src/com/android/dx/rop/annotation/Annotation.java b/dx/src/com/android/dx/rop/annotation/Annotation.java index b7cf16494..6154c618e 100644 --- a/dx/src/com/android/dx/rop/annotation/Annotation.java +++ b/dx/src/com/android/dx/rop/annotation/Annotation.java @@ -41,20 +41,20 @@ import java.util.TreeMap; */ public final class Annotation extends MutabilityControl implements Comparable<Annotation>, ToHuman { - /** non-null; type of the annotation */ + /** {@code non-null;} type of the annotation */ private final CstType type; - /** non-null; the visibility of the annotation */ + /** {@code non-null;} the visibility of the annotation */ private final AnnotationVisibility visibility; - /** non-null; map from names to {@link NameValuePair} instances */ + /** {@code non-null;} map from names to {@link NameValuePair} instances */ private final TreeMap<CstUtf8, NameValuePair> elements; /** * Construct an instance. It initially contains no elements. * - * @param type non-null; type of the annotation - * @param visibility non-null; the visibility of the annotation + * @param type {@code non-null;} type of the annotation + * @param visibility {@code non-null;} the visibility of the annotation */ public Annotation(CstType type, AnnotationVisibility visibility) { if (type == null) { @@ -165,7 +165,7 @@ public final class Annotation extends MutabilityControl /** * Gets the type of this instance. * - * @return non-null; the type + * @return {@code non-null;} the type */ public CstType getType() { return type; @@ -174,7 +174,7 @@ public final class Annotation extends MutabilityControl /** * Gets the visibility of this instance. * - * @return non-null; the visibility + * @return {@code non-null;} the visibility */ public AnnotationVisibility getVisibility() { return visibility; @@ -185,7 +185,7 @@ public final class Annotation extends MutabilityControl * If there is a preexisting element with the same name, it will be * replaced by this method. * - * @param pair non-null; the (name, value) pair to place into this instance + * @param pair {@code non-null;} the (name, value) pair to place into this instance */ public void put(NameValuePair pair) { throwIfImmutable(); @@ -202,7 +202,7 @@ public final class Annotation extends MutabilityControl * It is an error to call this method if there is a preexisting element * with the same name. * - * @param pair non-null; the (name, value) pair to add to this instance + * @param pair {@code non-null;} the (name, value) pair to add to this instance */ public void add(NameValuePair pair) { throwIfImmutable(); @@ -224,7 +224,7 @@ public final class Annotation extends MutabilityControl * Gets the set of name-value pairs contained in this instance. The * result is always unmodifiable. * - * @return non-null; the set of name-value pairs + * @return {@code non-null;} the set of name-value pairs */ public Collection<NameValuePair> getNameValuePairs() { return Collections.unmodifiableCollection(elements.values()); diff --git a/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java b/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java index c53fcd804..26246bb10 100644 --- a/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java +++ b/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java @@ -27,13 +27,13 @@ public enum AnnotationVisibility implements ToHuman { SYSTEM("system"), EMBEDDED("embedded"); - /** non-null; the human-oriented string representation */ + /** {@code non-null;} the human-oriented string representation */ private final String human; /** * Constructs an instance. * - * @param human non-null; the human-oriented string representation + * @param human {@code non-null;} the human-oriented string representation */ private AnnotationVisibility(String human) { this.human = human; diff --git a/dx/src/com/android/dx/rop/annotation/Annotations.java b/dx/src/com/android/dx/rop/annotation/Annotations.java index c1da88364..dcb74a182 100644 --- a/dx/src/com/android/dx/rop/annotation/Annotations.java +++ b/dx/src/com/android/dx/rop/annotation/Annotations.java @@ -29,14 +29,14 @@ import java.util.TreeMap; */ public final class Annotations extends MutabilityControl implements Comparable<Annotations> { - /** non-null; immutable empty instance */ + /** {@code non-null;} immutable empty instance */ public static final Annotations EMPTY = new Annotations(); static { EMPTY.setImmutable(); } - /** non-null; map from types to annotations */ + /** {@code non-null;} map from types to annotations */ private final TreeMap<CstType, Annotation> annotations; /** @@ -44,9 +44,9 @@ public final class Annotations extends MutabilityControl * two given instances. The two instances must contain disjoint sets * of types. * - * @param a1 non-null; an instance - * @param a2 non-null; the other instance - * @return non-null; the combination + * @param a1 {@code non-null;} an instance + * @param a2 {@code non-null;} the other instance + * @return {@code non-null;} the combination * @throws IllegalArgumentException thrown if there is a duplicate type */ public static Annotations combine(Annotations a1, Annotations a2) { @@ -64,9 +64,9 @@ public final class Annotations extends MutabilityControl * given instance with the given additional annotation. The latter's * type must not already appear in the former. * - * @param annotations non-null; the instance to augment - * @param annotation non-null; the additional annotation - * @return non-null; the combination + * @param annotations {@code non-null;} the instance to augment + * @param annotation {@code non-null;} the additional annotation + * @return {@code non-null;} the combination * @throws IllegalArgumentException thrown if there is a duplicate type */ public static Annotations combine(Annotations annotations, @@ -152,7 +152,7 @@ public final class Annotations extends MutabilityControl /** * Gets the number of elements in this instance. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int size() { return annotations.size(); @@ -162,7 +162,7 @@ public final class Annotations extends MutabilityControl * Adds an element to this instance. There must not already be an * element of the same type. * - * @param annotation non-null; the element to add + * @param annotation {@code non-null;} the element to add * @throws IllegalArgumentException thrown if there is a duplicate type */ public void add(Annotation annotation) { @@ -186,7 +186,7 @@ public final class Annotations extends MutabilityControl * Adds all of the elements of the given instance to this one. The * instances must not have any duplicate types. * - * @param toAdd non-null; the annotations to add + * @param toAdd {@code non-null;} the annotations to add * @throws IllegalArgumentException thrown if there is a duplicate type */ public void addAll(Annotations toAdd) { @@ -205,7 +205,7 @@ public final class Annotations extends MutabilityControl * Gets the set of annotations contained in this instance. The * result is always unmodifiable. * - * @return non-null; the set of annotations + * @return {@code non-null;} the set of annotations */ public Collection<Annotation> getAnnotations() { return Collections.unmodifiableCollection(annotations.values()); diff --git a/dx/src/com/android/dx/rop/annotation/AnnotationsList.java b/dx/src/com/android/dx/rop/annotation/AnnotationsList.java index 43a07ba94..0f4207b0b 100644 --- a/dx/src/com/android/dx/rop/annotation/AnnotationsList.java +++ b/dx/src/com/android/dx/rop/annotation/AnnotationsList.java @@ -23,7 +23,7 @@ import com.android.dx.util.FixedSizeList; */ public final class AnnotationsList extends FixedSizeList { - /** non-null; immutable empty instance */ + /** {@code non-null;} immutable empty instance */ public static final AnnotationsList EMPTY = new AnnotationsList(0); /** @@ -32,9 +32,9 @@ public final class AnnotationsList * same number of elements, and each pair of elements must contain * disjoint sets of types. * - * @param list1 non-null; an instance - * @param list2 non-null; the other instance - * @return non-null; the combination + * @param list1 {@code non-null;} an instance + * @param list2 {@code non-null;} the other instance + * @return {@code non-null;} the combination */ public static AnnotationsList combine(AnnotationsList list1, AnnotationsList list2) { @@ -57,7 +57,7 @@ public final class AnnotationsList } /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -68,10 +68,10 @@ public final class AnnotationsList /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Annotations get(int n) { return (Annotations) get0(n); @@ -81,8 +81,8 @@ public final class AnnotationsList * Sets the element at the given index. The given element must be * immutable. * - * @param n >= 0, < size(); which index - * @param a null-ok; the element to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); diff --git a/dx/src/com/android/dx/rop/annotation/NameValuePair.java b/dx/src/com/android/dx/rop/annotation/NameValuePair.java index dadabaa71..7137a6025 100644 --- a/dx/src/com/android/dx/rop/annotation/NameValuePair.java +++ b/dx/src/com/android/dx/rop/annotation/NameValuePair.java @@ -24,17 +24,17 @@ import com.android.dx.rop.cst.CstUtf8; * A (name, value) pair. These are used as the contents of an annotation. */ public final class NameValuePair implements Comparable<NameValuePair> { - /** non-null; the name */ + /** {@code non-null;} the name */ private final CstUtf8 name; - /** non-null; the value */ + /** {@code non-null;} the value */ private final Constant value; /** * Construct an instance. * - * @param name non-null; the name - * @param value non-null; the value + * @param name {@code non-null;} the name + * @param value {@code non-null;} the value */ public NameValuePair(CstUtf8 name, Constant value) { if (name == null) { @@ -95,7 +95,7 @@ public final class NameValuePair implements Comparable<NameValuePair> { /** * Gets the name. * - * @return non-null; the name + * @return {@code non-null;} the name */ public CstUtf8 getName() { return name; @@ -104,7 +104,7 @@ public final class NameValuePair implements Comparable<NameValuePair> { /** * Gets the value. * - * @return non-null; the valute + * @return {@code non-null;} the value */ public Constant getValue() { return value; diff --git a/dx/src/com/android/dx/rop/code/AccessFlags.java b/dx/src/com/android/dx/rop/code/AccessFlags.java index 265cfa619..b76b610e1 100644 --- a/dx/src/com/android/dx/rop/code/AccessFlags.java +++ b/dx/src/com/android/dx/rop/code/AccessFlags.java @@ -23,8 +23,8 @@ import com.android.dx.util.Hex; * related utilities. Although, at the rop layer, flags are generally * ignored, this is the layer of communication, and as such, this * package is where these definitions belong. The flag definitions are - * identical to Java access flags, but <code>ACC_SUPER</code> isn't - * used at all in translated code, and <code>ACC_SYNCHRONIZED</code> + * identical to Java access flags, but {@code ACC_SUPER} isn't + * used at all in translated code, and {@code ACC_SYNCHRONIZED} * is only used in a very limited way. */ public final class AccessFlags { @@ -44,13 +44,13 @@ public final class AccessFlags { public static final int ACC_FINAL = 0x0010; /** - * synchronized method; only valid in dex files for <code>native</code> + * synchronized method; only valid in dex files for {@code native} * methods */ public static final int ACC_SYNCHRONIZED = 0x0020; /** - * class with new-style <code>invokespecial</code> for superclass + * class with new-style {@code invokespecial} for superclass * method access */ public static final int ACC_SUPER = 0x0020; @@ -77,7 +77,7 @@ public final class AccessFlags { public static final int ACC_ABSTRACT = 0x0400; /** - * method with strict floating point (<code>strictfp</code>) + * method with strict floating point ({@code strictfp}) * behavior */ public static final int ACC_STRICT = 0x0800; @@ -98,7 +98,7 @@ public final class AccessFlags { public static final int ACC_CONSTRUCTOR = 0x10000; /** - * method was declared <code>synchronized</code>; has no effect on + * method was declared {@code synchronized}; has no effect on * execution (other than inspecting this flag, per se) */ public static final int ACC_DECLARED_SYNCHRONIZED = 0x20000; @@ -147,7 +147,7 @@ public final class AccessFlags { * as defined on classes (not fields or methods). * * @param flags the flags - * @return non-null; human-oriented string + * @return {@code non-null;} human-oriented string */ public static String classString(int flags) { return humanHelper(flags, CLASS_FLAGS, CONV_CLASS); @@ -158,7 +158,7 @@ public final class AccessFlags { * as defined on inner classes. * * @param flags the flags - * @return non-null; human-oriented string + * @return {@code non-null;} human-oriented string */ public static String innerClassString(int flags) { return humanHelper(flags, INNER_CLASS_FLAGS, CONV_CLASS); @@ -169,7 +169,7 @@ public final class AccessFlags { * as defined on fields (not classes or methods). * * @param flags the flags - * @return non-null; human-oriented string + * @return {@code non-null;} human-oriented string */ public static String fieldString(int flags) { return humanHelper(flags, FIELD_FLAGS, CONV_FIELD); @@ -180,106 +180,106 @@ public final class AccessFlags { * as defined on methods (not classes or fields). * * @param flags the flags - * @return non-null; human-oriented string + * @return {@code non-null;} human-oriented string */ public static String methodString(int flags) { return humanHelper(flags, METHOD_FLAGS, CONV_METHOD); } /** - * Returns whether the flag <code>ACC_PUBLIC</code> is on in the given + * Returns whether the flag {@code ACC_PUBLIC} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_PUBLIC</code> flag + * @return the value of the {@code ACC_PUBLIC} flag */ public static boolean isPublic(int flags) { return (flags & ACC_PUBLIC) != 0; } /** - * Returns whether the flag <code>ACC_PROTECTED</code> is on in the given + * Returns whether the flag {@code ACC_PROTECTED} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_PROTECTED</code> flag + * @return the value of the {@code ACC_PROTECTED} flag */ public static boolean isProtected(int flags) { return (flags & ACC_PROTECTED) != 0; } /** - * Returns whether the flag <code>ACC_PRIVATE</code> is on in the given + * Returns whether the flag {@code ACC_PRIVATE} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_PRIVATE</code> flag + * @return the value of the {@code ACC_PRIVATE} flag */ public static boolean isPrivate(int flags) { return (flags & ACC_PRIVATE) != 0; } /** - * Returns whether the flag <code>ACC_STATIC</code> is on in the given + * Returns whether the flag {@code ACC_STATIC} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_STATIC</code> flag + * @return the value of the {@code ACC_STATIC} flag */ public static boolean isStatic(int flags) { return (flags & ACC_STATIC) != 0; } /** - * Returns whether the flag <code>ACC_SYNCHRONIZED</code> is on in + * Returns whether the flag {@code ACC_SYNCHRONIZED} is on in * the given flags. * * @param flags the flags to check - * @return the value of the <code>ACC_SYNCHRONIZED</code> flag + * @return the value of the {@code ACC_SYNCHRONIZED} flag */ public static boolean isSynchronized(int flags) { return (flags & ACC_SYNCHRONIZED) != 0; } /** - * Returns whether the flag <code>ACC_ABSTRACT</code> is on in the given + * Returns whether the flag {@code ACC_ABSTRACT} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_ABSTRACT</code> flag + * @return the value of the {@code ACC_ABSTRACT} flag */ public static boolean isAbstract(int flags) { return (flags & ACC_ABSTRACT) != 0; } /** - * Returns whether the flag <code>ACC_NATIVE</code> is on in the given + * Returns whether the flag {@code ACC_NATIVE} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_NATIVE</code> flag + * @return the value of the {@code ACC_NATIVE} flag */ public static boolean isNative(int flags) { return (flags & ACC_NATIVE) != 0; } /** - * Returns whether the flag <code>ACC_ANNOTATION</code> is on in the given + * Returns whether the flag {@code ACC_ANNOTATION} is on in the given * flags. * * @param flags the flags to check - * @return the value of the <code>ACC_ANNOTATION</code> flag + * @return the value of the {@code ACC_ANNOTATION} flag */ public static boolean isAnnotation(int flags) { return (flags & ACC_ANNOTATION) != 0; } /** - * Returns whether the flag <code>ACC_DECLARED_SYNCHRONIZED</code> is + * Returns whether the flag {@code ACC_DECLARED_SYNCHRONIZED} is * on in the given flags. * * @param flags the flags to check - * @return the value of the <code>ACC_DECLARED_SYNCHRONIZED</code> flag + * @return the value of the {@code ACC_DECLARED_SYNCHRONIZED} flag */ public static boolean isDeclaredSynchronized(int flags) { return (flags & ACC_DECLARED_SYNCHRONIZED) != 0; @@ -291,8 +291,8 @@ public final class AccessFlags { * * @param flags the defined flags * @param mask mask for the "defined" bits - * @param what what the flags represent (one of <code>CONV_*</code>) - * @return non-null; human-oriented string + * @param what what the flags represent (one of {@code CONV_*}) + * @return {@code non-null;} human-oriented string */ private static String humanHelper(int flags, int mask, int what) { StringBuffer sb = new StringBuffer(80); diff --git a/dx/src/com/android/dx/rop/code/BasicBlock.java b/dx/src/com/android/dx/rop/code/BasicBlock.java index 66db5aa29..7bb2d9b03 100644 --- a/dx/src/com/android/dx/rop/code/BasicBlock.java +++ b/dx/src/com/android/dx/rop/code/BasicBlock.java @@ -25,34 +25,34 @@ import com.android.dx.util.LabeledItem; * Basic block of register-based instructions. */ public final class BasicBlock implements LabeledItem { - /** >= 0; target label for this block */ + /** {@code >= 0;} target label for this block */ private final int label; - /** non-null; list of instructions in this block */ + /** {@code non-null;} list of instructions in this block */ private final InsnList insns; /** - * non-null; full list of successors that this block may + * {@code non-null;} full list of successors that this block may * branch to */ private final IntList successors; /** - * >= -1; the primary / standard-flow / "default" successor, or - * <code>-1</code> if this block has no successors (that is, it + * {@code >= -1;} the primary / standard-flow / "default" successor, or + * {@code -1} if this block has no successors (that is, it * exits the function/method) */ private final int primarySuccessor; /** - * Constructs an instance. The predecessor set is set to <code>null</code>. + * Constructs an instance. The predecessor set is set to {@code null}. * - * @param label >= 0; target label for this block - * @param insns non-null; list of instructions in this block - * @param successors non-null; full list of successors that this + * @param label {@code >= 0;} target label for this block + * @param insns {@code non-null;} list of instructions in this block + * @param successors {@code non-null;} full list of successors that this * block may branch to - * @param primarySuccessor >= -1; the primary / standard-flow / - * "default" successor, or <code>-1</code> if this block has no + * @param primarySuccessor {@code >= -1;} the primary / standard-flow / + * "default" successor, or {@code -1} if this block has no * successors (that is, it exits the function/method or is an * unconditional throw) */ @@ -116,7 +116,7 @@ public final class BasicBlock implements LabeledItem { * {@inheritDoc} * * Instances of this class compare by identity. That is, - * <code>x.equals(y)</code> is only true if <code>x == y</code>. + * {@code x.equals(y)} is only true if {@code x == y}. */ @Override public boolean equals(Object other) { @@ -137,7 +137,7 @@ public final class BasicBlock implements LabeledItem { /** * Gets the target label of this block. * - * @return >= 0; the label + * @return {@code >= 0;} the label */ public int getLabel() { return label; @@ -146,7 +146,7 @@ public final class BasicBlock implements LabeledItem { /** * Gets the list of instructions inside this block. * - * @return non-null; the instruction list + * @return {@code non-null;} the instruction list */ public InsnList getInsns() { return insns; @@ -155,7 +155,7 @@ public final class BasicBlock implements LabeledItem { /** * Gets the list of successors that this block may branch to. * - * @return non-null; the successors list + * @return {@code non-null;} the successors list */ public IntList getSuccessors() { return successors; @@ -164,7 +164,7 @@ public final class BasicBlock implements LabeledItem { /** * Gets the primary successor of this block. * - * @return >= -1; the primary successor, or <code>-1</code> if this + * @return {@code >= -1;} the primary successor, or {@code -1} if this * block has no successors at all */ public int getPrimarySuccessor() { @@ -175,7 +175,7 @@ public final class BasicBlock implements LabeledItem { * Gets the secondary successor of this block. It is only valid to call * this method on blocks that have exactly two successors. * - * @return >= 0; the secondary successor + * @return {@code >= 0;} the secondary successor */ public int getSecondarySuccessor() { if (successors.size() != 2) { @@ -193,9 +193,9 @@ public final class BasicBlock implements LabeledItem { /** * Gets the first instruction of this block. This is just a - * convenient shorthand for <code>getInsns().get(0)</code>. + * convenient shorthand for {@code getInsns().get(0)}. * - * @return non-null; the first instruction + * @return {@code non-null;} the first instruction */ public Insn getFirstInsn() { return insns.get(0); @@ -203,9 +203,9 @@ public final class BasicBlock implements LabeledItem { /** * Gets the last instruction of this block. This is just a - * convenient shorthand for <code>getInsns().getLast()</code>. + * convenient shorthand for {@code getInsns().getLast()}. * - * @return non-null; the last instruction + * @return {@code non-null;} the last instruction */ public Insn getLastInsn() { return insns.getLast(); @@ -213,9 +213,9 @@ public final class BasicBlock implements LabeledItem { /** * Returns whether this block might throw an exception. This is - * just a convenient shorthand for <code>getLastInsn().canThrow()</code>. + * just a convenient shorthand for {@code getLastInsn().canThrow()}. * - * @return <code>true</code> iff this block might throw an + * @return {@code true} iff this block might throw an * exception */ public boolean canThrow() { @@ -228,7 +228,7 @@ public final class BasicBlock implements LabeledItem { * the block to see if it could throw, and if so, whether it in fact * has any associated handlers. * - * @return <code>true</code> iff this block has any associated + * @return {@code true} iff this block has any associated * exception handlers */ public boolean hasExceptionHandlers() { @@ -241,9 +241,9 @@ public final class BasicBlock implements LabeledItem { * if any. This is just a shorthand for inspecting the last * instruction in the block to see if it could throw, and if so, * grabbing the catch list out of it. If not, this returns an - * empty list (not <code>null</code>). + * empty list (not {@code null}). * - * @return non-null; the exception handler types associated with + * @return {@code non-null;} the exception handler types associated with * this block */ public TypeList getExceptionHandlerTypes() { @@ -257,7 +257,7 @@ public final class BasicBlock implements LabeledItem { * amount. * * @param delta the amount to offset register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlock withRegisterOffset(int delta) { return new BasicBlock(label, insns.withRegisterOffset(delta), diff --git a/dx/src/com/android/dx/rop/code/BasicBlockList.java b/dx/src/com/android/dx/rop/code/BasicBlockList.java index 6564318e1..0627425da 100644 --- a/dx/src/com/android/dx/rop/code/BasicBlockList.java +++ b/dx/src/com/android/dx/rop/code/BasicBlockList.java @@ -27,14 +27,14 @@ import com.android.dx.util.LabeledList; */ public final class BasicBlockList extends LabeledList { /** - * >= -1; the count of registers required by this method or - * <code>-1</code> if not yet calculated + * {@code >= -1;} the count of registers required by this method or + * {@code -1} if not yet calculated */ private int regCount; /** - * Constructs an instance. All indices initially contain <code>null</code>, - * and the first-block label is initially <code>-1</code>. + * Constructs an instance. All indices initially contain {@code null}, + * and the first-block label is initially {@code -1}. * * @param size the size of the list */ @@ -45,7 +45,7 @@ public final class BasicBlockList extends LabeledList { } /** - * Constructs a mutable copy for <code>getMutableCopy()</code>. + * Constructs a mutable copy for {@code getMutableCopy()}. * * @param old block to copy */ @@ -58,10 +58,10 @@ public final class BasicBlockList extends LabeledList { /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public BasicBlock get(int n) { return (BasicBlock) get0(n); @@ -70,8 +70,8 @@ public final class BasicBlockList extends LabeledList { /** * Sets the basic block at the given index. * - * @param n >= 0, < size(); which index - * @param bb null-ok; the element to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param bb {@code null-ok;} the element to set at {@code n} */ public void set(int n, BasicBlock bb) { super.set(n, bb); @@ -86,7 +86,7 @@ public final class BasicBlockList extends LabeledList { * instance's instructions (indirectly through {@link BasicBlock} * instances). * - * @return >= 0; the register count + * @return {@code >= 0;} the register count */ public int getRegCount() { if (regCount == -1) { @@ -102,7 +102,7 @@ public final class BasicBlockList extends LabeledList { * Gets the total instruction count for this instance. This is the * sum of the instruction counts of each block. * - * @return >= 0; the total instruction count + * @return {@code >= 0;} the total instruction count */ public int getInstructionCount() { int sz = size(); @@ -122,7 +122,7 @@ public final class BasicBlockList extends LabeledList { * Gets the total instruction count for this instance, ignoring * mark-local instructions which are not actually emitted. * - * @return >= 0; the total instruction count + * @return {@code >= 0;} the total instruction count */ public int getEffectiveInstructionCount() { int sz = size(); @@ -151,8 +151,8 @@ public final class BasicBlockList extends LabeledList { /** * Gets the first block in the list with the given label, if any. * - * @param label >= 0; the label to look for - * @return non-null; the so-labelled block + * @param label {@code >= 0;} the label to look for + * @return {@code non-null;} the so-labelled block * @throws IllegalArgumentException thrown if the label isn't found */ public BasicBlock labelToBlock(int label) { @@ -169,7 +169,7 @@ public final class BasicBlockList extends LabeledList { /** * Visits each instruction of each block in the list, in order. * - * @param visitor non-null; visitor to use + * @param visitor {@code non-null;} visitor to use */ public void forEachInsn(Insn.Visitor visitor) { int sz = size(); @@ -188,7 +188,7 @@ public final class BasicBlockList extends LabeledList { * original. * * @param delta the amount to offset register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList withRegisterOffset(int delta) { int sz = size(); @@ -211,7 +211,7 @@ public final class BasicBlockList extends LabeledList { /** * Returns a mutable copy of this list. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList getMutableCopy() { return new BasicBlockList(this); @@ -222,10 +222,10 @@ public final class BasicBlockList extends LabeledList { * only has one successor, then that is the preferred successor. * Otherwise, if the block has a primay successor, then that is * the preferred successor. If the block has no successors, then - * this returns <code>null</code>. + * this returns {@code null}. * - * @param block non-null; the block in question - * @return null-ok; the preferred successor, if any + * @param block {@code non-null;} the block in question + * @return {@code null-ok;} the preferred successor, if any */ public BasicBlock preferredSuccessorOf(BasicBlock block) { int primarySuccessor = block.getPrimarySuccessor(); @@ -252,9 +252,9 @@ public final class BasicBlockList extends LabeledList { * Compares the catches of two blocks for equality. This includes * both the catch types and target labels. * - * @param block1 non-null; one block to compare - * @param block2 non-null; the other block to compare - * @return <code>true</code> if the two blocks' non-primary successors + * @param block1 {@code non-null;} one block to compare + * @param block2 {@code non-null;} the other block to compare + * @return {@code true} if the two blocks' non-primary successors * are identical */ public boolean catchesEqual(BasicBlock block1, @@ -313,7 +313,7 @@ public final class BasicBlockList extends LabeledList { */ private static class RegCountVisitor implements Insn.Visitor { - /** >= 0; register count in-progress */ + /** {@code >= 0;} register count in-progress */ private int regCount; /** @@ -326,7 +326,7 @@ public final class BasicBlockList extends LabeledList { /** * Gets the register count. * - * @return >= 0; the count + * @return {@code >= 0;} the count */ public int getRegCount() { return regCount; @@ -363,9 +363,9 @@ public final class BasicBlockList extends LabeledList { } /** - * Helper for all the <code>visit*</code> methods. + * Helper for all the {@code visit*} methods. * - * @param insn non-null; instruction being visited + * @param insn {@code non-null;} instruction being visited */ private void visit(Insn insn) { RegisterSpec result = insn.getResult(); @@ -385,7 +385,7 @@ public final class BasicBlockList extends LabeledList { /** * Processes the given register spec. * - * @param spec non-null; the register spec + * @param spec {@code non-null;} the register spec */ private void processReg(RegisterSpec spec) { int reg = spec.getNextReg(); diff --git a/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java b/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java index a9da10932..1ecf02c15 100644 --- a/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java +++ b/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java @@ -18,11 +18,11 @@ package com.android.dx.rop.code; /** * Implementation of {@link TranslationAdvice} which conservatively answers - * <code>false</code> to all methods. + * {@code false} to all methods. */ public final class ConservativeTranslationAdvice implements TranslationAdvice { - /** non-null; standard instance of this class */ + /** {@code non-null;} standard instance of this class */ public static final ConservativeTranslationAdvice THE_ONE = new ConservativeTranslationAdvice(); diff --git a/dx/src/com/android/dx/rop/code/CstInsn.java b/dx/src/com/android/dx/rop/code/CstInsn.java index d1cf523a5..26df1a9bc 100644 --- a/dx/src/com/android/dx/rop/code/CstInsn.java +++ b/dx/src/com/android/dx/rop/code/CstInsn.java @@ -23,17 +23,17 @@ import com.android.dx.rop.cst.Constant; */ public abstract class CstInsn extends Insn { - /** non-null; the constant */ + /** {@code non-null;} the constant */ private final Constant cst; /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param sources non-null; specs for all the sources - * @param cst non-null; constant + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param sources {@code non-null;} specs for all the sources + * @param cst {@code non-null;} constant */ public CstInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources, Constant cst) { @@ -55,7 +55,7 @@ public abstract class CstInsn /** * Gets the constant. * - * @return non-null; the constant + * @return {@code non-null;} the constant */ public Constant getConstant() { return cst; diff --git a/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java b/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java index 1c2382464..8dbc00b1a 100644 --- a/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java +++ b/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java @@ -25,7 +25,7 @@ import com.android.dx.rop.type.Type; */ public final class DexTranslationAdvice implements TranslationAdvice { - /** non-null; standard instance of this class */ + /** {@code non-null;} standard instance of this class */ public static final DexTranslationAdvice THE_ONE = new DexTranslationAdvice(); @@ -98,8 +98,8 @@ public final class DexTranslationAdvice /** * Calculates the total rop width of the list of SSA registers * - * @param sources non-null; list of SSA registers - * @return >= 0 rop-form width in register units + * @param sources {@code non-null;} list of SSA registers + * @return {@code >= 0;} rop-form width in register units */ private int totalRopWidth(RegisterSpecList sources) { int sz = sources.size(); diff --git a/dx/src/com/android/dx/rop/code/Exceptions.java b/dx/src/com/android/dx/rop/code/Exceptions.java index 3ef4879e6..f99a760d5 100644 --- a/dx/src/com/android/dx/rop/code/Exceptions.java +++ b/dx/src/com/android/dx/rop/code/Exceptions.java @@ -23,78 +23,78 @@ import com.android.dx.rop.type.Type; * Common exception types. */ public final class Exceptions { - /** non-null; the type <code>java.lang.ArithmeticException</code> */ + /** {@code non-null;} the type {@code java.lang.ArithmeticException} */ public static final Type TYPE_ArithmeticException = Type.intern("Ljava/lang/ArithmeticException;"); /** - * non-null; the type - * <code>java.lang.ArrayIndexOutOfBoundsException</code> + * {@code non-null;} the type + * {@code java.lang.ArrayIndexOutOfBoundsException} */ public static final Type TYPE_ArrayIndexOutOfBoundsException = Type.intern("Ljava/lang/ArrayIndexOutOfBoundsException;"); - /** non-null; the type <code>java.lang.ArrayStoreException</code> */ + /** {@code non-null;} the type {@code java.lang.ArrayStoreException} */ public static final Type TYPE_ArrayStoreException = Type.intern("Ljava/lang/ArrayStoreException;"); - /** non-null; the type <code>java.lang.ClassCastException</code> */ + /** {@code non-null;} the type {@code java.lang.ClassCastException} */ public static final Type TYPE_ClassCastException = Type.intern("Ljava/lang/ClassCastException;"); - /** non-null; the type <code>java.lang.Error</code> */ + /** {@code non-null;} the type {@code java.lang.Error} */ public static final Type TYPE_Error = Type.intern("Ljava/lang/Error;"); /** - * non-null; the type - * <code>java.lang.IllegalMonitorStateException</code> + * {@code non-null;} the type + * {@code java.lang.IllegalMonitorStateException} */ public static final Type TYPE_IllegalMonitorStateException = Type.intern("Ljava/lang/IllegalMonitorStateException;"); - /** non-null; the type <code>java.lang.NegativeArraySizeException</code> */ + /** {@code non-null;} the type {@code java.lang.NegativeArraySizeException} */ public static final Type TYPE_NegativeArraySizeException = Type.intern("Ljava/lang/NegativeArraySizeException;"); - /** non-null; the type <code>java.lang.NullPointerException</code> */ + /** {@code non-null;} the type {@code java.lang.NullPointerException} */ public static final Type TYPE_NullPointerException = Type.intern("Ljava/lang/NullPointerException;"); - /** non-null; the list <code>[java.lang.Error]</code> */ + /** {@code non-null;} the list {@code [java.lang.Error]} */ public static final StdTypeList LIST_Error = StdTypeList.make(TYPE_Error); /** - * non-null; the list <code>[java.lang.Error, - * java.lang.ArithmeticException]</code> + * {@code non-null;} the list {@code[java.lang.Error, + * java.lang.ArithmeticException]} */ public static final StdTypeList LIST_Error_ArithmeticException = StdTypeList.make(TYPE_Error, TYPE_ArithmeticException); /** - * non-null; the list <code>[java.lang.Error, - * java.lang.ClassCastException]</code> + * {@code non-null;} the list {@code[java.lang.Error, + * java.lang.ClassCastException]} */ public static final StdTypeList LIST_Error_ClassCastException = StdTypeList.make(TYPE_Error, TYPE_ClassCastException); /** - * non-null; the list <code>[java.lang.Error, - * java.lang.NegativeArraySizeException]</code> + * {@code non-null;} the list {@code [java.lang.Error, + * java.lang.NegativeArraySizeException]} */ public static final StdTypeList LIST_Error_NegativeArraySizeException = StdTypeList.make(TYPE_Error, TYPE_NegativeArraySizeException); /** - * non-null; the list <code>[java.lang.Error, - * java.lang.NullPointerException]</code> + * {@code non-null;} the list {@code [java.lang.Error, + * java.lang.NullPointerException]} */ public static final StdTypeList LIST_Error_NullPointerException = StdTypeList.make(TYPE_Error, TYPE_NullPointerException); /** - * non-null; the list <code>[java.lang.Error, + * {@code non-null;} the list {@code [java.lang.Error, * java.lang.NullPointerException, - * java.lang.ArrayIndexOutOfBoundsException]</code> + * java.lang.ArrayIndexOutOfBoundsException]} */ public static final StdTypeList LIST_Error_Null_ArrayIndexOutOfBounds = StdTypeList.make(TYPE_Error, @@ -102,10 +102,10 @@ public final class Exceptions { TYPE_ArrayIndexOutOfBoundsException); /** - * non-null; the list <code>[java.lang.Error, + * {@code non-null;} the list {@code [java.lang.Error, * java.lang.NullPointerException, * java.lang.ArrayIndexOutOfBoundsException, - * java.lang.ArrayStoreException]</code> + * java.lang.ArrayStoreException]} */ public static final StdTypeList LIST_Error_Null_ArrayIndex_ArrayStore = StdTypeList.make(TYPE_Error, @@ -114,9 +114,9 @@ public final class Exceptions { TYPE_ArrayStoreException); /** - * non-null; the list <code>[java.lang.Error, + * {@code non-null;} the list {@code [java.lang.Error, * java.lang.NullPointerException, - * java.lang.IllegalMonitorStateException]</code> + * java.lang.IllegalMonitorStateException]} */ public static final StdTypeList LIST_Error_Null_IllegalMonitorStateException = diff --git a/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java b/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java index 3798afbf2..0fc7d2b61 100644 --- a/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java +++ b/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java @@ -42,11 +42,11 @@ public final class FillArrayDataInsn /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param sources non-null; specs for all the sources - * @param initValues non-null; list of initial values to fill the array - * @param cst non-null; type of the new array + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param sources {@code non-null;} specs for all the sources + * @param initValues {@code non-null;} list of initial values to fill the array + * @param cst {@code non-null;} type of the new array */ public FillArrayDataInsn(Rop opcode, SourcePosition position, RegisterSpecList sources, @@ -71,7 +71,7 @@ public final class FillArrayDataInsn /** * Return the list of init values - * @return non-null; list of init values + * @return {@code non-null;} list of init values */ public ArrayList<Constant> getInitValues() { return initValues; @@ -79,7 +79,7 @@ public final class FillArrayDataInsn /** * Return the type of the newly created array - * @return non-null; array type + * @return {@code non-null;} array type */ public Constant getConstant() { return arrayType; diff --git a/dx/src/com/android/dx/rop/code/Insn.java b/dx/src/com/android/dx/rop/code/Insn.java index b1ad0ade4..77ab9c043 100644 --- a/dx/src/com/android/dx/rop/code/Insn.java +++ b/dx/src/com/android/dx/rop/code/Insn.java @@ -30,25 +30,25 @@ import com.android.dx.util.ToHuman; * information. */ public abstract class Insn implements ToHuman { - /** non-null; opcode */ + /** {@code non-null;} opcode */ private final Rop opcode; - /** non-null; source position */ + /** {@code non-null;} source position */ private final SourcePosition position; - /** null-ok; spec for the result of this instruction, if any */ + /** {@code null-ok;} spec for the result of this instruction, if any */ private final RegisterSpec result; - /** non-null; specs for all the sources of this instruction */ + /** {@code non-null;} specs for all the sources of this instruction */ private final RegisterSpecList sources; /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param sources non-null; specs for all the sources + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param sources {@code non-null;} specs for all the sources */ public Insn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources) { @@ -74,7 +74,7 @@ public abstract class Insn implements ToHuman { * {@inheritDoc} * * Instances of this class compare by identity. That is, - * <code>x.equals(y)</code> is only true if <code>x == y</code>. + * {@code x.equals(y)} is only true if {@code x == y}. */ @Override public final boolean equals(Object other) { @@ -102,7 +102,7 @@ public abstract class Insn implements ToHuman { /** * Gets a human-oriented (and slightly lossy) string for this instance. * - * @return non-null; the human string form + * @return {@code non-null;} the human string form */ public String toHuman() { return toHumanWithInline(getInlineString()); @@ -112,7 +112,7 @@ public abstract class Insn implements ToHuman { * Gets an "inline" string portion for toHuman(), if available. This * is the portion that appears after the Rop opcode * - * @return null-ok; if non-null, the inline text for toHuman() + * @return {@code null-ok;} if non-null, the inline text for toHuman() */ public String getInlineString() { return null; @@ -121,7 +121,7 @@ public abstract class Insn implements ToHuman { /** * Gets the opcode. * - * @return non-null; the opcode + * @return {@code non-null;} the opcode */ public final Rop getOpcode() { return opcode; @@ -130,17 +130,17 @@ public abstract class Insn implements ToHuman { /** * Gets the source position. * - * @return non-null; the source position + * @return {@code non-null;} the source position */ public final SourcePosition getPosition() { return position; } /** - * Gets the result spec, if any. A return value of <code>null</code> + * Gets the result spec, if any. A return value of {@code null} * means this instruction returns nothing. * - * @return null-ok; the result spec, if any + * @return {@code null-ok;} the result spec, if any */ public final RegisterSpec getResult() { return result; @@ -149,10 +149,10 @@ public abstract class Insn implements ToHuman { /** * Gets the spec of a local variable assignment that occurs at this * instruction, or null if no local variable assignment occurs. This - * may be the result register, or for <code>mark-local</code> insns + * may be the result register, or for {@code mark-local} insns * it may be the source. * - * @return null-ok; a named register spec or null + * @return {@code null-ok;} a named register spec or null */ public final RegisterSpec getLocalAssignment() { RegisterSpec assignment; @@ -178,7 +178,7 @@ public abstract class Insn implements ToHuman { /** * Gets the source specs. * - * @return non-null; the source specs + * @return {@code non-null;} the source specs */ public final RegisterSpecList getSources() { return sources; @@ -186,9 +186,9 @@ public abstract class Insn implements ToHuman { /** * Gets whether this instruction can possibly throw an exception. This - * is just a convenient wrapper for <code>getOpcode().canThrow()</code>. + * is just a convenient wrapper for {@code getOpcode().canThrow()}. * - * @return <code>true</code> iff this instruction can possibly throw + * @return {@code true} iff this instruction can possibly throw */ public final boolean canThrow() { return opcode.canThrow(); @@ -202,7 +202,7 @@ public abstract class Insn implements ToHuman { * exceptions. To determine whether this instruction can throw, * use {@link #canThrow}. * - * @return non-null; the catches list + * @return {@code non-null;} the catches list */ public abstract TypeList getCatches(); @@ -210,7 +210,7 @@ public abstract class Insn implements ToHuman { * Calls the appropriate method on the given visitor, depending on the * class of this instance. Subclasses must override this. * - * @param visitor non-null; the visitor to call on + * @param visitor {@code non-null;} the visitor to call on */ public abstract void accept(Visitor visitor); @@ -221,8 +221,8 @@ public abstract class Insn implements ToHuman { * throw. To determine whether this instruction can throw, use * {@link #canThrow}. * - * @param type non-null; type to append to the catch list - * @return non-null; an appropriately-constructed instance + * @param type {@code non-null;} type to append to the catch list + * @return {@code non-null;} an appropriately-constructed instance */ public abstract Insn withAddedCatch(Type type); @@ -231,7 +231,7 @@ public abstract class Insn implements ToHuman { * register references have been offset by the given delta. * * @param delta the amount to offset register references by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public abstract Insn withRegisterOffset(int delta); @@ -239,10 +239,10 @@ public abstract class Insn implements ToHuman { * Returns an instance that is just like this one, except that, if * possible, the insn is converted into a version in which the last * source (if it is a constant) is represented directly rather than - * as a register reference. <code>this</code> is returned in cases where + * as a register reference. {@code this} is returned in cases where * the translation is not possible. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public Insn withLastSourceLiteral() { return this; @@ -251,7 +251,7 @@ public abstract class Insn implements ToHuman { /** * Returns an exact copy of this Insn * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public Insn copy() { return withRegisterOffset(0); @@ -270,8 +270,8 @@ public abstract class Insn implements ToHuman { } /** - * Compares Insn contents, since <code>Insn.equals()</code> is defined - * to be an identity compare. Insn's are <code>contentEquals()</code> + * Compares Insn contents, since {@code Insn.equals()} is defined + * to be an identity compare. Insn's are {@code contentEquals()} * if they have the same opcode, registers, source position, and other * metadata. * @@ -290,9 +290,9 @@ public abstract class Insn implements ToHuman { * Returns an instance that is just like this one, except * with new result and source registers. * - * @param result null-ok; new result register - * @param sources non-null; new sources registers - * @return non-null; an appropriately-constructed instance + * @param result {@code null-ok;} new result register + * @param sources {@code non-null;} new sources registers + * @return {@code non-null;} an appropriately-constructed instance */ public abstract Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources); @@ -301,8 +301,8 @@ public abstract class Insn implements ToHuman { * Returns the string form of this instance, with the given bit added in * the standard location for an inline argument. * - * @param extra null-ok; the inline argument string - * @return non-null; the string form + * @param extra {@code null-ok;} the inline argument string + * @return {@code non-null;} the string form */ protected final String toStringWithInline(String extra) { StringBuffer sb = new StringBuffer(80); @@ -334,8 +334,8 @@ public abstract class Insn implements ToHuman { * Returns the human string form of this instance, with the given * bit added in the standard location for an inline argument. * - * @param extra null-ok; the inline argument string - * @return non-null; the human string form + * @param extra {@code null-ok;} the inline argument string + * @return {@code non-null;} the human string form */ protected final String toHumanWithInline(String extra) { StringBuffer sb = new StringBuffer(80); @@ -380,42 +380,42 @@ public abstract class Insn implements ToHuman { /** * Visits a {@link PlainInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitPlainInsn(PlainInsn insn); /** * Visits a {@link PlainCstInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitPlainCstInsn(PlainCstInsn insn); /** * Visits a {@link SwitchInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitSwitchInsn(SwitchInsn insn); /** * Visits a {@link ThrowingCstInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitThrowingCstInsn(ThrowingCstInsn insn); /** * Visits a {@link ThrowingInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitThrowingInsn(ThrowingInsn insn); /** * Visits a {@link FillArrayDataInsn}. * - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitFillArrayDataInsn(FillArrayDataInsn insn); } diff --git a/dx/src/com/android/dx/rop/code/InsnList.java b/dx/src/com/android/dx/rop/code/InsnList.java index 34f124cca..493f7fceb 100644 --- a/dx/src/com/android/dx/rop/code/InsnList.java +++ b/dx/src/com/android/dx/rop/code/InsnList.java @@ -24,7 +24,7 @@ import com.android.dx.util.FixedSizeList; public final class InsnList extends FixedSizeList { /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -35,10 +35,10 @@ public final class InsnList /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Insn get(int n) { return (Insn) get0(n); @@ -47,8 +47,8 @@ public final class InsnList /** * Sets the instruction at the given index. * - * @param n >= 0, < size(); which index - * @param insn non-null; the instruction to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param insn {@code non-null;} the instruction to set at {@code n} */ public void set(int n, Insn insn) { set0(n, insn); @@ -56,9 +56,9 @@ public final class InsnList /** * Gets the last instruction. This is just a convenient shorthand for - * <code>get(size() - 1)</code>. + * {@code get(size() - 1)}. * - * @return non-null; the last instruction + * @return {@code non-null;} the last instruction */ public Insn getLast() { return get(size() - 1); @@ -67,7 +67,7 @@ public final class InsnList /** * Visits each instruction in the list, in order. * - * @param visitor non-null; visitor to use + * @param visitor {@code non-null;} visitor to use */ public void forEach(Insn.Visitor visitor) { int sz = size(); @@ -78,9 +78,9 @@ public final class InsnList } /** - * Compares the contents of this <code>InsnList</code> with another. + * Compares the contents of this {@code InsnList} with another. * The blocks must have the same number of insns, and each Insn must - * also return true to <code>Insn.contentEquals()</code>. + * also return true to {@code Insn.contentEquals()}. * * @param b to compare * @return true in the case described above. @@ -108,7 +108,7 @@ public final class InsnList * original. * * @param delta the amount to offset register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public InsnList withRegisterOffset(int delta) { int sz = size(); diff --git a/dx/src/com/android/dx/rop/code/LocalItem.java b/dx/src/com/android/dx/rop/code/LocalItem.java index bac6ce2a4..7d6bebe09 100644 --- a/dx/src/com/android/dx/rop/code/LocalItem.java +++ b/dx/src/com/android/dx/rop/code/LocalItem.java @@ -22,10 +22,10 @@ import com.android.dx.rop.cst.CstUtf8; * A local variable item: either a name or a signature or both. */ public class LocalItem implements Comparable<LocalItem> { - /** null-ok; local variable name */ + /** {@code null-ok;} local variable name */ private final CstUtf8 name; - /** null-ok; local variable signature */ + /** {@code null-ok;} local variable signature */ private final CstUtf8 signature; /** @@ -33,9 +33,9 @@ public class LocalItem implements Comparable<LocalItem> { * * TODO: intern these * - * @param name null-ok; local variable name - * @param signature null-ok; local variable signature - * @return non-null; appropriate instance. + * @param name {@code null-ok;} local variable name + * @param signature {@code null-ok;} local variable signature + * @return {@code non-null;} appropriate instance. */ public static LocalItem make(CstUtf8 name, CstUtf8 signature) { if (name == null && signature == null) { @@ -48,8 +48,8 @@ public class LocalItem implements Comparable<LocalItem> { /** * Constructs instance. * - * @param name null-ok; local variable name - * @param signature null-ok; local variable signature + * @param name {@code null-ok;} local variable name + * @param signature {@code null-ok;} local variable signature */ private LocalItem(CstUtf8 name, CstUtf8 signature) { this.name = name; @@ -126,7 +126,7 @@ public class LocalItem implements Comparable<LocalItem> { /** * Gets name. * - * @return null-ok; name + * @return {@code null-ok;} name */ public CstUtf8 getName() { return name; @@ -135,7 +135,7 @@ public class LocalItem implements Comparable<LocalItem> { /** * Gets signature. * - * @return null-ok; signature + * @return {@code null-ok;} signature */ public CstUtf8 getSignature() { return signature; diff --git a/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java b/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java index 2d4cbced8..db142c28e 100644 --- a/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java +++ b/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java @@ -24,23 +24,23 @@ import com.android.dx.util.IntList; * a method. */ public final class LocalVariableExtractor { - /** non-null; method being extracted from */ + /** {@code non-null;} method being extracted from */ private final RopMethod method; - /** non-null; block list for the method */ + /** {@code non-null;} block list for the method */ private final BasicBlockList blocks; - /** non-null; result in-progress */ + /** {@code non-null;} result in-progress */ private final LocalVariableInfo resultInfo; - /** non-null; work set indicating blocks needing to be processed */ + /** {@code non-null;} work set indicating blocks needing to be processed */ private final int[] workSet; /** * Extracts out all the local variable information from the given method. * - * @param method non-null; the method to extract from - * @return non-null; the extracted information + * @param method {@code non-null;} the method to extract from + * @return {@code non-null;} the extracted information */ public static LocalVariableInfo extract(RopMethod method) { LocalVariableExtractor lve = new LocalVariableExtractor(method); @@ -50,7 +50,7 @@ public final class LocalVariableExtractor { /** * Constructs an instance. This method is private. Use {@link #extract}. * - * @param method non-null; the method to extract from + * @param method {@code non-null;} the method to extract from */ private LocalVariableExtractor(RopMethod method) { if (method == null) { @@ -69,7 +69,7 @@ public final class LocalVariableExtractor { /** * Does the extraction. * - * @return non-null; the extracted information + * @return {@code non-null;} the extracted information */ private LocalVariableInfo doit() { for (int label = method.getFirstLabel(); @@ -86,7 +86,7 @@ public final class LocalVariableExtractor { /** * Processes a single block. * - * @param label >= 0; label of the block to process + * @param label {@code >= 0;} label of the block to process */ private void processBlock(int label) { RegisterSpecSet primaryState = resultInfo.mutableCopyOfStarts(label); @@ -101,7 +101,6 @@ public final class LocalVariableExtractor { * state *before* executing it to be what is merged into * exception targets. */ - Insn lastInsn = insns.getLast(); boolean canThrowDuringLastInsn = block.hasExceptionHandlers() && (insns.getLast().getResult() != null); int freezeSecondaryStateAt = insnSz - 1; diff --git a/dx/src/com/android/dx/rop/code/LocalVariableInfo.java b/dx/src/com/android/dx/rop/code/LocalVariableInfo.java index 29c239b23..fa5e7cc8c 100644 --- a/dx/src/com/android/dx/rop/code/LocalVariableInfo.java +++ b/dx/src/com/android/dx/rop/code/LocalVariableInfo.java @@ -27,30 +27,30 @@ import java.util.HashMap; */ public final class LocalVariableInfo extends MutabilityControl { - /** >= 0; the register count for the method */ + /** {@code >= 0;} the register count for the method */ private final int regCount; /** - * non-null; {@link RegisterSpecSet} to use when indicating a block + * {@code non-null;} {@link RegisterSpecSet} to use when indicating a block * that has no locals; it is empty and immutable but has an appropriate * max size for the method */ private final RegisterSpecSet emptySet; /** - * non-null; array consisting of register sets representing the + * {@code non-null;} array consisting of register sets representing the * sets of variables already assigned upon entry to each block, * where array indices correspond to block labels */ private final RegisterSpecSet[] blockStarts; - /** non-null; map from instructions to the variable each assigns */ + /** {@code non-null;} map from instructions to the variable each assigns */ private final HashMap<Insn, RegisterSpec> insnAssignments; /** * Constructs an instance. * - * @param method non-null; the method being represented by this instance + * @param method {@code non-null;} the method being represented by this instance */ public LocalVariableInfo(RopMethod method) { if (method == null) { @@ -73,8 +73,8 @@ public final class LocalVariableInfo * Sets the register set associated with the start of the block with * the given label. * - * @param label >= 0; the block label - * @param specs non-null; the register set to associate with the block + * @param label {@code >= 0;} the block label + * @param specs {@code non-null;} the register set to associate with the block */ public void setStarts(int label, RegisterSpecSet specs) { throwIfImmutable(); @@ -98,12 +98,12 @@ public final class LocalVariableInfo * merge the two sets and call {@link #setStarts} on the result of the * merge. * - * @param label >= 0; the block label - * @param specs non-null; the register set to merge into the start set + * @param label {@code >= 0;} the block label + * @param specs {@code non-null;} the register set to merge into the start set * for the block - * @return <code>true</code> if the merge resulted in an actual change + * @return {@code true} if the merge resulted in an actual change * to the associated set (including storing one for the first time) or - * <code>false</code> if there was no change + * {@code false} if there was no change */ public boolean mergeStarts(int label, RegisterSpecSet specs) { RegisterSpecSet start = getStarts0(label); @@ -132,8 +132,8 @@ public final class LocalVariableInfo * with the given label. This returns an empty set with the appropriate * max size if no set was associated with the block in question. * - * @param label >= 0; the block label - * @return non-null; the associated register set + * @param label {@code >= 0;} the block label + * @return {@code non-null;} the associated register set */ public RegisterSpecSet getStarts(int label) { RegisterSpecSet result = getStarts0(label); @@ -144,10 +144,10 @@ public final class LocalVariableInfo /** * Gets the register set associated with the start of the given * block. This is just convenient shorthand for - * <code>getStarts(block.getLabel())</code>. + * {@code getStarts(block.getLabel())}. * - * @param block non-null; the block in question - * @return non-null; the associated register set + * @param block {@code non-null;} the block in question + * @return {@code non-null;} the associated register set */ public RegisterSpecSet getStarts(BasicBlock block) { return getStarts(block.getLabel()); @@ -159,8 +159,8 @@ public final class LocalVariableInfo * newly-allocated empty {@link RegisterSpecSet} of appropriate * max size if there is not yet any set associated with the block. * - * @param label >= 0; the block label - * @return non-null; the associated register set + * @param label {@code >= 0;} the block label + * @return {@code non-null;} the associated register set */ public RegisterSpecSet mutableCopyOfStarts(int label) { RegisterSpecSet result = getStarts0(label); @@ -180,8 +180,8 @@ public final class LocalVariableInfo * simple type and the one in the instruction can be an arbitrary * {@link TypeBearer} (such as a constant value). * - * @param insn non-null; the instruction in question - * @param spec non-null; the associated register spec + * @param insn {@code non-null;} the instruction in question + * @param spec {@code non-null;} the associated register spec */ public void addAssignment(Insn insn, RegisterSpec spec) { throwIfImmutable(); @@ -201,8 +201,8 @@ public final class LocalVariableInfo * Gets the named register being assigned by the given instruction, if * previously stored in this instance. * - * @param insn non-null; instruction in question - * @return null-ok; the named register being assigned, if any + * @param insn {@code non-null;} instruction in question + * @return {@code null-ok;} the named register being assigned, if any */ public RegisterSpec getAssignment(Insn insn) { return insnAssignments.get(insn); @@ -211,7 +211,7 @@ public final class LocalVariableInfo /** * Gets the number of assignments recorded by this instance. * - * @return >= 0; the number of assignments + * @return {@code >= 0;} the number of assignments */ public int getAssignmentCount() { return insnAssignments.size(); @@ -235,8 +235,8 @@ public final class LocalVariableInfo * Helper method, to get the starts for a label, throwing the * right exception for range problems. * - * @param label >= 0; the block label - * @return null-ok; associated register set or <code>null</code> if there + * @param label {@code >= 0;} the block label + * @return {@code null-ok;} associated register set or {@code null} if there * is none */ private RegisterSpecSet getStarts0(int label) { diff --git a/dx/src/com/android/dx/rop/code/PlainCstInsn.java b/dx/src/com/android/dx/rop/code/PlainCstInsn.java index 908b3cb34..7a3ac38b5 100644 --- a/dx/src/com/android/dx/rop/code/PlainCstInsn.java +++ b/dx/src/com/android/dx/rop/code/PlainCstInsn.java @@ -30,11 +30,11 @@ public final class PlainCstInsn /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param sources non-null; specs for all the sources - * @param cst non-null; the constant + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param sources {@code non-null;} specs for all the sources + * @param cst {@code non-null;} the constant */ public PlainCstInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources, diff --git a/dx/src/com/android/dx/rop/code/PlainInsn.java b/dx/src/com/android/dx/rop/code/PlainInsn.java index 4c5c9b701..d1db646d0 100644 --- a/dx/src/com/android/dx/rop/code/PlainInsn.java +++ b/dx/src/com/android/dx/rop/code/PlainInsn.java @@ -31,10 +31,10 @@ public final class PlainInsn /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param sources non-null; specs for all the sources + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param sources {@code non-null;} specs for all the sources */ public PlainInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources) { @@ -57,10 +57,10 @@ public final class PlainInsn /** * Constructs a single-source instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param source non-null; spec for the source + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param source {@code non-null;} spec for the source */ public PlainInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpec source) { diff --git a/dx/src/com/android/dx/rop/code/RegOps.java b/dx/src/com/android/dx/rop/code/RegOps.java index f201f68da..2084a69a0 100644 --- a/dx/src/com/android/dx/rop/code/RegOps.java +++ b/dx/src/com/android/dx/rop/code/RegOps.java @@ -21,283 +21,279 @@ import com.android.dx.util.Hex; /** * All the register-based opcodes, and related utilities. * - * <p><b>Note:</b> Opcode descriptions use a rough pseudocode. <code>r</code> - * is the result register, <code>x</code> is the first argument, - * <code>y</code> is the second argument, and <code>z</code> is the + * <p><b>Note:</b> Opcode descriptions use a rough pseudocode. {@code r} + * is the result register, {@code x} is the first argument, + * {@code y} is the second argument, and {@code z} is the * third argument. The expression which describes * the operation uses Java-ish syntax but is preceded by type indicators for * each of the values. */ public final class RegOps { - /** <code>nop()</code> */ + /** {@code nop()} */ public static final int NOP = 1; - /** <code>T: any type; r,x: T :: r = x;</code> */ + /** {@code T: any type; r,x: T :: r = x;} */ public static final int MOVE = 2; - /** <code>T: any type; r,param(x): T :: r = param(x)</code> */ + /** {@code T: any type; r,param(x): T :: r = param(x)} */ public static final int MOVE_PARAM = 3; /** - * <code>T: Throwable; r: T :: r = caught_exception</code>. + * {@code T: Throwable; r: T :: r = caught_exception}. * <b>Note:</b> This opcode should only ever be used in the * first instruction of a block, and such blocks must be * the start of an exception handler. */ public static final int MOVE_EXCEPTION = 4; - /** <code>T: any type; r, literal: T :: r = literal;</code> */ + /** {@code T: any type; r, literal: T :: r = literal;} */ public static final int CONST = 5; - /** <code>goto <i>label</i></code> */ + /** {@code goto label} */ public static final int GOTO = 6; /** - * <code>T: int or Object; x,y: T :: if (x == y) goto - * <i>label</i></code> + * {@code T: int or Object; x,y: T :: if (x == y) goto + * label} */ public static final int IF_EQ = 7; /** - * <code>T: int or Object; x,y: T :: if (x != y) goto - * <i>label</i></code> + * {@code T: int or Object; x,y: T :: if (x != y) goto + * label} */ public static final int IF_NE = 8; - /** <code>x,y: int :: if (x < y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x < y) goto label} */ public static final int IF_LT = 9; - /** <code>x,y: int :: if (x >= y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x >= y) goto label} */ public static final int IF_GE = 10; - /** <code>x,y: int :: if (x <= y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x <= y) goto label} */ public static final int IF_LE = 11; - /** <code>x,y: int :: if (x > y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x > y) goto label} */ public static final int IF_GT = 12; - /** <code>x: int :: goto <i>table[x]</i></code> */ + /** {@code x: int :: goto table[x]} */ public static final int SWITCH = 13; - /** <code>T: any numeric type; r,x,y: T :: r = x + y</code> */ + /** {@code T: any numeric type; r,x,y: T :: r = x + y} */ public static final int ADD = 14; - /** <code>T: any numeric type; r,x,y: T :: r = x - y</code> */ + /** {@code T: any numeric type; r,x,y: T :: r = x - y} */ public static final int SUB = 15; - /** <code>T: any numeric type; r,x,y: T :: r = x * y</code> */ + /** {@code T: any numeric type; r,x,y: T :: r = x * y} */ public static final int MUL = 16; - /** <code>T: any numeric type; r,x,y: T :: r = x / y</code> */ + /** {@code T: any numeric type; r,x,y: T :: r = x / y} */ public static final int DIV = 17; /** - * <code>T: any numeric type; r,x,y: T :: r = x % y</code> + * {@code T: any numeric type; r,x,y: T :: r = x % y} * (Java-style remainder) */ public static final int REM = 18; - /** <code>T: any numeric type; r,x: T :: r = -x</code> */ + /** {@code T: any numeric type; r,x: T :: r = -x} */ public static final int NEG = 19; - /** <code>T: any integral type; r,x,y: T :: r = x & y</code> */ + /** {@code T: any integral type; r,x,y: T :: r = x & y} */ public static final int AND = 20; - /** <code>T: any integral type; r,x,y: T :: r = x | y</code> */ + /** {@code T: any integral type; r,x,y: T :: r = x | y} */ public static final int OR = 21; - /** <code>T: any integral type; r,x,y: T :: r = x ^ y</code> */ + /** {@code T: any integral type; r,x,y: T :: r = x ^ y} */ public static final int XOR = 22; /** - * <code>T: any integral type; r,x: T; y: int :: r = x << - * y</code> + * {@code T: any integral type; r,x: T; y: int :: r = x << y} */ public static final int SHL = 23; /** - * <code>T: any integral type; r,x: T; y: int :: r = x >> - * y</code> (signed right-shift) + * {@code T: any integral type; r,x: T; y: int :: r = x >> y} + * (signed right-shift) */ public static final int SHR = 24; /** - * <code>T: any integral type; r,x: T; y: int :: r = x - * >>> y</code> (unsigned right-shift) + * {@code T: any integral type; r,x: T; y: int :: r = x >>> y} + * (unsigned right-shift) */ public static final int USHR = 25; - /** <code>T: any integral type; r,x: T :: r = ~x</code> */ + /** {@code T: any integral type; r,x: T :: r = ~x} */ public static final int NOT = 26; /** - * <code>T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 - * : (x > y) ? 1 : -1</code> (Java-style "cmpl" where a NaN is + * {@code T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 + * : (x > y) ? 1 : -1} (Java-style "cmpl" where a NaN is * considered "less than" all other values; also used for integral * comparisons) */ public static final int CMPL = 27; /** - * <code>T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 - * : (x < y) ? -1 : 1</code> (Java-style "cmpg" where a NaN is + * {@code T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 + * : (x < y) ? -1 : 1} (Java-style "cmpg" where a NaN is * considered "greater than" all other values) */ public static final int CMPG = 28; /** - * <code>T: any numeric type; U: any numeric type; r: T; x: U :: - * r = (T) x</code> (numeric type conversion between the four + * {@code T: any numeric type; U: any numeric type; r: T; x: U :: + * r = (T) x} (numeric type conversion between the four * "real" numeric types) */ public static final int CONV = 29; /** - * <code>r,x: int :: r = (x << 24) >> 24</code> (Java-style + * {@code r,x: int :: r = (x << 24) >> 24} (Java-style * convert int to byte) */ public static final int TO_BYTE = 30; /** - * <code>r,x: int :: r = x & 0xffff</code> (Java-style - * convert int to char) + * {@code r,x: int :: r = x & 0xffff} (Java-style convert int to char) */ public static final int TO_CHAR = 31; /** - * <code>r,x: int :: r = (x << 16) >> 16</code> (Java-style + * {@code r,x: int :: r = (x << 16) >> 16} (Java-style * convert int to short) */ public static final int TO_SHORT = 32; - /** <code>T: return type for the method; x: T; return x</code> */ + /** {@code T: return type for the method; x: T; return x} */ public static final int RETURN = 33; - /** <code>T: any type; r: int; x: T[]; :: r = x.length</code> */ + /** {@code T: any type; r: int; x: T[]; :: r = x.length} */ public static final int ARRAY_LENGTH = 34; - /** <code>x: Throwable :: throw(x)</code> */ + /** {@code x: Throwable :: throw(x)} */ public static final int THROW = 35; - /** <code>x: Object :: monitorenter(x)</code> */ + /** {@code x: Object :: monitorenter(x)} */ public static final int MONITOR_ENTER = 36; - /** <code>x: Object :: monitorexit(x)</code> */ + /** {@code x: Object :: monitorexit(x)} */ public static final int MONITOR_EXIT = 37; - /** <code>T: any type; r: T; x: T[]; y: int :: r = x[y]</code> */ + /** {@code T: any type; r: T; x: T[]; y: int :: r = x[y]} */ public static final int AGET = 38; - /** <code>T: any type; x: T; y: T[]; z: int :: x[y] = z</code> */ + /** {@code T: any type; x: T; y: T[]; z: int :: x[y] = z} */ public static final int APUT = 39; /** - * <code>T: any non-array object type :: r = - * alloc(T)</code> (allocate heap space for an object) + * {@code T: any non-array object type :: r = + * alloc(T)} (allocate heap space for an object) */ public static final int NEW_INSTANCE = 40; - /** <code>T: any array type; r: T; x: int :: r = new T[x]</code> */ + /** {@code T: any array type; r: T; x: int :: r = new T[x]} */ public static final int NEW_ARRAY = 41; /** - * <code>T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] - * {v0, ..., vx}</code> + * {@code T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] + * {v0, ..., vx}} */ public static final int FILLED_NEW_ARRAY = 42; /** - * <code>T: any object type; x: Object :: (T) x</code> (can - * throw <code>ClassCastException</code>) + * {@code T: any object type; x: Object :: (T) x} (can + * throw {@code ClassCastException}) */ public static final int CHECK_CAST = 43; /** - * <code>T: any object type; x: Object :: x instanceof - * T</code> + * {@code T: any object type; x: Object :: x instanceof T} */ public static final int INSTANCE_OF = 44; /** - * <code>T: any type; r: T; x: Object; f: instance field spec of - * type T :: r = x.f</code> + * {@code T: any type; r: T; x: Object; f: instance field spec of + * type T :: r = x.f} */ public static final int GET_FIELD = 45; /** - * <code>T: any type; r: T; f: static field spec of type T :: r = - * f</code> + * {@code T: any type; r: T; f: static field spec of type T :: r = + * f} */ public static final int GET_STATIC = 46; /** - * <code>T: any type; x: T; y: Object; f: instance field spec of type - * T :: y.f = x</code> + * {@code T: any type; x: T; y: Object; f: instance field spec of type + * T :: y.f = x} */ public static final int PUT_FIELD = 47; /** - * <code>T: any type; f: static field spec of type T; x: T :: f = - * x</code> + * {@code T: any type; f: static field spec of type T; x: T :: f = x} */ public static final int PUT_STATIC = 48; /** - * <code>Tr, T0, T1...: any types; r: Tr; m: static method spec; - * y0: T0; y1: T1 ... :: r = m(y0, y1, ...)</code> (call static + * {@code Tr, T0, T1...: any types; r: Tr; m: static method spec; + * y0: T0; y1: T1 ... :: r = m(y0, y1, ...)} (call static * method) */ public static final int INVOKE_STATIC = 49; /** - * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method - * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call normal + * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method + * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call normal * virtual method) */ public static final int INVOKE_VIRTUAL = 50; /** - * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method - * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call + * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method + * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call * superclass virtual method) */ public static final int INVOKE_SUPER = 51; /** - * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method - * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call + * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method + * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call * direct/special method) */ public static final int INVOKE_DIRECT = 52; /** - * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: interface + * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: interface * (instance) method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, - * ...)</code> (call interface method) + * ...)} (call interface method) */ public static final int INVOKE_INTERFACE = 53; /** - * <code> T0: any type; </code> (mark beginning or end of local variable - * name + * {@code T0: any type; name: local variable name :: mark(name,T0)} + * (mark beginning or end of local variable name) */ public static final int MARK_LOCAL = 54; /** - * <code>T: Any type; r: T :: r = return_type</code>. + * {@code T: Any type; r: T :: r = return_type}. * <b>Note:</b> This opcode should only ever be used in the * first instruction of a block following an invoke-*. */ public static final int MOVE_RESULT = 55; /** - * <code>T: Any type; r: T :: r = return_type</code>. + * {@code T: Any type; r: T :: r = return_type}. * <b>Note:</b> This opcode should only ever be used in the * first instruction of a block following a non-invoke throwing insn */ public static final int MOVE_RESULT_PSEUDO = 56; - /** <code>T: Any primitive type; v0..vx: T :: {v0, ..., vx}</code> */ + /** {@code T: Any primitive type; v0..vx: T :: {v0, ..., vx}} */ public static final int FILL_ARRAY_DATA = 57; /** @@ -310,8 +306,8 @@ public final class RegOps { /** * Gets the name of the given opcode. * - * @param opcode >= 0, <= 255; the opcode - * @return non-null; its name + * @param opcode {@code >= 0, <= 255;} the opcode + * @return {@code non-null;} its name */ public static String opName(int opcode) { switch (opcode) { diff --git a/dx/src/com/android/dx/rop/code/RegisterSpec.java b/dx/src/com/android/dx/rop/code/RegisterSpec.java index 73af91fbc..1f1476780 100644 --- a/dx/src/com/android/dx/rop/code/RegisterSpec.java +++ b/dx/src/com/android/dx/rop/code/RegisterSpec.java @@ -30,33 +30,33 @@ import java.util.HashMap; */ public final class RegisterSpec implements TypeBearer, ToHuman, Comparable<RegisterSpec> { - /** non-null; string to prefix register numbers with */ + /** {@code non-null;} string to prefix register numbers with */ public static final String PREFIX = "v"; - /** non-null; intern table for instances */ + /** {@code non-null;} intern table for instances */ private static final HashMap<Object, RegisterSpec> theInterns = new HashMap<Object, RegisterSpec>(1000); - /** non-null; common comparison instance used while interning */ + /** {@code non-null;} common comparison instance used while interning */ private static final ForComparison theInterningItem = new ForComparison(); - /** >= 0; register number */ + /** {@code >= 0;} register number */ private final int reg; - /** non-null; type loaded or stored */ + /** {@code non-null;} type loaded or stored */ private final TypeBearer type; - /** null-ok; local variable info associated with this register, if any */ + /** {@code null-ok;} local variable info associated with this register, if any */ private final LocalItem local; /** * Intern the given triple as an instance of this class. * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual value) which * is loaded from or stored to the indicated register - * @param local null-ok; the associated local variable, if any - * @return non-null; an appropriately-constructed instance + * @param local {@code null-ok;} the associated local variable, if any + * @return {@code non-null;} an appropriately-constructed instance */ private static RegisterSpec intern(int reg, TypeBearer type, LocalItem local) { @@ -77,10 +77,10 @@ public final class RegisterSpec * no variable info. This method is allowed to return shared * instances (but doesn't necessarily do so). * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual value) which * is loaded from or stored to the indicated register - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpec make(int reg, TypeBearer type) { return intern(reg, type, null); @@ -91,11 +91,11 @@ public final class RegisterSpec * variable info. This method is allowed to return shared * instances (but doesn't necessarily do so). * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual value) which * is loaded from or stored to the indicated register - * @param local non-null; the associated local variable - * @return non-null; an appropriately-constructed instance + * @param local {@code non-null;} the associated local variable + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpec make(int reg, TypeBearer type, LocalItem local) { @@ -111,12 +111,12 @@ public final class RegisterSpec * variable info. This method is allowed to return shared * instances (but doesn't necessarily do so). * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual value) which * is loaded from or stored to the indicated register - * @param local null-ok; the associated variable info or null for + * @param local {@code null-ok;} the associated variable info or null for * none - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpec makeLocalOptional( int reg, TypeBearer type, LocalItem local) { @@ -127,8 +127,8 @@ public final class RegisterSpec /** * Gets the string form for the given register number. * - * @param reg >= 0; the register number - * @return non-null; the string form + * @param reg {@code >= 0;} the register number + * @return {@code non-null;} the string form */ public static String regString(int reg) { return PREFIX + reg; @@ -138,10 +138,10 @@ public final class RegisterSpec * Constructs an instance. This constructor is private. Use * {@link #make}. * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual value) which * is loaded from or stored to the indicated register - * @param local null-ok; the associated local variable, if any + * @param local {@code null-ok;} the associated local variable, if any */ private RegisterSpec(int reg, TypeBearer type, LocalItem local) { if (reg < 0) { @@ -178,7 +178,7 @@ public final class RegisterSpec * to ignore whatever arbitrary extra stuff might be carried around * by an outer {@link TypeBearer}. * - * @param other null-ok; spec to compare to + * @param other {@code null-ok;} spec to compare to * @return {@code true} iff {@code this} and {@code other} are equal * in the stated way */ @@ -195,7 +195,7 @@ public final class RegisterSpec * This is useful to determine if two instances refer to the "same" * local variable. * - * @param other null-ok; spec to compare to + * @param other {@code null-ok;} spec to compare to * @return {@code true} iff {@code this} and {@code other} are equal * in the stated way */ @@ -230,8 +230,8 @@ public final class RegisterSpec * Compares by (in priority order) register number, unwrapped type * (that is types not {@link TypeBearer}s, and local info. * - * @param other non-null; spec to compare to - * @return {@code -1..1}; standard result of comparison + * @param other {@code non-null;} spec to compare to + * @return {@code -1..1;} standard result of comparison */ public int compareTo(RegisterSpec other) { if (this.reg < other.reg) { @@ -316,7 +316,7 @@ public final class RegisterSpec /** * Gets the register number. * - * @return >= 0; the register number + * @return {@code >= 0;} the register number */ public int getReg() { return reg; @@ -326,7 +326,7 @@ public final class RegisterSpec * Gets the type (or actual value) which is loaded from or stored * to the register associated with this instance. * - * @return non-null; the type + * @return {@code non-null;} the type */ public TypeBearer getTypeBearer() { return type; @@ -335,7 +335,7 @@ public final class RegisterSpec /** * Gets the variable info associated with this instance, if any. * - * @return null-ok; the variable info, or <code>null</code> if this + * @return {@code null-ok;} the variable info, or {@code null} if this * instance has none */ public LocalItem getLocalItem() { @@ -349,7 +349,7 @@ public final class RegisterSpec * be used to determine the minimum required register count * implied by this instance. * - * @return >= 0; the required registers size + * @return {@code >= 0;} the required registers size */ public int getNextReg() { return reg + getCategory(); @@ -357,11 +357,11 @@ public final class RegisterSpec /** * Gets the category of this instance's type. This is just a convenient - * shorthand for <code>getType().getCategory()</code>. + * shorthand for {@code getType().getCategory()}. * * @see #isCategory1 * @see #isCategory2 - * @return 1..2; the category of this instance's type + * @return {@code 1..2;} the category of this instance's type */ public int getCategory() { return type.getType().getCategory(); @@ -369,7 +369,7 @@ public final class RegisterSpec /** * Gets whether this instance's type is category 1. This is just a - * convenient shorthand for <code>getType().isCategory1()</code>. + * convenient shorthand for {@code getType().isCategory1()}. * * @see #getCategory * @see #isCategory2 @@ -381,7 +381,7 @@ public final class RegisterSpec /** * Gets whether this instance's type is category 2. This is just a - * convenient shorthand for <code>getType().isCategory2()</code>. + * convenient shorthand for {@code getType().isCategory2()}. * * @see #getCategory * @see #isCategory1 @@ -394,7 +394,7 @@ public final class RegisterSpec /** * Gets the string form for just the register number of this instance. * - * @return non-null; the register string form + * @return {@code non-null;} the register string form */ public String regString() { return regString(reg); @@ -405,28 +405,28 @@ public final class RegisterSpec * and the given one, if any. The intersection is defined as follows: * * <ul> - * <li>If <code>other</code> is <code>null</code>, then the result - * is <code>null</code>. + * <li>If {@code other} is {@code null}, then the result + * is {@code null}. * <li>If the register numbers don't match, then the intersection - * is <code>null</code>. Otherwise, the register number of the + * is {@code null}. Otherwise, the register number of the * intersection is the same as the one in the two instances.</li> - * <li>If the types returned by <code>getType()</code> are not - * <code>equals()</code>, then the intersection is null.</li> - * <li>If the type bearers returned by <code>getTypeBearer()</code> - * are <code>equals()</code>, then the intersection's type bearer + * <li>If the types returned by {@code getType()} are not + * {@code equals()}, then the intersection is null.</li> + * <li>If the type bearers returned by {@code getTypeBearer()} + * are {@code equals()}, then the intersection's type bearer * is the one from this instance. Otherwise, the intersection's - * type bearer is the <code>getType()</code> of this instance.</li> - * <li>If the locals are <code>equals()</code>, then the local info + * type bearer is the {@code getType()} of this instance.</li> + * <li>If the locals are {@code equals()}, then the local info * of the intersection is the local info of this instance. Otherwise, - * the local info of the intersection is <code>null</code>.</li> + * the local info of the intersection is {@code null}.</li> * </ul> * - * @param other null-ok; instance to intersect with (or <code>null</code>) + * @param other {@code null-ok;} instance to intersect with (or {@code null}) * @param localPrimary whether local variables are primary to the - * intersection; if <code>true</code>, then the only non-null + * intersection; if {@code true}, then the only non-null * results occur when registers being intersected have equal local - * infos (or both have <code>null</code> local infos) - * @return null-ok; the intersection + * infos (or both have {@code null} local infos) + * @return {@code null-ok;} the intersection */ public RegisterSpec intersect(RegisterSpec other, boolean localPrimary) { if (this == other) { @@ -471,8 +471,8 @@ public final class RegisterSpec * Returns an instance that is identical to this one, except that the * register number is replaced by the given one. * - * @param newReg >= 0; the new register number - * @return non-null; an appropriately-constructed instance + * @param newReg {@code >= 0;} the new register number + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec withReg(int newReg) { if (reg == newReg) { @@ -486,8 +486,8 @@ public final class RegisterSpec * Returns an instance that is identical to this one, except that * the type is replaced by the given one. * - * @param newType non-null; the new type - * @return non-null; an appropriately-constructed instance + * @param newType {@code non-null;} the new type + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec withType(TypeBearer newType) { return makeLocalOptional(reg, newType, local); @@ -498,7 +498,7 @@ public final class RegisterSpec * register number is offset by the given amount. * * @param delta the amount to offset the register number by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec withOffset(int delta) { if (delta == 0) { @@ -514,7 +514,7 @@ public final class RegisterSpec * (thereby stripping off non-type information) with any * initialization information stripped away as well. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec withSimpleType() { TypeBearer orig = type; @@ -541,7 +541,7 @@ public final class RegisterSpec * Returns an instance that is identical to this one except that the * local variable is as specified in the parameter. * - * @param local null-ok; the local item or null for none + * @param local {@code null-ok;} the local item or null for none * @return an appropriate instance */ public RegisterSpec withLocalItem(LocalItem local) { @@ -559,7 +559,7 @@ public final class RegisterSpec * Helper for {@link #toString} and {@link #toHuman}. * * @param human whether to be human-oriented - * @return non-null; the string form + * @return {@code non-null;} the string form */ private String toString0(boolean human) { StringBuffer sb = new StringBuffer(40); @@ -588,27 +588,31 @@ public final class RegisterSpec /** * Holder of register spec data for the purposes of comparison (so that - * <code>RegisterSpec</code> itself can still keep <code>final</code> + * {@code RegisterSpec} itself can still keep {@code final} * instance variables. */ private static class ForComparison { - /** >= 0; register number */ + /** {@code >= 0;} register number */ private int reg; - /** non-null; type loaded or stored */ + /** {@code non-null;} type loaded or stored */ private TypeBearer type; - /** null-ok; local variable associated with this register, if any */ + /** + * {@code null-ok;} local variable associated with this + * register, if any + */ private LocalItem local; /** * Set all the instance variables. * - * @param reg >= 0; the register number - * @param type non-null; the type (or possibly actual value) which - * is loaded from or stored to the indicated register - * @param local null-ok; the associated local variable, if any - * @return non-null; an appropriately-constructed instance + * @param reg {@code >= 0;} the register number + * @param type {@code non-null;} the type (or possibly actual + * value) which is loaded from or stored to the indicated + * register + * @param local {@code null-ok;} the associated local variable, if any + * @return {@code non-null;} an appropriately-constructed instance */ public void set(int reg, TypeBearer type, LocalItem local) { this.reg = reg; @@ -617,10 +621,10 @@ public final class RegisterSpec } /** - * Construct a <code>RegisterSpec</code> of this instance's + * Construct a {@code RegisterSpec} of this instance's * contents. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec toRegisterSpec() { return new RegisterSpec(reg, type, local); diff --git a/dx/src/com/android/dx/rop/code/RegisterSpecList.java b/dx/src/com/android/dx/rop/code/RegisterSpecList.java index 28657a197..5a02a8d31 100644 --- a/dx/src/com/android/dx/rop/code/RegisterSpecList.java +++ b/dx/src/com/android/dx/rop/code/RegisterSpecList.java @@ -25,14 +25,14 @@ import com.android.dx.util.FixedSizeList; */ public final class RegisterSpecList extends FixedSizeList implements TypeList { - /** non-null; no-element instance */ + /** {@code non-null;} no-element instance */ public static final RegisterSpecList EMPTY = new RegisterSpecList(0); /** * Makes a single-element instance. * - * @param spec non-null; the element - * @return non-null; an appropriately-constructed instance + * @param spec {@code non-null;} the element + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpecList make(RegisterSpec spec) { RegisterSpecList result = new RegisterSpecList(1); @@ -43,9 +43,9 @@ public final class RegisterSpecList /** * Makes a two-element instance. * - * @param spec0 non-null; the first element - * @param spec1 non-null; the second element - * @return non-null; an appropriately-constructed instance + * @param spec0 {@code non-null;} the first element + * @param spec1 {@code non-null;} the second element + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpecList make(RegisterSpec spec0, RegisterSpec spec1) { @@ -58,10 +58,10 @@ public final class RegisterSpecList /** * Makes a three-element instance. * - * @param spec0 non-null; the first element - * @param spec1 non-null; the second element - * @param spec2 non-null; the third element - * @return non-null; an appropriately-constructed instance + * @param spec0 {@code non-null;} the first element + * @param spec1 {@code non-null;} the second element + * @param spec2 {@code non-null;} the third element + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpecList make(RegisterSpec spec0, RegisterSpec spec1, RegisterSpec spec2) { @@ -75,11 +75,11 @@ public final class RegisterSpecList /** * Makes a four-element instance. * - * @param spec0 non-null; the first element - * @param spec1 non-null; the second element - * @param spec2 non-null; the third element - * @param spec3 non-null; the fourth element - * @return non-null; an appropriately-constructed instance + * @param spec0 {@code non-null;} the first element + * @param spec1 {@code non-null;} the second element + * @param spec2 {@code non-null;} the third element + * @param spec3 {@code non-null;} the fourth element + * @return {@code non-null;} an appropriately-constructed instance */ public static RegisterSpecList make(RegisterSpec spec0, RegisterSpec spec1, RegisterSpec spec2, @@ -93,7 +93,7 @@ public final class RegisterSpecList } /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -126,10 +126,10 @@ public final class RegisterSpecList /** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this - * will throw <code>NullPointerException</code>. + * will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which element - * @return non-null; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code non-null;} the indicated element */ public RegisterSpec get(int n) { return (RegisterSpec) get0(n); @@ -180,8 +180,8 @@ public final class RegisterSpecList /** * Sets the element at the given index. * - * @param n >= 0, < size(); which element - * @param spec non-null; the value to store + * @param n {@code >= 0, < size();} which element + * @param spec {@code non-null;} the value to store */ public void set(int n, RegisterSpec spec) { set0(n, spec); @@ -193,7 +193,7 @@ public final class RegisterSpecList * to plus the widest width (largest category) of the type used in * that register. * - * @return >= 0; the required registers size + * @return {@code >= 0;} the required registers size */ public int getRegistersSize() { int sz = size(); @@ -217,8 +217,8 @@ public final class RegisterSpecList * except that it has an additional element prepended to the original. * Mutability of the result is inherited from the original. * - * @param spec non-null; the new first spec (to prepend) - * @return non-null; an appropriately-constructed instance + * @param spec {@code non-null;} the new first spec (to prepend) + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withFirst(RegisterSpec spec) { int sz = size(); @@ -241,7 +241,7 @@ public final class RegisterSpecList * except that its first element is removed. Mutability of the * result is inherited from the original. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withoutFirst() { int newSize = size() - 1; @@ -268,7 +268,7 @@ public final class RegisterSpecList * except that its last element is removed. Mutability of the * result is inherited from the original. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withoutLast() { int newSize = size() - 1; @@ -296,7 +296,7 @@ public final class RegisterSpecList * of the result is inherited from the original. * * @param delta the amount to offset the register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withOffset(int delta) { int sz = size(); @@ -329,7 +329,7 @@ public final class RegisterSpecList * * @param base the base register number * @param duplicateFirst whether to duplicate the first number - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withSequentialRegisters(int base, boolean duplicateFirst) { diff --git a/dx/src/com/android/dx/rop/code/RegisterSpecSet.java b/dx/src/com/android/dx/rop/code/RegisterSpecSet.java index adc77c35e..68009d997 100644 --- a/dx/src/com/android/dx/rop/code/RegisterSpecSet.java +++ b/dx/src/com/android/dx/rop/code/RegisterSpecSet.java @@ -25,23 +25,23 @@ import com.android.dx.rop.cst.CstUtf8; */ public final class RegisterSpecSet extends MutabilityControl { - /** non-null; no-element instance */ + /** {@code non-null;} no-element instance */ public static final RegisterSpecSet EMPTY = new RegisterSpecSet(0); /** - * non-null; array of register specs, where each element is - * <code>null</code> or is an instance whose <code>reg</code> + * {@code non-null;} array of register specs, where each element is + * {@code null} or is an instance whose {@code reg} * matches the array index */ private final RegisterSpec[] specs; - /** >= -1; size of the set or <code>-1</code> if not yet calculated */ + /** {@code >= -1;} size of the set or {@code -1} if not yet calculated */ private int size; /** * Constructs an instance. The instance is initially empty. * - * @param maxSize >= 0; the maximum register number (exclusive) that + * @param maxSize {@code >= 0;} the maximum register number (exclusive) that * may be represented in this instance */ public RegisterSpecSet(int maxSize) { @@ -127,7 +127,7 @@ public final class RegisterSpecSet * is also the maximum-plus-one of register numbers that may be * represented. * - * @return >= 0; the maximum size + * @return {@code >= 0;} the maximum size */ public int getMaxSize() { return specs.length; @@ -136,7 +136,7 @@ public final class RegisterSpecSet /** * Gets the current size of this instance. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int size() { int result = size; @@ -160,9 +160,9 @@ public final class RegisterSpecSet /** * Gets the element with the given register number, if any. * - * @param reg >= 0; the desired register number - * @return null-ok; the element with the given register number or - * <code>null</code> if there is none + * @param reg {@code >= 0;} the desired register number + * @return {@code null-ok;} the element with the given register number or + * {@code null} if there is none */ public RegisterSpec get(int reg) { try { @@ -176,11 +176,11 @@ public final class RegisterSpecSet /** * Gets the element with the same register number as the given * spec, if any. This is just a convenient shorthand for - * <code>get(spec.getReg())</code>. + * {@code get(spec.getReg())}. * - * @param spec non-null; spec with the desired register number - * @return null-ok; the element with the matching register number or - * <code>null</code> if there is none + * @param spec {@code non-null;} spec with the desired register number + * @return {@code null-ok;} the element with the matching register number or + * {@code null} if there is none */ public RegisterSpec get(RegisterSpec spec) { return get(spec.getReg()); @@ -192,8 +192,8 @@ public final class RegisterSpecSet * none. This ignores the register number of the given spec but * matches on everything else. * - * @param spec non-null; local to look for - * @return null-ok; first register found that matches, if any + * @param spec {@code non-null;} local to look for + * @return {@code null-ok;} first register found that matches, if any */ public RegisterSpec findMatchingLocal(RegisterSpec spec) { int length = specs.length; @@ -217,8 +217,8 @@ public final class RegisterSpecSet * Returns the spec in this set that's currently associated with a given * local (name and signature), or {@code null} if there is none. * - * @param local non-null; local item to search for - * @return null-ok; first register found with matching name and signature + * @param local {@code non-null;} local item to search for + * @return {@code null-ok;} first register found with matching name and signature */ public RegisterSpec localItemToSpec(LocalItem local) { int length = specs.length; @@ -238,7 +238,7 @@ public final class RegisterSpecSet * Removes a spec from the set. Only the register number * of the parameter is significant. * - * @param toRemove non-null; register to remove. + * @param toRemove {@code non-null;} register to remove. */ public void remove(RegisterSpec toRemove) { try { @@ -258,7 +258,7 @@ public final class RegisterSpecSet * a category-2 register, then the immediately subsequent element * is nullified. * - * @param spec non-null; the register spec to put in the instance + * @param spec {@code non-null;} the register spec to put in the instance */ public void put(RegisterSpec spec) { throwIfImmutable(); @@ -293,7 +293,7 @@ public final class RegisterSpecSet /** * Put the entire contents of the given set into this one. * - * @param set non-null; the set to put into this instance + * @param set {@code non-null;} the set to put into this instance */ public void putAll(RegisterSpecSet set) { int max = set.getMaxSize(); @@ -312,11 +312,11 @@ public final class RegisterSpecSet * {@link RegisterSpec#intersect} of corresponding elements from * this instance and the given one where both are non-null. * - * @param other non-null; set to intersect with + * @param other {@code non-null;} set to intersect with * @param localPrimary whether local variables are primary to - * the intersection; if <code>true</code>, then the only non-null + * the intersection; if {@code true}, then the only non-null * result elements occur when registers being intersected have - * equal names (or both have <code>null</code> names) + * equal names (or both have {@code null} names) */ public void intersect(RegisterSpecSet other, boolean localPrimary) { throwIfImmutable(); @@ -352,7 +352,7 @@ public final class RegisterSpecSet * of the result is inherited from the original. * * @param delta the amount to offset the register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecSet withOffset(int delta) { int len = specs.length; @@ -377,7 +377,7 @@ public final class RegisterSpecSet /** * Makes and return a mutable copy of this instance. * - * @return non-null; the mutable copy + * @return {@code non-null;} the mutable copy */ public RegisterSpecSet mutableCopy() { int len = specs.length; diff --git a/dx/src/com/android/dx/rop/code/Rop.java b/dx/src/com/android/dx/rop/code/Rop.java index f918e126c..fbd9a16f6 100644 --- a/dx/src/com/android/dx/rop/code/Rop.java +++ b/dx/src/com/android/dx/rop/code/Rop.java @@ -25,7 +25,7 @@ import com.android.dx.util.Hex; * Class that describes all the immutable parts of register-based operations. */ public final class Rop { - /** minimum <code>BRANCH_*</code> value */ + /** minimum {@code BRANCH_*} value */ public static final int BRANCH_MIN = 1; /** indicates a non-branching op */ @@ -46,26 +46,26 @@ public final class Rop { /** indicates a throw-style branch (both always-throws and may-throw) */ public static final int BRANCH_THROW = 6; - /** maximum <code>BRANCH_*</code> value */ + /** maximum {@code BRANCH_*} value */ public static final int BRANCH_MAX = 6; /** the opcode; one of the constants in {@link RegOps} */ private final int opcode; /** - * non-null; result type of this operation; {@link Type#VOID} for + * {@code non-null;} result type of this operation; {@link Type#VOID} for * no-result operations */ private final Type result; - /** non-null; types of all the sources of this operation */ + /** {@code non-null;} types of all the sources of this operation */ private final TypeList sources; - /** non-null; list of possible types thrown by this operation */ + /** {@code non-null;} list of possible types thrown by this operation */ private final TypeList exceptions; /** - * the branchingness of this op; one of the <code>BRANCH_*</code> + * the branchingness of this op; one of the {@code BRANCH_*} * constants in this class */ private final int branchingness; @@ -73,7 +73,7 @@ public final class Rop { /** whether this is a function/method call op or similar */ private final boolean isCallLike; - /** null-ok; nickname, if specified (used for debugging) */ + /** {@code null-ok;} nickname, if specified (used for debugging) */ private final String nickname; /** @@ -81,15 +81,15 @@ public final class Rop { * public constructors. * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param result non-null; result type of this operation; {@link + * @param result {@code non-null;} result type of this operation; {@link * Type#VOID} for no-result operations - * @param sources non-null; types of all the sources of this operation - * @param exceptions non-null; list of possible types thrown by this + * @param sources {@code non-null;} types of all the sources of this operation + * @param exceptions {@code non-null;} list of possible types thrown by this * operation * @param branchingness the branchingness of this op; one of the - * <code>BRANCH_*</code> constants + * {@code BRANCH_*} constants * @param isCallLike whether the op is a function/method call or similar - * @param nickname null-ok; optional nickname (used for debugging) + * @param nickname {@code null-ok;} optional nickname (used for debugging) */ public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, boolean isCallLike, @@ -129,14 +129,14 @@ public final class Rop { * call-like op (see {@link #isCallLike}). * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param result non-null; result type of this operation; {@link + * @param result {@code non-null;} result type of this operation; {@link * Type#VOID} for no-result operations - * @param sources non-null; types of all the sources of this operation - * @param exceptions non-null; list of possible types thrown by this + * @param sources {@code non-null;} types of all the sources of this operation + * @param exceptions {@code non-null;} list of possible types thrown by this * operation * @param branchingness the branchingness of this op; one of the - * <code>BRANCH_*</code> constants - * @param nickname null-ok; optional nickname (used for debugging) + * {@code BRANCH_*} constants + * @param nickname {@code null-ok;} optional nickname (used for debugging) */ public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, String nickname) { @@ -149,12 +149,12 @@ public final class Rop { * call-like op (see {@link #isCallLike}). * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param result non-null; result type of this operation; {@link + * @param result {@code non-null;} result type of this operation; {@link * Type#VOID} for no-result operations - * @param sources non-null; types of all the sources of this operation + * @param sources {@code non-null;} types of all the sources of this operation * @param branchingness the branchingness of this op; one of the - * <code>BRANCH_*</code> constants - * @param nickname null-ok; optional nickname (used for debugging) + * {@code BRANCH_*} constants + * @param nickname {@code null-ok;} optional nickname (used for debugging) */ public Rop(int opcode, Type result, TypeList sources, int branchingness, String nickname) { @@ -164,14 +164,14 @@ public final class Rop { /** * Constructs a non-branching no-exception instance. The - * <code>branchingness</code> is always <code>BRANCH_NONE</code>, + * {@code branchingness} is always {@code BRANCH_NONE}, * and it is never a call-like op (see {@link #isCallLike}). * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param result non-null; result type of this operation; {@link + * @param result {@code non-null;} result type of this operation; {@link * Type#VOID} for no-result operations - * @param sources non-null; types of all the sources of this operation - * @param nickname null-ok; optional nickname (used for debugging) + * @param sources {@code non-null;} types of all the sources of this operation + * @param nickname {@code null-ok;} optional nickname (used for debugging) */ public Rop(int opcode, Type result, TypeList sources, String nickname) { this(opcode, result, sources, StdTypeList.EMPTY, Rop.BRANCH_NONE, @@ -180,16 +180,16 @@ public final class Rop { /** * Constructs a non-empty exceptions instance. Its - * <code>branchingness</code> is always <code>BRANCH_THROW</code>, + * {@code branchingness} is always {@code BRANCH_THROW}, * but it is never a call-like op (see {@link #isCallLike}). * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param result non-null; result type of this operation; {@link + * @param result {@code non-null;} result type of this operation; {@link * Type#VOID} for no-result operations - * @param sources non-null; types of all the sources of this operation - * @param exceptions non-null; list of possible types thrown by this + * @param sources {@code non-null;} types of all the sources of this operation + * @param exceptions {@code non-null;} list of possible types thrown by this * operation - * @param nickname null-ok; optional nickname (used for debugging) + * @param nickname {@code null-ok;} optional nickname (used for debugging) */ public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, String nickname) { @@ -200,11 +200,11 @@ public final class Rop { /** * Constructs a non-nicknamed instance with non-empty exceptions, which * is always a call-like op (see {@link #isCallLike}). Its - * <code>branchingness</code> is always <code>BRANCH_THROW</code>. + * {@code branchingness} is always {@code BRANCH_THROW}. * * @param opcode the opcode; one of the constants in {@link RegOps} - * @param sources non-null; types of all the sources of this operation - * @param exceptions non-null; list of possible types thrown by this + * @param sources {@code non-null;} types of all the sources of this operation + * @param exceptions {@code non-null;} list of possible types thrown by this * operation */ public Rop(int opcode, TypeList sources, TypeList exceptions) { @@ -317,7 +317,7 @@ public final class Rop { * Gets the result type. A return value of {@link Type#VOID} * means this operation returns nothing. * - * @return null-ok; the result spec + * @return {@code null-ok;} the result spec */ public Type getResult() { return result; @@ -326,7 +326,7 @@ public final class Rop { /** * Gets the source types. * - * @return non-null; the source types + * @return {@code non-null;} the source types */ public TypeList getSources() { return sources; @@ -335,7 +335,7 @@ public final class Rop { /** * Gets the list of exception types that might be thrown. * - * @return non-null; the list of exception types + * @return {@code non-null;} the list of exception types */ public TypeList getExceptions() { return exceptions; @@ -353,7 +353,7 @@ public final class Rop { /** * Gets whether this opcode is a function/method call or similar. * - * @return <code>true</code> iff this opcode is call-like + * @return {@code true} iff this opcode is call-like */ public boolean isCallLike() { return isCallLike; @@ -384,7 +384,7 @@ public final class Rop { * Gets the nickname. If this instance has no nickname, this returns * the result of calling {@link #toString}. * - * @return non-null; the nickname + * @return {@code non-null;} the nickname */ public String getNickname() { if (nickname != null) { @@ -397,9 +397,9 @@ public final class Rop { /** * Gets whether this operation can possibly throw an exception. This * is just a convenient wrapper for - * <code>getExceptions().size() != 0</code>. + * {@code getExceptions().size() != 0}. * - * @return <code>true</code> iff this operation can possibly throw + * @return {@code true} iff this operation can possibly throw */ public final boolean canThrow() { return (exceptions.size() != 0); diff --git a/dx/src/com/android/dx/rop/code/RopMethod.java b/dx/src/com/android/dx/rop/code/RopMethod.java index 0c0d8f1a7..39575322a 100644 --- a/dx/src/com/android/dx/rop/code/RopMethod.java +++ b/dx/src/com/android/dx/rop/code/RopMethod.java @@ -24,20 +24,20 @@ import com.android.dx.util.IntList; * All of the parts that make up a method at the rop layer. */ public final class RopMethod { - /** non-null; basic block list of the method */ + /** {@code non-null;} basic block list of the method */ private final BasicBlockList blocks; - /** >= 0; label for the block which starts the method */ + /** {@code >= 0;} label for the block which starts the method */ private final int firstLabel; /** - * null-ok; array of predecessors for each block, indexed by block + * {@code null-ok;} array of predecessors for each block, indexed by block * label */ private IntList[] predecessors; /** - * null-ok; the predecessors for the implicit "exit" block, that is + * {@code null-ok;} the predecessors for the implicit "exit" block, that is * the labels for the blocks that return, if calculated */ private IntList exitPredecessors; @@ -45,8 +45,8 @@ public final class RopMethod { /** * Constructs an instance. * - * @param blocks non-null; basic block list of the method - * @param firstLabel >= 0; the label of the first block to execute + * @param blocks {@code non-null;} basic block list of the method + * @param firstLabel {@code >= 0;} the label of the first block to execute */ public RopMethod(BasicBlockList blocks, int firstLabel) { if (blocks == null) { @@ -67,7 +67,7 @@ public final class RopMethod { /** * Gets the basic block list for this method. * - * @return non-null; the list + * @return {@code non-null;} the list */ public BasicBlockList getBlocks() { return blocks; @@ -77,7 +77,7 @@ public final class RopMethod { * Gets the label for the first block in the method that this list * represents. * - * @return >= 0; the first-block label + * @return {@code >= 0;} the first-block label */ public int getFirstLabel() { return firstLabel; @@ -87,8 +87,8 @@ public final class RopMethod { * Gets the predecessors associated with the given block. This throws * an exception if there is no block with the given label. * - * @param label >= 0; the label of the block in question - * @return non-null; the predecessors of that block + * @param label {@code >= 0;} the label of the block in question + * @return {@code non-null;} the predecessors of that block */ public IntList labelToPredecessors(int label) { if (exitPredecessors == null) { @@ -107,7 +107,7 @@ public final class RopMethod { /** * Gets the exit predecessors for this instance. * - * @return non-null; the exit predecessors + * @return {@code non-null;} the exit predecessors */ public IntList getExitPredecessors() { if (exitPredecessors == null) { @@ -124,7 +124,7 @@ public final class RopMethod { * amount. * * @param delta the amount to offset register numbers by - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public RopMethod withRegisterOffset(int delta) { RopMethod result = new RopMethod(blocks.withRegisterOffset(delta), diff --git a/dx/src/com/android/dx/rop/code/Rops.java b/dx/src/com/android/dx/rop/code/Rops.java index b662656f7..15c2e17ed 100644 --- a/dx/src/com/android/dx/rop/code/Rops.java +++ b/dx/src/com/android/dx/rop/code/Rops.java @@ -30,32 +30,32 @@ import com.android.dx.rop.type.TypeList; * Standard instances of {@link Rop}. */ public final class Rops { - /** <code>nop()</code> */ + /** {@code nop()} */ public static final Rop NOP = new Rop(RegOps.NOP, Type.VOID, StdTypeList.EMPTY, "nop"); - /** <code>r,x: int :: r = x;</code> */ + /** {@code r,x: int :: r = x;} */ public static final Rop MOVE_INT = new Rop(RegOps.MOVE, Type.INT, StdTypeList.INT, "move-int"); - /** <code>r,x: long :: r = x;</code> */ + /** {@code r,x: long :: r = x;} */ public static final Rop MOVE_LONG = new Rop(RegOps.MOVE, Type.LONG, StdTypeList.LONG, "move-long"); - /** <code>r,x: float :: r = x;</code> */ + /** {@code r,x: float :: r = x;} */ public static final Rop MOVE_FLOAT = new Rop(RegOps.MOVE, Type.FLOAT, StdTypeList.FLOAT, "move-float"); - /** <code>r,x: double :: r = x;</code> */ + /** {@code r,x: double :: r = x;} */ public static final Rop MOVE_DOUBLE = new Rop(RegOps.MOVE, Type.DOUBLE, StdTypeList.DOUBLE, "move-double"); - /** <code>r,x: Object :: r = x;</code> */ + /** {@code r,x: Object :: r = x;} */ public static final Rop MOVE_OBJECT = new Rop(RegOps.MOVE, Type.OBJECT, StdTypeList.OBJECT, "move-object"); /** - * <code>r,x: ReturnAddress :: r = x;</code> + * {@code r,x: ReturnAddress :: r = x;} * * Note that this rop-form instruction has no dex-form equivilent and * must be removed before the dex conversion. @@ -64,756 +64,756 @@ public final class Rops { new Rop(RegOps.MOVE, Type.RETURN_ADDRESS, StdTypeList.RETURN_ADDRESS, "move-return-address"); - /** <code>r,param(x): int :: r = param(x);</code> */ + /** {@code r,param(x): int :: r = param(x);} */ public static final Rop MOVE_PARAM_INT = new Rop(RegOps.MOVE_PARAM, Type.INT, StdTypeList.EMPTY, "move-param-int"); - /** <code>r,param(x): long :: r = param(x);</code> */ + /** {@code r,param(x): long :: r = param(x);} */ public static final Rop MOVE_PARAM_LONG = new Rop(RegOps.MOVE_PARAM, Type.LONG, StdTypeList.EMPTY, "move-param-long"); - /** <code>r,param(x): float :: r = param(x);</code> */ + /** {@code r,param(x): float :: r = param(x);} */ public static final Rop MOVE_PARAM_FLOAT = new Rop(RegOps.MOVE_PARAM, Type.FLOAT, StdTypeList.EMPTY, "move-param-float"); - /** <code>r,param(x): double :: r = param(x);</code> */ + /** {@code r,param(x): double :: r = param(x);} */ public static final Rop MOVE_PARAM_DOUBLE = new Rop(RegOps.MOVE_PARAM, Type.DOUBLE, StdTypeList.EMPTY, "move-param-double"); - /** <code>r,param(x): Object :: r = param(x);</code> */ + /** {@code r,param(x): Object :: r = param(x);} */ public static final Rop MOVE_PARAM_OBJECT = new Rop(RegOps.MOVE_PARAM, Type.OBJECT, StdTypeList.EMPTY, "move-param-object"); - /** <code>r, literal: int :: r = literal;</code> */ + /** {@code r, literal: int :: r = literal;} */ public static final Rop CONST_INT = new Rop(RegOps.CONST, Type.INT, StdTypeList.EMPTY, "const-int"); - /** <code>r, literal: long :: r = literal;</code> */ + /** {@code r, literal: long :: r = literal;} */ public static final Rop CONST_LONG = new Rop(RegOps.CONST, Type.LONG, StdTypeList.EMPTY, "const-long"); - /** <code>r, literal: float :: r = literal;</code> */ + /** {@code r, literal: float :: r = literal;} */ public static final Rop CONST_FLOAT = new Rop(RegOps.CONST, Type.FLOAT, StdTypeList.EMPTY, "const-float"); - /** <code>r, literal: double :: r = literal;</code> */ + /** {@code r, literal: double :: r = literal;} */ public static final Rop CONST_DOUBLE = new Rop(RegOps.CONST, Type.DOUBLE, StdTypeList.EMPTY, "const-double"); - /** <code>r, literal: Object :: r = literal;</code> */ + /** {@code r, literal: Object :: r = literal;} */ public static final Rop CONST_OBJECT = new Rop(RegOps.CONST, Type.OBJECT, StdTypeList.EMPTY, Exceptions.LIST_Error, "const-object"); - /** <code>r, literal: Object :: r = literal;</code> */ + /** {@code r, literal: Object :: r = literal;} */ public static final Rop CONST_OBJECT_NOTHROW = new Rop(RegOps.CONST, Type.OBJECT, StdTypeList.EMPTY, "const-object-nothrow"); - /** <code>goto <i>label</i></code> */ + /** {@code goto label} */ public static final Rop GOTO = new Rop(RegOps.GOTO, Type.VOID, StdTypeList.EMPTY, Rop.BRANCH_GOTO, "goto"); - /** <code>x: int :: if (x == 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x == 0) goto label} */ public static final Rop IF_EQZ_INT = new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-eqz-int"); - /** <code>x: int :: if (x != 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x != 0) goto label} */ public static final Rop IF_NEZ_INT = new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-nez-int"); - /** <code>x: int :: if (x < 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x < 0) goto label} */ public static final Rop IF_LTZ_INT = new Rop(RegOps.IF_LT, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-ltz-int"); - /** <code>x: int :: if (x >= 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x >= 0) goto label} */ public static final Rop IF_GEZ_INT = new Rop(RegOps.IF_GE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-gez-int"); - /** <code>x: int :: if (x <= 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x <= 0) goto label} */ public static final Rop IF_LEZ_INT = new Rop(RegOps.IF_LE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-lez-int"); - /** <code>x: int :: if (x > 0) goto <i>label</i></code> */ + /** {@code x: int :: if (x > 0) goto label} */ public static final Rop IF_GTZ_INT = new Rop(RegOps.IF_GT, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF, "if-gtz-int"); - /** <code>x: Object :: if (x == null) goto <i>label</i></code> */ + /** {@code x: Object :: if (x == null) goto label} */ public static final Rop IF_EQZ_OBJECT = new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.OBJECT, Rop.BRANCH_IF, "if-eqz-object"); - /** <code>x: Object :: if (x != null) goto <i>label</i></code> */ + /** {@code x: Object :: if (x != null) goto label} */ public static final Rop IF_NEZ_OBJECT = new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.OBJECT, Rop.BRANCH_IF, "if-nez-object"); - /** <code>x,y: int :: if (x == y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x == y) goto label} */ public static final Rop IF_EQ_INT = new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-eq-int"); - /** <code>x,y: int :: if (x != y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x != y) goto label} */ public static final Rop IF_NE_INT = new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-ne-int"); - /** <code>x,y: int :: if (x < y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x < y) goto label} */ public static final Rop IF_LT_INT = new Rop(RegOps.IF_LT, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-lt-int"); - /** <code>x,y: int :: if (x >= y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x >= y) goto label} */ public static final Rop IF_GE_INT = new Rop(RegOps.IF_GE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-ge-int"); - /** <code>x,y: int :: if (x <= y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x <= y) goto label} */ public static final Rop IF_LE_INT = new Rop(RegOps.IF_LE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-le-int"); - /** <code>x,y: int :: if (x > y) goto <i>label</i></code> */ + /** {@code x,y: int :: if (x > y) goto label} */ public static final Rop IF_GT_INT = new Rop(RegOps.IF_GT, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF, "if-gt-int"); - /** <code>x,y: Object :: if (x == y) goto <i>label</i></code> */ + /** {@code x,y: Object :: if (x == y) goto label} */ public static final Rop IF_EQ_OBJECT = new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.OBJECT_OBJECT, Rop.BRANCH_IF, "if-eq-object"); - /** <code>x,y: Object :: if (x != y) goto <i>label</i></code> */ + /** {@code x,y: Object :: if (x != y) goto label} */ public static final Rop IF_NE_OBJECT = new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.OBJECT_OBJECT, Rop.BRANCH_IF, "if-ne-object"); - /** <code>x: int :: goto switchtable[x]</code> */ + /** {@code x: int :: goto switchtable[x]} */ public static final Rop SWITCH = new Rop(RegOps.SWITCH, Type.VOID, StdTypeList.INT, Rop.BRANCH_SWITCH, "switch"); - /** <code>r,x,y: int :: r = x + y;</code> */ + /** {@code r,x,y: int :: r = x + y;} */ public static final Rop ADD_INT = new Rop(RegOps.ADD, Type.INT, StdTypeList.INT_INT, "add-int"); - /** <code>r,x,y: long :: r = x + y;</code> */ + /** {@code r,x,y: long :: r = x + y;} */ public static final Rop ADD_LONG = new Rop(RegOps.ADD, Type.LONG, StdTypeList.LONG_LONG, "add-long"); - /** <code>r,x,y: float :: r = x + y;</code> */ + /** {@code r,x,y: float :: r = x + y;} */ public static final Rop ADD_FLOAT = new Rop(RegOps.ADD, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "add-float"); - /** <code>r,x,y: double :: r = x + y;</code> */ + /** {@code r,x,y: double :: r = x + y;} */ public static final Rop ADD_DOUBLE = new Rop(RegOps.ADD, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE, Rop.BRANCH_NONE, "add-double"); - /** <code>r,x,y: int :: r = x - y;</code> */ + /** {@code r,x,y: int :: r = x - y;} */ public static final Rop SUB_INT = new Rop(RegOps.SUB, Type.INT, StdTypeList.INT_INT, "sub-int"); - /** <code>r,x,y: long :: r = x - y;</code> */ + /** {@code r,x,y: long :: r = x - y;} */ public static final Rop SUB_LONG = new Rop(RegOps.SUB, Type.LONG, StdTypeList.LONG_LONG, "sub-long"); - /** <code>r,x,y: float :: r = x - y;</code> */ + /** {@code r,x,y: float :: r = x - y;} */ public static final Rop SUB_FLOAT = new Rop(RegOps.SUB, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "sub-float"); - /** <code>r,x,y: double :: r = x - y;</code> */ + /** {@code r,x,y: double :: r = x - y;} */ public static final Rop SUB_DOUBLE = new Rop(RegOps.SUB, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE, Rop.BRANCH_NONE, "sub-double"); - /** <code>r,x,y: int :: r = x * y;</code> */ + /** {@code r,x,y: int :: r = x * y;} */ public static final Rop MUL_INT = new Rop(RegOps.MUL, Type.INT, StdTypeList.INT_INT, "mul-int"); - /** <code>r,x,y: long :: r = x * y;</code> */ + /** {@code r,x,y: long :: r = x * y;} */ public static final Rop MUL_LONG = new Rop(RegOps.MUL, Type.LONG, StdTypeList.LONG_LONG, "mul-long"); - /** <code>r,x,y: float :: r = x * y;</code> */ + /** {@code r,x,y: float :: r = x * y;} */ public static final Rop MUL_FLOAT = new Rop(RegOps.MUL, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "mul-float"); - /** <code>r,x,y: double :: r = x * y;</code> */ + /** {@code r,x,y: double :: r = x * y;} */ public static final Rop MUL_DOUBLE = new Rop(RegOps.MUL, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE, Rop.BRANCH_NONE, "mul-double"); - /** <code>r,x,y: int :: r = x / y;</code> */ + /** {@code r,x,y: int :: r = x / y;} */ public static final Rop DIV_INT = new Rop(RegOps.DIV, Type.INT, StdTypeList.INT_INT, Exceptions.LIST_Error_ArithmeticException, "div-int"); - /** <code>r,x,y: long :: r = x / y;</code> */ + /** {@code r,x,y: long :: r = x / y;} */ public static final Rop DIV_LONG = new Rop(RegOps.DIV, Type.LONG, StdTypeList.LONG_LONG, Exceptions.LIST_Error_ArithmeticException, "div-long"); - /** <code>r,x,y: float :: r = x / y;</code> */ + /** {@code r,x,y: float :: r = x / y;} */ public static final Rop DIV_FLOAT = new Rop(RegOps.DIV, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "div-float"); - /** <code>r,x,y: double :: r = x / y;</code> */ + /** {@code r,x,y: double :: r = x / y;} */ public static final Rop DIV_DOUBLE = new Rop(RegOps.DIV, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE, "div-double"); - /** <code>r,x,y: int :: r = x % y;</code> */ + /** {@code r,x,y: int :: r = x % y;} */ public static final Rop REM_INT = new Rop(RegOps.REM, Type.INT, StdTypeList.INT_INT, Exceptions.LIST_Error_ArithmeticException, "rem-int"); - /** <code>r,x,y: long :: r = x % y;</code> */ + /** {@code r,x,y: long :: r = x % y;} */ public static final Rop REM_LONG = new Rop(RegOps.REM, Type.LONG, StdTypeList.LONG_LONG, Exceptions.LIST_Error_ArithmeticException, "rem-long"); - /** <code>r,x,y: float :: r = x % y;</code> */ + /** {@code r,x,y: float :: r = x % y;} */ public static final Rop REM_FLOAT = new Rop(RegOps.REM, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "rem-float"); - /** <code>r,x,y: double :: r = x % y;</code> */ + /** {@code r,x,y: double :: r = x % y;} */ public static final Rop REM_DOUBLE = new Rop(RegOps.REM, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE, "rem-double"); - /** <code>r,x: int :: r = -x;</code> */ + /** {@code r,x: int :: r = -x;} */ public static final Rop NEG_INT = new Rop(RegOps.NEG, Type.INT, StdTypeList.INT, "neg-int"); - /** <code>r,x: long :: r = -x;</code> */ + /** {@code r,x: long :: r = -x;} */ public static final Rop NEG_LONG = new Rop(RegOps.NEG, Type.LONG, StdTypeList.LONG, "neg-long"); - /** <code>r,x: float :: r = -x;</code> */ + /** {@code r,x: float :: r = -x;} */ public static final Rop NEG_FLOAT = new Rop(RegOps.NEG, Type.FLOAT, StdTypeList.FLOAT, "neg-float"); - /** <code>r,x: double :: r = -x;</code> */ + /** {@code r,x: double :: r = -x;} */ public static final Rop NEG_DOUBLE = new Rop(RegOps.NEG, Type.DOUBLE, StdTypeList.DOUBLE, "neg-double"); - /** <code>r,x,y: int :: r = x & y;</code> */ + /** {@code r,x,y: int :: r = x & y;} */ public static final Rop AND_INT = new Rop(RegOps.AND, Type.INT, StdTypeList.INT_INT, "and-int"); - /** <code>r,x,y: long :: r = x & y;</code> */ + /** {@code r,x,y: long :: r = x & y;} */ public static final Rop AND_LONG = new Rop(RegOps.AND, Type.LONG, StdTypeList.LONG_LONG, "and-long"); - /** <code>r,x,y: int :: r = x | y;</code> */ + /** {@code r,x,y: int :: r = x | y;} */ public static final Rop OR_INT = new Rop(RegOps.OR, Type.INT, StdTypeList.INT_INT, "or-int"); - /** <code>r,x,y: long :: r = x | y;</code> */ + /** {@code r,x,y: long :: r = x | y;} */ public static final Rop OR_LONG = new Rop(RegOps.OR, Type.LONG, StdTypeList.LONG_LONG, "or-long"); - /** <code>r,x,y: int :: r = x ^ y;</code> */ + /** {@code r,x,y: int :: r = x ^ y;} */ public static final Rop XOR_INT = new Rop(RegOps.XOR, Type.INT, StdTypeList.INT_INT, "xor-int"); - /** <code>r,x,y: long :: r = x ^ y;</code> */ + /** {@code r,x,y: long :: r = x ^ y;} */ public static final Rop XOR_LONG = new Rop(RegOps.XOR, Type.LONG, StdTypeList.LONG_LONG, "xor-long"); - /** <code>r,x,y: int :: r = x << y;</code> */ + /** {@code r,x,y: int :: r = x << y;} */ public static final Rop SHL_INT = new Rop(RegOps.SHL, Type.INT, StdTypeList.INT_INT, "shl-int"); - /** <code>r,x: long; y: int :: r = x << y;</code> */ + /** {@code r,x: long; y: int :: r = x << y;} */ public static final Rop SHL_LONG = new Rop(RegOps.SHL, Type.LONG, StdTypeList.LONG_INT, "shl-long"); - /** <code>r,x,y: int :: r = x >> y;</code> */ + /** {@code r,x,y: int :: r = x >> y;} */ public static final Rop SHR_INT = new Rop(RegOps.SHR, Type.INT, StdTypeList.INT_INT, "shr-int"); - /** <code>r,x: long; y: int :: r = x >> y;</code> */ + /** {@code r,x: long; y: int :: r = x >> y;} */ public static final Rop SHR_LONG = new Rop(RegOps.SHR, Type.LONG, StdTypeList.LONG_INT, "shr-long"); - /** <code>r,x,y: int :: r = x >>> y;</code> */ + /** {@code r,x,y: int :: r = x >>> y;} */ public static final Rop USHR_INT = new Rop(RegOps.USHR, Type.INT, StdTypeList.INT_INT, "ushr-int"); - /** <code>r,x: long; y: int :: r = x >>> y;</code> */ + /** {@code r,x: long; y: int :: r = x >>> y;} */ public static final Rop USHR_LONG = new Rop(RegOps.USHR, Type.LONG, StdTypeList.LONG_INT, "ushr-long"); - /** <code>r,x: int :: r = ~x;</code> */ + /** {@code r,x: int :: r = ~x;} */ public static final Rop NOT_INT = new Rop(RegOps.NOT, Type.INT, StdTypeList.INT, "not-int"); - /** <code>r,x: long :: r = ~x;</code> */ + /** {@code r,x: long :: r = ~x;} */ public static final Rop NOT_LONG = new Rop(RegOps.NOT, Type.LONG, StdTypeList.LONG, "not-long"); - /** <code>r,x,c: int :: r = x + c;</code> */ + /** {@code r,x,c: int :: r = x + c;} */ public static final Rop ADD_CONST_INT = new Rop(RegOps.ADD, Type.INT, StdTypeList.INT, "add-const-int"); - /** <code>r,x,c: long :: r = x + c;</code> */ + /** {@code r,x,c: long :: r = x + c;} */ public static final Rop ADD_CONST_LONG = new Rop(RegOps.ADD, Type.LONG, StdTypeList.LONG, "add-const-long"); - /** <code>r,x,c: float :: r = x + c;</code> */ + /** {@code r,x,c: float :: r = x + c;} */ public static final Rop ADD_CONST_FLOAT = new Rop(RegOps.ADD, Type.FLOAT, StdTypeList.FLOAT, "add-const-float"); - /** <code>r,x,c: double :: r = x + c;</code> */ + /** {@code r,x,c: double :: r = x + c;} */ public static final Rop ADD_CONST_DOUBLE = new Rop(RegOps.ADD, Type.DOUBLE, StdTypeList.DOUBLE, "add-const-double"); - /** <code>r,x,c: int :: r = x - c;</code> */ + /** {@code r,x,c: int :: r = x - c;} */ public static final Rop SUB_CONST_INT = new Rop(RegOps.SUB, Type.INT, StdTypeList.INT, "sub-const-int"); - /** <code>r,x,c: long :: r = x - c;</code> */ + /** {@code r,x,c: long :: r = x - c;} */ public static final Rop SUB_CONST_LONG = new Rop(RegOps.SUB, Type.LONG, StdTypeList.LONG, "sub-const-long"); - /** <code>r,x,c: float :: r = x - c;</code> */ + /** {@code r,x,c: float :: r = x - c;} */ public static final Rop SUB_CONST_FLOAT = new Rop(RegOps.SUB, Type.FLOAT, StdTypeList.FLOAT, "sub-const-float"); - /** <code>r,x,c: double :: r = x - c;</code> */ + /** {@code r,x,c: double :: r = x - c;} */ public static final Rop SUB_CONST_DOUBLE = new Rop(RegOps.SUB, Type.DOUBLE, StdTypeList.DOUBLE, "sub-const-double"); - /** <code>r,x,c: int :: r = x * c;</code> */ + /** {@code r,x,c: int :: r = x * c;} */ public static final Rop MUL_CONST_INT = new Rop(RegOps.MUL, Type.INT, StdTypeList.INT, "mul-const-int"); - /** <code>r,x,c: long :: r = x * c;</code> */ + /** {@code r,x,c: long :: r = x * c;} */ public static final Rop MUL_CONST_LONG = new Rop(RegOps.MUL, Type.LONG, StdTypeList.LONG, "mul-const-long"); - /** <code>r,x,c: float :: r = x * c;</code> */ + /** {@code r,x,c: float :: r = x * c;} */ public static final Rop MUL_CONST_FLOAT = new Rop(RegOps.MUL, Type.FLOAT, StdTypeList.FLOAT, "mul-const-float"); - /** <code>r,x,c: double :: r = x * c;</code> */ + /** {@code r,x,c: double :: r = x * c;} */ public static final Rop MUL_CONST_DOUBLE = new Rop(RegOps.MUL, Type.DOUBLE, StdTypeList.DOUBLE, "mul-const-double"); - /** <code>r,x,c: int :: r = x / c;</code> */ + /** {@code r,x,c: int :: r = x / c;} */ public static final Rop DIV_CONST_INT = new Rop(RegOps.DIV, Type.INT, StdTypeList.INT, Exceptions.LIST_Error_ArithmeticException, "div-const-int"); - /** <code>r,x,c: long :: r = x / c;</code> */ + /** {@code r,x,c: long :: r = x / c;} */ public static final Rop DIV_CONST_LONG = new Rop(RegOps.DIV, Type.LONG, StdTypeList.LONG, Exceptions.LIST_Error_ArithmeticException, "div-const-long"); - /** <code>r,x,c: float :: r = x / c;</code> */ + /** {@code r,x,c: float :: r = x / c;} */ public static final Rop DIV_CONST_FLOAT = new Rop(RegOps.DIV, Type.FLOAT, StdTypeList.FLOAT, "div-const-float"); - /** <code>r,x,c: double :: r = x / c;</code> */ + /** {@code r,x,c: double :: r = x / c;} */ public static final Rop DIV_CONST_DOUBLE = new Rop(RegOps.DIV, Type.DOUBLE, StdTypeList.DOUBLE, "div-const-double"); - /** <code>r,x,c: int :: r = x % c;</code> */ + /** {@code r,x,c: int :: r = x % c;} */ public static final Rop REM_CONST_INT = new Rop(RegOps.REM, Type.INT, StdTypeList.INT, Exceptions.LIST_Error_ArithmeticException, "rem-const-int"); - /** <code>r,x,c: long :: r = x % c;</code> */ + /** {@code r,x,c: long :: r = x % c;} */ public static final Rop REM_CONST_LONG = new Rop(RegOps.REM, Type.LONG, StdTypeList.LONG, Exceptions.LIST_Error_ArithmeticException, "rem-const-long"); - /** <code>r,x,c: float :: r = x % c;</code> */ + /** {@code r,x,c: float :: r = x % c;} */ public static final Rop REM_CONST_FLOAT = new Rop(RegOps.REM, Type.FLOAT, StdTypeList.FLOAT, "rem-const-float"); - /** <code>r,x,c: double :: r = x % c;</code> */ + /** {@code r,x,c: double :: r = x % c;} */ public static final Rop REM_CONST_DOUBLE = new Rop(RegOps.REM, Type.DOUBLE, StdTypeList.DOUBLE, "rem-const-double"); - /** <code>r,x,c: int :: r = x & c;</code> */ + /** {@code r,x,c: int :: r = x & c;} */ public static final Rop AND_CONST_INT = new Rop(RegOps.AND, Type.INT, StdTypeList.INT, "and-const-int"); - /** <code>r,x,c: long :: r = x & c;</code> */ + /** {@code r,x,c: long :: r = x & c;} */ public static final Rop AND_CONST_LONG = new Rop(RegOps.AND, Type.LONG, StdTypeList.LONG, "and-const-long"); - /** <code>r,x,c: int :: r = x | c;</code> */ + /** {@code r,x,c: int :: r = x | c;} */ public static final Rop OR_CONST_INT = new Rop(RegOps.OR, Type.INT, StdTypeList.INT, "or-const-int"); - /** <code>r,x,c: long :: r = x | c;</code> */ + /** {@code r,x,c: long :: r = x | c;} */ public static final Rop OR_CONST_LONG = new Rop(RegOps.OR, Type.LONG, StdTypeList.LONG, "or-const-long"); - /** <code>r,x,c: int :: r = x ^ c;</code> */ + /** {@code r,x,c: int :: r = x ^ c;} */ public static final Rop XOR_CONST_INT = new Rop(RegOps.XOR, Type.INT, StdTypeList.INT, "xor-const-int"); - /** <code>r,x,c: long :: r = x ^ c;</code> */ + /** {@code r,x,c: long :: r = x ^ c;} */ public static final Rop XOR_CONST_LONG = new Rop(RegOps.XOR, Type.LONG, StdTypeList.LONG, "xor-const-long"); - /** <code>r,x,c: int :: r = x << c;</code> */ + /** {@code r,x,c: int :: r = x << c;} */ public static final Rop SHL_CONST_INT = new Rop(RegOps.SHL, Type.INT, StdTypeList.INT, "shl-const-int"); - /** <code>r,x: long; c: int :: r = x << c;</code> */ + /** {@code r,x: long; c: int :: r = x << c;} */ public static final Rop SHL_CONST_LONG = new Rop(RegOps.SHL, Type.LONG, StdTypeList.INT, "shl-const-long"); - /** <code>r,x,c: int :: r = x >> c;</code> */ + /** {@code r,x,c: int :: r = x >> c;} */ public static final Rop SHR_CONST_INT = new Rop(RegOps.SHR, Type.INT, StdTypeList.INT, "shr-const-int"); - /** <code>r,x: long; c: int :: r = x >> c;</code> */ + /** {@code r,x: long; c: int :: r = x >> c;} */ public static final Rop SHR_CONST_LONG = new Rop(RegOps.SHR, Type.LONG, StdTypeList.INT, "shr-const-long"); - /** <code>r,x,c: int :: r = x >>> c;</code> */ + /** {@code r,x,c: int :: r = x >>> c;} */ public static final Rop USHR_CONST_INT = new Rop(RegOps.USHR, Type.INT, StdTypeList.INT, "ushr-const-int"); - /** <code>r,x: long; c: int :: r = x >>> c;</code> */ + /** {@code r,x: long; c: int :: r = x >>> c;} */ public static final Rop USHR_CONST_LONG = new Rop(RegOps.USHR, Type.LONG, StdTypeList.INT, "ushr-const-long"); - /** <code>r: int; x,y: long :: r = cmp(x, y);</code> */ + /** {@code r: int; x,y: long :: r = cmp(x, y);} */ public static final Rop CMPL_LONG = new Rop(RegOps.CMPL, Type.INT, StdTypeList.LONG_LONG, "cmpl-long"); - /** <code>r: int; x,y: float :: r = cmpl(x, y);</code> */ + /** {@code r: int; x,y: float :: r = cmpl(x, y);} */ public static final Rop CMPL_FLOAT = new Rop(RegOps.CMPL, Type.INT, StdTypeList.FLOAT_FLOAT, "cmpl-float"); - /** <code>r: int; x,y: double :: r = cmpl(x, y);</code> */ + /** {@code r: int; x,y: double :: r = cmpl(x, y);} */ public static final Rop CMPL_DOUBLE = new Rop(RegOps.CMPL, Type.INT, StdTypeList.DOUBLE_DOUBLE, "cmpl-double"); - /** <code>r: int; x,y: float :: r = cmpg(x, y);</code> */ + /** {@code r: int; x,y: float :: r = cmpg(x, y);} */ public static final Rop CMPG_FLOAT = new Rop(RegOps.CMPG, Type.INT, StdTypeList.FLOAT_FLOAT, "cmpg-float"); - /** <code>r: int; x,y: double :: r = cmpg(x, y);</code> */ + /** {@code r: int; x,y: double :: r = cmpg(x, y);} */ public static final Rop CMPG_DOUBLE = new Rop(RegOps.CMPG, Type.INT, StdTypeList.DOUBLE_DOUBLE, "cmpg-double"); - /** <code>r: int; x: long :: r = (int) x</code> */ + /** {@code r: int; x: long :: r = (int) x} */ public static final Rop CONV_L2I = new Rop(RegOps.CONV, Type.INT, StdTypeList.LONG, "conv-l2i"); - /** <code>r: int; x: float :: r = (int) x</code> */ + /** {@code r: int; x: float :: r = (int) x} */ public static final Rop CONV_F2I = new Rop(RegOps.CONV, Type.INT, StdTypeList.FLOAT, "conv-f2i"); - /** <code>r: int; x: double :: r = (int) x</code> */ + /** {@code r: int; x: double :: r = (int) x} */ public static final Rop CONV_D2I = new Rop(RegOps.CONV, Type.INT, StdTypeList.DOUBLE, "conv-d2i"); - /** <code>r: long; x: int :: r = (long) x</code> */ + /** {@code r: long; x: int :: r = (long) x} */ public static final Rop CONV_I2L = new Rop(RegOps.CONV, Type.LONG, StdTypeList.INT, "conv-i2l"); - /** <code>r: long; x: float :: r = (long) x</code> */ + /** {@code r: long; x: float :: r = (long) x} */ public static final Rop CONV_F2L = new Rop(RegOps.CONV, Type.LONG, StdTypeList.FLOAT, "conv-f2l"); - /** <code>r: long; x: double :: r = (long) x</code> */ + /** {@code r: long; x: double :: r = (long) x} */ public static final Rop CONV_D2L = new Rop(RegOps.CONV, Type.LONG, StdTypeList.DOUBLE, "conv-d2l"); - /** <code>r: float; x: int :: r = (float) x</code> */ + /** {@code r: float; x: int :: r = (float) x} */ public static final Rop CONV_I2F = new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.INT, "conv-i2f"); - /** <code>r: float; x: long :: r = (float) x</code> */ + /** {@code r: float; x: long :: r = (float) x} */ public static final Rop CONV_L2F = new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.LONG, "conv-l2f"); - /** <code>r: float; x: double :: r = (float) x</code> */ + /** {@code r: float; x: double :: r = (float) x} */ public static final Rop CONV_D2F = new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.DOUBLE, "conv-d2f"); - /** <code>r: double; x: int :: r = (double) x</code> */ + /** {@code r: double; x: int :: r = (double) x} */ public static final Rop CONV_I2D = new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.INT, "conv-i2d"); - /** <code>r: double; x: long :: r = (double) x</code> */ + /** {@code r: double; x: long :: r = (double) x} */ public static final Rop CONV_L2D = new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.LONG, "conv-l2d"); - /** <code>r: double; x: float :: r = (double) x</code> */ + /** {@code r: double; x: float :: r = (double) x} */ public static final Rop CONV_F2D = new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.FLOAT, "conv-f2d"); /** - * <code>r,x: int :: r = (x << 24) >> 24</code> (Java-style + * {@code r,x: int :: r = (x << 24) >> 24} (Java-style * convert int to byte) */ public static final Rop TO_BYTE = new Rop(RegOps.TO_BYTE, Type.INT, StdTypeList.INT, "to-byte"); /** - * <code>r,x: int :: r = x & 0xffff</code> (Java-style + * {@code r,x: int :: r = x & 0xffff} (Java-style * convert int to char) */ public static final Rop TO_CHAR = new Rop(RegOps.TO_CHAR, Type.INT, StdTypeList.INT, "to-char"); /** - * <code>r,x: int :: r = (x << 16) >> 16</code> (Java-style + * {@code r,x: int :: r = (x << 16) >> 16} (Java-style * convert int to short) */ public static final Rop TO_SHORT = new Rop(RegOps.TO_SHORT, Type.INT, StdTypeList.INT, "to-short"); - /** <code>return void</code> */ + /** {@code return void} */ public static final Rop RETURN_VOID = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.EMPTY, Rop.BRANCH_RETURN, "return-void"); - /** <code>x: int; return x</code> */ + /** {@code x: int; return x} */ public static final Rop RETURN_INT = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.INT, Rop.BRANCH_RETURN, "return-int"); - /** <code>x: long; return x</code> */ + /** {@code x: long; return x} */ public static final Rop RETURN_LONG = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.LONG, Rop.BRANCH_RETURN, "return-long"); - /** <code>x: float; return x</code> */ + /** {@code x: float; return x} */ public static final Rop RETURN_FLOAT = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.FLOAT, Rop.BRANCH_RETURN, "return-float"); - /** <code>x: double; return x</code> */ + /** {@code x: double; return x} */ public static final Rop RETURN_DOUBLE = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.DOUBLE, Rop.BRANCH_RETURN, "return-double"); - /** <code>x: Object; return x</code> */ + /** {@code x: Object; return x} */ public static final Rop RETURN_OBJECT = new Rop(RegOps.RETURN, Type.VOID, StdTypeList.OBJECT, Rop.BRANCH_RETURN, "return-object"); - /** <code>T: any type; r: int; x: T[]; :: r = x.length</code> */ + /** {@code T: any type; r: int; x: T[]; :: r = x.length} */ public static final Rop ARRAY_LENGTH = new Rop(RegOps.ARRAY_LENGTH, Type.INT, StdTypeList.OBJECT, Exceptions.LIST_Error_NullPointerException, "array-length"); - /** <code>x: Throwable :: throw(x)</code> */ + /** {@code x: Throwable :: throw(x)} */ public static final Rop THROW = new Rop(RegOps.THROW, Type.VOID, StdTypeList.THROWABLE, StdTypeList.THROWABLE, "throw"); - /** <code>x: Object :: monitorenter(x)</code> */ + /** {@code x: Object :: monitorenter(x)} */ public static final Rop MONITOR_ENTER = new Rop(RegOps.MONITOR_ENTER, Type.VOID, StdTypeList.OBJECT, Exceptions.LIST_Error_NullPointerException, "monitor-enter"); - /** <code>x: Object :: monitorexit(x)</code> */ + /** {@code x: Object :: monitorexit(x)} */ public static final Rop MONITOR_EXIT = new Rop(RegOps.MONITOR_EXIT, Type.VOID, StdTypeList.OBJECT, Exceptions.LIST_Error_Null_IllegalMonitorStateException, "monitor-exit"); - /** <code>r,y: int; x: int[] :: r = x[y]</code> */ + /** {@code r,y: int; x: int[] :: r = x[y]} */ public static final Rop AGET_INT = new Rop(RegOps.AGET, Type.INT, StdTypeList.INTARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-int"); - /** <code>r: long; x: long[]; y: int :: r = x[y]</code> */ + /** {@code r: long; x: long[]; y: int :: r = x[y]} */ public static final Rop AGET_LONG = new Rop(RegOps.AGET, Type.LONG, StdTypeList.LONGARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-long"); - /** <code>r: float; x: float[]; y: int :: r = x[y]</code> */ + /** {@code r: float; x: float[]; y: int :: r = x[y]} */ public static final Rop AGET_FLOAT = new Rop(RegOps.AGET, Type.FLOAT, StdTypeList.FLOATARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-float"); - /** <code>r: double; x: double[]; y: int :: r = x[y]</code> */ + /** {@code r: double; x: double[]; y: int :: r = x[y]} */ public static final Rop AGET_DOUBLE = new Rop(RegOps.AGET, Type.DOUBLE, StdTypeList.DOUBLEARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-double"); - /** <code>r: Object; x: Object[]; y: int :: r = x[y]</code> */ + /** {@code r: Object; x: Object[]; y: int :: r = x[y]} */ public static final Rop AGET_OBJECT = new Rop(RegOps.AGET, Type.OBJECT, StdTypeList.OBJECTARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-object"); - /** <code>r: boolean; x: boolean[]; y: int :: r = x[y]</code> */ + /** {@code r: boolean; x: boolean[]; y: int :: r = x[y]} */ public static final Rop AGET_BOOLEAN = new Rop(RegOps.AGET, Type.INT, StdTypeList.BOOLEANARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-boolean"); - /** <code>r: byte; x: byte[]; y: int :: r = x[y]</code> */ + /** {@code r: byte; x: byte[]; y: int :: r = x[y]} */ public static final Rop AGET_BYTE = new Rop(RegOps.AGET, Type.INT, StdTypeList.BYTEARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-byte"); - /** <code>r: char; x: char[]; y: int :: r = x[y]</code> */ + /** {@code r: char; x: char[]; y: int :: r = x[y]} */ public static final Rop AGET_CHAR = new Rop(RegOps.AGET, Type.INT, StdTypeList.CHARARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-char"); - /** <code>r: short; x: short[]; y: int :: r = x[y]</code> */ + /** {@code r: short; x: short[]; y: int :: r = x[y]} */ public static final Rop AGET_SHORT = new Rop(RegOps.AGET, Type.INT, StdTypeList.SHORTARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-short"); - /** <code>x,z: int; y: int[] :: y[z] = x</code> */ + /** {@code x,z: int; y: int[] :: y[z] = x} */ public static final Rop APUT_INT = new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_INTARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-int"); - /** <code>x: long; y: long[]; z: int :: y[z] = x</code> */ + /** {@code x: long; y: long[]; z: int :: y[z] = x} */ public static final Rop APUT_LONG = new Rop(RegOps.APUT, Type.VOID, StdTypeList.LONG_LONGARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-long"); - /** <code>x: float; y: float[]; z: int :: y[z] = x</code> */ + /** {@code x: float; y: float[]; z: int :: y[z] = x} */ public static final Rop APUT_FLOAT = new Rop(RegOps.APUT, Type.VOID, StdTypeList.FLOAT_FLOATARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-float"); - /** <code>x: double; y: double[]; z: int :: y[z] = x</code> */ + /** {@code x: double; y: double[]; z: int :: y[z] = x} */ public static final Rop APUT_DOUBLE = new Rop(RegOps.APUT, Type.VOID, StdTypeList.DOUBLE_DOUBLEARR_INT, Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-double"); - /** <code>x: Object; y: Object[]; z: int :: y[z] = x</code> */ + /** {@code x: Object; y: Object[]; z: int :: y[z] = x} */ public static final Rop APUT_OBJECT = new Rop(RegOps.APUT, Type.VOID, StdTypeList.OBJECT_OBJECTARR_INT, Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-object"); - /** <code>x: boolean; y: boolean[]; z: int :: y[z] = x</code> */ + /** {@code x: boolean; y: boolean[]; z: int :: y[z] = x} */ public static final Rop APUT_BOOLEAN = new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_BOOLEANARR_INT, Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-boolean"); - /** <code>x: byte; y: byte[]; z: int :: y[z] = x</code> */ + /** {@code x: byte; y: byte[]; z: int :: y[z] = x} */ public static final Rop APUT_BYTE = new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_BYTEARR_INT, Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-byte"); - /** <code>x: char; y: char[]; z: int :: y[z] = x</code> */ + /** {@code x: char; y: char[]; z: int :: y[z] = x} */ public static final Rop APUT_CHAR = new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_CHARARR_INT, Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-char"); - /** <code>x: short; y: short[]; z: int :: y[z] = x</code> */ + /** {@code x: short; y: short[]; z: int :: y[z] = x} */ public static final Rop APUT_SHORT = new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_SHORTARR_INT, Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-short"); /** - * <code>T: any non-array object type :: r = - * alloc(T)</code> (allocate heap space for an object) + * {@code T: any non-array object type :: r = + * alloc(T)} (allocate heap space for an object) */ public static final Rop NEW_INSTANCE = new Rop(RegOps.NEW_INSTANCE, Type.OBJECT, StdTypeList.EMPTY, Exceptions.LIST_Error, "new-instance"); - /** <code>r: int[]; x: int :: r = new int[x]</code> */ + /** {@code r: int[]; x: int :: r = new int[x]} */ public static final Rop NEW_ARRAY_INT = new Rop(RegOps.NEW_ARRAY, Type.INT_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-int"); - /** <code>r: long[]; x: int :: r = new long[x]</code> */ + /** {@code r: long[]; x: int :: r = new long[x]} */ public static final Rop NEW_ARRAY_LONG = new Rop(RegOps.NEW_ARRAY, Type.LONG_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-long"); - /** <code>r: float[]; x: int :: r = new float[x]</code> */ + /** {@code r: float[]; x: int :: r = new float[x]} */ public static final Rop NEW_ARRAY_FLOAT = new Rop(RegOps.NEW_ARRAY, Type.FLOAT_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-float"); - /** <code>r: double[]; x: int :: r = new double[x]</code> */ + /** {@code r: double[]; x: int :: r = new double[x]} */ public static final Rop NEW_ARRAY_DOUBLE = new Rop(RegOps.NEW_ARRAY, Type.DOUBLE_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-double"); - /** <code>r: boolean[]; x: int :: r = new boolean[x]</code> */ + /** {@code r: boolean[]; x: int :: r = new boolean[x]} */ public static final Rop NEW_ARRAY_BOOLEAN = new Rop(RegOps.NEW_ARRAY, Type.BOOLEAN_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-boolean"); - /** <code>r: byte[]; x: int :: r = new byte[x]</code> */ + /** {@code r: byte[]; x: int :: r = new byte[x]} */ public static final Rop NEW_ARRAY_BYTE = new Rop(RegOps.NEW_ARRAY, Type.BYTE_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-byte"); - /** <code>r: char[]; x: int :: r = new char[x]</code> */ + /** {@code r: char[]; x: int :: r = new char[x]} */ public static final Rop NEW_ARRAY_CHAR = new Rop(RegOps.NEW_ARRAY, Type.CHAR_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-char"); - /** <code>r: short[]; x: int :: r = new short[x]</code> */ + /** {@code r: short[]; x: int :: r = new short[x]} */ public static final Rop NEW_ARRAY_SHORT = new Rop(RegOps.NEW_ARRAY, Type.SHORT_ARRAY, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-short"); /** - * <code>T: any non-array object type; x: Object :: (T) x</code> (can - * throw <code>ClassCastException</code>) + * {@code T: any non-array object type; x: Object :: (T) x} (can + * throw {@code ClassCastException}) */ public static final Rop CHECK_CAST = new Rop(RegOps.CHECK_CAST, Type.VOID, StdTypeList.OBJECT, Exceptions.LIST_Error_ClassCastException, "check-cast"); /** - * <code>T: any non-array object type; x: Object :: x instanceof - * T</code>. Note: This is listed as throwing <code>Error</code> + * {@code T: any non-array object type; x: Object :: x instanceof + * T}. Note: This is listed as throwing {@code Error} * explicitly because the op <i>can</i> throw, but there are no * other predefined exceptions for it. */ @@ -822,24 +822,24 @@ public final class Rops { Exceptions.LIST_Error, "instance-of"); /** - * <code>r: int; x: Object; f: instance field spec of - * type int :: r = x.f</code> + * {@code r: int; x: Object; f: instance field spec of + * type int :: r = x.f} */ public static final Rop GET_FIELD_INT = new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT, Exceptions.LIST_Error_NullPointerException, "get-field-int"); /** - * <code>r: long; x: Object; f: instance field spec of - * type long :: r = x.f</code> + * {@code r: long; x: Object; f: instance field spec of + * type long :: r = x.f} */ public static final Rop GET_FIELD_LONG = new Rop(RegOps.GET_FIELD, Type.LONG, StdTypeList.OBJECT, Exceptions.LIST_Error_NullPointerException, "get-field-long"); /** - * <code>r: float; x: Object; f: instance field spec of - * type float :: r = x.f</code> + * {@code r: float; x: Object; f: instance field spec of + * type float :: r = x.f} */ public static final Rop GET_FIELD_FLOAT = new Rop(RegOps.GET_FIELD, Type.FLOAT, StdTypeList.OBJECT, @@ -847,8 +847,8 @@ public final class Rops { "get-field-float"); /** - * <code>r: double; x: Object; f: instance field spec of - * type double :: r = x.f</code> + * {@code r: double; x: Object; f: instance field spec of + * type double :: r = x.f} */ public static final Rop GET_FIELD_DOUBLE = new Rop(RegOps.GET_FIELD, Type.DOUBLE, StdTypeList.OBJECT, @@ -856,8 +856,8 @@ public final class Rops { "get-field-double"); /** - * <code>r: Object; x: Object; f: instance field spec of - * type Object :: r = x.f</code> + * {@code r: Object; x: Object; f: instance field spec of + * type Object :: r = x.f} */ public static final Rop GET_FIELD_OBJECT = new Rop(RegOps.GET_FIELD, Type.OBJECT, StdTypeList.OBJECT, @@ -865,8 +865,8 @@ public final class Rops { "get-field-object"); /** - * <code>r: boolean; x: Object; f: instance field spec of - * type boolean :: r = x.f</code> + * {@code r: boolean; x: Object; f: instance field spec of + * type boolean :: r = x.f} */ public static final Rop GET_FIELD_BOOLEAN = new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT, @@ -874,8 +874,8 @@ public final class Rops { "get-field-boolean"); /** - * <code>r: byte; x: Object; f: instance field spec of - * type byte :: r = x.f</code> + * {@code r: byte; x: Object; f: instance field spec of + * type byte :: r = x.f} */ public static final Rop GET_FIELD_BYTE = new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT, @@ -883,8 +883,8 @@ public final class Rops { "get-field-byte"); /** - * <code>r: char; x: Object; f: instance field spec of - * type char :: r = x.f</code> + * {@code r: char; x: Object; f: instance field spec of + * type char :: r = x.f} */ public static final Rop GET_FIELD_CHAR = new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT, @@ -892,105 +892,78 @@ public final class Rops { "get-field-char"); /** - * <code>r: short; x: Object; f: instance field spec of - * type short :: r = x.f</code> + * {@code r: short; x: Object; f: instance field spec of + * type short :: r = x.f} */ public static final Rop GET_FIELD_SHORT = new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT, Exceptions.LIST_Error_NullPointerException, "get-field-short"); - /** - * <code>r: int; f: static field spec of type int :: r = - * f</code> - */ + /** {@code r: int; f: static field spec of type int :: r = f} */ public static final Rop GET_STATIC_INT = new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-static-int"); - /** - * <code>r: long; f: static field spec of type long :: r = - * f</code> - */ + /** {@code r: long; f: static field spec of type long :: r = f} */ public static final Rop GET_STATIC_LONG = new Rop(RegOps.GET_STATIC, Type.LONG, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-static-long"); - /** - * <code>r: float; f: static field spec of type float :: r = - * f</code> - */ + /** {@code r: float; f: static field spec of type float :: r = f} */ public static final Rop GET_STATIC_FLOAT = new Rop(RegOps.GET_STATIC, Type.FLOAT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-static-float"); - /** - * <code>r: double; f: static field spec of type double :: r = - * f</code> - */ + /** {@code r: double; f: static field spec of type double :: r = f} */ public static final Rop GET_STATIC_DOUBLE = new Rop(RegOps.GET_STATIC, Type.DOUBLE, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-static-double"); - /** - * <code>r: Object; f: static field spec of type Object :: r = - * f</code> - */ + /** {@code r: Object; f: static field spec of type Object :: r = f} */ public static final Rop GET_STATIC_OBJECT = new Rop(RegOps.GET_STATIC, Type.OBJECT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-static-object"); - /** - * <code>r: boolean; f: static field spec of type boolean :: r = - * f</code> - */ + /** {@code r: boolean; f: static field spec of type boolean :: r = f} */ public static final Rop GET_STATIC_BOOLEAN = new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-field-boolean"); - /** - * <code>r: byte; f: static field spec of type byte :: r = - * f</code> - */ + /** {@code r: byte; f: static field spec of type byte :: r = f} */ public static final Rop GET_STATIC_BYTE = new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-field-byte"); - /** - * <code>r: char; f: static field spec of type char :: r = - * f</code> - */ + /** {@code r: char; f: static field spec of type char :: r = f} */ public static final Rop GET_STATIC_CHAR = new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-field-char"); - /** - * <code>r: short; f: static field spec of type short :: r = - * f</code> - */ + /** {@code r: short; f: static field spec of type short :: r = f} */ public static final Rop GET_STATIC_SHORT = new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY, Exceptions.LIST_Error, "get-field-short"); /** - * <code>x: int; y: Object; f: instance field spec of type - * int :: y.f = x</code> + * {@code x: int; y: Object; f: instance field spec of type + * int :: y.f = x} */ public static final Rop PUT_FIELD_INT = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT, Exceptions.LIST_Error_NullPointerException, "put-field-int"); /** - * <code>x: long; y: Object; f: instance field spec of type - * long :: y.f = x</code> + * {@code x: long; y: Object; f: instance field spec of type + * long :: y.f = x} */ public static final Rop PUT_FIELD_LONG = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.LONG_OBJECT, Exceptions.LIST_Error_NullPointerException, "put-field-long"); /** - * <code>x: float; y: Object; f: instance field spec of type - * float :: y.f = x</code> + * {@code x: float; y: Object; f: instance field spec of type + * float :: y.f = x} */ public static final Rop PUT_FIELD_FLOAT = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.FLOAT_OBJECT, @@ -998,8 +971,8 @@ public final class Rops { "put-field-float"); /** - * <code>x: double; y: Object; f: instance field spec of type - * double :: y.f = x</code> + * {@code x: double; y: Object; f: instance field spec of type + * double :: y.f = x} */ public static final Rop PUT_FIELD_DOUBLE = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.DOUBLE_OBJECT, @@ -1007,8 +980,8 @@ public final class Rops { "put-field-double"); /** - * <code>x: Object; y: Object; f: instance field spec of type - * Object :: y.f = x</code> + * {@code x: Object; y: Object; f: instance field spec of type + * Object :: y.f = x} */ public static final Rop PUT_FIELD_OBJECT = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.OBJECT_OBJECT, @@ -1016,8 +989,8 @@ public final class Rops { "put-field-object"); /** - * <code>x: int; y: Object; f: instance field spec of type - * boolean :: y.f = x</code> + * {@code x: int; y: Object; f: instance field spec of type + * boolean :: y.f = x} */ public static final Rop PUT_FIELD_BOOLEAN = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT, @@ -1025,8 +998,8 @@ public final class Rops { "put-field-boolean"); /** - * <code>x: int; y: Object; f: instance field spec of type - * byte :: y.f = x</code> + * {@code x: int; y: Object; f: instance field spec of type + * byte :: y.f = x} */ public static final Rop PUT_FIELD_BYTE = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT, @@ -1034,8 +1007,8 @@ public final class Rops { "put-field-byte"); /** - * <code>x: int; y: Object; f: instance field spec of type - * char :: y.f = x</code> + * {@code x: int; y: Object; f: instance field spec of type + * char :: y.f = x} */ public static final Rop PUT_FIELD_CHAR = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT, @@ -1043,112 +1016,88 @@ public final class Rops { "put-field-char"); /** - * <code>x: int; y: Object; f: instance field spec of type - * short :: y.f = x</code> + * {@code x: int; y: Object; f: instance field spec of type + * short :: y.f = x} */ public static final Rop PUT_FIELD_SHORT = new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT, Exceptions.LIST_Error_NullPointerException, "put-field-short"); - /** - * <code>f: static field spec of type int; x: int :: f = - * x</code> - */ + /** {@code f: static field spec of type int; x: int :: f = x} */ public static final Rop PUT_STATIC_INT = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT, Exceptions.LIST_Error, "put-static-int"); - /** - * <code>f: static field spec of type long; x: long :: f = - * x</code> - */ + /** {@code f: static field spec of type long; x: long :: f = x} */ public static final Rop PUT_STATIC_LONG = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.LONG, Exceptions.LIST_Error, "put-static-long"); - /** - * <code>f: static field spec of type float; x: float :: f = - * x</code> - */ + /** {@code f: static field spec of type float; x: float :: f = x} */ public static final Rop PUT_STATIC_FLOAT = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.FLOAT, Exceptions.LIST_Error, "put-static-float"); - /** - * <code>f: static field spec of type double; x: double :: f = - * x</code> - */ + /** {@code f: static field spec of type double; x: double :: f = x} */ public static final Rop PUT_STATIC_DOUBLE = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.DOUBLE, Exceptions.LIST_Error, "put-static-double"); - /** - * <code>f: static field spec of type Object; x: Object :: f = - * x</code> - */ + /** {@code f: static field spec of type Object; x: Object :: f = x} */ public static final Rop PUT_STATIC_OBJECT = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.OBJECT, Exceptions.LIST_Error, "put-static-object"); /** - * <code>f: static field spec of type boolean; x: boolean :: f = - * x</code> + * {@code f: static field spec of type boolean; x: boolean :: f = + * x} */ public static final Rop PUT_STATIC_BOOLEAN = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT, Exceptions.LIST_Error, "put-static-boolean"); - /** - * <code>f: static field spec of type byte; x: byte :: f = - * x</code> - */ + /** {@code f: static field spec of type byte; x: byte :: f = x} */ public static final Rop PUT_STATIC_BYTE = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT, Exceptions.LIST_Error, "put-static-byte"); - /** - * <code>f: static field spec of type char; x: char :: f = - * x</code> - */ + /** {@code f: static field spec of type char; x: char :: f = x} */ public static final Rop PUT_STATIC_CHAR = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT, Exceptions.LIST_Error, "put-static-char"); - /** - * <code>f: static field spec of type short; x: short :: f = - * x</code> - */ + /** {@code f: static field spec of type short; x: short :: f = x} */ public static final Rop PUT_STATIC_SHORT = new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT, Exceptions.LIST_Error, "put-static-short"); - /** <code>x: Int :: local variable begins in x */ + /** {@code x: Int :: local variable begins in x} */ public static final Rop MARK_LOCAL_INT = new Rop (RegOps.MARK_LOCAL, Type.VOID, StdTypeList.INT, "mark-local-int"); - /** <code>x: Long :: local variable begins in x */ + /** {@code x: Long :: local variable begins in x} */ public static final Rop MARK_LOCAL_LONG = new Rop (RegOps.MARK_LOCAL, Type.VOID, StdTypeList.LONG, "mark-local-long"); - /** <code>x: Float :: local variable begins in x */ + /** {@code x: Float :: local variable begins in x} */ public static final Rop MARK_LOCAL_FLOAT = new Rop (RegOps.MARK_LOCAL, Type.VOID, StdTypeList.FLOAT, "mark-local-float"); - /** <code>x: Double :: local variable begins in x */ + /** {@code x: Double :: local variable begins in x} */ public static final Rop MARK_LOCAL_DOUBLE = new Rop (RegOps.MARK_LOCAL, Type.VOID, StdTypeList.DOUBLE, "mark-local-double"); - /** <code>x: Object :: local variable begins in x */ + /** {@code x: Object :: local variable begins in x} */ public static final Rop MARK_LOCAL_OBJECT = new Rop (RegOps.MARK_LOCAL, Type.VOID, StdTypeList.OBJECT, "mark-local-object"); - /** <code>T: Any primitive type; v0..vx: T :: {v0, ..., vx}</code> */ + /** {@code T: Any primitive type; v0..vx: T :: {v0, ..., vx}} */ public static final Rop FILL_ARRAY_DATA = new Rop(RegOps.FILL_ARRAY_DATA, Type.VOID, StdTypeList.EMPTY, "fill-array-data"); @@ -1164,13 +1113,14 @@ public final class Rops { * match what is returned. TODO: Revisit this issue.</p> * * @param opcode the opcode - * @param dest non-null; destination type, or {@link Type#VOID} if none - * @param sources non-null; list of source types - * @param cst null-ok; associated constant, if any - * @return non-null; an appropriate instance + * @param dest {@code non-null;} destination (result) type, or + * {@link Type#VOID} if none + * @param sources {@code non-null;} list of source types + * @param cst {@code null-ok;} associated constant, if any + * @return {@code non-null;} an appropriate instance */ public static Rop ropFor(int opcode, TypeBearer dest, TypeList sources, - Constant cst) { + Constant cst) { switch (opcode) { case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); @@ -1216,19 +1166,31 @@ public final class Rops { case RegOps.MONITOR_EXIT: return MONITOR_EXIT; case RegOps.AGET: { Type source = sources.getType(0); + Type componentType; if (source == Type.KNOWN_NULL) { - // Treat a known-null as an Object[] in this context. - source = Type.OBJECT_ARRAY; - } - return opAget(source.getComponentType()); + /* + * Treat a known-null as an array of the expected + * result type. + */ + componentType = dest.getType(); + } else { + componentType = source.getComponentType(); + } + return opAget(componentType); } case RegOps.APUT: { Type source = sources.getType(1); + Type componentType; if (source == Type.KNOWN_NULL) { - // Treat a known-null as an Object[] in this context. - source = Type.OBJECT_ARRAY; - } - return opAput(source.getComponentType()); + /* + * Treat a known-null as an array of the type being + * stored. + */ + componentType = sources.getType(0); + } else { + componentType = source.getComponentType(); + } + return opAput(componentType); } case RegOps.NEW_INSTANCE: return NEW_INSTANCE; case RegOps.NEW_ARRAY: return opNewArray(dest.getType()); @@ -1275,11 +1237,11 @@ public final class Rops { } /** - * Returns the appropriate <code>move</code> rop for the given type. The + * Returns the appropriate {@code move} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being moved - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being moved + * @return {@code non-null;} an appropriate instance */ public static Rop opMove(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -1295,11 +1257,11 @@ public final class Rops { } /** - * Returns the appropriate <code>move-param</code> rop for the + * Returns the appropriate {@code move-param} rop for the * given type. The result is a shared instance. * - * @param type non-null; type of value being moved - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being moved + * @return {@code non-null;} an appropriate instance */ public static Rop opMoveParam(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -1314,11 +1276,11 @@ public final class Rops { } /** - * Returns the appropriate <code>move-exception</code> rop for the + * Returns the appropriate {@code move-exception} rop for the * given type. The result may be a shared instance. * - * @param type non-null; type of the exception - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the exception + * @return {@code non-null;} an appropriate instance */ public static Rop opMoveException(TypeBearer type) { return new Rop(RegOps.MOVE_EXCEPTION, type.getType(), @@ -1326,11 +1288,11 @@ public final class Rops { } /** - * Returns the appropriate <code>move-result</code> rop for the + * Returns the appropriate {@code move-result} rop for the * given type. The result may be a shared instance. * - * @param type non-null; type of the parameter - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opMoveResult(TypeBearer type) { return new Rop(RegOps.MOVE_RESULT, type.getType(), @@ -1338,11 +1300,11 @@ public final class Rops { } /** - * Returns the appropriate <code>move-result-pseudo</code> rop for the + * Returns the appropriate {@code move-result-pseudo} rop for the * given type. The result may be a shared instance. * - * @param type non-null; type of the parameter - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opMoveResultPseudo(TypeBearer type) { return new Rop(RegOps.MOVE_RESULT_PSEUDO, type.getType(), @@ -1350,11 +1312,11 @@ public final class Rops { } /** - * Returns the appropriate <code>const</code> rop for the given + * Returns the appropriate {@code const} rop for the given * type. The result is a shared instance. * - * @param type non-null; type of the constant - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the constant + * @return {@code non-null;} an appropriate instance */ public static Rop opConst(TypeBearer type) { if (type.getType() == Type.KNOWN_NULL) { @@ -1373,11 +1335,11 @@ public final class Rops { } /** - * Returns the appropriate <code>if-eq</code> rop for the given + * Returns the appropriate {@code if-eq} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfEq(TypeList types) { return pickIf(types, IF_EQZ_INT, IF_EQZ_OBJECT, @@ -1385,11 +1347,11 @@ public final class Rops { } /** - * Returns the appropriate <code>if-ne</code> rop for the given + * Returns the appropriate {@code if-ne} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfNe(TypeList types) { return pickIf(types, IF_NEZ_INT, IF_NEZ_OBJECT, @@ -1397,60 +1359,60 @@ public final class Rops { } /** - * Returns the appropriate <code>if-lt</code> rop for the given + * Returns the appropriate {@code if-lt} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfLt(TypeList types) { return pickIf(types, IF_LTZ_INT, null, IF_LT_INT, null); } /** - * Returns the appropriate <code>if-ge</code> rop for the given + * Returns the appropriate {@code if-ge} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfGe(TypeList types) { return pickIf(types, IF_GEZ_INT, null, IF_GE_INT, null); } /** - * Returns the appropriate <code>if-gt</code> rop for the given + * Returns the appropriate {@code if-gt} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfGt(TypeList types) { return pickIf(types, IF_GTZ_INT, null, IF_GT_INT, null); } /** - * Returns the appropriate <code>if-le</code> rop for the given + * Returns the appropriate {@code if-le} rop for the given * sources. The result is a shared instance. * - * @param types non-null; source types - * @return non-null; an appropriate instance + * @param types {@code non-null;} source types + * @return {@code non-null;} an appropriate instance */ public static Rop opIfLe(TypeList types) { return pickIf(types, IF_LEZ_INT, null, IF_LE_INT, null); } /** - * Helper for all the <code>if*</code>-related methods, which + * Helper for all the {@code if*}-related methods, which * checks types and picks one of the four variants, throwing if * there's a problem. * - * @param types non-null; the types - * @param intZ non-null; the int-to-0 comparison - * @param objZ null-ok; the object-to-null comparison - * @param intInt non-null; the int-to-int comparison - * @param objObj non-null; the object-to-object comparison - * @return non-null; the appropriate instance + * @param types {@code non-null;} the types + * @param intZ {@code non-null;} the int-to-0 comparison + * @param objZ {@code null-ok;} the object-to-null comparison + * @param intInt {@code non-null;} the int-to-int comparison + * @param objObj {@code non-null;} the object-to-object comparison + * @return {@code non-null;} the appropriate instance */ private static Rop pickIf(TypeList types, Rop intZ, Rop objZ, Rop intInt, Rop objObj) { @@ -1490,11 +1452,11 @@ public final class Rops { } /** - * Returns the appropriate <code>add</code> rop for the given + * Returns the appropriate {@code add} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opAdd(TypeList types) { return pickBinaryOp(types, ADD_CONST_INT, ADD_CONST_LONG, @@ -1503,11 +1465,11 @@ public final class Rops { } /** - * Returns the appropriate <code>sub</code> rop for the given + * Returns the appropriate {@code sub} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opSub(TypeList types) { return pickBinaryOp(types, SUB_CONST_INT, SUB_CONST_LONG, @@ -1516,11 +1478,11 @@ public final class Rops { } /** - * Returns the appropriate <code>mul</code> rop for the given + * Returns the appropriate {@code mul} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opMul(TypeList types) { return pickBinaryOp(types, MUL_CONST_INT, MUL_CONST_LONG, @@ -1529,11 +1491,11 @@ public final class Rops { } /** - * Returns the appropriate <code>div</code> rop for the given + * Returns the appropriate {@code div} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opDiv(TypeList types) { return pickBinaryOp(types, DIV_CONST_INT, DIV_CONST_LONG, @@ -1542,11 +1504,11 @@ public final class Rops { } /** - * Returns the appropriate <code>rem</code> rop for the given + * Returns the appropriate {@code rem} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opRem(TypeList types) { return pickBinaryOp(types, REM_CONST_INT, REM_CONST_LONG, @@ -1555,11 +1517,11 @@ public final class Rops { } /** - * Returns the appropriate <code>and</code> rop for the given + * Returns the appropriate {@code and} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opAnd(TypeList types) { return pickBinaryOp(types, AND_CONST_INT, AND_CONST_LONG, null, null, @@ -1567,11 +1529,11 @@ public final class Rops { } /** - * Returns the appropriate <code>or</code> rop for the given + * Returns the appropriate {@code or} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opOr(TypeList types) { return pickBinaryOp(types, OR_CONST_INT, OR_CONST_LONG, null, null, @@ -1579,11 +1541,11 @@ public final class Rops { } /** - * Returns the appropriate <code>xor</code> rop for the given + * Returns the appropriate {@code xor} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opXor(TypeList types) { return pickBinaryOp(types, XOR_CONST_INT, XOR_CONST_LONG, null, null, @@ -1591,11 +1553,11 @@ public final class Rops { } /** - * Returns the appropriate <code>shl</code> rop for the given + * Returns the appropriate {@code shl} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opShl(TypeList types) { return pickBinaryOp(types, SHL_CONST_INT, SHL_CONST_LONG, null, null, @@ -1603,11 +1565,11 @@ public final class Rops { } /** - * Returns the appropriate <code>shr</code> rop for the given + * Returns the appropriate {@code shr} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opShr(TypeList types) { return pickBinaryOp(types, SHR_CONST_INT, SHR_CONST_LONG, null, null, @@ -1615,11 +1577,11 @@ public final class Rops { } /** - * Returns the appropriate <code>ushr</code> rop for the given + * Returns the appropriate {@code ushr} rop for the given * types. The result is a shared instance. * - * @param types non-null; types of the sources - * @return non-null; an appropriate instance + * @param types {@code non-null;} types of the sources + * @return {@code non-null;} an appropriate instance */ public static Rop opUshr(TypeList types) { return pickBinaryOp(types, USHR_CONST_INT, USHR_CONST_LONG, null, null, @@ -1630,16 +1592,16 @@ public final class Rops { * Returns the appropriate binary arithmetic rop for the given type * and arguments. The result is a shared instance. * - * @param types non-null; sources of the operation - * @param int1 non-null; the int-to-constant rop - * @param long1 non-null; the long-to-constant rop - * @param float1 null-ok; the float-to-constant rop, if any - * @param double1 null-ok; the double-to-constant rop, if any - * @param int2 non-null; the int-to-int rop - * @param long2 non-null; the long-to-long or long-to-int rop - * @param float2 null-ok; the float-to-float rop, if any - * @param double2 null-ok; the double-to-double rop, if any - * @return non-null; an appropriate instance + * @param types {@code non-null;} sources of the operation + * @param int1 {@code non-null;} the int-to-constant rop + * @param long1 {@code non-null;} the long-to-constant rop + * @param float1 {@code null-ok;} the float-to-constant rop, if any + * @param double1 {@code null-ok;} the double-to-constant rop, if any + * @param int2 {@code non-null;} the int-to-int rop + * @param long2 {@code non-null;} the long-to-long or long-to-int rop + * @param float2 {@code null-ok;} the float-to-float rop, if any + * @param double2 {@code null-ok;} the double-to-double rop, if any + * @return {@code non-null;} an appropriate instance */ private static Rop pickBinaryOp(TypeList types, Rop int1, Rop long1, Rop float1, Rop double1, Rop int2, @@ -1676,11 +1638,11 @@ public final class Rops { } /** - * Returns the appropriate <code>neg</code> rop for the given type. The + * Returns the appropriate {@code neg} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being operated on - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being operated on + * @return {@code non-null;} an appropriate instance */ public static Rop opNeg(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -1694,11 +1656,11 @@ public final class Rops { } /** - * Returns the appropriate <code>not</code> rop for the given type. The + * Returns the appropriate {@code not} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being operated on - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being operated on + * @return {@code non-null;} an appropriate instance */ public static Rop opNot(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -1710,11 +1672,11 @@ public final class Rops { } /** - * Returns the appropriate <code>cmpl</code> rop for the given type. The + * Returns the appropriate {@code cmpl} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being compared - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being compared + * @return {@code non-null;} an appropriate instance */ public static Rop opCmpl(TypeBearer type) { switch (type.getBasicType()) { @@ -1727,11 +1689,11 @@ public final class Rops { } /** - * Returns the appropriate <code>cmpg</code> rop for the given type. The + * Returns the appropriate {@code cmpg} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being compared - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being compared + * @return {@code non-null;} an appropriate instance */ public static Rop opCmpg(TypeBearer type) { switch (type.getBasicType()) { @@ -1743,12 +1705,12 @@ public final class Rops { } /** - * Returns the appropriate <code>conv</code> rop for the given types. The + * Returns the appropriate {@code conv} rop for the given types. The * result is a shared instance. * - * @param dest non-null; target value type - * @param source non-null; source value type - * @return non-null; an appropriate instance + * @param dest {@code non-null;} target value type + * @param source {@code non-null;} source value type + * @return {@code non-null;} an appropriate instance */ public static Rop opConv(TypeBearer dest, TypeBearer source) { int dbt = dest.getBasicFrameType(); @@ -1788,11 +1750,11 @@ public final class Rops { } /** - * Returns the appropriate <code>return</code> rop for the given type. The + * Returns the appropriate {@code return} rop for the given type. The * result is a shared instance. * - * @param type non-null; type of value being returned - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being returned + * @return {@code non-null;} an appropriate instance */ public static Rop opReturn(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -1808,11 +1770,11 @@ public final class Rops { } /** - * Returns the appropriate <code>aget</code> rop for the given type. The + * Returns the appropriate {@code aget} rop for the given type. The * result is a shared instance. * - * @param type non-null; element type of array being accessed - * @return non-null; an appropriate instance + * @param type {@code non-null;} element type of array being accessed + * @return {@code non-null;} an appropriate instance */ public static Rop opAget(TypeBearer type) { switch (type.getBasicType()) { @@ -1831,11 +1793,11 @@ public final class Rops { } /** - * Returns the appropriate <code>aput</code> rop for the given type. The + * Returns the appropriate {@code aput} rop for the given type. The * result is a shared instance. * - * @param type non-null; element type of array being accessed - * @return non-null; an appropriate instance + * @param type {@code non-null;} element type of array being accessed + * @return {@code non-null;} an appropriate instance */ public static Rop opAput(TypeBearer type) { switch (type.getBasicType()) { @@ -1854,11 +1816,11 @@ public final class Rops { } /** - * Returns the appropriate <code>new-array</code> rop for the given + * Returns the appropriate {@code new-array} rop for the given * type. The result is a shared instance. * - * @param arrayType non-null; array type of array being created - * @return non-null; an appropriate instance + * @param arrayType {@code non-null;} array type of array being created + * @return {@code non-null;} an appropriate instance */ public static Rop opNewArray(TypeBearer arrayType) { Type type = arrayType.getType(); @@ -1884,12 +1846,12 @@ public final class Rops { } /** - * Returns the appropriate <code>filled-new-array</code> rop for the given + * Returns the appropriate {@code filled-new-array} rop for the given * type. The result may be a shared instance. * - * @param arrayType non-null; type of array being created - * @param count >= 0; number of elements that the array should have - * @return non-null; an appropriate instance + * @param arrayType {@code non-null;} type of array being created + * @param count {@code >= 0;} number of elements that the array should have + * @return {@code non-null;} an appropriate instance */ public static Rop opFilledNewArray(TypeBearer arrayType, int count) { Type type = arrayType.getType(); @@ -1916,11 +1878,11 @@ public final class Rops { } /** - * Returns the appropriate <code>get-field</code> rop for the given + * Returns the appropriate {@code get-field} rop for the given * type. The result is a shared instance. * - * @param type non-null; type of the field in question - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the field in question + * @return {@code non-null;} an appropriate instance */ public static Rop opGetField(TypeBearer type) { switch (type.getBasicType()) { @@ -1939,11 +1901,11 @@ public final class Rops { } /** - * Returns the appropriate <code>put-field</code> rop for the given + * Returns the appropriate {@code put-field} rop for the given * type. The result is a shared instance. * - * @param type non-null; type of the field in question - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the field in question + * @return {@code non-null;} an appropriate instance */ public static Rop opPutField(TypeBearer type) { switch (type.getBasicType()) { @@ -1962,11 +1924,11 @@ public final class Rops { } /** - * Returns the appropriate <code>get-static</code> rop for the given + * Returns the appropriate {@code get-static} rop for the given * type. The result is a shared instance. * - * @param type non-null; type of the field in question - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the field in question + * @return {@code non-null;} an appropriate instance */ public static Rop opGetStatic(TypeBearer type) { switch (type.getBasicType()) { @@ -1985,11 +1947,11 @@ public final class Rops { } /** - * Returns the appropriate <code>put-static</code> rop for the given + * Returns the appropriate {@code put-static} rop for the given * type. The result is a shared instance. * - * @param type non-null; type of the field in question - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of the field in question + * @return {@code non-null;} an appropriate instance */ public static Rop opPutStatic(TypeBearer type) { switch (type.getBasicType()) { @@ -2008,11 +1970,11 @@ public final class Rops { } /** - * Returns the appropriate <code>invoke-static</code> rop for the + * Returns the appropriate {@code invoke-static} rop for the * given type. The result is typically a newly-allocated instance. * - * @param meth non-null; descriptor of the method - * @return non-null; an appropriate instance + * @param meth {@code non-null;} descriptor of the method + * @return {@code non-null;} an appropriate instance */ public static Rop opInvokeStatic(Prototype meth) { return new Rop(RegOps.INVOKE_STATIC, @@ -2021,12 +1983,12 @@ public final class Rops { } /** - * Returns the appropriate <code>invoke-virtual</code> rop for the + * Returns the appropriate {@code invoke-virtual} rop for the * given type. The result is typically a newly-allocated instance. * - * @param meth non-null; descriptor of the method, including the - * <code>this</code> parameter - * @return non-null; an appropriate instance + * @param meth {@code non-null;} descriptor of the method, including the + * {@code this} parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opInvokeVirtual(Prototype meth) { return new Rop(RegOps.INVOKE_VIRTUAL, @@ -2035,12 +1997,12 @@ public final class Rops { } /** - * Returns the appropriate <code>invoke-super</code> rop for the + * Returns the appropriate {@code invoke-super} rop for the * given type. The result is typically a newly-allocated instance. * - * @param meth non-null; descriptor of the method, including the - * <code>this</code> parameter - * @return non-null; an appropriate instance + * @param meth {@code non-null;} descriptor of the method, including the + * {@code this} parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opInvokeSuper(Prototype meth) { return new Rop(RegOps.INVOKE_SUPER, @@ -2049,12 +2011,12 @@ public final class Rops { } /** - * Returns the appropriate <code>invoke-direct</code> rop for the + * Returns the appropriate {@code invoke-direct} rop for the * given type. The result is typically a newly-allocated instance. * - * @param meth non-null; descriptor of the method, including the - * <code>this</code> parameter - * @return non-null; an appropriate instance + * @param meth {@code non-null;} descriptor of the method, including the + * {@code this} parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opInvokeDirect(Prototype meth) { return new Rop(RegOps.INVOKE_DIRECT, @@ -2063,12 +2025,12 @@ public final class Rops { } /** - * Returns the appropriate <code>invoke-interface</code> rop for the + * Returns the appropriate {@code invoke-interface} rop for the * given type. The result is typically a newly-allocated instance. * - * @param meth non-null; descriptor of the method, including the - * <code>this</code> parameter - * @return non-null; an appropriate instance + * @param meth {@code non-null;} descriptor of the method, including the + * {@code this} parameter + * @return {@code non-null;} an appropriate instance */ public static Rop opInvokeInterface(Prototype meth) { return new Rop(RegOps.INVOKE_INTERFACE, @@ -2077,11 +2039,11 @@ public final class Rops { } /** - * Returns the appropriate <code>mark-local</code> rop for the given type. + * Returns the appropriate {@code mark-local} rop for the given type. * The result is a shared instance. * - * @param type non-null; type of value being marked - * @return non-null; an appropriate instance + * @param type {@code non-null;} type of value being marked + * @return {@code non-null;} an appropriate instance */ public static Rop opMarkLocal(TypeBearer type) { switch (type.getBasicFrameType()) { @@ -2105,7 +2067,7 @@ public final class Rops { /** * Throws the right exception to complain about a bogus type. * - * @param type non-null; the bad type + * @param type {@code non-null;} the bad type * @return never */ private static Rop throwBadType(TypeBearer type) { @@ -2115,7 +2077,7 @@ public final class Rops { /** * Throws the right exception to complain about a bogus list of types. * - * @param types non-null; the bad types + * @param types {@code non-null;} the bad types * @return never */ private static Rop throwBadTypes(TypeList types) { diff --git a/dx/src/com/android/dx/rop/code/SourcePosition.java b/dx/src/com/android/dx/rop/code/SourcePosition.java index da66c7de2..f32caa15e 100644 --- a/dx/src/com/android/dx/rop/code/SourcePosition.java +++ b/dx/src/com/android/dx/rop/code/SourcePosition.java @@ -24,21 +24,21 @@ import com.android.dx.util.Hex; * line number and original bytecode address. */ public final class SourcePosition { - /** non-null; convenient "no information known" instance */ + /** {@code non-null;} convenient "no information known" instance */ public static final SourcePosition NO_INFO = new SourcePosition(null, -1, -1); - /** null-ok; name of the file of origin or <code>null</code> if unknown */ + /** {@code null-ok;} name of the file of origin or {@code null} if unknown */ private final CstUtf8 sourceFile; /** - * >= -1; the bytecode address, or <code>-1</code> if that + * {@code >= -1;} the bytecode address, or {@code -1} if that * information is unknown */ private final int address; /** - * >= -1; the line number, or <code>-1</code> if that + * {@code >= -1;} the line number, or {@code -1} if that * information is unknown */ private final int line; @@ -46,11 +46,11 @@ public final class SourcePosition { /** * Constructs an instance. * - * @param sourceFile null-ok; name of the file of origin or - * <code>null</code> if unknown - * @param address >= -1; original bytecode address or <code>-1</code> + * @param sourceFile {@code null-ok;} name of the file of origin or + * {@code null} if unknown + * @param address {@code >= -1;} original bytecode address or {@code -1} * if unknown - * @param line >= -1; original line number or <code>-1</code> if + * @param line {@code >= -1;} original line number or {@code -1} if * unknown */ public SourcePosition(CstUtf8 sourceFile, int address, int line) { @@ -118,8 +118,8 @@ public final class SourcePosition { * Returns whether the lines match between this instance and * the one given. * - * @param other non-null; the instance to compare to - * @return <code>true</code> iff the lines match + * @param other {@code non-null;} the instance to compare to + * @return {@code true} iff the lines match */ public boolean sameLine(SourcePosition other) { return (line == other.line); @@ -129,8 +129,8 @@ public final class SourcePosition { * Returns whether the lines and files match between this instance and * the one given. * - * @param other non-null; the instance to compare to - * @return <code>true</code> iff the lines and files match + * @param other {@code non-null;} the instance to compare to + * @return {@code true} iff the lines and files match */ public boolean sameLineAndFile(SourcePosition other) { return (line == other.line) && @@ -141,7 +141,7 @@ public final class SourcePosition { /** * Gets the source file, if known. * - * @return null-ok; the source file or <code>null</code> if unknown + * @return {@code null-ok;} the source file or {@code null} if unknown */ public CstUtf8 getSourceFile() { return sourceFile; @@ -150,7 +150,7 @@ public final class SourcePosition { /** * Gets the original bytecode address. * - * @return >= -1; the address or <code>-1</code> if unknown + * @return {@code >= -1;} the address or {@code -1} if unknown */ public int getAddress() { return address; @@ -159,7 +159,7 @@ public final class SourcePosition { /** * Gets the original line number. * - * @return >= -1; the original line number or <code>-1</code> if + * @return {@code >= -1;} the original line number or {@code -1} if * unknown */ public int getLine() { diff --git a/dx/src/com/android/dx/rop/code/SwitchInsn.java b/dx/src/com/android/dx/rop/code/SwitchInsn.java index fdf1a468f..586205bdf 100644 --- a/dx/src/com/android/dx/rop/code/SwitchInsn.java +++ b/dx/src/com/android/dx/rop/code/SwitchInsn.java @@ -26,17 +26,17 @@ import com.android.dx.util.IntList; */ public final class SwitchInsn extends Insn { - /** non-null; list of switch cases */ + /** {@code non-null;} list of switch cases */ private final IntList cases; /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param result null-ok; spec for the result, if any - * @param sources non-null; specs for all the sources - * @param cases non-null; list of switch cases + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param result {@code null-ok;} spec for the result, if any + * @param sources {@code non-null;} specs for all the sources + * @param cases {@code non-null;} list of switch cases */ public SwitchInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources, IntList cases) { @@ -90,7 +90,7 @@ public final class SwitchInsn * {@inheritDoc} * * <p> SwitchInsn always compares false. The current use for this method - * never encounters <code>SwitchInsn</code>s + * never encounters {@code SwitchInsn}s */ @Override public boolean contentEquals(Insn b) { @@ -111,7 +111,7 @@ public final class SwitchInsn /** * Gets the list of switch cases. * - * @return non-null; the case list + * @return {@code non-null;} the case list */ public IntList getCases() { return cases; diff --git a/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java b/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java index 49ebc91a5..b14e7588d 100644 --- a/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java +++ b/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java @@ -26,17 +26,17 @@ import com.android.dx.rop.type.TypeList; */ public final class ThrowingCstInsn extends CstInsn { - /** non-null; list of exceptions caught */ + /** {@code non-null;} list of exceptions caught */ private final TypeList catches; /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param sources non-null; specs for all the sources - * @param catches non-null; list of exceptions caught - * @param cst non-null; the constant + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param sources {@code non-null;} specs for all the sources + * @param catches {@code non-null;} list of exceptions caught + * @param cst {@code non-null;} the constant */ public ThrowingCstInsn(Rop opcode, SourcePosition position, RegisterSpecList sources, diff --git a/dx/src/com/android/dx/rop/code/ThrowingInsn.java b/dx/src/com/android/dx/rop/code/ThrowingInsn.java index 24a5bed9b..78dc87489 100644 --- a/dx/src/com/android/dx/rop/code/ThrowingInsn.java +++ b/dx/src/com/android/dx/rop/code/ThrowingInsn.java @@ -20,22 +20,22 @@ import com.android.dx.rop.type.Type; import com.android.dx.rop.type.TypeList; /** - * Instruction which possibly throws. The <code>successors</code> list in the + * Instruction which possibly throws. The {@code successors} list in the * basic block an instance of this class is inside corresponds in-order to * the list of exceptions handled by this instruction, with the * no-exception case appended as the final target. */ public final class ThrowingInsn extends Insn { - /** non-null; list of exceptions caught */ + /** {@code non-null;} list of exceptions caught */ private final TypeList catches; /** * Gets the string form of a register spec list to be used as a catches * list. * - * @param catches non-null; the catches list - * @return non-null; the string form + * @param catches {@code non-null;} the catches list + * @return {@code non-null;} the string form */ public static String toCatchString(TypeList catches) { StringBuffer sb = new StringBuffer(100); @@ -54,10 +54,10 @@ public final class ThrowingInsn /** * Constructs an instance. * - * @param opcode non-null; the opcode - * @param position non-null; source position - * @param sources non-null; specs for all the sources - * @param catches non-null; list of exceptions caught + * @param opcode {@code non-null;} the opcode + * @param position {@code non-null;} source position + * @param sources {@code non-null;} specs for all the sources + * @param catches {@code non-null;} list of exceptions caught */ public ThrowingInsn(Rop opcode, SourcePosition position, RegisterSpecList sources, diff --git a/dx/src/com/android/dx/rop/code/TranslationAdvice.java b/dx/src/com/android/dx/rop/code/TranslationAdvice.java index 8c2cde984..832d84df6 100644 --- a/dx/src/com/android/dx/rop/code/TranslationAdvice.java +++ b/dx/src/com/android/dx/rop/code/TranslationAdvice.java @@ -30,10 +30,10 @@ public interface TranslationAdvice { * last argument must have a type which indicates it is a known constant.) * The instruction associated must have exactly two sources. * - * @param opcode non-null; the opcode - * @param sourceA non-null; the first source - * @param sourceB non-null; the second source - * @return <code>true</code> iff the target can represent the operation + * @param opcode {@code non-null;} the opcode + * @param sourceA {@code non-null;} the first source + * @param sourceB {@code non-null;} the second source + * @return {@code true} iff the target can represent the operation * using a constant for the last argument */ public boolean hasConstantOperation(Rop opcode, @@ -43,9 +43,9 @@ public interface TranslationAdvice { * Returns true if the translation target requires the sources of the * specified opcode to be in order and contiguous (eg, for an invoke-range) * - * @param opcode non-null; opcode - * @param sources non-null; source list - * @return <code>true</code> iff the target requires the sources to be + * @param opcode {@code non-null;} opcode + * @param sources {@code non-null;} source list + * @return {@code true} iff the target requires the sources to be * in order and contiguous. */ public boolean requiresSourcesInOrder(Rop opcode, RegisterSpecList sources); diff --git a/dx/src/com/android/dx/rop/cst/Constant.java b/dx/src/com/android/dx/rop/cst/Constant.java index 0f440103c..64231d3b3 100644 --- a/dx/src/com/android/dx/rop/cst/Constant.java +++ b/dx/src/com/android/dx/rop/cst/Constant.java @@ -24,11 +24,11 @@ import com.android.dx.util.ToHuman; public abstract class Constant implements ToHuman, Comparable<Constant> { /** - * Returns <code>true</code> if this instance is a category-2 constant, + * Returns {@code true} if this instance is a category-2 constant, * meaning it takes up two slots in the constant pool, or - * <code>false</code> if this instance is category-1. + * {@code false} if this instance is category-1. * - * @return <code>true</code> iff this instance is category-2 + * @return {@code true} iff this instance is category-2 */ public abstract boolean isCategory2(); @@ -36,7 +36,7 @@ public abstract class Constant * Returns the human name for the particular type of constant * this instance is. * - * @return non-null; the name + * @return {@code non-null;} the name */ public abstract String typeName(); @@ -60,8 +60,8 @@ public abstract class Constant * Compare the values of this and another instance, which are guaranteed * to be of the same class. Subclasses must implement this. * - * @param other non-null; the instance to compare to - * @return <code>-1</code>, <code>0</code>, or <code>1</code>, as usual + * @param other {@code non-null;} the instance to compare to + * @return {@code -1}, {@code 0}, or {@code 1}, as usual * for a comparison */ protected abstract int compareTo0(Constant other); diff --git a/dx/src/com/android/dx/rop/cst/ConstantPool.java b/dx/src/com/android/dx/rop/cst/ConstantPool.java index 9a64a2aab..efc394daa 100644 --- a/dx/src/com/android/dx/rop/cst/ConstantPool.java +++ b/dx/src/com/android/dx/rop/cst/ConstantPool.java @@ -23,47 +23,47 @@ package com.android.dx.rop.cst; public interface ConstantPool { /** * Get the "size" of the constant pool. This corresponds to the - * class file field <code>constant_pool_count</code>, and is in fact + * class file field {@code constant_pool_count}, and is in fact * always at least one more than the actual size of the constant pool, - * as element <code>0</code> is always invalid. + * as element {@code 0} is always invalid. * - * @return <code>>= 1</code>; the size + * @return {@code >= 1;} the size */ public int size(); /** - * Get the <code>n</code>th entry in the constant pool, which must + * Get the {@code n}th entry in the constant pool, which must * be valid. * - * @param n <code>n >= 0, n < size()</code>; the constant pool index - * @return non-null; the corresponding entry - * @throws IllegalArgumentException thrown if <code>n</code> is + * @param n {@code n >= 0, n < size();} the constant pool index + * @return {@code non-null;} the corresponding entry + * @throws IllegalArgumentException thrown if {@code n} is * in-range but invalid */ public Constant get(int n); /** - * Get the <code>n</code>th entry in the constant pool, which must - * be valid unless <code>n == 0</code>, in which case <code>null</code> + * Get the {@code n}th entry in the constant pool, which must + * be valid unless {@code n == 0}, in which case {@code null} * is returned. * - * @param n <code>n >= 0, n < size()</code>; the constant pool index - * @return null-ok; the corresponding entry, if <code>n != 0</code> - * @throws IllegalArgumentException thrown if <code>n</code> is + * @param n {@code n >= 0, n < size();} the constant pool index + * @return {@code null-ok;} the corresponding entry, if {@code n != 0} + * @throws IllegalArgumentException thrown if {@code n} is * in-range and non-zero but invalid */ public Constant get0Ok(int n); /** - * Get the <code>n</code>th entry in the constant pool, or - * <code>null</code> if the index is in-range but invalid. In - * particular, <code>null</code> is returned for index <code>0</code> + * Get the {@code n}th entry in the constant pool, or + * {@code null} if the index is in-range but invalid. In + * particular, {@code null} is returned for index {@code 0} * as well as the index after any entry which is defined to take up - * two slots (that is, <code>Long</code> and <code>Double</code> + * two slots (that is, {@code Long} and {@code Double} * entries). * - * @param n <code>n >= 0, n < size()</code>; the constant pool index - * @return null-ok; the corresponding entry, or <code>null</code> if + * @param n {@code n >= 0, n < size();} the constant pool index + * @return {@code null-ok;} the corresponding entry, or {@code null} if * the index is in-range but invalid */ public Constant getOrNull(int n); diff --git a/dx/src/com/android/dx/rop/cst/CstAnnotation.java b/dx/src/com/android/dx/rop/cst/CstAnnotation.java index d6dc1f255..1385798c9 100644 --- a/dx/src/com/android/dx/rop/cst/CstAnnotation.java +++ b/dx/src/com/android/dx/rop/cst/CstAnnotation.java @@ -22,13 +22,13 @@ import com.android.dx.rop.annotation.Annotation; * Constant type that represents an annotation. */ public final class CstAnnotation extends Constant { - /** non-null; the actual annotation */ + /** {@code non-null;} the actual annotation */ private final Annotation annotation; /** * Constructs an instance. * - * @param annotation non-null; the annotation to hold + * @param annotation {@code non-null;} the annotation to hold */ public CstAnnotation(Annotation annotation) { if (annotation == null) { @@ -88,7 +88,7 @@ public final class CstAnnotation extends Constant { /** * Get the underlying annotation. * - * @return non-null; the annotation + * @return {@code non-null;} the annotation */ public Annotation getAnnotation() { return annotation; diff --git a/dx/src/com/android/dx/rop/cst/CstArray.java b/dx/src/com/android/dx/rop/cst/CstArray.java index 69c0aeffa..8b521bdc9 100644 --- a/dx/src/com/android/dx/rop/cst/CstArray.java +++ b/dx/src/com/android/dx/rop/cst/CstArray.java @@ -24,13 +24,13 @@ import com.android.dx.util.FixedSizeList; * may be of any type <i>other</i> than {@link CstUtf8}. */ public final class CstArray extends Constant { - /** non-null; the actual list of contents */ + /** {@code non-null;} the actual list of contents */ private final List list; /** * Constructs an instance. * - * @param list non-null; the actual list of contents + * @param list {@code non-null;} the actual list of contents */ public CstArray(List list) { if (list == null) { @@ -90,7 +90,7 @@ public final class CstArray extends Constant { /** * Get the underlying list. * - * @return non-null; the list + * @return {@code non-null;} the list */ public List getList() { return list; @@ -103,7 +103,7 @@ public final class CstArray extends Constant { extends FixedSizeList implements Comparable<List> { /** * Constructs an instance. All indices initially contain - * <code>null</code>. + * {@code null}. * * @param size the size of the list */ @@ -138,10 +138,10 @@ public final class CstArray extends Constant { /** * Gets the element at the given index. It is an error to call * this with the index for an element which was never set; if you - * do that, this will throw <code>NullPointerException</code>. + * do that, this will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which index - * @return non-null; element at that index + * @param n {@code >= 0, < size();} which index + * @return {@code non-null;} element at that index */ public Constant get(int n) { return (Constant) get0(n); @@ -150,8 +150,8 @@ public final class CstArray extends Constant { /** * Sets the element at the given index. * - * @param n >= 0, < size(); which index - * @param a null-ok; the element to set at <code>n</code> + * @param n {@code >= 0, < size();} which index + * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Constant a) { if (a instanceof CstUtf8) { diff --git a/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java b/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java index c8856019d..039d7edb5 100644 --- a/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java +++ b/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java @@ -28,20 +28,20 @@ import com.android.dx.rop.type.TypeBearer; */ public abstract class CstBaseMethodRef extends CstMemberRef { - /** non-null; the raw prototype for this method */ + /** {@code non-null;} the raw prototype for this method */ private final Prototype prototype; /** - * null-ok; the prototype for this method taken to be an instance - * method, or <code>null</code> if not yet calculated + * {@code null-ok;} the prototype for this method taken to be an instance + * method, or {@code null} if not yet calculated */ private Prototype instancePrototype; /** * Constructs an instance. * - * @param definingClass non-null; the type of the defining class - * @param nat non-null; the name-and-type + * @param definingClass {@code non-null;} the type of the defining class + * @param nat {@code non-null;} the name-and-type */ /*package*/ CstBaseMethodRef(CstType definingClass, CstNat nat) { super(definingClass, nat); @@ -53,9 +53,9 @@ public abstract class CstBaseMethodRef /** * Gets the raw prototype of this method. This doesn't include a - * <code>this</code> argument. + * {@code this} argument. * - * @return non-null; the method prototype + * @return {@code non-null;} the method prototype */ public final Prototype getPrototype() { return prototype; @@ -63,14 +63,14 @@ public abstract class CstBaseMethodRef /** * Gets the prototype of this method as either a - * <code>static</code> or instance method. In the case of a - * <code>static</code> method, this is the same as the raw + * {@code static} or instance method. In the case of a + * {@code static} method, this is the same as the raw * prototype. In the case of an instance method, this has an - * appropriately-typed <code>this</code> argument as the first + * appropriately-typed {@code this} argument as the first * one. * * @param isStatic whether the method should be considered static - * @return non-null; the method prototype + * @return {@code non-null;} the method prototype */ public final Prototype getPrototype(boolean isStatic) { if (isStatic) { @@ -102,7 +102,7 @@ public abstract class CstBaseMethodRef * * In this case, this method returns the <i>return type</i> of this method. * - * @return non-null; the method's return type + * @return {@code non-null;} the method's return type */ public final Type getType() { return prototype.getReturnType(); @@ -111,15 +111,15 @@ public abstract class CstBaseMethodRef /** * Gets the number of words of parameters required by this * method's descriptor. Since instances of this class have no way - * to know if they will be used in a <code>static</code> or + * to know if they will be used in a {@code static} or * instance context, one has to indicate this explicitly as an * argument. This method is just a convenient shorthand for - * <code>getPrototype().getParameterTypes().getWordCount()</code>, - * plus <code>1</code> if the method is to be treated as an + * {@code getPrototype().getParameterTypes().getWordCount()}, + * plus {@code 1} if the method is to be treated as an * instance method. * * @param isStatic whether the method should be considered static - * @return >= 0; the argument word count + * @return {@code >= 0;} the argument word count */ public final int getParameterWordCount(boolean isStatic) { return getPrototype(isStatic).getParameterTypes().getWordCount(); @@ -128,9 +128,9 @@ public abstract class CstBaseMethodRef /** * Gets whether this is a reference to an instance initialization * method. This is just a convenient shorthand for - * <code>getNat().isInstanceInit()</code>. + * {@code getNat().isInstanceInit()}. * - * @return <code>true</code> iff this is a reference to an + * @return {@code true} iff this is a reference to an * instance initialization method */ public final boolean isInstanceInit() { @@ -140,9 +140,9 @@ public abstract class CstBaseMethodRef /** * Gets whether this is a reference to a class initialization * method. This is just a convenient shorthand for - * <code>getNat().isClassInit()</code>. + * {@code getNat().isClassInit()}. * - * @return <code>true</code> iff this is a reference to an + * @return {@code true} iff this is a reference to an * instance initialization method */ public final boolean isClassInit() { diff --git a/dx/src/com/android/dx/rop/cst/CstBoolean.java b/dx/src/com/android/dx/rop/cst/CstBoolean.java index ab25d5bcf..8c290ef20 100644 --- a/dx/src/com/android/dx/rop/cst/CstBoolean.java +++ b/dx/src/com/android/dx/rop/cst/CstBoolean.java @@ -19,33 +19,33 @@ package com.android.dx.rop.cst; import com.android.dx.rop.type.Type; /** - * Constants of type <code>boolean</code>. + * Constants of type {@code boolean}. */ public final class CstBoolean extends CstLiteral32 { - /** non-null; instance representing <code>false</code> */ + /** {@code non-null;} instance representing {@code false} */ public static final CstBoolean VALUE_FALSE = new CstBoolean(false); - /** non-null; instance representing <code>true</code> */ + /** {@code non-null;} instance representing {@code true} */ public static final CstBoolean VALUE_TRUE = new CstBoolean(true); /** * Makes an instance for the given value. This will return an * already-allocated instance. * - * @param value the <code>boolean</code> value - * @return non-null; the appropriate instance + * @param value the {@code boolean} value + * @return {@code non-null;} the appropriate instance */ public static CstBoolean make(boolean value) { return value ? VALUE_TRUE : VALUE_FALSE; } /** - * Makes an instance for the given <code>int</code> value. This + * Makes an instance for the given {@code int} value. This * will return an already-allocated instance. * - * @param value must be either <code>0</code> or <code>1</code> - * @return non-null; the appropriate instance + * @param value must be either {@code 0} or {@code 1} + * @return {@code non-null;} the appropriate instance */ public static CstBoolean make(int value) { if (value == 0) { @@ -60,7 +60,7 @@ public final class CstBoolean /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>boolean</code> value + * @param value the {@code boolean} value */ private CstBoolean(boolean value) { super(value ? 1 : 0); @@ -89,7 +89,7 @@ public final class CstBoolean } /** - * Gets the <code>boolean</code> value. + * Gets the {@code boolean} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstByte.java b/dx/src/com/android/dx/rop/cst/CstByte.java index ffc3206b6..a8af9f786 100644 --- a/dx/src/com/android/dx/rop/cst/CstByte.java +++ b/dx/src/com/android/dx/rop/cst/CstByte.java @@ -20,30 +20,30 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>byte</code>. + * Constants of type {@code byte}. */ public final class CstByte extends CstLiteral32 { - /** non-null; the value <code>0</code> as an instance of this class */ + /** {@code non-null;} the value {@code 0} as an instance of this class */ public static final CstByte VALUE_0 = make((byte) 0); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param value the <code>byte</code> value + * @param value the {@code byte} value */ public static CstByte make(byte value) { return new CstByte(value); } /** - * Makes an instance for the given <code>int</code> value. This + * Makes an instance for the given {@code int} value. This * may (but does not necessarily) return an already-allocated * instance. * - * @param value the value, which must be in range for a <code>byte</code> - * @return non-null; the appropriate instance + * @param value the value, which must be in range for a {@code byte} + * @return {@code non-null;} the appropriate instance */ public static CstByte make(int value) { byte cast = (byte) value; @@ -59,7 +59,7 @@ public final class CstByte /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>byte</code> value + * @param value the {@code byte} value */ private CstByte(byte value) { super(value); @@ -89,7 +89,7 @@ public final class CstByte } /** - * Gets the <code>byte</code> value. + * Gets the {@code byte} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstChar.java b/dx/src/com/android/dx/rop/cst/CstChar.java index a31bd7fc0..0a87cbc65 100644 --- a/dx/src/com/android/dx/rop/cst/CstChar.java +++ b/dx/src/com/android/dx/rop/cst/CstChar.java @@ -20,30 +20,30 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>char</code>. + * Constants of type {@code char}. */ public final class CstChar extends CstLiteral32 { - /** non-null; the value <code>0</code> as an instance of this class */ + /** {@code non-null;} the value {@code 0} as an instance of this class */ public static final CstChar VALUE_0 = make((char) 0); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param value the <code>char</code> value + * @param value the {@code char} value */ public static CstChar make(char value) { return new CstChar(value); } /** - * Makes an instance for the given <code>int</code> value. This + * Makes an instance for the given {@code int} value. This * may (but does not necessarily) return an already-allocated * instance. * - * @param value the value, which must be in range for a <code>char</code> - * @return non-null; the appropriate instance + * @param value the value, which must be in range for a {@code char} + * @return {@code non-null;} the appropriate instance */ public static CstChar make(int value) { char cast = (char) value; @@ -59,7 +59,7 @@ public final class CstChar /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>char</code> value + * @param value the {@code char} value */ private CstChar(char value) { super(value); @@ -89,7 +89,7 @@ public final class CstChar } /** - * Gets the <code>char</code> value. + * Gets the {@code char} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstDouble.java b/dx/src/com/android/dx/rop/cst/CstDouble.java index 451666791..df4a2cf79 100644 --- a/dx/src/com/android/dx/rop/cst/CstDouble.java +++ b/dx/src/com/android/dx/rop/cst/CstDouble.java @@ -20,15 +20,15 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>CONSTANT_Double_info</code>. + * Constants of type {@code CONSTANT_Double_info}. */ public final class CstDouble extends CstLiteral64 { - /** non-null; instance representing <code>0</code> */ + /** {@code non-null;} instance representing {@code 0} */ public static final CstDouble VALUE_0 = new CstDouble(Double.doubleToLongBits(0.0)); - /** non-null; instance representing <code>1</code> */ + /** {@code non-null;} instance representing {@code 1} */ public static final CstDouble VALUE_1 = new CstDouble(Double.doubleToLongBits(1.0)); @@ -36,7 +36,7 @@ public final class CstDouble * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param bits the <code>double</code> value as <code>long</code> bits + * @param bits the {@code double} value as {@code long} bits */ public static CstDouble make(long bits) { /* @@ -49,7 +49,7 @@ public final class CstDouble /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param bits the <code>double</code> value as <code>long</code> bits + * @param bits the {@code double} value as {@code long} bits */ private CstDouble(long bits) { super(bits); @@ -80,7 +80,7 @@ public final class CstDouble } /** - * Gets the <code>double</code> value. + * Gets the {@code double} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstEnumRef.java b/dx/src/com/android/dx/rop/cst/CstEnumRef.java index f5aec0549..78cab9df3 100644 --- a/dx/src/com/android/dx/rop/cst/CstEnumRef.java +++ b/dx/src/com/android/dx/rop/cst/CstEnumRef.java @@ -23,13 +23,13 @@ import com.android.dx.rop.type.Type; * value of an enumerated type. */ public final class CstEnumRef extends CstMemberRef { - /** null-ok; the corresponding field ref, lazily initialized */ + /** {@code null-ok;} the corresponding field ref, lazily initialized */ private CstFieldRef fieldRef; /** * Constructs an instance. * - * @param nat non-null; the name-and-type; the defining class is derived + * @param nat {@code non-null;} the name-and-type; the defining class is derived * from this */ public CstEnumRef(CstNat nat) { @@ -56,7 +56,7 @@ public final class CstEnumRef extends CstMemberRef { /** * Get a {@link CstFieldRef} that corresponds with this instance. * - * @return non-null; the corresponding field reference + * @return {@code non-null;} the corresponding field reference */ public CstFieldRef getFieldRef() { if (fieldRef == null) { diff --git a/dx/src/com/android/dx/rop/cst/CstFieldRef.java b/dx/src/com/android/dx/rop/cst/CstFieldRef.java index 306eca928..497531fa5 100644 --- a/dx/src/com/android/dx/rop/cst/CstFieldRef.java +++ b/dx/src/com/android/dx/rop/cst/CstFieldRef.java @@ -19,7 +19,7 @@ package com.android.dx.rop.cst; import com.android.dx.rop.type.Type; /** - * Constants of type <code>CONSTANT_Fieldref_info</code>. + * Constants of type {@code CONSTANT_Fieldref_info}. */ public final class CstFieldRef extends CstMemberRef { /** @@ -27,10 +27,10 @@ public final class CstFieldRef extends CstMemberRef { * field which should hold the class corresponding to a given * primitive type. For example, if given {@link Type#INT}, this * method returns an instance corresponding to the field - * <code>java.lang.Integer.TYPE</code>. + * {@code java.lang.Integer.TYPE}. * - * @param primitiveType non-null; the primitive type - * @return non-null; the corresponding static field + * @param primitiveType {@code non-null;} the primitive type + * @return {@code non-null;} the corresponding static field */ public static CstFieldRef forPrimitiveType(Type primitiveType) { return new CstFieldRef(CstType.forBoxedPrimitiveType(primitiveType), @@ -40,8 +40,8 @@ public final class CstFieldRef extends CstMemberRef { /** * Constructs an instance. * - * @param definingClass non-null; the type of the defining class - * @param nat non-null; the name-and-type + * @param definingClass {@code non-null;} the type of the defining class + * @param nat {@code non-null;} the name-and-type */ public CstFieldRef(CstType definingClass, CstNat nat) { super(definingClass, nat); @@ -56,7 +56,7 @@ public final class CstFieldRef extends CstMemberRef { /** * Returns the type of this field. * - * @return non-null; the field's type + * @return {@code non-null;} the field's type */ public Type getType() { return getNat().getFieldType(); diff --git a/dx/src/com/android/dx/rop/cst/CstFloat.java b/dx/src/com/android/dx/rop/cst/CstFloat.java index 08b7f764e..531a20d96 100644 --- a/dx/src/com/android/dx/rop/cst/CstFloat.java +++ b/dx/src/com/android/dx/rop/cst/CstFloat.java @@ -20,24 +20,24 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>CONSTANT_Float_info</code>. + * Constants of type {@code CONSTANT_Float_info}. */ public final class CstFloat extends CstLiteral32 { - /** non-null; instance representing <code>0</code> */ + /** {@code non-null;} instance representing {@code 0} */ public static final CstFloat VALUE_0 = make(Float.floatToIntBits(0.0f)); - /** non-null; instance representing <code>1</code> */ + /** {@code non-null;} instance representing {@code 1} */ public static final CstFloat VALUE_1 = make(Float.floatToIntBits(1.0f)); - /** non-null; instance representing <code>2</code> */ + /** {@code non-null;} instance representing {@code 2} */ public static final CstFloat VALUE_2 = make(Float.floatToIntBits(2.0f)); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param bits the <code>float</code> value as <code>int</code> bits + * @param bits the {@code float} value as {@code int} bits */ public static CstFloat make(int bits) { /* @@ -50,7 +50,7 @@ public final class CstFloat /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param bits the <code>float</code> value as <code>int</code> bits + * @param bits the {@code float} value as {@code int} bits */ private CstFloat(int bits) { super(bits); @@ -81,7 +81,7 @@ public final class CstFloat } /** - * Gets the <code>float</code> value. + * Gets the {@code float} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstInteger.java b/dx/src/com/android/dx/rop/cst/CstInteger.java index d3fafccd7..8fae4fa57 100644 --- a/dx/src/com/android/dx/rop/cst/CstInteger.java +++ b/dx/src/com/android/dx/rop/cst/CstInteger.java @@ -20,40 +20,40 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>CONSTANT_Integer_info</code>. + * Constants of type {@code CONSTANT_Integer_info}. */ public final class CstInteger extends CstLiteral32 { - /** non-null; array of cached instances */ + /** {@code non-null;} array of cached instances */ private static final CstInteger[] cache = new CstInteger[511]; - /** non-null; instance representing <code>-1</code> */ + /** {@code non-null;} instance representing {@code -1} */ public static final CstInteger VALUE_M1 = make(-1); - /** non-null; instance representing <code>0</code> */ + /** {@code non-null;} instance representing {@code 0} */ public static final CstInteger VALUE_0 = make(0); - /** non-null; instance representing <code>1</code> */ + /** {@code non-null;} instance representing {@code 1} */ public static final CstInteger VALUE_1 = make(1); - /** non-null; instance representing <code>2</code> */ + /** {@code non-null;} instance representing {@code 2} */ public static final CstInteger VALUE_2 = make(2); - /** non-null; instance representing <code>3</code> */ + /** {@code non-null;} instance representing {@code 3} */ public static final CstInteger VALUE_3 = make(3); - /** non-null; instance representing <code>4</code> */ + /** {@code non-null;} instance representing {@code 4} */ public static final CstInteger VALUE_4 = make(4); - /** non-null; instance representing <code>5</code> */ + /** {@code non-null;} instance representing {@code 5} */ public static final CstInteger VALUE_5 = make(5); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param value the <code>int</code> value - * @return non-null; the appropriate instance + * @param value the {@code int} value + * @return {@code non-null;} the appropriate instance */ public static CstInteger make(int value) { /* @@ -76,7 +76,7 @@ public final class CstInteger /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>int</code> value + * @param value the {@code int} value */ private CstInteger(int value) { super(value); @@ -106,7 +106,7 @@ public final class CstInteger } /** - * Gets the <code>int</code> value. + * Gets the {@code int} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java b/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java index f169ec939..55a75995a 100644 --- a/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java +++ b/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java @@ -17,12 +17,12 @@ package com.android.dx.rop.cst; /** - * Constants of type <code>CONSTANT_InterfaceMethodref_info</code>. + * Constants of type {@code CONSTANT_InterfaceMethodref_info}. */ public final class CstInterfaceMethodRef extends CstBaseMethodRef { /** - * null-ok; normal {@link CstMethodRef} that corresponds to this + * {@code null-ok;} normal {@link CstMethodRef} that corresponds to this * instance, if calculated */ private CstMethodRef methodRef; @@ -30,8 +30,8 @@ public final class CstInterfaceMethodRef /** * Constructs an instance. * - * @param definingClass non-null; the type of the defining class - * @param nat non-null; the name-and-type + * @param definingClass {@code non-null;} the type of the defining class + * @param nat {@code non-null;} the name-and-type */ public CstInterfaceMethodRef(CstType definingClass, CstNat nat) { super(definingClass, nat); @@ -48,7 +48,7 @@ public final class CstInterfaceMethodRef * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * - * @return non-null; an appropriate instance + * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { diff --git a/dx/src/com/android/dx/rop/cst/CstKnownNull.java b/dx/src/com/android/dx/rop/cst/CstKnownNull.java index 853e57e56..09dde1b31 100644 --- a/dx/src/com/android/dx/rop/cst/CstKnownNull.java +++ b/dx/src/com/android/dx/rop/cst/CstKnownNull.java @@ -19,10 +19,10 @@ package com.android.dx.rop.cst; import com.android.dx.rop.type.Type; /** - * Constant type to represent a known-<code>null</code> value. + * Constant type to represent a known-{@code null} value. */ public final class CstKnownNull extends CstLiteralBits { - /** non-null; unique instance of this class */ + /** {@code non-null;} unique instance of this class */ public static final CstKnownNull THE_ONE = new CstKnownNull(); /** diff --git a/dx/src/com/android/dx/rop/cst/CstLiteral32.java b/dx/src/com/android/dx/rop/cst/CstLiteral32.java index 31e96dd63..c6e3021eb 100644 --- a/dx/src/com/android/dx/rop/cst/CstLiteral32.java +++ b/dx/src/com/android/dx/rop/cst/CstLiteral32.java @@ -21,13 +21,13 @@ package com.android.dx.rop.cst; */ public abstract class CstLiteral32 extends CstLiteralBits { - /** the value as <code>int</code> bits */ + /** the value as {@code int} bits */ private final int bits; /** * Constructs an instance. * - * @param bits the value as <code>int</code> bits + * @param bits the value as {@code int} bits */ /*package*/ CstLiteral32(int bits) { this.bits = bits; diff --git a/dx/src/com/android/dx/rop/cst/CstLiteral64.java b/dx/src/com/android/dx/rop/cst/CstLiteral64.java index dd7d24dea..d0b27d2b0 100644 --- a/dx/src/com/android/dx/rop/cst/CstLiteral64.java +++ b/dx/src/com/android/dx/rop/cst/CstLiteral64.java @@ -21,13 +21,13 @@ package com.android.dx.rop.cst; */ public abstract class CstLiteral64 extends CstLiteralBits { - /** the value as <code>long</code> bits */ + /** the value as {@code long} bits */ private final long bits; /** * Constructs an instance. * - * @param bits the value as <code>long</code> bits + * @param bits the value as {@code long} bits */ /*package*/ CstLiteral64(long bits) { this.bits = bits; diff --git a/dx/src/com/android/dx/rop/cst/CstLiteralBits.java b/dx/src/com/android/dx/rop/cst/CstLiteralBits.java index 98a3f0e53..64154874b 100644 --- a/dx/src/com/android/dx/rop/cst/CstLiteralBits.java +++ b/dx/src/com/android/dx/rop/cst/CstLiteralBits.java @@ -23,18 +23,18 @@ public abstract class CstLiteralBits extends TypedConstant { /** * Returns whether or not this instance's value may be accurately - * represented as an <code>int</code>. The rule is that if there - * is an <code>int</code> which may be sign-extended to yield this - * instance's value, then this method returns <code>true</code>. - * Otherwise, it returns <code>false</code>. + * represented as an {@code int}. The rule is that if there + * is an {@code int} which may be sign-extended to yield this + * instance's value, then this method returns {@code true}. + * Otherwise, it returns {@code false}. * - * @return <code>true</code> iff this instance fits in an <code>int</code> + * @return {@code true} iff this instance fits in an {@code int} */ public abstract boolean fitsInInt(); /** - * Gets the value as <code>int</code> bits. If this instance contains - * more bits than fit in an <code>int</code>, then this returns only + * Gets the value as {@code int} bits. If this instance contains + * more bits than fit in an {@code int}, then this returns only * the low-order bits. * * @return the bits @@ -42,8 +42,8 @@ public abstract class CstLiteralBits public abstract int getIntBits(); /** - * Gets the value as <code>long</code> bits. If this instance contains - * fewer bits than fit in a <code>long</code>, then the result of this + * Gets the value as {@code long} bits. If this instance contains + * fewer bits than fit in a {@code long}, then the result of this * method is the sign extension of the value. * * @return the bits diff --git a/dx/src/com/android/dx/rop/cst/CstLong.java b/dx/src/com/android/dx/rop/cst/CstLong.java index 377eb9312..c89a33992 100644 --- a/dx/src/com/android/dx/rop/cst/CstLong.java +++ b/dx/src/com/android/dx/rop/cst/CstLong.java @@ -20,21 +20,21 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>CONSTANT_Long_info</code>. + * Constants of type {@code CONSTANT_Long_info}. */ public final class CstLong extends CstLiteral64 { - /** non-null; instance representing <code>0</code> */ + /** {@code non-null;} instance representing {@code 0} */ public static final CstLong VALUE_0 = make(0); - /** non-null; instance representing <code>1</code> */ + /** {@code non-null;} instance representing {@code 1} */ public static final CstLong VALUE_1 = make(1); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param value the <code>long</code> value + * @param value the {@code long} value */ public static CstLong make(long value) { /* @@ -47,7 +47,7 @@ public final class CstLong /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>long</code> value + * @param value the {@code long} value */ private CstLong(long value) { super(value); @@ -77,7 +77,7 @@ public final class CstLong } /** - * Gets the <code>long</code> value. + * Gets the {@code long} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstMemberRef.java b/dx/src/com/android/dx/rop/cst/CstMemberRef.java index dbaad47eb..bae47c210 100644 --- a/dx/src/com/android/dx/rop/cst/CstMemberRef.java +++ b/dx/src/com/android/dx/rop/cst/CstMemberRef.java @@ -17,20 +17,20 @@ package com.android.dx.rop.cst; /** - * Constants of type <code>CONSTANT_*ref_info</code>. + * Constants of type {@code CONSTANT_*ref_info}. */ public abstract class CstMemberRef extends TypedConstant { - /** non-null; the type of the defining class */ + /** {@code non-null;} the type of the defining class */ private final CstType definingClass; - /** non-null; the name-and-type */ + /** {@code non-null;} the name-and-type */ private final CstNat nat; /** * Constructs an instance. * - * @param definingClass non-null; the type of the defining class - * @param nat non-null; the name-and-type + * @param definingClass {@code non-null;} the type of the defining class + * @param nat {@code non-null;} the name-and-type */ /*package*/ CstMemberRef(CstType definingClass, CstNat nat) { if (definingClass == null) { @@ -68,7 +68,7 @@ public abstract class CstMemberRef extends TypedConstant { * * <p><b>Note:</b> This implementation just compares the defining * class and name, and it is up to subclasses to compare the rest - * after calling <code>super.compareTo0()</code>.</p> + * after calling {@code super.compareTo0()}.</p> */ @Override protected int compareTo0(Constant other) { @@ -105,7 +105,7 @@ public abstract class CstMemberRef extends TypedConstant { /** * Gets the type of the defining class. * - * @return non-null; the type of defining class + * @return {@code non-null;} the type of defining class */ public final CstType getDefiningClass() { return definingClass; @@ -114,7 +114,7 @@ public abstract class CstMemberRef extends TypedConstant { /** * Gets the defining name-and-type. * - * @return non-null; the name-and-type + * @return {@code non-null;} the name-and-type */ public final CstNat getNat() { return nat; diff --git a/dx/src/com/android/dx/rop/cst/CstMethodRef.java b/dx/src/com/android/dx/rop/cst/CstMethodRef.java index 766c9bfba..77c97e9d1 100644 --- a/dx/src/com/android/dx/rop/cst/CstMethodRef.java +++ b/dx/src/com/android/dx/rop/cst/CstMethodRef.java @@ -17,15 +17,15 @@ package com.android.dx.rop.cst; /** - * Constants of type <code>CONSTANT_Methodref_info</code>. + * Constants of type {@code CONSTANT_Methodref_info}. */ public final class CstMethodRef extends CstBaseMethodRef { /** * Constructs an instance. * - * @param definingClass non-null; the type of the defining class - * @param nat non-null; the name-and-type + * @param definingClass {@code non-null;} the type of the defining class + * @param nat {@code non-null;} the name-and-type */ public CstMethodRef(CstType definingClass, CstNat nat) { super(definingClass, nat); diff --git a/dx/src/com/android/dx/rop/cst/CstNat.java b/dx/src/com/android/dx/rop/cst/CstNat.java index 106b599cc..5270fd2c7 100644 --- a/dx/src/com/android/dx/rop/cst/CstNat.java +++ b/dx/src/com/android/dx/rop/cst/CstNat.java @@ -19,29 +19,29 @@ package com.android.dx.rop.cst; import com.android.dx.rop.type.Type; /** - * Constants of type <code>CONSTANT_NameAndType_info</code>. + * Constants of type {@code CONSTANT_NameAndType_info}. */ public final class CstNat extends Constant { /** - * non-null; the instance for name <code>TYPE</code> and descriptor - * <code>java.lang.Class</code>, which is useful when dealing with + * {@code non-null;} the instance for name {@code TYPE} and descriptor + * {@code java.lang.Class}, which is useful when dealing with * wrapped primitives */ public static final CstNat PRIMITIVE_TYPE_NAT = new CstNat(new CstUtf8("TYPE"), new CstUtf8("Ljava/lang/Class;")); - /** non-null; the name */ + /** {@code non-null;} the name */ private final CstUtf8 name; - /** non-null; the descriptor (type) */ + /** {@code non-null;} the descriptor (type) */ private final CstUtf8 descriptor; /** * Constructs an instance. * - * @param name non-null; the name - * @param descriptor non-null; the descriptor + * @param name {@code non-null;} the name + * @param descriptor {@code non-null;} the descriptor */ public CstNat(CstUtf8 name, CstUtf8 descriptor) { if (name == null) { @@ -108,7 +108,7 @@ public final class CstNat extends Constant { /** * Gets the name. * - * @return non-null; the name + * @return {@code non-null;} the name */ public CstUtf8 getName() { return name; @@ -117,7 +117,7 @@ public final class CstNat extends Constant { /** * Gets the descriptor. * - * @return non-null; the descriptor + * @return {@code non-null;} the descriptor */ public CstUtf8 getDescriptor() { return descriptor; @@ -127,7 +127,7 @@ public final class CstNat extends Constant { * Returns an unadorned but human-readable version of the name-and-type * value. * - * @return non-null; the human form + * @return {@code non-null;} the human form */ public String toHuman() { return name.toHuman() + ':' + descriptor.toHuman(); @@ -138,7 +138,7 @@ public final class CstNat extends Constant { * This method is only valid to call if the descriptor in fact describes * a field (and not a method). * - * @return non-null; the field type + * @return {@code non-null;} the field type */ public Type getFieldType() { return Type.intern(descriptor.getString()); @@ -147,9 +147,9 @@ public final class CstNat extends Constant { /** * Gets whether this instance has the name of a standard instance * initialization method. This is just a convenient shorthand for - * <code>getName().getString().equals("<init>")</code>. + * {@code getName().getString().equals("<init>")}. * - * @return <code>true</code> iff this is a reference to an + * @return {@code true} iff this is a reference to an * instance initialization method */ public final boolean isInstanceInit() { @@ -159,9 +159,9 @@ public final class CstNat extends Constant { /** * Gets whether this instance has the name of a standard class * initialization method. This is just a convenient shorthand for - * <code>getName().getString().equals("<clinit>")</code>. + * {@code getName().getString().equals("<clinit>")}. * - * @return <code>true</code> iff this is a reference to an + * @return {@code true} iff this is a reference to an * instance initialization method */ public final boolean isClassInit() { diff --git a/dx/src/com/android/dx/rop/cst/CstShort.java b/dx/src/com/android/dx/rop/cst/CstShort.java index 38042541a..4ac2f68da 100644 --- a/dx/src/com/android/dx/rop/cst/CstShort.java +++ b/dx/src/com/android/dx/rop/cst/CstShort.java @@ -20,31 +20,31 @@ import com.android.dx.rop.type.Type; import com.android.dx.util.Hex; /** - * Constants of type <code>short</code>. + * Constants of type {@code short}. */ public final class CstShort extends CstLiteral32 { - /** non-null; the value <code>0</code> as an instance of this class */ + /** {@code non-null;} the value {@code 0} as an instance of this class */ public static final CstShort VALUE_0 = make((short) 0); /** * Makes an instance for the given value. This may (but does not * necessarily) return an already-allocated instance. * - * @param value the <code>short</code> value - * @return non-null; the appropriate instance + * @param value the {@code short} value + * @return {@code non-null;} the appropriate instance */ public static CstShort make(short value) { return new CstShort(value); } /** - * Makes an instance for the given <code>int</code> value. This + * Makes an instance for the given {@code int} value. This * may (but does not necessarily) return an already-allocated * instance. * - * @param value the value, which must be in range for a <code>short</code> - * @return non-null; the appropriate instance + * @param value the value, which must be in range for a {@code short} + * @return {@code non-null;} the appropriate instance */ public static CstShort make(int value) { short cast = (short) value; @@ -60,7 +60,7 @@ public final class CstShort /** * Constructs an instance. This constructor is private; use {@link #make}. * - * @param value the <code>short</code> value + * @param value the {@code short} value */ private CstShort(short value) { super(value); @@ -90,7 +90,7 @@ public final class CstShort } /** - * Gets the <code>short</code> value. + * Gets the {@code short} value. * * @return the value */ diff --git a/dx/src/com/android/dx/rop/cst/CstString.java b/dx/src/com/android/dx/rop/cst/CstString.java index 89a4c8bfe..ce00f5275 100644 --- a/dx/src/com/android/dx/rop/cst/CstString.java +++ b/dx/src/com/android/dx/rop/cst/CstString.java @@ -19,17 +19,17 @@ package com.android.dx.rop.cst; import com.android.dx.rop.type.Type; /** - * Constants of type <code>CONSTANT_String_info</code>. + * Constants of type {@code CONSTANT_String_info}. */ public final class CstString extends TypedConstant { - /** non-null; the string value */ + /** {@code non-null;} the string value */ private final CstUtf8 string; /** * Constructs an instance. * - * @param string non-null; the string value + * @param string {@code non-null;} the string value */ public CstString(CstUtf8 string) { if (string == null) { @@ -42,7 +42,7 @@ public final class CstString /** * Constructs an instance. * - * @param string non-null; the string value + * @param string {@code non-null;} the string value */ public CstString(String string) { this(new CstUtf8(string)); @@ -101,7 +101,7 @@ public final class CstString /** * Gets the string value. * - * @return non-null; the string value + * @return {@code non-null;} the string value */ public CstUtf8 getString() { return string; diff --git a/dx/src/com/android/dx/rop/cst/CstType.java b/dx/src/com/android/dx/rop/cst/CstType.java index 02df28d98..6dc986785 100644 --- a/dx/src/com/android/dx/rop/cst/CstType.java +++ b/dx/src/com/android/dx/rop/cst/CstType.java @@ -24,69 +24,69 @@ import java.util.HashMap; * Constants that represent an arbitrary type (reference or primitive). */ public final class CstType extends TypedConstant { - /** non-null; map of interned types */ + /** {@code non-null;} map of interned types */ private static final HashMap<Type, CstType> interns = new HashMap<Type, CstType>(100); - /** non-null; instance corresponding to the class <code>Object</code> */ + /** {@code non-null;} instance corresponding to the class {@code Object} */ public static final CstType OBJECT = intern(Type.OBJECT); - /** non-null; instance corresponding to the class <code>Boolean</code> */ + /** {@code non-null;} instance corresponding to the class {@code Boolean} */ public static final CstType BOOLEAN = intern(Type.BOOLEAN_CLASS); - /** non-null; instance corresponding to the class <code>Byte</code> */ + /** {@code non-null;} instance corresponding to the class {@code Byte} */ public static final CstType BYTE = intern(Type.BYTE_CLASS); - /** non-null; instance corresponding to the class <code>Character</code> */ + /** {@code non-null;} instance corresponding to the class {@code Character} */ public static final CstType CHARACTER = intern(Type.CHARACTER_CLASS); - /** non-null; instance corresponding to the class <code>Double</code> */ + /** {@code non-null;} instance corresponding to the class {@code Double} */ public static final CstType DOUBLE = intern(Type.DOUBLE_CLASS); - /** non-null; instance corresponding to the class <code>Float</code> */ + /** {@code non-null;} instance corresponding to the class {@code Float} */ public static final CstType FLOAT = intern(Type.FLOAT_CLASS); - /** non-null; instance corresponding to the class <code>Long</code> */ + /** {@code non-null;} instance corresponding to the class {@code Long} */ public static final CstType LONG = intern(Type.LONG_CLASS); - /** non-null; instance corresponding to the class <code>Integer</code> */ + /** {@code non-null;} instance corresponding to the class {@code Integer} */ public static final CstType INTEGER = intern(Type.INTEGER_CLASS); - /** non-null; instance corresponding to the class <code>Short</code> */ + /** {@code non-null;} instance corresponding to the class {@code Short} */ public static final CstType SHORT = intern(Type.SHORT_CLASS); - /** non-null; instance corresponding to the class <code>Void</code> */ + /** {@code non-null;} instance corresponding to the class {@code Void} */ public static final CstType VOID = intern(Type.VOID_CLASS); - /** non-null; instance corresponding to the type <code>boolean[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code boolean[]} */ public static final CstType BOOLEAN_ARRAY = intern(Type.BOOLEAN_ARRAY); - /** non-null; instance corresponding to the type <code>byte[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code byte[]} */ public static final CstType BYTE_ARRAY = intern(Type.BYTE_ARRAY); - /** non-null; instance corresponding to the type <code>char[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code char[]} */ public static final CstType CHAR_ARRAY = intern(Type.CHAR_ARRAY); - /** non-null; instance corresponding to the type <code>double[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code double[]} */ public static final CstType DOUBLE_ARRAY = intern(Type.DOUBLE_ARRAY); - /** non-null; instance corresponding to the type <code>float[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code float[]} */ public static final CstType FLOAT_ARRAY = intern(Type.FLOAT_ARRAY); - /** non-null; instance corresponding to the type <code>long[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code long[]} */ public static final CstType LONG_ARRAY = intern(Type.LONG_ARRAY); - /** non-null; instance corresponding to the type <code>int[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code int[]} */ public static final CstType INT_ARRAY = intern(Type.INT_ARRAY); - /** non-null; instance corresponding to the type <code>short[]</code> */ + /** {@code non-null;} instance corresponding to the type {@code short[]} */ public static final CstType SHORT_ARRAY = intern(Type.SHORT_ARRAY); - /** non-null; the underlying type */ + /** {@code non-null;} the underlying type */ private final Type type; /** - * null-ok; the type descriptor corresponding to this instance, if + * {@code null-ok;} the type descriptor corresponding to this instance, if * calculated */ private CstUtf8 descriptor; @@ -95,10 +95,10 @@ public final class CstType extends TypedConstant { * Returns an instance of this class that represents the wrapper * class corresponding to a given primitive type. For example, if * given {@link Type#INT}, this method returns the class reference - * <code>java.lang.Integer</code>. + * {@code java.lang.Integer}. * - * @param primitiveType non-null; the primitive type - * @return non-null; the corresponding wrapper class + * @param primitiveType {@code non-null;} the primitive type + * @return {@code non-null;} the corresponding wrapper class */ public static CstType forBoxedPrimitiveType(Type primitiveType) { switch (primitiveType.getBasicType()) { @@ -119,8 +119,8 @@ public final class CstType extends TypedConstant { /** * Returns an interned instance of this class for the given type. * - * @param type non-null; the underlying type - * @return non-null; an appropriately-constructed instance + * @param type {@code non-null;} the underlying type + * @return {@code non-null;} an appropriately-constructed instance */ public static CstType intern(Type type) { CstType cst = interns.get(type); @@ -136,7 +136,7 @@ public final class CstType extends TypedConstant { /** * Constructs an instance. * - * @param type non-null; the underlying type + * @param type {@code non-null;} the underlying type */ public CstType(Type type) { if (type == null) { @@ -207,9 +207,9 @@ public final class CstType extends TypedConstant { /** * Gets the underlying type (as opposed to the type corresponding * to this instance as a constant, which is always - * <code>Class</code>). + * {@code Class}). * - * @return non-null; the type corresponding to the name + * @return {@code non-null;} the type corresponding to the name */ public Type getClassType() { return type; @@ -218,7 +218,7 @@ public final class CstType extends TypedConstant { /** * Gets the type descriptor for this instance. * - * @return non-null; the descriptor + * @return {@code non-null;} the descriptor */ public CstUtf8 getDescriptor() { if (descriptor == null) { diff --git a/dx/src/com/android/dx/rop/cst/CstUtf8.java b/dx/src/com/android/dx/rop/cst/CstUtf8.java index f0ca5f5b9..2c7a1df83 100644 --- a/dx/src/com/android/dx/rop/cst/CstUtf8.java +++ b/dx/src/com/android/dx/rop/cst/CstUtf8.java @@ -20,19 +20,19 @@ import com.android.dx.util.ByteArray; import com.android.dx.util.Hex; /** - * Constants of type <code>CONSTANT_Utf8_info</code>. + * Constants of type {@code CONSTANT_Utf8_info}. */ public final class CstUtf8 extends Constant { /** - * non-null; instance representing <code>""</code>, that is, the + * {@code non-null;} instance representing {@code ""}, that is, the * empty string */ public static final CstUtf8 EMPTY_STRING = new CstUtf8(""); - /** non-null; the UTF-8 value as a string */ + /** {@code non-null;} the UTF-8 value as a string */ private final String string; - /** non-null; the UTF-8 value as bytes */ + /** {@code non-null;} the UTF-8 value as bytes */ private final ByteArray bytes; /** @@ -40,8 +40,8 @@ public final class CstUtf8 extends Constant { * differs from normal UTF-8 in the handling of character '\0' and * surrogate pairs. * - * @param string non-null; the string to convert - * @return non-null; the UTF-8 bytes for it + * @param string {@code non-null;} the string to convert + * @return {@code non-null;} the UTF-8 bytes for it */ public static byte[] stringToUtf8Bytes(String string) { int len = string.length(); @@ -73,8 +73,8 @@ public final class CstUtf8 extends Constant { /** * Converts an array of UTF-8 bytes into a string. * - * @param bytes non-null; the bytes to convert - * @return non-null; the converted string + * @param bytes {@code non-null;} the bytes to convert + * @return {@code non-null;} the converted string */ public static String utf8BytesToString(ByteArray bytes) { int length = bytes.size(); @@ -173,9 +173,9 @@ public final class CstUtf8 extends Constant { } /** - * Constructs an instance from a <code>String</code>. + * Constructs an instance from a {@code String}. * - * @param string non-null; the UTF-8 value as a string + * @param string {@code non-null;} the UTF-8 value as a string */ public CstUtf8(String string) { if (string == null) { @@ -189,7 +189,7 @@ public final class CstUtf8 extends Constant { /** * Constructs an instance from some UTF-8 bytes. * - * @param bytes non-null; array of the UTF-8 bytes + * @param bytes {@code non-null;} array of the UTF-8 bytes */ public CstUtf8(ByteArray bytes) { if (bytes == null) { @@ -299,7 +299,7 @@ public final class CstUtf8 extends Constant { * Gets the value as a human-oriented string, surrounded by double * quotes. * - * @return non-null; the quoted string + * @return {@code non-null;} the quoted string */ public String toQuoted() { return '\"' + toHuman() + '\"'; @@ -310,8 +310,8 @@ public final class CstUtf8 extends Constant { * quotes, but ellipsizes the result if it is longer than the given * maximum length * - * @param maxLength >= 5; the maximum length of the string to return - * @return non-null; the quoted string + * @param maxLength {@code >= 5;} the maximum length of the string to return + * @return {@code non-null;} the quoted string */ public String toQuoted(int maxLength) { String string = toHuman(); @@ -332,7 +332,7 @@ public final class CstUtf8 extends Constant { * Gets the UTF-8 value as a string. * The returned string is always already interned. * - * @return non-null; the UTF-8 value as a string + * @return {@code non-null;} the UTF-8 value as a string */ public String getString() { return string; @@ -341,7 +341,7 @@ public final class CstUtf8 extends Constant { /** * Gets the UTF-8 value as UTF-8 encoded bytes. * - * @return non-null; an array of the UTF-8 bytes + * @return {@code non-null;} an array of the UTF-8 bytes */ public ByteArray getBytes() { return bytes; @@ -351,7 +351,7 @@ public final class CstUtf8 extends Constant { * Gets the size of this instance as UTF-8 code points. That is, * get the number of bytes in the UTF-8 encoding of this instance. * - * @return >= 0; the UTF-8 size + * @return {@code >= 0;} the UTF-8 size */ public int getUtf8Size() { return bytes.size(); @@ -360,10 +360,10 @@ public final class CstUtf8 extends Constant { /** * Gets the size of this instance as UTF-16 code points. That is, * get the number of 16-bit chars in the UTF-16 encoding of this - * instance. This is the same as the <code>length</code> of the - * Java <code>String</code> representation of this instance. + * instance. This is the same as the {@code length} of the + * Java {@code String} representation of this instance. * - * @return >= 0; the UTF-16 size + * @return {@code >= 0;} the UTF-16 size */ public int getUtf16Size() { return string.length(); diff --git a/dx/src/com/android/dx/rop/cst/StdConstantPool.java b/dx/src/com/android/dx/rop/cst/StdConstantPool.java index 69791020f..82c3ab760 100644 --- a/dx/src/com/android/dx/rop/cst/StdConstantPool.java +++ b/dx/src/com/android/dx/rop/cst/StdConstantPool.java @@ -26,16 +26,16 @@ import com.android.dx.util.MutabilityControl; */ public final class StdConstantPool extends MutabilityControl implements ConstantPool { - /** non-null; array of entries */ + /** {@code non-null;} array of entries */ private final Constant[] entries; /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the pool; this corresponds to the - * class file field <code>constant_pool_count</code>, and is in fact + * class file field {@code constant_pool_count}, and is in fact * always at least one more than the actual size of the constant pool, - * as element <code>0</code> is always invalid. + * as element {@code 0} is always invalid. */ public StdConstantPool(int size) { super(size > 1); @@ -90,8 +90,8 @@ public final class StdConstantPool /** * Sets the entry at the given index. * - * @param n >= 1, < size(); which entry - * @param cst null-ok; the constant to store + * @param n {@code >= 1, < size();} which entry + * @param cst {@code null-ok;} the constant to store */ public void set(int n, Constant cst) { throwIfImmutable(); diff --git a/dx/src/com/android/dx/rop/cst/TypedConstant.java b/dx/src/com/android/dx/rop/cst/TypedConstant.java index 54472b058..823d9c4fa 100644 --- a/dx/src/com/android/dx/rop/cst/TypedConstant.java +++ b/dx/src/com/android/dx/rop/cst/TypedConstant.java @@ -26,7 +26,7 @@ public abstract class TypedConstant /** * {@inheritDoc} * - * This implentation always returns <code>this</code>. + * This implentation always returns {@code this}. */ public final TypeBearer getFrameType() { return this; diff --git a/dx/src/com/android/dx/rop/cst/Zeroes.java b/dx/src/com/android/dx/rop/cst/Zeroes.java index 3379b6cc4..8bed657a2 100644 --- a/dx/src/com/android/dx/rop/cst/Zeroes.java +++ b/dx/src/com/android/dx/rop/cst/Zeroes.java @@ -30,10 +30,10 @@ public final class Zeroes { } /** - * Gets the "zero" (or <code>null</code>) value for the given type. + * Gets the "zero" (or {@code null}) value for the given type. * - * @param type non-null; the type in question - * @return non-null; its "zero" value + * @param type {@code non-null;} the type in question + * @return {@code non-null;} its "zero" value */ public static Constant zeroFor(Type type) { switch (type.getBasicType()) { diff --git a/dx/src/com/android/dx/rop/package-info.java b/dx/src/com/android/dx/rop/package-info.java index 97fe9de73..aaf21eed3 100644 --- a/dx/src/com/android/dx/rop/package-info.java +++ b/dx/src/com/android/dx/rop/package-info.java @@ -19,7 +19,7 @@ package com.android.dx.rop; /** * <h1>An Introduction to Rop Form</h1> * - * This package contains classes associated with dx's <code>Rop</code> + * This package contains classes associated with dx's {@code Rop} * intermediate form.<p> * * The Rop form is intended to represent the instructions and the control-flow @@ -33,16 +33,16 @@ package com.android.dx.rop; * <li> {@link BasicBlock} and its per-method container, {@link BasicBlockList}, * the representation of control flow elements. * <li> {@link Insn} and its subclasses along with its per-basic block - * container {@link InsnList}. <code>Insn</code> instances represent + * container {@link InsnList}. {@code Insn} instances represent * individual instructions in the abstract register machine. * <li> {@link RegisterSpec} and its container {@link RegisterSpecList}. A * register spec encodes register number, register width, type information, * and potentially local variable information as well for instruction sources * and results. * <li> {@link Rop} instances represent opcodes in the abstract machine. Many - * <code>Rop</code> instances are singletons defined in static fields in + * {@code Rop} instances are singletons defined in static fields in * {@link Rops}. The rest are constructed dynamically using static methods - * in <code>Rops</code> + * in {@code Rops} * <li> {@link RegOps} lists numeric constants for the opcodes * <li> {@link Constant} and its subclasses represent constant data values * that opcodes may refer to. @@ -62,8 +62,8 @@ package com.android.dx.rop; * bytecode. Blocks that don't originate directly from source bytecode have * labels generated for them in a mostly arbitrary order.<p> * - * Blocks are referred to by their label, for the most part, because <code> - * BasicBlock</code> instances are immutable and thus any modification to + * Blocks are referred to by their label, for the most part, because + * {@code BasicBlock} instances are immutable and thus any modification to * the control flow graph or the instruction list results in replacement * instances (with identical labels) being created.<p> * @@ -105,7 +105,7 @@ package com.android.dx.rop; * instruction where a catch block exists inside the current method for that * exception class. Since the only possible path is the exception path, only * the exception path (which cannot be a primary successor) is a successor. - * An example of this is shown in <code>dx/tests/092-ssa-cfg-edge-cases</code>. + * An example of this is shown in {@code dx/tests/092-ssa-cfg-edge-cases}. * * <h2>Rop Instructions</h2> * @@ -123,18 +123,18 @@ package com.android.dx.rop; * Rops#MOVE_RESULT move-result} or {@link Rops#MOVE_RESULT_PSEUDO * move-result-pseudo} instructions at the top of the primary successor block. * - * Only a single <code>move-result</code> or <code>move-result-pseudo</code> + * Only a single {@code move-result} or {@code move-result-pseudo} * may exist in any block and it must be exactly the first instruction in the * block. * - * A <code>move-result</code> instruction is used for the results of call-like - * instructions. If the value produced by a <code>move-result</code> is not + * A {@code move-result} instruction is used for the results of call-like + * instructions. If the value produced by a {@code move-result} is not * used by the method, it may be eliminated as dead code. * - * A <code>move-result-pseudo</code> instruction is used for the results of + * A {@code move-result-pseudo} instruction is used for the results of * non-call-like throwing instructions. It may never be considered dead code * since the final dex instruction will always indicate a result register. - * If a required <code>move-result-pseudo</code> instruction is not found + * If a required {@code move-result-pseudo} instruction is not found * during conversion to dex bytecode, an exception will be thrown. * * <h3>move-exception</h3> @@ -148,25 +148,25 @@ package com.android.dx.rop; * <h3>move-param</h3> * * A {@link RegOps.MOVE_PARAM move-param} instruction represents a method - * parameter. Every <code>move-param</code> instruction is a + * parameter. Every {@code move-param} instruction is a * {@link PlainCstInsn}. The index of the method parameter they refer to is * carried as the {@link CstInteger integer constant} associated with the * instruction. * - * Any number of <code>move-param</code> instructions referring to the same + * Any number of {@code move-param} instructions referring to the same * parameter index may be included in a method's instruction lists. They * have no restrictions on placement beyond those of any other * {@link Rop.BRANCH_NONE} instruction. Note that the SSA optimizer arranges the * parameter assignments to align with the dex bytecode calling conventions. * With parameter assignments so arranged, the - * {@link com.android.dx.dex.code.RopTranslator} sees Rop <code>move-param</code> + * {@link com.android.dx.dex.code.RopTranslator} sees Rop {@code move-param} * instructions as unnecessary in dex form and eliminates them. * * <h3>mark-local</h3> * * A {@link RegOps.MARK_LOCAL mark-local} instruction indicates that a local * variable becomes live in a specified register specified register for the - * purposes of debug information. A <code>mark-local</code> instruction has + * purposes of debug information. A {@code mark-local} instruction has * a single source (the register which will now be considered a local variable) * and no results. The instruction has no side effect.<p> * @@ -179,23 +179,22 @@ package com.android.dx.rop; * an assignment occurring. A common example of this is occurs in the Rop * representation of the following code:<p> * - * <code> + * <pre> * try { * Object foo = null; * foo = new Object(); - * } catch (Throwable ex) { - * } - * </code> - * - * An object's initialization occurs in two steps. First, a <code>new-instance - * </code> instruction is executed, whose result is stored in a register. - * However, that register can not yet be considered to contain "foo". That's - * because the instance's constructor method must be called via an - * <code>invoke</code> instruction. The constructor method, however, may + * } catch (Throwable ex) { } + * </pre> + * + * An object's initialization occurs in two steps. First, a + * {@code new-instance} instruction is executed, whose result is stored in a + * register. However, that register can not yet be considered to contain + * "foo". That's because the instance's constructor method must be called + * via an {@code invoke} instruction. The constructor method, however, may * throw an exception. And if an exception occurs, then "foo" should remain - * null. So "foo" becomes the value of the result of the <code>new-instance - * </code> instruction after the (void) constructor method is invoked and - * returns successfully. In such a case, a <code>mark-local</code> will + * null. So "foo" becomes the value of the result of the {@code new-instance} + * instruction after the (void) constructor method is invoked and + * returns successfully. In such a case, a {@code mark-local} will * typically occur at the beginning of the primary successor block following * the invocation to the constructor. */ diff --git a/dx/src/com/android/dx/rop/type/Prototype.java b/dx/src/com/android/dx/rop/type/Prototype.java index a6ee74252..7e6ab59d5 100644 --- a/dx/src/com/android/dx/rop/type/Prototype.java +++ b/dx/src/com/android/dx/rop/type/Prototype.java @@ -21,23 +21,23 @@ import java.util.HashMap; /** * Representation of a method decriptor. Instances of this class are * generally interned and may be usefully compared with each other - * using <code>==</code>. + * using {@code ==}. */ public final class Prototype implements Comparable<Prototype> { - /** non-null; intern table mapping string descriptors to instances */ + /** {@code non-null;} intern table mapping string descriptors to instances */ private static final HashMap<String, Prototype> internTable = new HashMap<String, Prototype>(500); - /** non-null; method descriptor */ + /** {@code non-null;} method descriptor */ private final String descriptor; - /** non-null; return type */ + /** {@code non-null;} return type */ private final Type returnType; - /** non-null; list of parameter types */ + /** {@code non-null;} list of parameter types */ private final StdTypeList parameterTypes; - /** null-ok; list of parameter frame types, if calculated */ + /** {@code null-ok;} list of parameter frame types, if calculated */ private StdTypeList parameterFrameTypes; /** @@ -45,8 +45,8 @@ public final class Prototype implements Comparable<Prototype> { * given method descriptor. See vmspec-2 sec4.3.3 for details on the * field descriptor syntax. * - * @param descriptor non-null; the descriptor - * @return non-null; the corresponding instance + * @param descriptor {@code non-null;} the descriptor + * @return {@code non-null;} the corresponding instance * @throws IllegalArgumentException thrown if the descriptor has * invalid syntax */ @@ -111,8 +111,8 @@ public final class Prototype implements Comparable<Prototype> { * that there is a '(' at the start of the descriptor and a * single ')' somewhere before the end. * - * @param descriptor non-null; the descriptor string - * @return non-null; array large enough to hold all parsed parameter + * @param descriptor {@code non-null;} the descriptor string + * @return {@code non-null;} array large enough to hold all parsed parameter * types, but which is likely actually larger than needed */ private static Type[] makeParameterArray(String descriptor) { @@ -153,14 +153,14 @@ public final class Prototype implements Comparable<Prototype> { /** * Interns an instance, adding to the descriptor as necessary based * on the given definer, name, and flags. For example, an init - * method has an uninitialized object of type <code>definer</code> + * method has an uninitialized object of type {@code definer} * as its first argument. * - * @param descriptor non-null; the descriptor string - * @param definer non-null; class the method is defined on + * @param descriptor {@code non-null;} the descriptor string + * @param definer {@code non-null;} class the method is defined on * @param isStatic whether this is a static method * @param isInit whether this is an init method - * @return non-null; the interned instance + * @return {@code non-null;} the interned instance */ public static Prototype intern(String descriptor, Type definer, boolean isStatic, boolean isInit) { @@ -179,11 +179,11 @@ public final class Prototype implements Comparable<Prototype> { /** * Interns an instance which consists of the given number of - * <code>int</code>s along with the given return type + * {@code int}s along with the given return type * - * @param returnType non-null; the return type - * @param count > 0; the number of elements in the prototype - * @return non-null; the interned instance + * @param returnType {@code non-null;} the return type + * @param count {@code > 0;} the number of elements in the prototype + * @return {@code non-null;} the interned instance */ public static Prototype internInts(Type returnType, int count) { // Make the descriptor... @@ -207,7 +207,7 @@ public final class Prototype implements Comparable<Prototype> { * Constructs an instance. This is a private constructor; use one * of the public static methods to get instances. * - * @param descriptor non-null; the descriptor string + * @param descriptor {@code non-null;} the descriptor string */ private Prototype(String descriptor, Type returnType, StdTypeList parameterTypes) { @@ -304,7 +304,7 @@ public final class Prototype implements Comparable<Prototype> { /** * Gets the descriptor string. * - * @return non-null; the descriptor + * @return {@code non-null;} the descriptor */ public String getDescriptor() { return descriptor; @@ -313,7 +313,7 @@ public final class Prototype implements Comparable<Prototype> { /** * Gets the return type. * - * @return non-null; the return type + * @return {@code non-null;} the return type */ public Type getReturnType() { return returnType; @@ -322,7 +322,7 @@ public final class Prototype implements Comparable<Prototype> { /** * Gets the list of parameter types. * - * @return non-null; the list of parameter types + * @return {@code non-null;} the list of parameter types */ public StdTypeList getParameterTypes() { return parameterTypes; @@ -334,7 +334,7 @@ public final class Prototype implements Comparable<Prototype> { * "intlike" types (see {@link Type#isIntlike}) are replaced by * {@link Type#INT}. * - * @return non-null; the list of parameter frame types + * @return {@code non-null;} the list of parameter frame types */ public StdTypeList getParameterFrameTypes() { if (parameterFrameTypes == null) { @@ -360,8 +360,8 @@ public final class Prototype implements Comparable<Prototype> { * except that it has an additional parameter prepended to the original's * argument list. * - * @param param non-null; the new first parameter - * @return non-null; an appropriately-constructed instance + * @param param {@code non-null;} the new first parameter + * @return {@code non-null;} an appropriately-constructed instance */ public Prototype withFirstParameter(Type param) { String newDesc = "(" + param.getDescriptor() + descriptor.substring(1); @@ -380,8 +380,8 @@ public final class Prototype implements Comparable<Prototype> { * there. If a conflicting value is already in the table, then leave it. * Return the interned value. * - * @param desc non-null; instance to make interned - * @return non-null; the actual interned object + * @param desc {@code non-null;} instance to make interned + * @return {@code non-null;} the actual interned object */ private static Prototype putIntern(Prototype desc) { synchronized (internTable) { diff --git a/dx/src/com/android/dx/rop/type/StdTypeList.java b/dx/src/com/android/dx/rop/type/StdTypeList.java index a4c2d44b0..a02381237 100644 --- a/dx/src/com/android/dx/rop/type/StdTypeList.java +++ b/dx/src/com/android/dx/rop/type/StdTypeList.java @@ -23,149 +23,149 @@ import com.android.dx.util.FixedSizeList; */ public final class StdTypeList extends FixedSizeList implements TypeList { - /** non-null; no-element instance */ + /** {@code non-null;} no-element instance */ public static final StdTypeList EMPTY = new StdTypeList(0); - /** non-null; the list <code>[int]</code> */ + /** {@code non-null;} the list {@code [int]} */ public static final StdTypeList INT = StdTypeList.make(Type.INT); - /** non-null; the list <code>[long]</code> */ + /** {@code non-null;} the list {@code [long]} */ public static final StdTypeList LONG = StdTypeList.make(Type.LONG); - /** non-null; the list <code>[float]</code> */ + /** {@code non-null;} the list {@code [float]} */ public static final StdTypeList FLOAT = StdTypeList.make(Type.FLOAT); - /** non-null; the list <code>[double]</code> */ + /** {@code non-null;} the list {@code [double]} */ public static final StdTypeList DOUBLE = StdTypeList.make(Type.DOUBLE); - /** non-null; the list <code>[Object]</code> */ + /** {@code non-null;} the list {@code [Object]} */ public static final StdTypeList OBJECT = StdTypeList.make(Type.OBJECT); - /** non-null; the list <code>[ReturnAddress]</code> */ + /** {@code non-null;} the list {@code [ReturnAddress]} */ public static final StdTypeList RETURN_ADDRESS = StdTypeList.make(Type.RETURN_ADDRESS); - /** non-null; the list <code>[Throwable]</code> */ + /** {@code non-null;} the list {@code [Throwable]} */ public static final StdTypeList THROWABLE = StdTypeList.make(Type.THROWABLE); - /** non-null; the list <code>[int, int]</code> */ + /** {@code non-null;} the list {@code [int, int]} */ public static final StdTypeList INT_INT = StdTypeList.make(Type.INT, Type.INT); - /** non-null; the list <code>[long, long]</code> */ + /** {@code non-null;} the list {@code [long, long]} */ public static final StdTypeList LONG_LONG = StdTypeList.make(Type.LONG, Type.LONG); - /** non-null; the list <code>[float, float]</code> */ + /** {@code non-null;} the list {@code [float, float]} */ public static final StdTypeList FLOAT_FLOAT = StdTypeList.make(Type.FLOAT, Type.FLOAT); - /** non-null; the list <code>[double, double]</code> */ + /** {@code non-null;} the list {@code [double, double]} */ public static final StdTypeList DOUBLE_DOUBLE = StdTypeList.make(Type.DOUBLE, Type.DOUBLE); - /** non-null; the list <code>[Object, Object]</code> */ + /** {@code non-null;} the list {@code [Object, Object]} */ public static final StdTypeList OBJECT_OBJECT = StdTypeList.make(Type.OBJECT, Type.OBJECT); - /** non-null; the list <code>[int, Object]</code> */ + /** {@code non-null;} the list {@code [int, Object]} */ public static final StdTypeList INT_OBJECT = StdTypeList.make(Type.INT, Type.OBJECT); - /** non-null; the list <code>[long, Object]</code> */ + /** {@code non-null;} the list {@code [long, Object]} */ public static final StdTypeList LONG_OBJECT = StdTypeList.make(Type.LONG, Type.OBJECT); - /** non-null; the list <code>[float, Object]</code> */ + /** {@code non-null;} the list {@code [float, Object]} */ public static final StdTypeList FLOAT_OBJECT = StdTypeList.make(Type.FLOAT, Type.OBJECT); - /** non-null; the list <code>[double, Object]</code> */ + /** {@code non-null;} the list {@code [double, Object]} */ public static final StdTypeList DOUBLE_OBJECT = StdTypeList.make(Type.DOUBLE, Type.OBJECT); - /** non-null; the list <code>[long, int]</code> */ + /** {@code non-null;} the list {@code [long, int]} */ public static final StdTypeList LONG_INT = StdTypeList.make(Type.LONG, Type.INT); - /** non-null; the list <code>[int[], int]</code> */ + /** {@code non-null;} the list {@code [int[], int]} */ public static final StdTypeList INTARR_INT = StdTypeList.make(Type.INT_ARRAY, Type.INT); - /** non-null; the list <code>[long[], int]</code> */ + /** {@code non-null;} the list {@code [long[], int]} */ public static final StdTypeList LONGARR_INT = StdTypeList.make(Type.LONG_ARRAY, Type.INT); - /** non-null; the list <code>[float[], int]</code> */ + /** {@code non-null;} the list {@code [float[], int]} */ public static final StdTypeList FLOATARR_INT = StdTypeList.make(Type.FLOAT_ARRAY, Type.INT); - /** non-null; the list <code>[double[], int]</code> */ + /** {@code non-null;} the list {@code [double[], int]} */ public static final StdTypeList DOUBLEARR_INT = StdTypeList.make(Type.DOUBLE_ARRAY, Type.INT); - /** non-null; the list <code>[Object[], int]</code> */ + /** {@code non-null;} the list {@code [Object[], int]} */ public static final StdTypeList OBJECTARR_INT = StdTypeList.make(Type.OBJECT_ARRAY, Type.INT); - /** non-null; the list <code>[boolean[], int]</code> */ + /** {@code non-null;} the list {@code [boolean[], int]} */ public static final StdTypeList BOOLEANARR_INT = StdTypeList.make(Type.BOOLEAN_ARRAY, Type.INT); - /** non-null; the list <code>[byte[], int]</code> */ + /** {@code non-null;} the list {@code [byte[], int]} */ public static final StdTypeList BYTEARR_INT = StdTypeList.make(Type.BYTE_ARRAY, Type.INT); - /** non-null; the list <code>[char[], int]</code> */ + /** {@code non-null;} the list {@code [char[], int]} */ public static final StdTypeList CHARARR_INT = StdTypeList.make(Type.CHAR_ARRAY, Type.INT); - /** non-null; the list <code>[short[], int]</code> */ + /** {@code non-null;} the list {@code [short[], int]} */ public static final StdTypeList SHORTARR_INT = StdTypeList.make(Type.SHORT_ARRAY, Type.INT); - /** non-null; the list <code>[int, int[], int]</code> */ + /** {@code non-null;} the list {@code [int, int[], int]} */ public static final StdTypeList INT_INTARR_INT = StdTypeList.make(Type.INT, Type.INT_ARRAY, Type.INT); - /** non-null; the list <code>[long, long[], int]</code> */ + /** {@code non-null;} the list {@code [long, long[], int]} */ public static final StdTypeList LONG_LONGARR_INT = StdTypeList.make(Type.LONG, Type.LONG_ARRAY, Type.INT); - /** non-null; the list <code>[float, float[], int]</code> */ + /** {@code non-null;} the list {@code [float, float[], int]} */ public static final StdTypeList FLOAT_FLOATARR_INT = StdTypeList.make(Type.FLOAT, Type.FLOAT_ARRAY, Type.INT); - /** non-null; the list <code>[double, double[], int]</code> */ + /** {@code non-null;} the list {@code [double, double[], int]} */ public static final StdTypeList DOUBLE_DOUBLEARR_INT = StdTypeList.make(Type.DOUBLE, Type.DOUBLE_ARRAY, Type.INT); - /** non-null; the list <code>[Object, Object[], int]</code> */ + /** {@code non-null;} the list {@code [Object, Object[], int]} */ public static final StdTypeList OBJECT_OBJECTARR_INT = StdTypeList.make(Type.OBJECT, Type.OBJECT_ARRAY, Type.INT); - /** non-null; the list <code>[int, boolean[], int]</code> */ + /** {@code non-null;} the list {@code [int, boolean[], int]} */ public static final StdTypeList INT_BOOLEANARR_INT = StdTypeList.make(Type.INT, Type.BOOLEAN_ARRAY, Type.INT); - /** non-null; the list <code>[int, byte[], int]</code> */ + /** {@code non-null;} the list {@code [int, byte[], int]} */ public static final StdTypeList INT_BYTEARR_INT = StdTypeList.make(Type.INT, Type.BYTE_ARRAY, Type.INT); - /** non-null; the list <code>[int, char[], int]</code> */ + /** {@code non-null;} the list {@code [int, char[], int]} */ public static final StdTypeList INT_CHARARR_INT = StdTypeList.make(Type.INT, Type.CHAR_ARRAY, Type.INT); - /** non-null; the list <code>[int, short[], int]</code> */ + /** {@code non-null;} the list {@code [int, short[], int]} */ public static final StdTypeList INT_SHORTARR_INT = StdTypeList.make(Type.INT, Type.SHORT_ARRAY, Type.INT); /** * Makes a single-element instance. * - * @param type non-null; the element - * @return non-null; an appropriately-constructed instance + * @param type {@code non-null;} the element + * @return {@code non-null;} an appropriately-constructed instance */ public static StdTypeList make(Type type) { StdTypeList result = new StdTypeList(1); @@ -176,9 +176,9 @@ public final class StdTypeList /** * Makes a two-element instance. * - * @param type0 non-null; the first element - * @param type1 non-null; the second element - * @return non-null; an appropriately-constructed instance + * @param type0 {@code non-null;} the first element + * @param type1 {@code non-null;} the second element + * @return {@code non-null;} an appropriately-constructed instance */ public static StdTypeList make(Type type0, Type type1) { StdTypeList result = new StdTypeList(2); @@ -190,10 +190,10 @@ public final class StdTypeList /** * Makes a three-element instance. * - * @param type0 non-null; the first element - * @param type1 non-null; the second element - * @param type2 non-null; the third element - * @return non-null; an appropriately-constructed instance + * @param type0 {@code non-null;} the first element + * @param type1 {@code non-null;} the second element + * @param type2 {@code non-null;} the third element + * @return {@code non-null;} an appropriately-constructed instance */ public static StdTypeList make(Type type0, Type type1, Type type2) { StdTypeList result = new StdTypeList(3); @@ -206,11 +206,11 @@ public final class StdTypeList /** * Makes a four-element instance. * - * @param type0 non-null; the first element - * @param type1 non-null; the second element - * @param type2 non-null; the third element - * @param type3 non-null; the fourth element - * @return non-null; an appropriately-constructed instance + * @param type0 {@code non-null;} the first element + * @param type1 {@code non-null;} the second element + * @param type2 {@code non-null;} the third element + * @param type3 {@code non-null;} the fourth element + * @return {@code non-null;} an appropriately-constructed instance */ public static StdTypeList make(Type type0, Type type1, Type type2, Type type3) { @@ -227,8 +227,8 @@ public final class StdTypeList * is a static method so as to work on arbitrary {@link TypeList} * instances. * - * @param list non-null; the list to convert - * @return non-null; the human form + * @param list {@code non-null;} the list to convert + * @return {@code non-null;} the human form */ public static String toHuman(TypeList list) { int size = list.size(); @@ -254,8 +254,8 @@ public final class StdTypeList * is a static method so as to work on arbitrary {@link TypeList} * instances. * - * @param list non-null; the list to inspect - * @return non-null; the hash code + * @param list {@code non-null;} the list to inspect + * @return {@code non-null;} the hash code */ public static int hashContents(TypeList list) { int size = list.size(); @@ -273,8 +273,8 @@ public final class StdTypeList * is a static method so as to work on arbitrary {@link TypeList} * instances. * - * @param list1 non-null; one list to compare - * @param list2 non-null; another list to compare + * @param list1 {@code non-null;} one list to compare + * @param list2 {@code non-null;} another list to compare * @return whether the two lists contain corresponding equal elements */ public static boolean equalContents(TypeList list1, TypeList list2) { @@ -298,8 +298,8 @@ public final class StdTypeList * is a static method so as to work on arbitrary {@link TypeList} * instances. * - * @param list1 non-null; one list to compare - * @param list2 non-null; another list to compare + * @param list1 {@code non-null;} one list to compare + * @param list2 {@code non-null;} another list to compare * @return the order of the two lists */ public static int compareContents(TypeList list1, TypeList list2) { @@ -324,7 +324,7 @@ public final class StdTypeList } /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -366,10 +366,10 @@ public final class StdTypeList /** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this - * will throw <code>NullPointerException</code>. + * will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which element - * @return non-null; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code non-null;} the indicated element */ public Type get(int n) { return (Type) get0(n); @@ -378,8 +378,8 @@ public final class StdTypeList /** * Sets the type at the given index. * - * @param n >= 0, < size(); which element - * @param type non-null; the type to store + * @param n {@code >= 0, < size();} which element + * @param type {@code non-null;} the type to store */ public void set(int n, Type type) { set0(n, type); @@ -390,8 +390,8 @@ public final class StdTypeList * except that it has an additional type prepended to the * original. * - * @param type non-null; the new first element - * @return non-null; an appropriately-constructed instance + * @param type {@code non-null;} the new first element + * @return {@code non-null;} an appropriately-constructed instance */ public StdTypeList withFirst(Type type) { int sz = size(); diff --git a/dx/src/com/android/dx/rop/type/Type.java b/dx/src/com/android/dx/rop/type/Type.java index 09ea2e26d..64c3c3069 100644 --- a/dx/src/com/android/dx/rop/type/Type.java +++ b/dx/src/com/android/dx/rop/type/Type.java @@ -24,41 +24,41 @@ import java.util.HashMap; * Representation of a value type, such as may appear in a field, in a * local, on a stack, or in a method descriptor. Instances of this * class are generally interned and may be usefully compared with each - * other using <code>==</code>. + * other using {@code ==}. */ public final class Type implements TypeBearer, Comparable<Type> { - /** non-null; intern table mapping string descriptors to instances */ + /** {@code non-null;} intern table mapping string descriptors to instances */ private static final HashMap<String, Type> internTable = new HashMap<String, Type>(500); - /** basic type constant for <code>void</code> */ + /** basic type constant for {@code void} */ public static final int BT_VOID = 0; - /** basic type constant for <code>boolean</code> */ + /** basic type constant for {@code boolean} */ public static final int BT_BOOLEAN = 1; - /** basic type constant for <code>byte</code> */ + /** basic type constant for {@code byte} */ public static final int BT_BYTE = 2; - /** basic type constant for <code>char</code> */ + /** basic type constant for {@code char} */ public static final int BT_CHAR = 3; - /** basic type constant for <code>double</code> */ + /** basic type constant for {@code double} */ public static final int BT_DOUBLE = 4; - /** basic type constant for <code>float</code> */ + /** basic type constant for {@code float} */ public static final int BT_FLOAT = 5; - /** basic type constant for <code>int</code> */ + /** basic type constant for {@code int} */ public static final int BT_INT = 6; - /** basic type constant for <code>long</code> */ + /** basic type constant for {@code long} */ public static final int BT_LONG = 7; - /** basic type constant for <code>short</code> */ + /** basic type constant for {@code short} */ public static final int BT_SHORT = 8; - /** basic type constant for <code>Object</code> */ + /** basic type constant for {@code Object} */ public static final int BT_OBJECT = 9; /** basic type constant for a return address */ @@ -67,37 +67,37 @@ public final class Type implements TypeBearer, Comparable<Type> { /** count of basic type constants */ public static final int BT_COUNT = 11; - /** non-null; instance representing <code>boolean</code> */ + /** {@code non-null;} instance representing {@code boolean} */ public static final Type BOOLEAN = new Type("Z", BT_BOOLEAN); - /** non-null; instance representing <code>byte</code> */ + /** {@code non-null;} instance representing {@code byte} */ public static final Type BYTE = new Type("B", BT_BYTE); - /** non-null; instance representing <code>char</code> */ + /** {@code non-null;} instance representing {@code char} */ public static final Type CHAR = new Type("C", BT_CHAR); - /** non-null; instance representing <code>double</code> */ + /** {@code non-null;} instance representing {@code double} */ public static final Type DOUBLE = new Type("D", BT_DOUBLE); - /** non-null; instance representing <code>float</code> */ + /** {@code non-null;} instance representing {@code float} */ public static final Type FLOAT = new Type("F", BT_FLOAT); - /** non-null; instance representing <code>int</code> */ + /** {@code non-null;} instance representing {@code int} */ public static final Type INT = new Type("I", BT_INT); - /** non-null; instance representing <code>long</code> */ + /** {@code non-null;} instance representing {@code long} */ public static final Type LONG = new Type("J", BT_LONG); - /** non-null; instance representing <code>short</code> */ + /** {@code non-null;} instance representing {@code short} */ public static final Type SHORT = new Type("S", BT_SHORT); - /** non-null; instance representing <code>void</code> */ + /** {@code non-null;} instance representing {@code void} */ public static final Type VOID = new Type("V", BT_VOID); - /** non-null; instance representing a known-<code>null</code> */ + /** {@code non-null;} instance representing a known-{@code null} */ public static final Type KNOWN_NULL = new Type("<null>", BT_OBJECT); - /** non-null; instance representing a subroutine return address */ + /** {@code non-null;} instance representing a subroutine return address */ public static final Type RETURN_ADDRESS = new Type("<addr>", BT_ADDR); static { @@ -120,158 +120,158 @@ public final class Type implements TypeBearer, Comparable<Type> { } /** - * non-null; instance representing - * <code>java.lang.annotation.Annotation</code> + * {@code non-null;} instance representing + * {@code java.lang.annotation.Annotation} */ public static final Type ANNOTATION = intern("Ljava/lang/annotation/Annotation;"); - /** non-null; instance representing <code>java.lang.Class</code> */ + /** {@code non-null;} instance representing {@code java.lang.Class} */ public static final Type CLASS = intern("Ljava/lang/Class;"); - /** non-null; instance representing <code>java.lang.Cloneable</code> */ + /** {@code non-null;} instance representing {@code java.lang.Cloneable} */ public static final Type CLONEABLE = intern("Ljava/lang/Cloneable;"); - /** non-null; instance representing <code>java.lang.Object</code> */ + /** {@code non-null;} instance representing {@code java.lang.Object} */ public static final Type OBJECT = intern("Ljava/lang/Object;"); - /** non-null; instance representing <code>java.io.Serializable</code> */ + /** {@code non-null;} instance representing {@code java.io.Serializable} */ public static final Type SERIALIZABLE = intern("Ljava/io/Serializable;"); - /** non-null; instance representing <code>java.lang.String</code> */ + /** {@code non-null;} instance representing {@code java.lang.String} */ public static final Type STRING = intern("Ljava/lang/String;"); - /** non-null; instance representing <code>java.lang.Throwable</code> */ + /** {@code non-null;} instance representing {@code java.lang.Throwable} */ public static final Type THROWABLE = intern("Ljava/lang/Throwable;"); /** - * non-null; instance representing <code>java.lang.Boolean</code>; the + * {@code non-null;} instance representing {@code java.lang.Boolean}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type BOOLEAN_CLASS = intern("Ljava/lang/Boolean;"); /** - * non-null; instance representing <code>java.lang.Byte</code>; the + * {@code non-null;} instance representing {@code java.lang.Byte}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type BYTE_CLASS = intern("Ljava/lang/Byte;"); /** - * non-null; instance representing <code>java.lang.Character</code>; the + * {@code non-null;} instance representing {@code java.lang.Character}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type CHARACTER_CLASS = intern("Ljava/lang/Character;"); /** - * non-null; instance representing <code>java.lang.Double</code>; the + * {@code non-null;} instance representing {@code java.lang.Double}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type DOUBLE_CLASS = intern("Ljava/lang/Double;"); /** - * non-null; instance representing <code>java.lang.Float</code>; the + * {@code non-null;} instance representing {@code java.lang.Float}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type FLOAT_CLASS = intern("Ljava/lang/Float;"); /** - * non-null; instance representing <code>java.lang.Integer</code>; the + * {@code non-null;} instance representing {@code java.lang.Integer}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type INTEGER_CLASS = intern("Ljava/lang/Integer;"); /** - * non-null; instance representing <code>java.lang.Long</code>; the + * {@code non-null;} instance representing {@code java.lang.Long}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type LONG_CLASS = intern("Ljava/lang/Long;"); /** - * non-null; instance representing <code>java.lang.Short</code>; the + * {@code non-null;} instance representing {@code java.lang.Short}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type SHORT_CLASS = intern("Ljava/lang/Short;"); /** - * non-null; instance representing <code>java.lang.Void</code>; the + * {@code non-null;} instance representing {@code java.lang.Void}; the * suffix on the name helps disambiguate this from the instance * representing a primitive type */ public static final Type VOID_CLASS = intern("Ljava/lang/Void;"); - /** non-null; instance representing <code>boolean[]</code> */ + /** {@code non-null;} instance representing {@code boolean[]} */ public static final Type BOOLEAN_ARRAY = BOOLEAN.getArrayType(); - /** non-null; instance representing <code>byte[]</code> */ + /** {@code non-null;} instance representing {@code byte[]} */ public static final Type BYTE_ARRAY = BYTE.getArrayType(); - /** non-null; instance representing <code>char[]</code> */ + /** {@code non-null;} instance representing {@code char[]} */ public static final Type CHAR_ARRAY = CHAR.getArrayType(); - /** non-null; instance representing <code>double[]</code> */ + /** {@code non-null;} instance representing {@code double[]} */ public static final Type DOUBLE_ARRAY = DOUBLE.getArrayType(); - /** non-null; instance representing <code>float[]</code> */ + /** {@code non-null;} instance representing {@code float[]} */ public static final Type FLOAT_ARRAY = FLOAT.getArrayType(); - /** non-null; instance representing <code>int[]</code> */ + /** {@code non-null;} instance representing {@code int[]} */ public static final Type INT_ARRAY = INT.getArrayType(); - /** non-null; instance representing <code>long[]</code> */ + /** {@code non-null;} instance representing {@code long[]} */ public static final Type LONG_ARRAY = LONG.getArrayType(); - /** non-null; instance representing <code>Object[]</code> */ + /** {@code non-null;} instance representing {@code Object[]} */ public static final Type OBJECT_ARRAY = OBJECT.getArrayType(); - /** non-null; instance representing <code>short[]</code> */ + /** {@code non-null;} instance representing {@code short[]} */ public static final Type SHORT_ARRAY = SHORT.getArrayType(); - /** non-null; field descriptor for the type */ + /** {@code non-null;} field descriptor for the type */ private final String descriptor; /** * basic type corresponding to this type; one of the - * <code>BT_*</code> constants + * {@code BT_*} constants */ private final int basicType; /** - * >= -1; for an uninitialized type, bytecode index that this - * instance was allocated at; <code>Integer.MAX_VALUE</code> if it - * was an incoming uninitialized instance; <code>-1</code> if this + * {@code >= -1;} for an uninitialized type, bytecode index that this + * instance was allocated at; {@code Integer.MAX_VALUE} if it + * was an incoming uninitialized instance; {@code -1} if this * is an <i>inititialized</i> instance */ private final int newAt; /** - * null-ok; the internal-form class name corresponding to this type, if - * calculated; only valid if <code>this</code> is a reference type and + * {@code null-ok;} the internal-form class name corresponding to this type, if + * calculated; only valid if {@code this} is a reference type and * additionally not a return address */ private String className; /** - * null-ok; the type corresponding to an array of this type, if + * {@code null-ok;} the type corresponding to an array of this type, if * calculated */ private Type arrayType; /** - * null-ok; the type corresponding to elements of this type, if - * calculated; only valid if <code>this</code> is an array type + * {@code null-ok;} the type corresponding to elements of this type, if + * calculated; only valid if {@code this} is an array type */ private Type componentType; /** - * null-ok; the type corresponding to the initialized version of + * {@code null-ok;} the type corresponding to the initialized version of * this type, if this instance is in fact an uninitialized type */ private Type initializedType; @@ -280,11 +280,11 @@ public final class Type implements TypeBearer, Comparable<Type> { * Returns the unique instance corresponding to the type with the * given descriptor. See vmspec-2 sec4.3.2 for details on the * field descriptor syntax. This method does <i>not</i> allow - * <code>"V"</code> (that is, type <code>void</code>) as a valid + * {@code "V"} (that is, type {@code void}) as a valid * descriptor. * - * @param descriptor non-null; the descriptor - * @return non-null; the corresponding instance + * @param descriptor {@code non-null;} the descriptor + * @return {@code non-null;} the corresponding instance * @throws IllegalArgumentException thrown if the descriptor has * invalid syntax */ @@ -362,12 +362,12 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Returns the unique instance corresponding to the type with the - * given descriptor, allowing <code>"V"</code> to return the type - * for <code>void</code>. Other than that one caveat, this method + * given descriptor, allowing {@code "V"} to return the type + * for {@code void}. Other than that one caveat, this method * is identical to {@link #intern}. * - * @param descriptor non-null; the descriptor - * @return non-null; the corresponding instance + * @param descriptor {@code non-null;} the descriptor + * @return {@code non-null;} the corresponding instance * @throws IllegalArgumentException thrown if the descriptor has * invalid syntax */ @@ -388,12 +388,12 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Returns the unique instance corresponding to the type of the * class with the given name. Calling this method is equivalent to - * calling <code>intern(name)</code> if <code>name</code> begins - * with <code>"["</code> and calling <code>intern("L" + name + ";")</code> + * calling {@code intern(name)} if {@code name} begins + * with {@code "["} and calling {@code intern("L" + name + ";")} * in all other cases. * - * @param name non-null; the name of the class whose type is desired - * @return non-null; the corresponding type + * @param name {@code non-null;} the name of the class whose type is desired + * @return {@code non-null;} the corresponding type * @throws IllegalArgumentException thrown if the name has * invalid syntax */ @@ -414,10 +414,10 @@ public final class Type implements TypeBearer, Comparable<Type> { * This is a private constructor; use one of the public static * methods to get instances. * - * @param descriptor non-null; the field descriptor for the type + * @param descriptor {@code non-null;} the field descriptor for the type * @param basicType basic type corresponding to this type; one of the - * <code>BT_*</code> constants - * @param newAt >= -1 allocation bytecode index + * {@code BT_*} constants + * @param newAt {@code >= -1;} allocation bytecode index */ private Type(String descriptor, int basicType, int newAt) { if (descriptor == null) { @@ -445,9 +445,9 @@ public final class Type implements TypeBearer, Comparable<Type> { * This is a private constructor; use one of the public static * methods to get instances. * - * @param descriptor non-null; the field descriptor for the type + * @param descriptor {@code non-null;} the field descriptor for the type * @param basicType basic type corresponding to this type; one of the - * <code>BT_*</code> constants + * {@code BT_*} constants */ private Type(String descriptor, int basicType) { this(descriptor, basicType, -1); @@ -560,7 +560,7 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets the descriptor. * - * @return non-null; the descriptor + * @return {@code non-null;} the descriptor */ public String getDescriptor() { return descriptor; @@ -572,7 +572,7 @@ public final class Type implements TypeBearer, Comparable<Type> { * normal reference type (that is, a reference type and * additionally not a return address). * - * @return non-null; the internal-form class name + * @return {@code non-null;} the internal-form class name */ public String getClassName() { if (className == null) { @@ -592,8 +592,8 @@ public final class Type implements TypeBearer, Comparable<Type> { } /** - * Gets the category. Most instances are category 1. <code>long</code> - * and <code>double</code> are the only category 2 types. + * Gets the category. Most instances are category 1. {@code long} + * and {@code double} are the only category 2 types. * * @see #isCategory1 * @see #isCategory2 @@ -649,7 +649,7 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets whether this type is "intlike." An intlike type is one which, when * placed on a stack or in a local, is automatically converted to an - * <code>int</code>. + * {@code int}. * * @return whether this type is "intlike" */ @@ -695,7 +695,7 @@ public final class Type implements TypeBearer, Comparable<Type> { * Gets whether this type is a normal reference type. A normal * reference type is a reference type that is not a return * address. This method is just convenient shorthand for - * <code>getBasicType() == Type.BT_OBJECT</code>. + * {@code getBasicType() == Type.BT_OBJECT}. * * @return whether this type is a normal reference type */ @@ -705,7 +705,7 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets whether this type is an array type. If this method returns - * <code>true</code>, then it is safe to use {@link #getComponentType} + * {@code true}, then it is safe to use {@link #getComponentType} * to determine the component type. * * @return whether this type is an array type @@ -726,7 +726,7 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets whether this type represents an uninitialized instance. An - * uninitialized instance is what one gets back from the <code>new</code> + * uninitialized instance is what one gets back from the {@code new} * opcode, and remains uninitialized until a valid constructor is * invoked on it. * @@ -738,12 +738,12 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets the bytecode index at which this uninitialized type was - * allocated. This returns <code>Integer.MAX_VALUE</code> if this + * allocated. This returns {@code Integer.MAX_VALUE} if this * type is an uninitialized incoming parameter (i.e., the - * <code>this</code> of an <code><init></code> method) or - * <code>-1</code> if this type is in fact <i>initialized</i>. + * {@code this} of an {@code <init>} method) or + * {@code -1} if this type is in fact <i>initialized</i>. * - * @return >= -1; the allocation bytecode index + * @return {@code >= -1;} the allocation bytecode index */ public int getNewAt() { return newAt; @@ -753,7 +753,7 @@ public final class Type implements TypeBearer, Comparable<Type> { * Gets the initialized type corresponding to this instance, but only * if this instance is in fact an uninitialized object type. * - * @return non-null; the initialized type + * @return {@code non-null;} the initialized type */ public Type getInitializedType() { if (initializedType == null) { @@ -767,7 +767,7 @@ public final class Type implements TypeBearer, Comparable<Type> { /** * Gets the type corresponding to an array of this type. * - * @return non-null; the array type + * @return {@code non-null;} the array type */ public Type getArrayType() { if (arrayType == null) { @@ -781,7 +781,7 @@ public final class Type implements TypeBearer, Comparable<Type> { * Gets the component type of this type. This method is only valid on * array types. * - * @return non-null; the component type + * @return {@code non-null;} the component type */ public Type getComponentType() { if (componentType == null) { @@ -800,8 +800,8 @@ public final class Type implements TypeBearer, Comparable<Type> { * it is indicated as uninitialized and allocated at the given bytecode * index. This instance must be an initialized object type. * - * @param newAt >= 0; the allocation bytecode index - * @return non-null; an appropriately-constructed instance + * @param newAt {@code >= 0;} the allocation bytecode index + * @return {@code non-null;} an appropriately-constructed instance */ public Type asUninitialized(int newAt) { if (newAt < 0) { @@ -838,8 +838,8 @@ public final class Type implements TypeBearer, Comparable<Type> { * there. If a conflicting value is already in the table, then leave it. * Return the interned value. * - * @param type non-null; instance to make interned - * @return non-null; the actual interned object + * @param type {@code non-null;} instance to make interned + * @return {@code non-null;} the actual interned object */ private static Type putIntern(Type type) { synchronized (internTable) { diff --git a/dx/src/com/android/dx/rop/type/TypeBearer.java b/dx/src/com/android/dx/rop/type/TypeBearer.java index b9e4ea576..2f2f2749b 100644 --- a/dx/src/com/android/dx/rop/type/TypeBearer.java +++ b/dx/src/com/android/dx/rop/type/TypeBearer.java @@ -26,40 +26,40 @@ public interface TypeBearer /** * Gets the type associated with this instance. * - * @return non-null; the type + * @return {@code non-null;} the type */ public Type getType(); /** * Gets the frame type corresponding to this type. This method returns - * <code>this</code>, except if {@link Type#isIntlike} on the underlying - * type returns <code>true</code> but the underlying type is not in + * {@code this}, except if {@link Type#isIntlike} on the underlying + * type returns {@code true} but the underlying type is not in * fact {@link Type#INT}, in which case this method returns an instance - * whose underlying type <i>is</i> <code>INT</code>. + * whose underlying type <i>is</i> {@code INT}. * - * @return non-null; the frame type for this instance + * @return {@code non-null;} the frame type for this instance */ public TypeBearer getFrameType(); /** * Gets the basic type corresponding to this instance. * - * @return the basic type; one of the <code>BT_*</code> constants + * @return the basic type; one of the {@code BT_*} constants * defined by {@link Type} */ public int getBasicType(); /** * Gets the basic type corresponding to this instance's frame type. This - * is equivalent to <code>getFrameType().getBasicType()</code>, and - * is the same as calling <code>getFrameType()</code> unless this + * is equivalent to {@code getFrameType().getBasicType()}, and + * is the same as calling {@code getFrameType()} unless this * instance is an int-like type, in which case this method returns - * <code>BT_INT</code>. + * {@code BT_INT}. * * @see #getBasicType * @see #getFrameType * - * @return the basic frame type; one of the <code>BT_*</code> constants + * @return the basic frame type; one of the {@code BT_*} constants * defined by {@link Type} */ public int getBasicFrameType(); @@ -67,8 +67,8 @@ public interface TypeBearer /** * Returns whether this instance represents a constant value. * - * @return <code>true</code> if this instance represents a constant value - * and <code>false</code> if not + * @return {@code true} if this instance represents a constant value + * and {@code false} if not */ public boolean isConstant(); } diff --git a/dx/src/com/android/dx/rop/type/TypeList.java b/dx/src/com/android/dx/rop/type/TypeList.java index 0944fe271..e82cca7c2 100644 --- a/dx/src/com/android/dx/rop/type/TypeList.java +++ b/dx/src/com/android/dx/rop/type/TypeList.java @@ -22,29 +22,29 @@ package com.android.dx.rop.type; public interface TypeList { /** * Returns whether this instance is mutable. Note that the - * <code>TypeList</code> interface itself doesn't provide any + * {@code TypeList} interface itself doesn't provide any * means of mutation, but that doesn't mean that there isn't an * extra-interface way of mutating an instance. * - * @return <code>true</code> if this instance is mutable or - * <code>false</code> if it is immutable + * @return {@code true} if this instance is mutable or + * {@code false} if it is immutable */ public boolean isMutable(); /** * Gets the size of this list. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int size(); /** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this - * will throw <code>NullPointerException</code>. + * will throw {@code NullPointerException}. * - * @param n >= 0, < size(); which element - * @return non-null; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code non-null;} the indicated element */ public Type getType(int n); @@ -53,7 +53,7 @@ public interface TypeList { * all the elements of this list. This is a sum of the widths (categories) * of all the elements. * - * @return >= 0; the required number of words + * @return {@code >= 0;} the required number of words */ public int getWordCount(); @@ -62,8 +62,8 @@ public interface TypeList { * the given item is appended to the end and it is guaranteed to be * immutable. * - * @param type non-null; item to append - * @return non-null; an appropriately-constructed instance + * @param type {@code non-null;} item to append + * @return {@code non-null;} an appropriately-constructed instance */ public TypeList withAddedType(Type type); } diff --git a/dx/src/com/android/dx/ssa/BasicRegisterMapper.java b/dx/src/com/android/dx/ssa/BasicRegisterMapper.java index 86fcf8131..fdabaab1d 100644 --- a/dx/src/com/android/dx/ssa/BasicRegisterMapper.java +++ b/dx/src/com/android/dx/ssa/BasicRegisterMapper.java @@ -24,17 +24,16 @@ import com.android.dx.util.IntList; * This class maps one register space into another, with * each mapping built up individually and added via addMapping() */ -public class BasicRegisterMapper - extends RegisterMapper { - +public class BasicRegisterMapper extends RegisterMapper { /** indexed by old register, containing new name */ private IntList oldToNew; - /** Running count of used registers in new namespace */ + /** running count of used registers in new namespace */ private int runningCountNewRegisters; /** - * Creates a new OneToOneRegisterMapper + * Creates a new OneToOneRegisterMapper. + * * @param countOldRegisters the number of registers in the old name space */ public BasicRegisterMapper(int countOldRegisters) { @@ -70,15 +69,16 @@ public class BasicRegisterMapper /** * Returns the new-namespace mapping for the specified - * old-namespace register, or -1 if one exists + * old-namespace register, or -1 if one exists. * - * @param oldReg >=0; old-namespace register - * @return new-namespace register or -1 if none. + * @param oldReg {@code >= 0;} old-namespace register + * @return new-namespace register or -1 if none */ public int oldToNew(int oldReg) { - if(oldReg >= oldToNew.size()) { + if (oldReg >= oldToNew.size()) { return -1; } + return oldToNew.get(oldReg); } @@ -88,7 +88,8 @@ public class BasicRegisterMapper sb.append("Old\tNew\n"); int sz = oldToNew.size(); - for(int i = 0; i < sz; i++) { + + for (int i = 0; i < sz; i++) { sb.append(i); sb.append('\t'); sb.append(oldToNew.get(i)); @@ -104,12 +105,12 @@ public class BasicRegisterMapper } /** - * adds a mapping to the mapper. If oldReg has already been mapped, + * Adds a mapping to the mapper. If oldReg has already been mapped, * overwrites previous mapping with new mapping. * - * @param oldReg >=0 - * @param newReg >=0 - * @param category width of reg (1 or 2) + * @param oldReg {@code >= 0;} old register + * @param newReg {@code >= 0;} new register + * @param category {@code 1..2;} width of reg */ public void addMapping(int oldReg, int newReg, int category) { if (oldReg >= oldToNew.size()) { @@ -118,6 +119,7 @@ public class BasicRegisterMapper oldToNew.add(-1); } } + oldToNew.set(oldReg, newReg); if (runningCountNewRegisters < (newReg + category)) { diff --git a/dx/src/com/android/dx/ssa/ConstCollector.java b/dx/src/com/android/dx/ssa/ConstCollector.java index afdede7c2..03252d1a4 100644 --- a/dx/src/com/android/dx/ssa/ConstCollector.java +++ b/dx/src/com/android/dx/ssa/ConstCollector.java @@ -17,19 +17,20 @@ package com.android.dx.ssa; import com.android.dx.rop.code.*; -import com.android.dx.rop.type.TypeBearer; -import com.android.dx.rop.type.StdTypeList; -import com.android.dx.rop.type.Type; import com.android.dx.rop.cst.Constant; -import com.android.dx.rop.cst.TypedConstant; import com.android.dx.rop.cst.CstString; +import com.android.dx.rop.cst.TypedConstant; +import com.android.dx.rop.type.StdTypeList; +import com.android.dx.rop.type.Type; +import com.android.dx.rop.type.TypeBearer; -import java.util.HashMap; import java.util.ArrayList; -import java.util.Iterator; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; /** * Collects constants that are used more than once at the top of the @@ -37,7 +38,6 @@ import java.util.HashSet; * insn size by about 3%. */ public class ConstCollector { - /** Maximum constants to collect per method. Puts cap on reg use */ private static final int MAX_COLLECTED_CONSTANTS = 5; @@ -60,18 +60,20 @@ public class ConstCollector { private final SsaMethod ssaMeth; /** - * Process a method. + * Processes a method. * - * @param ssaMethod non-null; method to process + * @param ssaMethod {@code non-null;} method to process */ public static void process(SsaMethod ssaMethod) { - ConstCollector dc; - - dc = new ConstCollector(ssaMethod); - - dc.run(); + ConstCollector cc = new ConstCollector(ssaMethod); + cc.run(); } + /** + * Constructs an instance. + * + * @param ssaMethod {@code non-null;} method to process + */ private ConstCollector(SsaMethod ssaMethod) { this.ssaMeth = ssaMethod; } @@ -111,9 +113,7 @@ public class ConstCollector { SsaBasicBlock successorBlock = entryBlock.getPrimarySuccessor(); - /* - * Insert a block containing the const insn - */ + // Insert a block containing the const insn. SsaBasicBlock constBlock = entryBlock.insertNewSuccessor(successorBlock); @@ -122,18 +122,17 @@ public class ConstCollector { RegisterSpecList.EMPTY, StdTypeList.EMPTY, cst)); - /* - * Insert a block containing the move-result-pseudo insn - */ + // Insert a block containing the move-result-pseudo insn. SsaBasicBlock resultBlock = constBlock.insertNewSuccessor(successorBlock); + PlainInsn insn + = new PlainInsn( + Rops.opMoveResultPseudo(result.getTypeBearer()), + SourcePosition.NO_INFO, + result, RegisterSpecList.EMPTY); - resultBlock.addInsnToHead( - new PlainInsn( - Rops.opMoveResultPseudo(result.getTypeBearer()), - SourcePosition.NO_INFO, - result, RegisterSpecList.EMPTY)); + resultBlock.addInsnToHead(insn); } newRegs.put(cst, result); @@ -147,7 +146,7 @@ public class ConstCollector { * sorted by most used first. Skips non-collectable consts, such as * non-string object constants * - * @return non-null; list of constants in most-to-least used order + * @return {@code non-null;} list of constants in most-to-least used order */ private ArrayList<TypedConstant> getConstsSortedByCountUse() { int regSz = ssaMeth.getRegCount(); @@ -155,20 +154,21 @@ public class ConstCollector { final HashMap<TypedConstant, Integer> countUses = new HashMap<TypedConstant, Integer>(); - // Each collected constant can be used by just one local - // (used only if COLLECT_ONE_LOCAL is true) + /* + * Each collected constant can be used by just one local + * (used only if COLLECT_ONE_LOCAL is true). + */ final HashSet<TypedConstant> usedByLocal = new HashSet<TypedConstant>(); - // Count how many times each const value is used + // Count how many times each const value is used. for (int i = 0; i < regSz; i++) { SsaInsn insn = ssaMeth.getDefinitionForRegister(i); if (insn == null) continue; RegisterSpec result = insn.getResult(); - - TypeBearer typeBearer = insn.getResult().getTypeBearer(); + TypeBearer typeBearer = result.getTypeBearer(); if (!typeBearer.isConstant()) continue; @@ -177,28 +177,30 @@ public class ConstCollector { if (insn.canThrow()) { /* * Don't move anything other than strings -- the risk - * of changing where an exception is thrown is too high. + * of changing where an exception is thrown is too high. */ if (!(cst instanceof CstString) || !COLLECT_STRINGS) { continue; } /* - * We can't move any throwable const whose throw will be caught, - * so don't count them. + * We can't move any throwable const whose throw will be + * caught, so don't count them. */ if (insn.getBlock().getSuccessors().cardinality() > 1) { continue; } } - // TODO might be nice to try and figure out which local wins most - // when collected + /* + * TODO: Might be nice to try and figure out which local + * wins most when collected. + */ if (ssaMeth.isRegALocal(result)) { if (!COLLECT_ONE_LOCAL) { continue; } else { if (usedByLocal.contains(cst)) { - // Count one local usage only + // Count one local usage only. continue; } else { usedByLocal.add(cst); @@ -214,18 +216,15 @@ public class ConstCollector { } } - // Collect constants that have been reused - Iterator<TypedConstant> it = countUses.keySet().iterator(); + // Collect constants that have been reused. ArrayList<TypedConstant> constantList = new ArrayList<TypedConstant>(); - while (it.hasNext()) { - TypedConstant cst = it.next(); - - if (countUses.get(cst) > 1) { - constantList.add(cst); + for (Map.Entry<TypedConstant, Integer> entry : countUses.entrySet()) { + if (entry.getValue() > 1) { + constantList.add(entry.getKey()); } } - // Sort by use, with most used at the beginning of the list + // Sort by use, with most used at the beginning of the list. Collections.sort(constantList, new Comparator<Constant>() { public int compare(Constant a, Constant b) { int ret; @@ -241,47 +240,48 @@ public class ConstCollector { return ret; } + public boolean equals (Object obj) { return obj == this; } }); + return constantList; } /** * Inserts mark-locals if necessary when changing a register. If - * the definition of <code>origReg</code> is associated with a local - * variable, then insert a mark-local for <code>newReg</code> just below - * it. We expect the definition of <code>origReg</code> to ultimately + * the definition of {@code origReg} is associated with a local + * variable, then insert a mark-local for {@code newReg} just below + * it. We expect the definition of {@code origReg} to ultimately * be removed by the dead code eliminator * - * @param origReg non-null; original register - * @param newReg non-null; new register that will replace - * <code>origReg</code> + * @param origReg {@code non-null;} original register + * @param newReg {@code non-null;} new register that will replace + * {@code origReg} */ - private void fixLocalAssignment(RegisterSpec origReg, RegisterSpec newReg) { - for (SsaInsn use: ssaMeth.getUseListForRegister(origReg.getReg())) { + private void fixLocalAssignment(RegisterSpec origReg, + RegisterSpec newReg) { + for (SsaInsn use : ssaMeth.getUseListForRegister(origReg.getReg())) { RegisterSpec localAssignment = use.getLocalAssignment(); if (localAssignment == null) { continue; } if (use.getResult() == null) { - // this is a mark-local. it will be updated when all uses - // are updated + /* + * This is a mark-local. it will be updated when all uses + * are updated. + */ continue; } LocalItem local = localAssignment.getLocalItem(); - /* - * un-associate original use - */ + // Un-associate original use. use.setResultLocal(null); - /* - * now add a mark-local to the new reg immediately after - */ + // Now add a mark-local to the new reg immediately after. newReg = newReg.withLocalItem(local); SsaInsn newInsn @@ -301,15 +301,17 @@ public class ConstCollector { * Updates all uses of various consts to use the values in the newly * assigned registers. * - * @param newRegs non-null; mapping between constant and new reg - * @param origRegCount >=0; original SSA reg count, not including + * @param newRegs {@code non-null;} mapping between constant and new reg + * @param origRegCount {@code >=0;} original SSA reg count, not including * newly added constant regs */ private void updateConstUses(HashMap<TypedConstant, RegisterSpec> newRegs, int origRegCount) { - // Set of constants associated with a local variable - // Used only if COLLECT_ONE_LOCAL is true + /* + * set of constants associated with a local variable; used + * only if COLLECT_ONE_LOCAL is true. + */ final HashSet<TypedConstant> usedByLocal = new HashSet<TypedConstant>(); @@ -338,8 +340,11 @@ public class ConstCollector { if (!COLLECT_ONE_LOCAL) { continue; } else { - // TODO if the same local gets the same cst multiple times, - // it would be nice to reuse the register + /* + * TODO: If the same local gets the same cst + * multiple times, it would be nice to reuse the + * register. + */ if (usedByLocal.contains(cst)) { continue; } else { @@ -349,7 +354,7 @@ public class ConstCollector { } } - // Maps an original const register to the new collected register + // maps an original const register to the new collected register RegisterMapper mapper = new RegisterMapper() { @Override public int getNewRegisterCount() { @@ -359,14 +364,15 @@ public class ConstCollector { @Override public RegisterSpec map(RegisterSpec registerSpec) { if (registerSpec.getReg() == origReg.getReg()) { - return newReg.withLocalItem(registerSpec.getLocalItem()); + return newReg.withLocalItem( + registerSpec.getLocalItem()); } return registerSpec; } }; - for (SsaInsn use: useList[origReg.getReg()]) { + for (SsaInsn use : useList[origReg.getReg()]) { if (use.canThrow() && use.getBlock().getSuccessors().cardinality() > 1) { continue; diff --git a/dx/src/com/android/dx/ssa/DeadCodeRemover.java b/dx/src/com/android/dx/ssa/DeadCodeRemover.java index 4fded44aa..ec960b824 100644 --- a/dx/src/com/android/dx/ssa/DeadCodeRemover.java +++ b/dx/src/com/android/dx/ssa/DeadCodeRemover.java @@ -36,55 +36,55 @@ import java.util.HashSet; * block to entry block. */ public class DeadCodeRemover { - /** method we're processing */ - private SsaMethod ssaMeth; + private final SsaMethod ssaMeth; + /** ssaMeth.getRegCount() */ - private int regCount; + private final int regCount; /** * indexed by register: whether reg should be examined * (does it correspond to a no-side-effect insn?) */ - private BitSet worklist; + private final BitSet worklist; /** use list indexed by register; modified during operation */ - private ArrayList<SsaInsn>[] useList; + private final ArrayList<SsaInsn>[] useList; /** * Process a method with the dead-code remver + * * @param ssaMethod method to process */ public static void process(SsaMethod ssaMethod) { - DeadCodeRemover dc; - - dc = new DeadCodeRemover(ssaMethod); - + DeadCodeRemover dc = new DeadCodeRemover(ssaMethod); dc.run(); } + /** + * Constructs an instance. + * + * @param ssaMethod method to process + */ private DeadCodeRemover(SsaMethod ssaMethod) { this.ssaMeth = ssaMethod; regCount = ssaMethod.getRegCount(); - worklist = new BitSet(regCount); - useList = ssaMeth.getUseListCopy(); } /** - * Run the dead code remover + * Runs the dead code remover. */ private void run() { - HashSet<SsaInsn> deletedInsns = (HashSet<SsaInsn>) new HashSet(); ssaMeth.forEachInsn(new NoSideEffectVisitor(worklist)); int regV; - while ( 0 <= (regV = worklist.nextSetBit(0)) ) { + while ( 0 <= (regV = worklist.nextSetBit(0)) ) { worklist.clear(regV); if (useList[regV].size() == 0 @@ -92,7 +92,7 @@ public class DeadCodeRemover { SsaInsn insnS = ssaMeth.getDefinitionForRegister(regV); - // This insn has already been deleted + // This insn has already been deleted. if (deletedInsns.contains(insnS)) { continue; } @@ -101,8 +101,7 @@ public class DeadCodeRemover { int sz = sources.size(); for (int i = 0; i < sz; i++) { - - // Delete this insn from all usage lists + // Delete this insn from all usage lists. RegisterSpec source = sources.get(i); useList[source.getReg()].remove(insnS); @@ -110,14 +109,14 @@ public class DeadCodeRemover { ssaMeth.getDefinitionForRegister( source.getReg()))) { /* - * Only registers who's definition has no side effect - * should be added back to the worklist + * Only registers whose definition has no side effect + * should be added back to the worklist. */ worklist.set(source.getReg()); } } - // Schedule this insn for later deletion + // Schedule this insn for later deletion. deletedInsns.add(insnS); } } @@ -127,7 +126,8 @@ public class DeadCodeRemover { /** * Returns true if the only uses of this register form a circle of - * operations with no side effects + * operations with no side effects. + * * @param regV register to examine * @param set a set of registers that we've already determined * are only used as sources in operations with no side effect or null @@ -139,7 +139,7 @@ public class DeadCodeRemover { return true; } - for (SsaInsn use: useList[regV]) { + for (SsaInsn use : useList[regV]) { if (hasSideEffect(use)) { return false; } @@ -152,7 +152,7 @@ public class DeadCodeRemover { // This register is only used in operations that have no side effect. set.set(regV); - for (SsaInsn use: useList[regV]) { + for (SsaInsn use : useList[regV]) { RegisterSpec result = use.getResult(); if (result == null @@ -167,13 +167,14 @@ public class DeadCodeRemover { /** * Returns true if this insn has a side-effect. Returns true * if the insn is null for reasons stated in the code block. - * @param insn null-ok; instruction in question + * + * @param insn {@code null-ok;} instruction in question * @return true if it has a side-effect */ private static boolean hasSideEffect(SsaInsn insn) { if (insn == null) { - /* while false would seem to make more sense here, true - * prevents us from adding this back to a worklist unnecessarally + /* While false would seem to make more sense here, true + * prevents us from adding this back to a worklist unnecessarally. */ return true; } @@ -185,7 +186,7 @@ public class DeadCodeRemover { * A callback class used to build up the initial worklist of * registers defined by an instruction with no side effect. */ - static class NoSideEffectVisitor implements SsaInsn.Visitor { + static private class NoSideEffectVisitor implements SsaInsn.Visitor { BitSet noSideEffectRegs; /** @@ -195,13 +196,13 @@ public class DeadCodeRemover { * @param noSideEffectRegs to-build bitset of regs that are * results of regs with no side effects */ - NoSideEffectVisitor(BitSet noSideEffectRegs) { + public NoSideEffectVisitor(BitSet noSideEffectRegs) { this.noSideEffectRegs = noSideEffectRegs; } /** {@inheritDoc} */ public void visitMoveInsn (NormalSsaInsn insn) { - // If we're tracking local vars, some moves have side effects + // If we're tracking local vars, some moves have side effects. if (!hasSideEffect(insn)) { noSideEffectRegs.set(insn.getResult().getReg()); } @@ -209,7 +210,7 @@ public class DeadCodeRemover { /** {@inheritDoc} */ public void visitPhiInsn (PhiInsn phi) { - // If we're tracking local vars, then some phis have side effects + // If we're tracking local vars, then some phis have side effects. if (!hasSideEffect(phi)) { noSideEffectRegs.set(phi.getResult().getReg()); } diff --git a/dx/src/com/android/dx/ssa/DomFront.java b/dx/src/com/android/dx/ssa/DomFront.java index ea089ec13..3005015b1 100644 --- a/dx/src/com/android/dx/ssa/DomFront.java +++ b/dx/src/com/android/dx/ssa/DomFront.java @@ -30,27 +30,34 @@ import java.util.BitSet; * Harvey, and Kennedy; transliterated to Java. */ public class DomFront { + /** local debug flag */ private static boolean DEBUG = false; + /** {@code non-null;} method being processed */ private final SsaMethod meth; + private final ArrayList<SsaBasicBlock> nodes; + private final DomInfo[] domInfos; /** * Dominance-frontier information for a single basic block. */ public static class DomInfo { - /** non-null; the dominance frontier set indexed by block index */ - IntSet dominanceFrontiers; - /** >= 0 after run(); the index of the immediate dominator */ - int idom = -1; - /** depth-first traversal index */ - int traversalIndex; + /** + * {@code null-ok;} the dominance frontier set indexed by + * block index + */ + public IntSet dominanceFrontiers; + + /** {@code >= 0 after run();} the index of the immediate dominator */ + public int idom = -1; } /** * Constructs instance. Call {@link DomFront#run} to process. - * @param meth + * + * @param meth {@code non-null;} method to process */ public DomFront(SsaMethod meth) { this.meth = meth; @@ -67,7 +74,7 @@ public class DomFront { /** * Calculates the dominance frontier information for the method. * - * @return non-null; an array of DomInfo structures + * @return {@code non-null;} an array of DomInfo structures */ public DomInfo[] run() { int szNodes = nodes.size(); @@ -80,8 +87,7 @@ public class DomFront { } } - Dominators methDom = new Dominators(domInfos, false); - methDom.run(meth); + Dominators methDom = Dominators.make(meth, domInfos, false); if (DEBUG) { for (int i = 0; i < szNodes; i++) { @@ -123,7 +129,7 @@ public class DomFront { sb.append('{'); boolean comma = false; - for (SsaBasicBlock child: node.getDomChildren()) { + for (SsaBasicBlock child : node.getDomChildren()) { if (comma) { sb.append(','); } @@ -164,20 +170,25 @@ public class DomFront { SsaBasicBlock nb = nodes.get(b); DomInfo nbInfo = domInfos[b]; BitSet pred = nb.getPredecessors(); + if (pred.cardinality() > 1) { for (int i = pred.nextSetBit(0); i >= 0; i = pred.nextSetBit(i + 1)) { - for(int runnerIndex = i - ; runnerIndex != nbInfo.idom - ;) { - // We can stop if we hit a block we already - // added label to, since we must be at a part - // of the dom tree we have seen before. + for (int runnerIndex = i; + runnerIndex != nbInfo.idom; /* empty */) { + /* + * We can stop if we hit a block we already + * added label to, since we must be at a part + * of the dom tree we have seen before. + */ DomInfo runnerInfo = domInfos[runnerIndex]; - if (runnerInfo.dominanceFrontiers.has(b)) + + if (runnerInfo.dominanceFrontiers.has(b)) { break; - // "add b to runner's dominance frontier set" + } + + // Add b to runner's dominance frontier set. runnerInfo.dominanceFrontiers.add(b); runnerIndex = runnerInfo.idom; } diff --git a/dx/src/com/android/dx/ssa/Dominators.java b/dx/src/com/android/dx/ssa/Dominators.java index 1af2cbc88..f7d7da6f2 100644 --- a/dx/src/com/android/dx/ssa/Dominators.java +++ b/dx/src/com/android/dx/ssa/Dominators.java @@ -41,31 +41,55 @@ import java.util.HashSet; * rank to keep the union-find tree balanced. */ public final class Dominators { - /* postdom is true if we want post dominators. */ - private boolean postdom; + /* postdom is true if we want post dominators */ + private final boolean postdom; + + /* {@code non-null;} method being processed */ + private final SsaMethod meth; + /* Method's basic blocks. */ - private ArrayList<SsaBasicBlock> blocks; + private final ArrayList<SsaBasicBlock> blocks; - private static final class DFSInfo { - int semidom; - SsaBasicBlock parent; - // rep(resentative) is known as "label" in the paper. It is the node - // that our block's DFS info has been unioned to. - SsaBasicBlock rep; - SsaBasicBlock ancestor; - ArrayList<SsaBasicBlock> bucket; + /** indexed by basic block index */ + private final DFSInfo[] info; - public DFSInfo() { - bucket = new ArrayList<SsaBasicBlock>(); - } + private final ArrayList<SsaBasicBlock> vertex; + + /** {@code non-null;} the raw dominator info */ + private final DomFront.DomInfo domInfos[]; + /** + * Constructs an instance. + * + * @param meth {@code non-null;} method to process + * @param domInfos {@code non-null;} the raw dominator info + * @param postdom true for postdom information, false for normal dom info + */ + private Dominators(SsaMethod meth, DomFront.DomInfo[] domInfos, + boolean postdom) { + this.meth = meth; + this.domInfos = domInfos; + this.postdom = postdom; + this.blocks = meth.getBlocks(); + this.info = new DFSInfo[blocks.size() + 2]; + this.vertex = new ArrayList<SsaBasicBlock>(); } - /** Indexed by basic block index */ - private DFSInfo[] info; - private ArrayList<SsaBasicBlock> vertex; + /** + * Constructs a fully-initialized instance. (This method exists so as + * to avoid calling a large amount of code in the constructor.) + * + * @param meth {@code non-null;} method to process + * @param domInfos {@code non-null;} the raw dominator info + * @param postdom true for postdom information, false for normal dom info + */ + public static Dominators make(SsaMethod meth, DomFront.DomInfo[] domInfos, + boolean postdom) { + Dominators result = new Dominators(meth, domInfos, postdom); - private DomFront.DomInfo domInfos[]; + result.run(); + return result; + } private BitSet getSuccs(SsaBasicBlock block) { if (postdom) { @@ -85,6 +109,7 @@ public final class Dominators { /** * Performs path compress on the DFS info. + * * @param in Basic block whose DFS info we are path compressing. */ private void compress(SsaBasicBlock in) { @@ -110,7 +135,7 @@ public final class Dominators { } worklist.remove(wsize - 1); - // Update based on ancestor info + // Update based on ancestor info. if (vabbInfo.ancestor == null) { continue; } @@ -124,42 +149,25 @@ public final class Dominators { } } } + private SsaBasicBlock eval(SsaBasicBlock v) { DFSInfo bbInfo = info[v.getIndex()]; + if (bbInfo.ancestor == null) { return v; } + compress(v); return bbInfo.rep; } /** - * Callback for depth-first walk through control flow graph (either - * from the entry block or the exit block). Records the traversal order - * in the <code>info</code>list. - */ - private class DfsWalker implements SsaBasicBlock.Visitor { - int dfsNum = 0; - - public void visitBlock (SsaBasicBlock v, SsaBasicBlock parent) { - DFSInfo bbInfo = new DFSInfo(); - bbInfo.semidom = ++dfsNum; - bbInfo.rep = v; - bbInfo.parent = parent; - vertex.add(v); - info[v.getIndex()] = bbInfo; - } - } - - /** - * Performs dominator/post-dominator calculation for the control flow graph. - * @param meth Method to analyze + * Performs dominator/post-dominator calculation for the control + * flow graph. + * + * @param meth {@code non-null;} method to analyze */ - public void run(SsaMethod meth) { - - this.blocks = meth.getBlocks(); - this.info = new DFSInfo[blocks.size() + 2]; - this.vertex = new ArrayList<SsaBasicBlock>(); + private void run() { SsaBasicBlock root = postdom ? meth.getExitBlock() : meth.getEntryBlock(); @@ -168,8 +176,10 @@ public final class Dominators { domInfos[root.getIndex()].idom = root.getIndex(); } - // First we perform a DFS numbering of the blocks, by numbering the dfs - // tree roots + /* + * First we perform a DFS numbering of the blocks, by + * numbering the dfs tree roots. + */ DfsWalker walker = new DfsWalker(); meth.forEachBlockDepthFirst(postdom, walker); @@ -184,12 +194,15 @@ public final class Dominators { BitSet preds = getPreds(w); for (int j = preds.nextSetBit(0); - j >= 0; - j = preds.nextSetBit(j + 1)) { + j >= 0; + j = preds.nextSetBit(j + 1)) { SsaBasicBlock predBlock = blocks.get(j); DFSInfo predInfo = info[predBlock.getIndex()]; - // PredInfo may not exist in case the predecessor is not - // reachable + + /* + * PredInfo may not exist in case the predecessor is + * not reachable. + */ if (predInfo != null) { int predSemidom = info[eval(predBlock).getIndex()].semidom; if (predSemidom < wInfo.semidom) { @@ -199,11 +212,14 @@ public final class Dominators { } info[vertex.get(wInfo.semidom).getIndex()].bucket.add(w); - // Normally we would call link here, but in our m log n - // implementation this is equivalent to the following single line + /* + * Normally we would call link here, but in our O(m log n) + * implementation this is equivalent to the following + * single line. + */ wInfo.ancestor = wInfo.parent; - // Implicity define idom for each vertex + // Implicity define idom for each vertex. ArrayList<SsaBasicBlock> wParentBucket; wParentBucket = info[wInfo.parent.getIndex()].bucket; @@ -219,6 +235,7 @@ public final class Dominators { } } } + // Now explicitly define the immediate dominator of each vertex for (int i = 2; i <= dfsMax; ++i) { SsaBasicBlock w = vertex.get(i); @@ -231,10 +248,38 @@ public final class Dominators { } /** - * @param postdom true for postdom information, false for normal dom info + * Callback for depth-first walk through control flow graph (either + * from the entry block or the exit block). Records the traversal order + * in the {@code info}list. */ - public Dominators(DomFront.DomInfo[] domInfos, boolean postdom) { - this.domInfos = domInfos; - this.postdom = postdom; + private class DfsWalker implements SsaBasicBlock.Visitor { + private int dfsNum = 0; + + public void visitBlock(SsaBasicBlock v, SsaBasicBlock parent) { + DFSInfo bbInfo = new DFSInfo(); + bbInfo.semidom = ++dfsNum; + bbInfo.rep = v; + bbInfo.parent = parent; + vertex.add(v); + info[v.getIndex()] = bbInfo; + } + } + + private static final class DFSInfo { + public int semidom; + public SsaBasicBlock parent; + + /** + * rep(resentative) is known as "label" in the paper. It is the node + * that our block's DFS info has been unioned to. + */ + public SsaBasicBlock rep; + + public SsaBasicBlock ancestor; + public ArrayList<SsaBasicBlock> bucket; + + public DFSInfo() { + bucket = new ArrayList<SsaBasicBlock>(); + } } } diff --git a/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java b/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java index be678ddde..392579d88 100644 --- a/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java +++ b/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java @@ -33,7 +33,6 @@ import java.util.BitSet; * have variable register widths/categories, and the new namespace does. */ public class InterferenceRegisterMapper extends BasicRegisterMapper { - /** * Array of interference sets. ArrayList is indexed by new namespace * and BitIntSet's are indexed by old namespace. The list expands @@ -45,16 +44,15 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { */ private final ArrayList<BitIntSet> newRegInterference; - /** - * The interference graph for the old namespace - */ + /** the interference graph for the old namespace */ private final InterferenceGraph oldRegInterference; /** - * @param countOldRegisters number of registers in old namespace. + * Constructs an instance + * + * @param countOldRegisters number of registers in old namespace */ - public InterferenceRegisterMapper( - InterferenceGraph oldRegInterference, + public InterferenceRegisterMapper(InterferenceGraph oldRegInterference, int countOldRegisters) { super(countOldRegisters); @@ -75,8 +73,8 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { } /** - * Checks to see if old namespace reg <code>oldReg</code> interferes - * with what currently maps to <code>newReg</code>. + * Checks to see if old namespace reg {@code oldReg} interferes + * with what currently maps to {@code newReg}. * * @param oldReg old namespace register * @param newReg new namespace register @@ -101,10 +99,10 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { } /** - * Checks to see if old namespace reg <code>oldReg</code> interferes - * with what currently maps to <code>newReg</code>. + * Checks to see if old namespace reg {@code oldReg} interferes + * with what currently maps to {@code newReg}. * - * @param oldSpec non-null; old namespace register + * @param oldSpec {@code non-null;} old namespace register * @param newReg new namespace register * @return true if oldReg will interfere with newReg */ @@ -115,6 +113,7 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { /** * Adds a register's interference set to the interference list, * growing it if necessary. + * * @param newReg register in new namespace * @param oldReg register in old namespace */ @@ -134,17 +133,17 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { * pinned to the specified new-namespace reg + category. Takes into * account the category of the old-namespace registers. * - * @param oldSpecs non-null; set of old-namespace regs - * @param newReg >= 0 new-namespace register - * @param targetCategory 1 or 2; the number of adjacent new-namespace + * @param oldSpecs {@code non-null;} set of old-namespace regs + * @param newReg {@code >= 0;} new-namespace register + * @param targetCategory {@code 1..2;} the number of adjacent new-namespace * registers (starting at ropReg) to consider * @return true if any of the old-namespace register have been mapped * to the new-namespace register + category */ public boolean areAnyPinned(RegisterSpecList oldSpecs, int newReg, int targetCategory) { - int sz = oldSpecs.size(); + for (int i = 0; i < sz; i++) { RegisterSpec oldSpec = oldSpecs.get(i); int r = oldToNew(oldSpec.getReg()); @@ -159,6 +158,7 @@ public class InterferenceRegisterMapper extends BasicRegisterMapper { return true; } } + return false; } } diff --git a/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java b/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java index ad10cd75d..a70b5bb29 100644 --- a/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java +++ b/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java @@ -42,7 +42,7 @@ public class LiteralOpUpgrader { /** * Process a method. * - * @param ssaMethod non-null; method to process + * @param ssaMethod {@code non-null;} method to process */ public static void process(SsaMethod ssaMethod) { LiteralOpUpgrader dc; @@ -135,8 +135,8 @@ public class LiteralOpUpgrader { * * TODO move this somewhere else. * - * @param insn non-null; an SsaInsn containing a PlainInsn - * @param newSources non-null; new sources list for new insn + * @param insn {@code non-null;} an SsaInsn containing a PlainInsn + * @param newSources {@code non-null;} new sources list for new insn * @param newOpcode A RegOp from {@link RegOps} */ private void replacePlainInsn(NormalSsaInsn insn, diff --git a/dx/src/com/android/dx/ssa/LocalVariableExtractor.java b/dx/src/com/android/dx/ssa/LocalVariableExtractor.java index 21c306b7e..11d53cf2a 100644 --- a/dx/src/com/android/dx/ssa/LocalVariableExtractor.java +++ b/dx/src/com/android/dx/ssa/LocalVariableExtractor.java @@ -33,23 +33,23 @@ import java.util.List; * converted, and adapted through edge-splitting. */ public class LocalVariableExtractor { - /** non-null; method being extracted from */ + /** {@code non-null;} method being extracted from */ private final SsaMethod method; - /** non-null; block list for the method */ + /** {@code non-null;} block list for the method */ private final ArrayList<SsaBasicBlock> blocks; - /** non-null; result in-progress */ + /** {@code non-null;} result in-progress */ private final LocalVariableInfo resultInfo; - /** non-null; work set indicating blocks needing to be processed */ + /** {@code non-null;} work set indicating blocks needing to be processed */ private final BitSet workSet; /** * Extracts out all the local variable information from the given method. * - * @param method non-null; the method to extract from - * @return non-null; the extracted information + * @param method {@code non-null;} the method to extract from + * @return {@code non-null;} the extracted information */ public static LocalVariableInfo extract(SsaMethod method) { LocalVariableExtractor lve = new LocalVariableExtractor(method); @@ -59,7 +59,7 @@ public class LocalVariableExtractor { /** * Constructs an instance. This method is private. Use {@link #extract}. * - * @param method non-null; the method to extract from + * @param method {@code non-null;} the method to extract from */ private LocalVariableExtractor(SsaMethod method) { if (method == null) { @@ -77,7 +77,7 @@ public class LocalVariableExtractor { /** * Does the extraction. * - * @return non-null; the extracted information + * @return {@code non-null;} the extracted information */ private LocalVariableInfo doit() { @@ -98,7 +98,7 @@ public class LocalVariableExtractor { /** * Processes a single block. * - * @param blockIndex >= 0; block index of the block to process + * @param blockIndex {@code >= 0;} block index of the block to process */ private void processBlock(int blockIndex) { RegisterSpecSet primaryState diff --git a/dx/src/com/android/dx/ssa/LocalVariableInfo.java b/dx/src/com/android/dx/ssa/LocalVariableInfo.java index f7c37d24d..8845270c3 100644 --- a/dx/src/com/android/dx/ssa/LocalVariableInfo.java +++ b/dx/src/com/android/dx/ssa/LocalVariableInfo.java @@ -29,30 +29,30 @@ import java.util.List; * Stolen from {@link com.android.dx.rop.code.LocalVariableInfo}. */ public class LocalVariableInfo extends MutabilityControl { - /** >= 0; the register count for the method */ + /** {@code >= 0;} the register count for the method */ private final int regCount; /** - * non-null; {@link com.android.dx.rop.code.RegisterSpecSet} to use when indicating a block + * {@code non-null;} {@link com.android.dx.rop.code.RegisterSpecSet} to use when indicating a block * that has no locals; it is empty and immutable but has an appropriate * max size for the method */ private final RegisterSpecSet emptySet; /** - * non-null; array consisting of register sets representing the + * {@code non-null;} array consisting of register sets representing the * sets of variables already assigned upon entry to each block, * where array indices correspond to block indices */ private final RegisterSpecSet[] blockStarts; - /** non-null; map from instructions to the variable each assigns */ + /** {@code non-null;} map from instructions to the variable each assigns */ private final HashMap<SsaInsn, RegisterSpec> insnAssignments; /** * Constructs an instance. * - * @param method non-null; the method being represented by this instance + * @param method {@code non-null;} the method being represented by this instance */ public LocalVariableInfo(SsaMethod method) { if (method == null) { @@ -74,8 +74,8 @@ public class LocalVariableInfo extends MutabilityControl { * Sets the register set associated with the start of the block with * the given index. * - * @param index >= 0; the block index - * @param specs non-null; the register set to associate with the block + * @param index {@code >= 0;} the block index + * @param specs {@code non-null;} the register set to associate with the block */ public void setStarts(int index, RegisterSpecSet specs) { throwIfImmutable(); @@ -99,12 +99,12 @@ public class LocalVariableInfo extends MutabilityControl { * merge the two sets and call {@link #setStarts} on the result of the * merge. * - * @param index >= 0; the block index - * @param specs non-null; the register set to merge into the start set + * @param index {@code >= 0;} the block index + * @param specs {@code non-null;} the register set to merge into the start set * for the block - * @return <code>true</code> if the merge resulted in an actual change + * @return {@code true} if the merge resulted in an actual change * to the associated set (including storing one for the first time) or - * <code>false</code> if there was no change + * {@code false} if there was no change */ public boolean mergeStarts(int index, RegisterSpecSet specs) { RegisterSpecSet start = getStarts0(index); @@ -133,8 +133,8 @@ public class LocalVariableInfo extends MutabilityControl { * with the given index. This returns an empty set with the appropriate * max size if no set was associated with the block in question. * - * @param index >= 0; the block index - * @return non-null; the associated register set + * @param index {@code >= 0;} the block index + * @return {@code non-null;} the associated register set */ public RegisterSpecSet getStarts(int index) { RegisterSpecSet result = getStarts0(index); @@ -145,10 +145,10 @@ public class LocalVariableInfo extends MutabilityControl { /** * Gets the register set associated with the start of the given * block. This is just convenient shorthand for - * <code>getStarts(block.getLabel())</code>. + * {@code getStarts(block.getLabel())}. * - * @param block non-null; the block in question - * @return non-null; the associated register set + * @param block {@code non-null;} the block in question + * @return {@code non-null;} the associated register set */ public RegisterSpecSet getStarts(SsaBasicBlock block) { return getStarts(block.getIndex()); @@ -160,8 +160,8 @@ public class LocalVariableInfo extends MutabilityControl { * newly-allocated empty {@link RegisterSpecSet} of appropriate * max size if there is not yet any set associated with the block. * - * @param index >= 0; the block index - * @return non-null; the associated register set + * @param index {@code >= 0;} the block index + * @return {@code non-null;} the associated register set */ public RegisterSpecSet mutableCopyOfStarts(int index) { RegisterSpecSet result = getStarts0(index); @@ -181,8 +181,8 @@ public class LocalVariableInfo extends MutabilityControl { * simple type and the one in the instruction can be an arbitrary * {@link com.android.dx.rop.type.TypeBearer} (such as a constant value). * - * @param insn non-null; the instruction in question - * @param spec non-null; the associated register spec + * @param insn {@code non-null;} the instruction in question + * @param spec {@code non-null;} the associated register spec */ public void addAssignment(SsaInsn insn, RegisterSpec spec) { throwIfImmutable(); @@ -202,8 +202,8 @@ public class LocalVariableInfo extends MutabilityControl { * Gets the named register being assigned by the given instruction, if * previously stored in this instance. * - * @param insn non-null; instruction in question - * @return null-ok; the named register being assigned, if any + * @param insn {@code non-null;} instruction in question + * @return {@code null-ok;} the named register being assigned, if any */ public RegisterSpec getAssignment(SsaInsn insn) { return insnAssignments.get(insn); @@ -212,7 +212,7 @@ public class LocalVariableInfo extends MutabilityControl { /** * Gets the number of assignments recorded by this instance. * - * @return >= 0; the number of assignments + * @return {@code >= 0;} the number of assignments */ public int getAssignmentCount() { return insnAssignments.size(); @@ -236,8 +236,8 @@ public class LocalVariableInfo extends MutabilityControl { * Helper method, to get the starts for a index, throwing the * right exception for range problems. * - * @param index >= 0; the block index - * @return null-ok; associated register set or <code>null</code> if there + * @param index {@code >= 0;} the block index + * @return {@code null-ok;} associated register set or {@code null} if there * is none */ private RegisterSpecSet getStarts0(int index) { diff --git a/dx/src/com/android/dx/ssa/MoveParamCombiner.java b/dx/src/com/android/dx/ssa/MoveParamCombiner.java index a27aec58b..352e3e6ab 100644 --- a/dx/src/com/android/dx/ssa/MoveParamCombiner.java +++ b/dx/src/com/android/dx/ssa/MoveParamCombiner.java @@ -143,8 +143,8 @@ public class MoveParamCombiner { * Returns the parameter index associated with a move-param insn. Does * not verify that the insn is a move-param insn. * - * @param insn non-null; a move-param insn - * @return >=0 parameter index + * @param insn {@code non-null;} a move-param insn + * @return {@code >=0;} parameter index */ private int getParamIndex(NormalSsaInsn insn) { CstInsn cstInsn = (CstInsn)(insn.getOriginalRopInsn()); diff --git a/dx/src/com/android/dx/ssa/NormalSsaInsn.java b/dx/src/com/android/dx/ssa/NormalSsaInsn.java index ad9315a16..d3392ca0f 100644 --- a/dx/src/com/android/dx/ssa/NormalSsaInsn.java +++ b/dx/src/com/android/dx/ssa/NormalSsaInsn.java @@ -19,13 +19,10 @@ package com.android.dx.ssa; import com.android.dx.rop.code.*; /** - * A "normal" (non-phi) instruction in SSA form. Always wraps a ROP insn. + * A "normal" (non-phi) instruction in SSA form. Always wraps a rop insn. */ public final class NormalSsaInsn extends SsaInsn implements Cloneable { - - /** - * ROP insn that we're wrapping - */ + /** {@code non-null;} rop insn that we're wrapping */ private Insn insn; /** @@ -35,21 +32,19 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { * @param block block that contains this insn */ NormalSsaInsn(final Insn insn, final SsaBasicBlock block) { - super(block); + super(insn.getResult(), block); this.insn = insn; - this.result = insn.getResult(); } /** {@inheritDoc} */ @Override public final void mapSourceRegisters(RegisterMapper mapper) { - RegisterSpecList oldSources = insn.getSources(); RegisterSpecList newSources = mapper.map(oldSources); if (newSources != oldSources) { - insn = insn.withNewRegisters(result, newSources); - block.getParent().onSourcesChanged(this, oldSources); + insn = insn.withNewRegisters(getResult(), newSources); + getBlock().getParent().onSourcesChanged(this, oldSources); } } @@ -57,7 +52,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { * Changes one of the insn's sources. New source should be of same type * and category. * - * @param index >=0; index of source to change + * @param index {@code >=0;} index of source to change * @param newSpec spec for new source */ public final void changeOneSource(int index, RegisterSpec newSpec) { @@ -68,6 +63,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { for (int i = 0; i < sz; i++) { newSources.set(i, i == index ? newSpec : origSources.get(i)); } + newSources.setImmutable(); RegisterSpec origSpec = origSources.get(index); @@ -76,10 +72,10 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { * If the register remains unchanged, we're only changing * the type or local var name so don't update use list */ - block.getParent().onSourceChanged(this, origSpec, newSpec); + getBlock().getParent().onSourceChanged(this, origSpec, newSpec); } - insn = insn.withNewRegisters(result, newSources); + insn = insn.withNewRegisters(getResult(), newSources); } /** @@ -90,22 +86,24 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { */ public final void setNewSources (RegisterSpecList newSources) { RegisterSpecList origSources = insn.getSources(); + if (origSources.size() != newSources.size()) { throw new RuntimeException("Sources counts don't match"); } - insn = insn.withNewRegisters(result, newSources); + insn = insn.withNewRegisters(getResult(), newSources); } /** {@inheritDoc} */ @Override public NormalSsaInsn clone() { - return (NormalSsaInsn)super.clone(); + return (NormalSsaInsn) super.clone(); } /** - * Like rop.Insn.getSources() - * @return null-ok; sources list + * Like rop.Insn.getSources(). + * + * @return {@code null-ok;} sources list */ public RegisterSpecList getSources() { return insn.getSources(); @@ -119,7 +117,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { /** {@inheritDoc} */ @Override public Insn toRopInsn() { - return insn.withNewRegisters(result,insn.getSources()); + return insn.withNewRegisters(getResult(), insn.getSources()); } /** @@ -143,7 +141,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { if (insn.getOpcode().getOpcode() == RegOps.MARK_LOCAL) { assignment = insn.getSources().get(0); } else { - assignment = result; + assignment = getResult(); } if (assignment == null) { @@ -167,8 +165,9 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { */ public void upgradeToLiteral() { RegisterSpecList oldSources = insn.getSources(); + insn = insn.withLastSourceLiteral(); - block.getParent().onSourcesChanged(this, oldSources); + getBlock().getParent().onSourcesChanged(this, oldSources); } /** @@ -210,7 +209,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { /** * {@inheritDoc} * - * TODO increase the scope of this. + * TODO: Increase the scope of this. */ @Override public boolean hasSideEffect() { @@ -221,7 +220,7 @@ public final class NormalSsaInsn extends SsaInsn implements Cloneable { } boolean hasLocalSideEffect - = Optimizer.getPreserveLocals() && getLocalAssignment() != null; + = Optimizer.getPreserveLocals() && getLocalAssignment() != null; switch (opcode.getOpcode()) { case RegOps.MOVE_RESULT: diff --git a/dx/src/com/android/dx/ssa/Optimizer.java b/dx/src/com/android/dx/ssa/Optimizer.java index cee6d7b37..c5f6dc9a2 100644 --- a/dx/src/com/android/dx/ssa/Optimizer.java +++ b/dx/src/com/android/dx/ssa/Optimizer.java @@ -48,7 +48,7 @@ public class Optimizer { } /** - * @return non-null; translation advice + * @return {@code non-null;} translation advice */ public static TranslationAdvice getAdvice() { return advice; @@ -64,7 +64,7 @@ public class Optimizer { * @param isStatic true if this method has no 'this' pointer argument. * @param inPreserveLocals true if local variable info should be preserved, * at the cost of some registers and insns - * @param inAdvice non-null; translation advice + * @param inAdvice {@code non-null;} translation advice * @return optimized method */ public static RopMethod optimize(RopMethod rmeth, int paramWidth, @@ -85,7 +85,7 @@ public class Optimizer { * @param isStatic true if this method has no 'this' pointer argument. * @param inPreserveLocals true if local variable info should be preserved, * at the cost of some registers and insns - * @param inAdvice non-null; translation advice + * @param inAdvice {@code non-null;} translation advice * @param steps set of optional optimization steps to run * @return optimized method */ diff --git a/dx/src/com/android/dx/ssa/PhiInsn.java b/dx/src/com/android/dx/ssa/PhiInsn.java index 1829133bb..64e85acb9 100644 --- a/dx/src/com/android/dx/ssa/PhiInsn.java +++ b/dx/src/com/android/dx/ssa/PhiInsn.java @@ -30,67 +30,53 @@ import java.util.List; * conversion back to ROP form. */ public final class PhiInsn extends SsaInsn { - /** - * the original result register of the phi insn is needed during the - * renaming process after the new result register has already been chosen. + * result register. The original result register of the phi insn + * is needed during the renaming process after the new result + * register has already been chosen. */ - private int ropResultReg; - private ArrayList<Operand> operands = new ArrayList<Operand>(); - private RegisterSpecList sources; + private final int ropResultReg; /** - * A single phi operand, consiting of source register and block index - * for move. + * {@code non-null;} operands of the instruction; built up by + * {@link #addPhiOperand} */ - class Operand { - RegisterSpec regSpec; - int blockIndex; - int ropLabel; //mostly for debugging + private final ArrayList<Operand> operands = new ArrayList<Operand>(); - Operand (final RegisterSpec regSpec, final int blockIndex, - final int ropLabel){ - this.regSpec = regSpec; - this.blockIndex = blockIndex; - this.ropLabel = ropLabel; - } - } - - public static interface Visitor { - public void visitPhiInsn(PhiInsn insn); - } - - public PhiInsn clone() { - throw new UnsupportedOperationException("can't clone phi"); - } + /** {@code null-ok;} source registers; constructed lazily */ + private RegisterSpecList sources; /** * Constructs a new phi insn with no operands. + * * @param resultReg the result reg for this phi insn * @param block block containing this insn. */ - PhiInsn(final RegisterSpec resultReg, final SsaBasicBlock block) { - super(block); - this.result = resultReg; + public PhiInsn(RegisterSpec resultReg, SsaBasicBlock block) { + super(resultReg, block); ropResultReg = resultReg.getReg(); } /** * Makes a phi insn with a void result type. + * * @param resultReg the result register for this phi insn. * @param block block containing this insn. */ - PhiInsn(final int resultReg, final SsaBasicBlock block) { - super(block); - + public PhiInsn(final int resultReg, final SsaBasicBlock block) { /* - * The type here is bogus: the type depends on the operand and - * will be derived later. + * The result type here is bogus: The type depends on the + * operand and will be derived later. */ - this.result = RegisterSpec.make(resultReg, Type.VOID); + super(RegisterSpec.make(resultReg, Type.VOID), block); ropResultReg = resultReg; } + /** {@inheritDoc} */ + public PhiInsn clone() { + throw new UnsupportedOperationException("can't clone phi"); + } + /** * Updates the TypeBearers of all the sources (phi operands) to be * the current TypeBearer of the register-defining instruction's result. @@ -100,9 +86,8 @@ public final class PhiInsn extends SsaInsn { * * @param ssaMeth method that contains this insn */ - void updateSourcesToDefinitions(SsaMethod ssaMeth) { - - for (Operand o: operands) { + public void updateSourcesToDefinitions(SsaMethod ssaMeth) { + for (Operand o : operands) { RegisterSpec def = ssaMeth.getDefinitionForRegister( o.regSpec.getReg()).getResult(); @@ -116,37 +101,42 @@ public final class PhiInsn extends SsaInsn { /** * Changes the result type. Used during phi type resolution * - * @param type non-null; new TypeBearer - * @param local null-ok; new local info, if available + * @param type {@code non-null;} new TypeBearer + * @param local {@code null-ok;} new local info, if available */ - void changeResultType(TypeBearer type, LocalItem local) { - result = RegisterSpec.makeLocalOptional(result.getReg(), type, local); + public void changeResultType(TypeBearer type, LocalItem local) { + setResult(RegisterSpec.makeLocalOptional( + getResult().getReg(), type, local)); } /** - * @return the original rop-form result reg. Useful during renaming. + * Gets the original rop-form result reg. This is useful during renaming. + * + * @return the original rop-form result reg */ - int getRopResultReg() { + public int getRopResultReg() { return ropResultReg; } /** - * Add an operand to this phi instruction + * Adds an operand to this phi instruction. + * * @param registerSpec register spec, including type and reg of operand - * @param predBlock Predecessor block to be associated with this operand + * @param predBlock predecessor block to be associated with this operand */ public void addPhiOperand(RegisterSpec registerSpec, SsaBasicBlock predBlock) { operands.add(new Operand(registerSpec, predBlock.getIndex(), predBlock.getRopLabel())); - // in case someone has already called getSources() + // Un-cache sources, in case someone has already called getSources(). sources = null; } /** * Gets the index of the pred block associated with the RegisterSpec * at the particular getSources() index. + * * @param sourcesIndex index of source in getSources() * @return block index */ @@ -157,7 +147,7 @@ public final class PhiInsn extends SsaInsn { /** * {@inheritDoc} * - * Always returns null for <code>PhiInsn</code>s + * Always returns null for {@code PhiInsn}s. */ @Override public Rop getOpcode() { @@ -167,18 +157,17 @@ public final class PhiInsn extends SsaInsn { /** * {@inheritDoc} * - * Always returns null for <code>PhiInsn</code>s + * Always returns null for {@code PhiInsn}s. */ @Override public Insn getOriginalRopInsn() { return null; } - /** * {@inheritDoc} * - * Always returns false for <code>PhiInsn</code>s + * Always returns false for {@code PhiInsn}s. */ @Override public boolean canThrow() { @@ -188,10 +177,10 @@ public final class PhiInsn extends SsaInsn { /** * Gets sources. Constructed lazily from phi operand data structures and * then cached. - * @return sources list + * + * @return {@code non-null;} sources list */ public RegisterSpecList getSources() { - if (sources != null) { return sources; } @@ -219,10 +208,10 @@ public final class PhiInsn extends SsaInsn { public boolean isRegASource(int reg) { /* * Avoid creating a sources list in case it has not already been - * created + * created. */ - for (Operand o: operands) { + for (Operand o : operands) { if (o.regSpec.getReg() == reg) { return true; } @@ -236,12 +225,12 @@ public final class PhiInsn extends SsaInsn { */ public boolean areAllOperandsEqual() { if (operands.size() == 0 ) { - // this should never happen + // This should never happen. return true; } int firstReg = operands.get(0).regSpec.getReg(); - for (Operand o: operands) { + for (Operand o : operands) { if (firstReg != o.regSpec.getReg()) { return false; } @@ -253,19 +242,20 @@ public final class PhiInsn extends SsaInsn { /** {@inheritDoc} */ @Override public final void mapSourceRegisters(RegisterMapper mapper) { - for (Operand o: operands) { + for (Operand o : operands) { RegisterSpec old = o.regSpec; o.regSpec = mapper.map(old); if (old != o.regSpec) { - block.getParent().onSourceChanged(this, old, o.regSpec); + getBlock().getParent().onSourceChanged(this, old, o.regSpec); } } sources = null; } /** - * Always throws an exeption, since - * a phi insn may not be converted back to rop form + * Always throws an exeption, since a phi insn may not be + * converted back to rop form. + * * @return always throws exception */ @Override @@ -276,17 +266,16 @@ public final class PhiInsn extends SsaInsn { /** * Returns the list of predecessor blocks associated with all operands - * that have <code>reg</code> as an operand register. + * that have {@code reg} as an operand register. * * @param reg register to look up * @param ssaMeth method we're operating on - * @return List of predecessor blocks, empty if none + * @return list of predecessor blocks, empty if none */ - public List<SsaBasicBlock> predBlocksForReg (int reg, SsaMethod ssaMeth) { - ArrayList<SsaBasicBlock> ret - = (ArrayList<SsaBasicBlock>)new ArrayList(); + public List<SsaBasicBlock> predBlocksForReg(int reg, SsaMethod ssaMeth) { + ArrayList<SsaBasicBlock> ret = new ArrayList<SsaBasicBlock>(); - for (Operand o: operands) { + for (Operand o : operands) { if (o.regSpec.getReg() == reg) { ret.add(ssaMeth.getBlocks().get(o.blockIndex)); } @@ -297,12 +286,13 @@ public final class PhiInsn extends SsaInsn { /** {@inheritDoc} */ @Override - public boolean isPhiOrMove() { + public boolean isPhiOrMove() { return true; } /** {@inheritDoc} */ - @Override public boolean hasSideEffect() { + @Override + public boolean hasSideEffect() { return Optimizer.getPreserveLocals() && getLocalAssignment() != null; } @@ -312,25 +302,23 @@ public final class PhiInsn extends SsaInsn { v.visitPhiInsn(this); } - /** - * @return human-readable string for listing dumps - */ + /** {@inheritDoc} */ public String toHuman() { return toHumanWithInline(null); } /** - * Returns human-readable string for listing dumps. - * Allows sub-classes to specify extra text - * @param extra null-ok; the argument to print after the opcode + * Returns human-readable string for listing dumps. This method + * allows sub-classes to specify extra text. + * + * @param extra {@code null-ok;} the argument to print after the opcode * @return human-readable string for listing dumps */ protected final String toHumanWithInline(String extra) { StringBuffer sb = new StringBuffer(80); sb.append(SourcePosition.NO_INFO); - sb.append(": "); - sb.append("phi"); + sb.append(": phi"); if (extra != null) { sb.append("("); @@ -338,6 +326,8 @@ public final class PhiInsn extends SsaInsn { sb.append(")"); } + RegisterSpec result = getResult(); + if (result == null) { sb.append(" ."); } else { @@ -361,4 +351,27 @@ public final class PhiInsn extends SsaInsn { return sb.toString(); } + + /** + * A single phi operand, consiting of source register and block index + * for move. + */ + private static class Operand { + public RegisterSpec regSpec; + public final int blockIndex; + public final int ropLabel; // only used for debugging + + public Operand(RegisterSpec regSpec, int blockIndex, int ropLabel) { + this.regSpec = regSpec; + this.blockIndex = blockIndex; + this.ropLabel = ropLabel; + } + } + + /** + * Visitor interface for instances of this (outer) class. + */ + public static interface Visitor { + public void visitPhiInsn(PhiInsn insn); + } } diff --git a/dx/src/com/android/dx/ssa/RegisterMapper.java b/dx/src/com/android/dx/ssa/RegisterMapper.java index 98503e2d8..1f45b429a 100644 --- a/dx/src/com/android/dx/ssa/RegisterMapper.java +++ b/dx/src/com/android/dx/ssa/RegisterMapper.java @@ -21,13 +21,12 @@ import com.android.dx.rop.code.RegisterSpecList; import com.android.dx.util.ToHuman; /** - * Represents a mapping between two register numbering schemes. - * Subclasses of this may be mutable, and as such the mapping provided is only - * valid for the lifetime of the method call in which instances of this class - * are passed. + * Represents a mapping between two register numbering schemes. + * Subclasses of this may be mutable, and as such the mapping provided + * is only valid for the lifetime of the method call in which + * instances of this class are passed. */ public abstract class RegisterMapper { - /** * Gets the count of registers (really, the total register width, since * category width is counted) in the new namespace. @@ -47,17 +46,16 @@ public abstract class RegisterMapper { * @return new mapped register list, or old if nothing has changed. */ public final RegisterSpecList map(RegisterSpecList sources) { - RegisterSpecList newSources; - - newSources = new RegisterSpecList(sources.size()); - int sz = sources.size(); + RegisterSpecList newSources = new RegisterSpecList(sz); + for (int i = 0; i < sz; i++) { newSources.set(i, map(sources.get(i))); } newSources.setImmutable(); - // Return the old sources if nothing has changed - return newSources.equals(sources)? sources: newSources; + + // Return the old sources if nothing has changed. + return newSources.equals(sources) ? sources : newSources; } } diff --git a/dx/src/com/android/dx/ssa/SCCP.java b/dx/src/com/android/dx/ssa/SCCP.java index 1d95da63c..73e9b4992 100644 --- a/dx/src/com/android/dx/ssa/SCCP.java +++ b/dx/src/com/android/dx/ssa/SCCP.java @@ -102,11 +102,11 @@ public class SCCP { */ private void addUsersToWorklist(int reg, int latticeValue) { if (latticeValue == VARYING) { - for (SsaInsn insn: ssaMeth.getUseListForRegister(reg)) { + for (SsaInsn insn : ssaMeth.getUseListForRegister(reg)) { varyingWorklist.add(insn); } } else { - for (SsaInsn insn: ssaMeth.getUseListForRegister(reg)) { + for (SsaInsn insn : ssaMeth.getUseListForRegister(reg)) { ssaWorklist.add(insn); } } @@ -137,9 +137,6 @@ public class SCCP { } } - private boolean setLatticeValueTo(int reg, int value) { - return setLatticeValueTo(reg, value, null); - } /** * Simulates a PHI node and set the lattice for the result * to the approriate value. @@ -160,6 +157,7 @@ public class SCCP { int phiResultValue = TOP; Constant phiConstant = null; int sourceSize = sources.size(); + for (int i = 0; i < sourceSize; i++) { int predBlockIndex = insn.predBlockIndexForSourcesIndex(i); int sourceReg = sources.get(i).getReg(); @@ -194,7 +192,7 @@ public class SCCP { * @param block Block to visit */ private void simulateBlock(SsaBasicBlock block) { - for (SsaInsn insn: block.getInsns()) { + for (SsaInsn insn : block.getInsns()) { if (insn instanceof PhiInsn) { simulatePhi((PhiInsn) insn); } else { @@ -464,7 +462,7 @@ public class SCCP { * Update the sources RegisterSpec's of all non-move uses. * These will be used in later steps. */ - for(SsaInsn insn: ssaMeth.getUseListForRegister(reg)) { + for (SsaInsn insn : ssaMeth.getUseListForRegister(reg)) { if (insn.isPhiOrMove()) { continue; } @@ -478,7 +476,6 @@ public class SCCP { RegisterSpec newSpec = spec.withType((TypedConstant)latticeConstants[reg]); - nInsn.changeOneSource(index, newSpec); } } diff --git a/dx/src/com/android/dx/ssa/SetFactory.java b/dx/src/com/android/dx/ssa/SetFactory.java index f34d08d91..92e965fb9 100644 --- a/dx/src/com/android/dx/ssa/SetFactory.java +++ b/dx/src/com/android/dx/ssa/SetFactory.java @@ -59,8 +59,8 @@ public final class SetFactory { /** * Make IntSet for the dominance-frontier sets. * - * @param szBlocks >=0; count of basic blocks in method - * @return non-null; appropriate set + * @param szBlocks {@code >=0;} count of basic blocks in method + * @return {@code non-null;} appropriate set */ /*package*/ static IntSet makeDomFrontSet(int szBlocks) { return szBlocks <= DOMFRONT_SET_THRESHOLD_SIZE @@ -72,8 +72,8 @@ public final class SetFactory { * Make IntSet for the interference graph sets. Public because * InterferenceGraph is in another package. * - * @param countRegs >=0; count of SSA registers used in method - * @return non-null; appropriate set + * @param countRegs {@code >=0;} count of SSA registers used in method + * @return {@code non-null;} appropriate set */ public static IntSet makeInterferenceSet(int countRegs) { return countRegs <= INTERFERENCE_SET_THRESHOLD_SIZE @@ -84,8 +84,8 @@ public final class SetFactory { /** * Make IntSet for register live in/out sets. * - * @param countRegs >=0; count of SSA registers used in method - * @return non-null; appropriate set + * @param countRegs {@code >=0;} count of SSA registers used in method + * @return {@code non-null;} appropriate set */ /*package*/ static IntSet makeLivenessSet(int countRegs) { return countRegs <= LIVENESS_SET_THRESHOLD_SIZE diff --git a/dx/src/com/android/dx/ssa/SsaBasicBlock.java b/dx/src/com/android/dx/ssa/SsaBasicBlock.java index 99ada7edb..ab0e12258 100644 --- a/dx/src/com/android/dx/ssa/SsaBasicBlock.java +++ b/dx/src/com/android/dx/ssa/SsaBasicBlock.java @@ -36,53 +36,80 @@ import com.android.dx.util.ListIntSet; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; +import java.util.Comparator; import java.util.List; /** * An SSA representation of a basic block. */ public final class SsaBasicBlock { + /** + * {@code non-null;} comparator for instances of this class that + * just compares block labels + */ + public static final Comparator<SsaBasicBlock> LABEL_COMPARATOR = + new LabelComparator(); - /** non-null; insn list associated with this instance */ + /** {@code non-null;} insn list associated with this instance */ private ArrayList<SsaInsn> insns; - /** non-null; predecessor set (by block list index) */ + + /** {@code non-null;} predecessor set (by block list index) */ private BitSet predecessors; - /** non-null; successor set (by block list index) */ + + /** {@code non-null;} successor set (by block list index) */ private BitSet successors; + /** - * non-null; ordered successor list + * {@code non-null;} ordered successor list * (same block may be listed more than once) */ private IntList successorList; - /** block list index of primary successor, or -1 for no primary successor */ + + /** + * block list index of primary successor, or {@code -1} for no primary + * successor + */ private int primarySuccessor = -1; + /** label of block in rop form */ private int ropLabel; - /** non-null; method we belong to */ + + /** {@code non-null;} method we belong to */ private SsaMethod parent; + /** our index into parent.getBlock() */ private int index; + /** list of dom children */ private final ArrayList<SsaBasicBlock> domChildren; - /** - * The number of moves added to the end of the block during the + /** + * the number of moves added to the end of the block during the * phi-removal process. Retained for subsequent move scheduling. */ private int movesFromPhisAtEnd = 0; - /** - * The number of moves added to the beginning of the block during the + + /** + * the number of moves added to the beginning of the block during the * phi-removal process. Retained for subsequent move scheduling. */ private int movesFromPhisAtBeginning = 0; - /** null-ok; indexed by reg: the regs that are live-in at this block */ + /** + * {@code null-ok;} indexed by reg: the regs that are live-in at + * this block + */ private IntSet liveIn; - /** null-ok; indexed by reg: the regs that are live-out at this block */ + + /** + * {@code null-ok;} indexed by reg: the regs that are live-out at + * this block + */ private IntSet liveOut; /** - * Create a new empty basic block + * Creates a new empty basic block. + * * @param basicBlockIndex index this block will have * @param ropLabel original rop-form label * @param parent method of this block @@ -106,26 +133,20 @@ public final class SsaBasicBlock { * * @param rmeth original method * @param basicBlockIndex index this block will have - * @param parent method of this block - * predecessor set will be updated. + * @param parent method of this block predecessor set will be + * updated * @return new instance */ public static SsaBasicBlock newFromRop(RopMethod rmeth, int basicBlockIndex, final SsaMethod parent) { - - BasicBlockList ropBlocks; - SsaBasicBlock result; - InsnList ropInsns; - BasicBlock bb; - - ropBlocks = rmeth.getBlocks(); - bb = ropBlocks.get(basicBlockIndex); - - result = new SsaBasicBlock(basicBlockIndex, bb.getLabel(), parent); - - ropInsns = bb.getInsns(); + BasicBlockList ropBlocks = rmeth.getBlocks(); + BasicBlock bb = ropBlocks.get(basicBlockIndex); + SsaBasicBlock result = + new SsaBasicBlock(basicBlockIndex, bb.getLabel(), parent); + InsnList ropInsns = bb.getInsns(); result.insns.ensureCapacity(ropInsns.size()); + for (int i = 0, sz = ropInsns.size() ; i < sz ; i++) { result.insns.add(new NormalSsaInsn (ropInsns.get(i), result)); } @@ -141,7 +162,6 @@ public final class SsaBasicBlock { = SsaMethod.indexListFromLabelList(ropBlocks, bb.getSuccessors()); - if (result.successorList.size() != 0) { int primarySuccessor = bb.getPrimarySuccessor(); @@ -156,18 +176,18 @@ public final class SsaBasicBlock { * Adds a basic block as a dom child for this block. Used when constructing * the dom tree. * - * @param child non-null; new dom child + * @param child {@code non-null;} new dom child */ - void addDomChild(SsaBasicBlock child) { + public void addDomChild(SsaBasicBlock child) { domChildren.add(child); } /** * Gets the dom children for this node. Don't modify this list. * - * @return non-null; list of dom children + * @return {@code non-null;} list of dom children */ - ArrayList<SsaBasicBlock> getDomChildren() { + public ArrayList<SsaBasicBlock> getDomChildren() { return domChildren; } @@ -175,9 +195,9 @@ public final class SsaBasicBlock { * Adds a phi insn to the beginning of this block. The result type of * the phi will be set to void, to indicate that it's currently unknown. * - * @param reg >=0 result reg + * @param reg {@code >=0;} result reg */ - void addPhiInsnForReg(int reg) { + public void addPhiInsnForReg(int reg) { insns.add(0, new PhiInsn(reg, this)); } @@ -186,9 +206,9 @@ public final class SsaBasicBlock { * when the result type or local-association can be determined at phi * insert time. * - * @param resultSpec non-null; reg + * @param resultSpec {@code non-null;} reg */ - void addPhiInsnForReg(RegisterSpec resultSpec) { + public void addPhiInsnForReg(RegisterSpec resultSpec) { insns.add(0, new PhiInsn(resultSpec, this)); } @@ -196,9 +216,9 @@ public final class SsaBasicBlock { * Adds an insn to the head of this basic block, just after any phi * insns. * - * @param insn non-null; rop-form insn to add + * @param insn {@code non-null;} rop-form insn to add */ - void addInsnToHead(Insn insn) { + public void addInsnToHead(Insn insn) { SsaInsn newInsn = SsaInsn.makeFromRop(insn, this); insns.add(getCountPhiInsns(), newInsn); parent.onInsnAdded(newInsn); @@ -208,9 +228,9 @@ public final class SsaBasicBlock { * Replaces the last insn in this block. The provided insn must have * some branchingness. * - * @param insn non-null; rop-form insn to add, which must branch. + * @param insn {@code non-null;} rop-form insn to add, which must branch. */ - void replaceLastInsn(Insn insn) { + public void replaceLastInsn(Insn insn) { if (insn.getOpcode().getBranchingness() == Rop.BRANCH_NONE) { throw new IllegalArgumentException("last insn must branch"); } @@ -225,12 +245,13 @@ public final class SsaBasicBlock { } /** - * Visits each phi insn - * @param v callback + * Visits each phi insn. + * + * @param v {@code non-null;} the callback */ public void forEachPhiInsn(PhiInsn.Visitor v) { - int sz = insns.size(); + for (int i = 0; i < sz; i++) { SsaInsn insn = insns.get(i); if (insn instanceof PhiInsn) { @@ -251,7 +272,7 @@ public final class SsaBasicBlock { public void removeAllPhiInsns() { /* * Presently we assume PhiInsn's are in a continuous - * block at the top of the list + * block at the top of the list. */ insns.subList(0, getCountPhiInsns()).clear(); @@ -259,6 +280,7 @@ public final class SsaBasicBlock { /** * Gets the number of phi insns at the top of this basic block. + * * @return count of phi insns */ private int getCountPhiInsns() { @@ -276,15 +298,15 @@ public final class SsaBasicBlock { } /** - * @return non-null;the (mutable) instruction list for this block, - * with phi insns at the beginning. + * @return {@code non-null;} the (mutable) instruction list for this block, + * with phi insns at the beginning */ public ArrayList<SsaInsn> getInsns() { return insns; } /** - * @return non-null; the (mutable) list of phi insns for this block + * @return {@code non-null;} the (mutable) list of phi insns for this block */ public List<SsaInsn> getPhiInsns() { return insns.subList(0, getCountPhiInsns()); @@ -312,29 +334,30 @@ public final class SsaBasicBlock { } /** - * @return non-null;predecessors set, indexed by block index + * @return {@code non-null;} predecessors set, indexed by block index */ public BitSet getPredecessors() { return predecessors; } /** - * @return non-null;successors set, indexed by block index + * @return {@code non-null;} successors set, indexed by block index */ public BitSet getSuccessors() { return successors; } /** - * @return non-null;ordered successor list, containing block indicies + * @return {@code non-null;} ordered successor list, containing block + * indicies */ public IntList getSuccessorList() { return successorList; } /** - * @return >= -1; block index of primary successor or -1 if no - * primary successor. + * @return {@code >= -1;} block index of primary successor or + * {@code -1} if no primary successor */ public int getPrimarySuccessorIndex() { return primarySuccessor; @@ -348,7 +371,8 @@ public final class SsaBasicBlock { } /** - * @return null-ok; the primary successor block or null if there is none. + * @return {@code null-ok;} the primary successor block or {@code null} + * if there is none */ public SsaBasicBlock getPrimarySuccessor() { if (primarySuccessor < 0) { @@ -373,7 +397,7 @@ public final class SsaBasicBlock { } /** - * @return non-null; method that contains this block + * @return {@code non-null;} method that contains this block */ public SsaMethod getParent() { return parent; @@ -383,23 +407,23 @@ public final class SsaBasicBlock { * Inserts a new empty GOTO block as a predecessor to this block. * All previous predecessors will be predecessors to the new block. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public SsaBasicBlock insertNewPredecessor() { SsaBasicBlock newPred = parent.makeNewGotoBlock(); - // Update the new block + // Update the new block. newPred.predecessors = predecessors; newPred.successors.set(index) ; newPred.successorList.add(index); newPred.primarySuccessor = index; - // Update us + // Update us. predecessors = new BitSet(parent.getBlocks().size()); predecessors.set(newPred.index); - // Update our (soon-to-be) old predecessors + // Update our (soon-to-be) old predecessors. for (int i = newPred.predecessors.nextSetBit(0); i >= 0; i = newPred.predecessors.nextSetBit(i + 1)) { @@ -412,15 +436,15 @@ public final class SsaBasicBlock { } /** - * Constructs and inserts a new empty GOTO block <code>Z</code> between - * this block (<code>A</code>) and a current successor block - * (<code>B</code>). The new block will replace B as A's successor and + * Constructs and inserts a new empty GOTO block {@code Z} between + * this block ({@code A}) and a current successor block + * ({@code B}). The new block will replace B as A's successor and * A as B's predecessor. A and B will no longer be directly connected. * If B is listed as a successor multiple times, all references * are replaced. * * @param other current successor (B) - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public SsaBasicBlock insertNewSuccessor(SsaBasicBlock other) { SsaBasicBlock newSucc = parent.makeNewGotoBlock(); @@ -430,15 +454,15 @@ public final class SsaBasicBlock { + " not successor of " + getRopLabelString()); } - // Update the new block + // Update the new block. newSucc.predecessors.set(this.index); newSucc.successors.set(other.index) ; newSucc.successorList.add(other.index); newSucc.primarySuccessor = other.index; - // Update us + // Update us. for (int i = successorList.size() - 1 ; i >= 0; i--) { - if(successorList.get(i) == other.index) { + if (successorList.get(i) == other.index) { successorList.set(i, newSucc.index); } } @@ -449,7 +473,7 @@ public final class SsaBasicBlock { successors.clear(other.index); successors.set(newSucc.index); - // Update "other" + // Update "other". other.predecessors.set(newSucc.index); other.predecessors.set(index, successors.get(other.index)); @@ -457,17 +481,18 @@ public final class SsaBasicBlock { } /** - * Replace an old successor with a new successor. - * Throws RuntimeException if oldIndex was not a successor. + * Replaces an old successor with a new successor. This will throw + * RuntimeException if {@code oldIndex} was not a successor. + * * @param oldIndex index of old successor block - * @param newIndex index of new successor block. + * @param newIndex index of new successor block */ public void replaceSuccessor(int oldIndex, int newIndex) { if (oldIndex == newIndex) { return; } - // Update us + // Update us. successors.set(newIndex); if (primarySuccessor == oldIndex) { @@ -475,17 +500,17 @@ public final class SsaBasicBlock { } for (int i = successorList.size() - 1 ; i >= 0; i--) { - if(successorList.get(i) == oldIndex) { + if (successorList.get(i) == oldIndex) { successorList.set(i, newIndex); } } successors.clear(oldIndex); - // Update new successor + // Update new successor. parent.getBlocks().get(newIndex).predecessors.set(index); - // Update old successor + // Update old successor. parent.getBlocks().get(oldIndex).predecessors.clear(index); } @@ -495,7 +520,7 @@ public final class SsaBasicBlock { * is not an exit predecessor or is the exit block, this block does * nothing. For use by {@link com.android.dx.ssa.SsaMethod#makeExitBlock} * - * @param exitBlock non-null; exit block + * @param exitBlock {@code non-null;} exit block */ public void exitBlockFixup(SsaBasicBlock exitBlock) { if (this == exitBlock) { @@ -519,6 +544,7 @@ public final class SsaBasicBlock { * before the last instruction. If the result of the final instruction * is the source in question, then the move is placed at the beginning of * the primary successor block. This is for unversioned registers. + * * @param result move destination * @param source move source */ @@ -538,12 +564,13 @@ public final class SsaBasicBlock { if (lastInsn.getResult() != null || lastInsn.getSources().size() > 0) { /* - * The final insn in this block has a source or result register, - * and the moves we may need to place and schedule may interfere. - * We need to insert this instruction at the - * beginning of the primary successor block instead. We know - * this is safe, because when we edge-split earlier, we ensured - * that each successor has only us as a predecessor. + * The final insn in this block has a source or result + * register, and the moves we may need to place and + * schedule may interfere. We need to insert this + * instruction at the beginning of the primary successor + * block instead. We know this is safe, because when we + * edge-split earlier, we ensured that each successor has + * only us as a predecessor. */ for (int i = successors.nextSetBit(0) @@ -557,19 +584,14 @@ public final class SsaBasicBlock { } } else { /* - * We can safely add a move to the end of the block - * just before the last instruction because - * the final insn does not assign to anything. + * We can safely add a move to the end of the block just + * before the last instruction, because the final insn does + * not assign to anything. */ - - RegisterSpecList sources; - sources = RegisterSpecList.make(source); - - NormalSsaInsn toAdd; - - toAdd = new NormalSsaInsn( - new PlainInsn(Rops.opMove(result.getType()), - SourcePosition.NO_INFO, result, sources), this); + RegisterSpecList sources = RegisterSpecList.make(source); + NormalSsaInsn toAdd = new NormalSsaInsn( + new PlainInsn(Rops.opMove(result.getType()), + SourcePosition.NO_INFO, result, sources), this); insns.add(insns.size() - 1, toAdd); @@ -578,28 +600,24 @@ public final class SsaBasicBlock { } /** - * Add a move instruction after the phi insn block. + * Adds a move instruction after the phi insn block. + * * @param result move destination * @param source move source */ public void addMoveToBeginning (RegisterSpec result, RegisterSpec source) { - if (result.getReg() == source.getReg()) { // Sometimes we end up with no-op moves. Ignore them here. return; } - RegisterSpecList sources; - sources = RegisterSpecList.make(source); - - NormalSsaInsn toAdd; - - toAdd = new NormalSsaInsn( - new PlainInsn(Rops.opMove(result.getType()), - SourcePosition.NO_INFO, result, sources), this); + RegisterSpecList sources = RegisterSpecList.make(source); + NormalSsaInsn toAdd = new NormalSsaInsn( + new PlainInsn(Rops.opMove(result.getType()), + SourcePosition.NO_INFO, result, sources), this); insns.add(getCountPhiInsns(), toAdd); - movesFromPhisAtBeginning++; + movesFromPhisAtBeginning++; } /** @@ -612,7 +630,7 @@ public final class SsaBasicBlock { private static void setRegsUsed (BitSet regsUsed, RegisterSpec rs) { regsUsed.set(rs.getReg()); if (rs.getCategory() > 1) { - regsUsed.set(rs.getReg() + 1); + regsUsed.set(rs.getReg() + 1); } } @@ -638,14 +656,16 @@ public final class SsaBasicBlock { * reads of any register happen before writes to that register. * NOTE: caller is expected to returnSpareRegisters()! * - * TODO See Briggs, et al "Practical Improvements to the Construction and + * TODO: See Briggs, et al "Practical Improvements to the Construction and * Destruction of Static Single Assignment Form" section 5. a) This can * be done in three passes. + * * @param toSchedule List of instructions. Must consist only of moves. */ private void scheduleUseBeforeAssigned(List<SsaInsn> toSchedule) { BitSet regsUsedAsSources = new BitSet(parent.getRegCount()); - // TODO get rid of this + + // TODO: Get rid of this. BitSet regsUsedAsResults = new BitSet(parent.getRegCount()); int sz = toSchedule.size(); @@ -680,8 +700,10 @@ public final class SsaBasicBlock { } } - // If we've made no progress in this iteration, there's a - // circular dependency. Split it using the temp reg. + /* + * If we've made no progress in this iteration, there's a + * circular dependency. Split it using the temp reg. + */ if (oldInsertPlace == insertPlace) { SsaInsn insnToSplit = null; @@ -694,43 +716,40 @@ public final class SsaBasicBlock { insn.getSources().get(0))) { insnToSplit = insn; - // We're going to split this insn--move it to the - // front + /* + * We're going to split this insn; move it to the + * front. + */ Collections.swap(toSchedule, insertPlace, i); break; } } - // At least one insn will be set above + // At least one insn will be set above. RegisterSpec result = insnToSplit.getResult(); RegisterSpec tempSpec = result.withReg( parent.borrowSpareRegister(result.getCategory())); - NormalSsaInsn toAdd; - - toAdd = new NormalSsaInsn( - new PlainInsn(Rops.opMove(result.getType()), - SourcePosition.NO_INFO, - tempSpec, - insnToSplit.getSources()), this); + NormalSsaInsn toAdd = new NormalSsaInsn( + new PlainInsn(Rops.opMove(result.getType()), + SourcePosition.NO_INFO, + tempSpec, + insnToSplit.getSources()), this); toSchedule.add(insertPlace++, toAdd); - NormalSsaInsn toReplace; - RegisterSpecList newSources; - - newSources = RegisterSpecList.make(tempSpec); + RegisterSpecList newSources = RegisterSpecList.make(tempSpec); - toReplace = new NormalSsaInsn( - new PlainInsn(Rops.opMove(result.getType()), - SourcePosition.NO_INFO, - result, - newSources), this); + NormalSsaInsn toReplace = new NormalSsaInsn( + new PlainInsn(Rops.opMove(result.getType()), + SourcePosition.NO_INFO, + result, + newSources), this); toSchedule.set(insertPlace, toReplace); - // size has changed + // The size changed. sz = toSchedule.size(); } @@ -740,12 +759,12 @@ public final class SsaBasicBlock { } /** - * Adds regV to the live-out list for this block. - * Called by the liveness analyzer. + * Adds {@code regV} to the live-out list for this block. This is called + * by the liveness analyzer. + * * @param regV register that is live-out for this block. */ - public void - addLiveOut (int regV) { + public void addLiveOut (int regV) { if (liveOut == null) { liveOut = SetFactory.makeLivenessSet(parent.getRegCount()); } @@ -754,24 +773,24 @@ public final class SsaBasicBlock { } /** - * Adds regV to the live-in list for this block. - * Called by the liveness analyzer. + * Adds {@code regV} to the live-in list for this block. This is + * called by the liveness analyzer. + * * @param regV register that is live-in for this block. */ - public void - addLiveIn (int regV) { + public void addLiveIn (int regV) { if (liveIn == null) { liveIn = SetFactory.makeLivenessSet(parent.getRegCount()); } - liveIn.add(regV); + liveIn.add(regV); } /** * Returns the set of live-in registers. Valid after register * interference graph has been generated, otherwise empty. * - * @return non-null; live-in register set. + * @return {@code non-null;} live-in register set. */ public IntSet getLiveInRegs() { if (liveIn == null) { @@ -783,8 +802,8 @@ public final class SsaBasicBlock { /** * Returns the set of live-out registers. Valid after register * interference graph has been generated, otherwise empty. - * - * @return non-null; live-out register set. + * + * @return {@code non-null;} live-out register set */ public IntSet getLiveOutRegs() { if (liveOut == null) { @@ -806,15 +825,15 @@ public final class SsaBasicBlock { * that it's either the start block or it has predecessors, which suffices * for all current control flow transformations. * - * @return true if reachable + * @return {@code true} if reachable */ public boolean isReachable() { return index == parent.getEntryBlockIndex() || predecessors.cardinality() > 0; } - + /** - * Sorts move instructions added via <code>addMoveToEnd</code> during + * Sorts move instructions added via {@code addMoveToEnd} during * phi removal so that results don't overwrite sources that are used. * For use after all phis have been removed and all calls to * addMoveToEnd() have been made.<p> @@ -825,7 +844,6 @@ public final class SsaBasicBlock { * refers value before any other phis have executed. */ public void scheduleMovesFromPhis() { - if (movesFromPhisAtBeginning > 1) { List<SsaInsn> toSchedule; @@ -835,32 +853,37 @@ public final class SsaBasicBlock { SsaInsn firstNonPhiMoveInsn = insns.get(movesFromPhisAtBeginning); - //TODO it's actually possible that this case never happens, - //because a move-exception block, having only one predecessor - //in SSA form, perhaps is never on a dominance frontier. + /* + * TODO: It's actually possible that this case never happens, + * because a move-exception block, having only one predecessor + * in SSA form, perhaps is never on a dominance frontier. + */ if (firstNonPhiMoveInsn.isMoveException()) { if (true) { /* * We've yet to observe this case, and if it can - * occur the code written to handle it probably + * occur the code written to handle it probably * does not work. */ throw new RuntimeException( "Unexpected: moves from " +"phis before move-exception"); } else { - - // A move-exception insn must be placed first in this block - // We need to move it there, and deal with possible - // interference. + /* + * A move-exception insn must be placed first in this block + * We need to move it there, and deal with possible + * interference. + */ boolean moveExceptionInterferes = false; int moveExceptionResult = firstNonPhiMoveInsn.getResult().getReg(); - // Does the move-exception result reg interfere with the - // phi moves? - for(SsaInsn insn: toSchedule) { + /* + * Does the move-exception result reg interfere with the + * phi moves? + */ + for (SsaInsn insn : toSchedule) { if (insn.isResultReg(moveExceptionResult) || insn.isRegASource(moveExceptionResult)) { moveExceptionInterferes = true; @@ -869,81 +892,107 @@ public final class SsaBasicBlock { } if (!moveExceptionInterferes) { - // The easy case + // This is the easy case. insns.remove(movesFromPhisAtBeginning); insns.add(0, firstNonPhiMoveInsn); } else { - // We need to move the result to a spare reg and move it - // back. - - int spareRegister; - RegisterSpec originalResultSpec; - - originalResultSpec = firstNonPhiMoveInsn.getResult(); - spareRegister = parent.borrowSpareRegister( + /* + * We need to move the result to a spare reg + * and move it back. + */ + RegisterSpec originalResultSpec + = firstNonPhiMoveInsn.getResult(); + int spareRegister = parent.borrowSpareRegister( originalResultSpec.getCategory()); - // We now move it to a spare register + // We now move it to a spare register. firstNonPhiMoveInsn.changeResultReg(spareRegister); - RegisterSpec tempSpec = firstNonPhiMoveInsn.getResult(); + RegisterSpec tempSpec = + firstNonPhiMoveInsn.getResult(); insns.add(0, firstNonPhiMoveInsn); - // And here we move it back - - NormalSsaInsn toAdd; + // And here we move it back. - toAdd = new NormalSsaInsn( - new PlainInsn(Rops.opMove( - tempSpec.getType()), - SourcePosition.NO_INFO, - originalResultSpec, - RegisterSpecList.make(tempSpec)), + NormalSsaInsn toAdd = new NormalSsaInsn( + new PlainInsn( + Rops.opMove(tempSpec.getType()), + SourcePosition.NO_INFO, + originalResultSpec, + RegisterSpecList.make(tempSpec)), this); - // Place it immediately after the phi-moves, - // overwriting the move-exception that was there. + /* + * Place it immediately after the phi-moves, + * overwriting the move-exception that was there. + */ insns.set(movesFromPhisAtBeginning + 1, toAdd); } } } } + if (movesFromPhisAtEnd > 1) { scheduleUseBeforeAssigned( insns.subList(insns.size() - movesFromPhisAtEnd - 1, insns.size() - 1)); } - // Return registers borrowed here and in scheduleUseBeforeAssigned() + // Return registers borrowed here and in scheduleUseBeforeAssigned(). parent.returnSpareRegisters(); } /** - * Visit all insns in this block - * @param visitor callback interface + * Visits all insns in this block. + * + * @param visitor {@code non-null;} callback interface */ public void forEachInsn(SsaInsn.Visitor visitor) { - for (SsaInsn insn: insns) { - insn.accept(visitor); + // This gets called a LOT, and not using an iterator + // saves a lot of allocations and reduces memory usage + int len = insns.size(); + for (int i = 0; i < len; i++) { + insns.get(i).accept(visitor); } } + /** {@inheritDoc} */ public String toString() { return "{" + index + ":" + Hex.u2(ropLabel) + '}'; } /** - * Visitor interface for basic blocks + * Visitor interface for basic blocks. */ public interface Visitor { - /** * Indicates a block has been visited by an iterator method. - * @param v non-null; block visited - * @param parent null-ok; parent node if applicable. + * + * @param v {@code non-null;} block visited + * @param parent {@code null-ok;} parent node if applicable */ void visitBlock (SsaBasicBlock v, SsaBasicBlock parent); } + + /** + * Label comparator. + */ + public static final class LabelComparator + implements Comparator<SsaBasicBlock> { + /** {@inheritDoc} */ + public int compare(SsaBasicBlock b1, SsaBasicBlock b2) { + int label1 = b1.ropLabel; + int label2 = b2.ropLabel; + + if (label1 < label2) { + return -1; + } else if (label1 > label2) { + return 1; + } else { + return 0; + } + } + } } diff --git a/dx/src/com/android/dx/ssa/SsaConverter.java b/dx/src/com/android/dx/ssa/SsaConverter.java index a731fcb87..d5be2871b 100644 --- a/dx/src/com/android/dx/ssa/SsaConverter.java +++ b/dx/src/com/android/dx/ssa/SsaConverter.java @@ -27,22 +27,23 @@ import java.util.BitSet; * Converts ROP methods to SSA Methods */ public class SsaConverter { - public static boolean DEBUG = false; + public static final boolean DEBUG = false; /** - * returns an SSA representation, edge-split and with phi functions placed + * Returns an SSA representation, edge-split and with phi + * functions placed. + * * @param rmeth input * @param paramWidth the total width, in register-units, of the method's * parameters - * @param isStatic true if this method has no 'this' + * @param isStatic {@code true} if this method has no {@code this} * pointer argument * @return output in SSA form */ - public static SsaMethod convertToSsaMethod(RopMethod rmeth, + public static SsaMethod convertToSsaMethod(RopMethod rmeth, int paramWidth, boolean isStatic) { - SsaMethod result; - - result = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); + SsaMethod result + = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic); edgeSplit(result); @@ -52,7 +53,7 @@ public class SsaConverter { new SsaRenamer(result).run(); /* - * Exit block, added here, is not considered for edge splitting + * The exit block, added here, is not considered for edge splitting * or phi placement since no actual control flows to it. */ result.makeExitBlock(); @@ -62,10 +63,12 @@ public class SsaConverter { /** * Returns an SSA represention with only the edge-splitter run. + * * @param rmeth method to process * @param paramWidth width of all arguments in the method - * @param isStatic true if this method has no 'this' pointer argument - * @return an SSA represention with only the edge-splitter run. + * @param isStatic {@code true} if this method has no {@code this} + * pointer argument + * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testEdgeSplit (RopMethod rmeth, int paramWidth, boolean isStatic) { @@ -80,10 +83,12 @@ public class SsaConverter { /** * Returns an SSA represention with only the steps through the * phi placement run. + * * @param rmeth method to process * @param paramWidth width of all arguments in the method - * @param isStatic true if this method has no 'this' pointer argument - * @return an SSA represention with only the edge-splitter run. + * @param isStatic {@code true} if this method has no {@code this} + * pointer argument + * @return an SSA represention with only the edge-splitter run */ public static SsaMethod testPhiPlacement (RopMethod rmeth, int paramWidth, boolean isStatic) { @@ -100,7 +105,8 @@ public class SsaConverter { } /** - * See Appel section 19.1 + * See Appel section 19.1: + * * Converts CFG into "edge-split" form, such that each node either a * unique successor or unique predecessor.<p> * @@ -109,11 +115,10 @@ public class SsaConverter { * value to have a primary successor that has no other * predecessor. This ensures move statements can always be * inserted correctly when phi statements are removed. - * + * * @param result method to process */ private static void edgeSplit(SsaMethod result) { - edgeSplitPredecessors(result); edgeSplitMoveExceptionsAndResults(result); edgeSplitSuccessors(result); @@ -122,13 +127,16 @@ public class SsaConverter { /** * Inserts Z nodes as new predecessors for every node that has multiple * successors and multiple predecessors. - * @param result non-null; method to process + * + * @param result {@code non-null;} method to process */ private static void edgeSplitPredecessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); - - // New blocks are added to the end of the block list during - // this iteration + + /* + * New blocks are added to the end of the block list during + * this iteration. + */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); if (nodeNeedsUniquePredecessor(block)) { @@ -138,12 +146,11 @@ public class SsaConverter { } /** - * @param block non-null; block in question - * @return true if this node needs to have a unique predecessor created for - * it. + * @param block {@code non-null;} block in question + * @return {@code true} if this node needs to have a unique + * predecessor created for it */ private static boolean nodeNeedsUniquePredecessor(SsaBasicBlock block) { - /* * Any block with that has both multiple successors and multiple * predecessors needs a new predecessor node. @@ -161,59 +168,68 @@ public class SsaConverter { * We may need room to insert move insns later, so make sure to split * any block that starts with a move-exception such that there is a * unique move-exception block for each predecessor. + * * @param ssaMeth method to process */ private static void edgeSplitMoveExceptionsAndResults(SsaMethod ssaMeth) { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); - // New blocks are added to the end of the block list during - // this iteration + /* + * New blocks are added to the end of the block list during + * this iteration. + */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); - - // Any block that starts with a move-exception and has more than - // one predecessor... + + /* + * Any block that starts with a move-exception and has more than + * one predecessor... + */ if (!block.isExitBlock() - && block.getPredecessors().cardinality() > 1 + && block.getPredecessors().cardinality() > 1 && block.getInsns().get(0).isMoveException()) { - // block.getPredecessors() is changed in the loop below + // block.getPredecessors() is changed in the loop below. BitSet preds = (BitSet)block.getPredecessors().clone(); for (int j = preds.nextSetBit(0); j >= 0; - j = preds.nextSetBit(j + 1)) { - + j = preds.nextSetBit(j + 1)) { SsaBasicBlock predecessor = blocks.get(j); + SsaBasicBlock zNode + = predecessor.insertNewSuccessor(block); - SsaBasicBlock zNode = predecessor.insertNewSuccessor(block); - - // Make sure to place the move-exception as the - // first insn... + /* + * Make sure to place the move-exception as the + * first insn. + */ zNode.getInsns().add(0, block.getInsns().get(0).clone()); } - // remove the move-exception from the original block... + // Remove the move-exception from the original block. block.getInsns().remove(0); } } } /** - * Inserts Z nodes for every node that needs a new + * Inserts Z nodes for every node that needs a new * successor. - * @param result non-null; method to process + * + * @param result {@code non-null;} method to process */ private static void edgeSplitSuccessors(SsaMethod result) { ArrayList<SsaBasicBlock> blocks = result.getBlocks(); - // New blocks are added to the end of the block list during - // this iteration + /* + * New blocks are added to the end of the block list during + * this iteration. + */ for (int i = blocks.size() - 1; i >= 0; i-- ) { SsaBasicBlock block = blocks.get(i); - // successors list is modified in loop below + // Successors list is modified in loop below. BitSet successors = (BitSet)block.getSuccessors().clone(); - for(int j = successors.nextSetBit(0); - j >= 0; j = successors.nextSetBit(j+1)) { + for (int j = successors.nextSetBit(0); + j >= 0; j = successors.nextSetBit(j+1)) { SsaBasicBlock succ = blocks.get(j); @@ -225,17 +241,17 @@ public class SsaConverter { } /** - * Returns true if block and successor need a Z-node between them. - * Presently, this is true if the final instruction has any sources - * or results and the current successor block has more than one - * predecessor. + * Returns {@code true} if block and successor need a Z-node + * between them. Presently, this is {@code true} if the final + * instruction has any sources or results and the current + * successor block has more than one predecessor. + * * @param block predecessor node * @param succ successor node - * @return true if a Z node is needed + * @return {@code true} if a Z node is needed */ private static boolean needsNewSuccessor(SsaBasicBlock block, SsaBasicBlock succ) { - ArrayList<SsaInsn> insns = block.getInsns(); SsaInsn lastInsn = insns.get(insns.size() - 1); @@ -245,11 +261,14 @@ public class SsaConverter { } /** - * See Appel algorithm 19.6 + * See Appel algorithm 19.6: + * * Place Phi functions in appropriate locations. * - * @param ssaMeth non-null; method to process. Modifications made in-place - * @param localInfo non-null; Local variable info, used when placing phis + * @param ssaMeth {@code non-null;} method to process. + * Modifications are made in-place. + * @param localInfo {@code non-null;} local variable info, used + * when placing phis */ private static void placePhiFunctions (SsaMethod ssaMeth, LocalVariableInfo localInfo) { @@ -282,8 +301,7 @@ public class SsaConverter { for (int bi = 0, s = ssaBlocks.size(); bi < s; bi++) { SsaBasicBlock b = ssaBlocks.get(bi); - for (SsaInsn insn: b.getInsns()) { - + for (SsaInsn insn : b.getInsns()) { RegisterSpec rs = insn.getResult(); if (rs != null) { @@ -297,11 +315,8 @@ public class SsaConverter { for (int i = 0; i < regCount; i++) { StringBuilder sb = new StringBuilder(); - sb.append('v').append(i).append(": "); - sb.append(defsites[i].toString()); - System.out.println(sb); } } @@ -315,15 +330,14 @@ public class SsaConverter { for (int reg = 0, s = ssaMeth.getRegCount() ; reg < s ; reg++ ) { int workBlockIndex; - /* Worklist set starts out with each node where reg is assigned */ + /* Worklist set starts out with each node where reg is assigned. */ - worklist = (BitSet)(defsites[reg].clone()); + worklist = (BitSet) (defsites[reg].clone()); while (0 <= (workBlockIndex = worklist.nextSetBit(0))) { worklist.clear(workBlockIndex); IntIterator dfIterator - = domInfos[workBlockIndex] - .dominanceFrontiers.iterator(); + = domInfos[workBlockIndex].dominanceFrontiers.iterator(); while (dfIterator.hasNext()) { int dfBlockIndex = dfIterator.next(); @@ -353,11 +367,8 @@ public class SsaConverter { for (int i = 0; i < regCount; i++) { StringBuilder sb = new StringBuilder(); - sb.append('v').append(i).append(": "); - sb.append(phisites[i].toString()); - System.out.println(sb); } } diff --git a/dx/src/com/android/dx/ssa/SsaInsn.java b/dx/src/com/android/dx/ssa/SsaInsn.java index d9e33a0dc..815f82d38 100644 --- a/dx/src/com/android/dx/ssa/SsaInsn.java +++ b/dx/src/com/android/dx/ssa/SsaInsn.java @@ -23,24 +23,34 @@ import com.android.dx.util.ToHuman; * An instruction in SSA form */ public abstract class SsaInsn implements ToHuman, Cloneable { + /** {@code non-null;} the block that contains this instance */ + private final SsaBasicBlock block; - protected RegisterSpec result; - protected final SsaBasicBlock block; + /** {@code null-ok;} result register */ + private RegisterSpec result; /** - * Constructs an instance - * @param block block containing this insn. Can never change. + * Constructs an instance. + * + * @param result {@code null-ok;} initial result register. May be changed. + * @param block {@code non-null;} block containing this insn. Can + * never change. */ - protected SsaInsn(final SsaBasicBlock block) { + protected SsaInsn(RegisterSpec result, SsaBasicBlock block) { + if (block == null) { + throw new NullPointerException("block == null"); + } + this.block = block; + this.result = result; } /** - * Makes a new SSA insn form a ROP insn + * Makes a new SSA insn form a rop insn. * - * @param insn non-null; rop insn - * @param block non-null; owning block - * @return non-null; an appropriately constructed instance + * @param insn {@code non-null;} rop insn + * @param block {@code non-null;} owning block + * @return {@code non-null;} an appropriately constructed instance */ public static SsaInsn makeFromRop(Insn insn, SsaBasicBlock block) { return new NormalSsaInsn(insn, block); @@ -58,6 +68,7 @@ public abstract class SsaInsn implements ToHuman, Cloneable { /** * Like {@link com.android.dx.rop.code.Insn getResult()}. + * * @return result register */ public RegisterSpec getResult() { @@ -65,8 +76,22 @@ public abstract class SsaInsn implements ToHuman, Cloneable { } /** + * Set the result register. + * + * @param result {@code non-null;} the new result register + */ + protected void setResult(RegisterSpec result) { + if (result == null) { + throw new NullPointerException("result == null"); + } + + this.result = result; + } + + /** * Like {@link com.android.dx.rop.code.Insn getSources()}. - * @return non-null; sources list + * + * @return {@code non-null;} sources list */ abstract public RegisterSpecList getSources(); @@ -80,7 +105,8 @@ public abstract class SsaInsn implements ToHuman, Cloneable { } /** - * is the specified reg the result reg? + * Returns whether or not the specified reg is the result reg. + * * @param reg register to test * @return true if there is a result and it is stored in the specified * register @@ -91,9 +117,10 @@ public abstract class SsaInsn implements ToHuman, Cloneable { /** - * Changes the result register if this insn has a result. - * Used during renaming. - * @param reg new result register. + * Changes the result register if this insn has a result. This is used + * during renaming. + * + * @param reg new result register */ public void changeResultReg(int reg) { if (result != null) { @@ -102,10 +129,10 @@ public abstract class SsaInsn implements ToHuman, Cloneable { } /** - * Sets the local association for the result of this insn. - * This is sometimes updated during the SsaRenamer process. + * Sets the local association for the result of this insn. This is + * sometimes updated during the SsaRenamer process. * - * @param local null-ok; New debug/local variable info. + * @param local {@code null-ok;} new debug/local variable info */ public final void setResultLocal(LocalItem local) { LocalItem oldItem = result.getLocalItem(); @@ -120,10 +147,11 @@ public abstract class SsaInsn implements ToHuman, Cloneable { /** * Map registers after register allocation. * - * @param mapper + * @param mapper {@code non-null;} mapping from old to new registers */ public final void mapRegisters(RegisterMapper mapper) { RegisterSpec oldResult = result; + result = mapper.map(result); block.getParent().updateOneDefinition(this, oldResult); mapSourceRegisters(mapper); @@ -136,13 +164,12 @@ public abstract class SsaInsn implements ToHuman, Cloneable { */ abstract public void mapSourceRegisters(RegisterMapper mapper); - /** - * Returns the Rop opcode for this insn, or null if this is a phi insn + * Returns the Rop opcode for this insn, or null if this is a phi insn. * - * TODO move this up into NormalSsaInsn + * TODO: Move this up into NormalSsaInsn. * - * @return null-ok; Rop opcode if there is one. + * @return {@code null-ok;} Rop opcode if there is one. */ abstract public Rop getOpcode(); @@ -150,20 +177,21 @@ public abstract class SsaInsn implements ToHuman, Cloneable { * Returns the original Rop insn for this insn, or null if this is * a phi insn. * - * TODO move this up into NormalSsaInsn + * TODO: Move this up into NormalSsaInsn. * - * @return null-ok; Rop insn if there is one. + * @return {@code null-ok;} Rop insn if there is one. */ abstract public Insn getOriginalRopInsn(); /** * Gets the spec of a local variable assignment that occurs at this * instruction, or null if no local variable assignment occurs. This - * may be the result register, or for <code>mark-local</code> insns + * may be the result register, or for {@code mark-local} insns * it may be the source. * - * @return null-ok; a local-associated register spec or null * @see com.android.dx.rop.code.Insn#getLocalAssignment() + * + * @return {@code null-ok;} a local-associated register spec or null */ public RegisterSpec getLocalAssignment() { if (result != null && result.getLocalItem() != null) { @@ -176,7 +204,8 @@ public abstract class SsaInsn implements ToHuman, Cloneable { /** * Indicates whether the specified register is amongst the registers * used as sources for this instruction. - * @param reg The register in question + * + * @param reg the register in question * @return true if the reg is a source */ public boolean isRegASource(int reg) { @@ -186,9 +215,9 @@ public abstract class SsaInsn implements ToHuman, Cloneable { /** * Transform back to ROP form. * - * TODO move this up into NormalSsaInsn + * TODO: Move this up into NormalSsaInsn. * - * @return non-null; a ROP representation of this instruction, with + * @return {@code non-null;} a ROP representation of this instruction, with * updated registers. */ public abstract Insn toRopInsn(); @@ -208,8 +237,8 @@ public abstract class SsaInsn implements ToHuman, Cloneable { public abstract boolean hasSideEffect(); /** - * @return true if this is a move (but not a move-operand or move-exception) - * instruction + * @return true if this is a move (but not a move-operand or + * move-exception) instruction */ public boolean isNormalMoveInsn() { return false; @@ -229,8 +258,9 @@ public abstract class SsaInsn implements ToHuman, Cloneable { abstract public boolean canThrow(); /** - * accepts a visitor - * @param v visitor + * Accepts a visitor. + * + * @param v {@code non-null} the visitor */ public abstract void accept(Visitor v); @@ -238,22 +268,21 @@ public abstract class SsaInsn implements ToHuman, Cloneable { * Visitor interface for this class. */ public static interface Visitor { - /** * Any non-phi move instruction - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitMoveInsn(NormalSsaInsn insn); /** * Any phi insn - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitPhiInsn(PhiInsn insn); /** * Any insn that isn't a move or a phi (which is also a move). - * @param insn non-null; the instruction to visit + * @param insn {@code non-null;} the instruction to visit */ public void visitNonMoveInsn(NormalSsaInsn insn); } diff --git a/dx/src/com/android/dx/ssa/SsaMethod.java b/dx/src/com/android/dx/ssa/SsaMethod.java index 49f8ea5f7..073e5153c 100644 --- a/dx/src/com/android/dx/ssa/SsaMethod.java +++ b/dx/src/com/android/dx/ssa/SsaMethod.java @@ -36,10 +36,9 @@ import java.util.Stack; import java.util.Set; /** - * A method in SSA form + * A method in SSA form. */ public final class SsaMethod { - /** basic blocks, indexed by block index */ private ArrayList<SsaBasicBlock> blocks; @@ -48,12 +47,17 @@ public final class SsaMethod { /** * Index of exit block, which exists only in SSA form, - * or or -1 if there is none + * or or {@code -1} if there is none */ private int exitBlockIndex; + /** total number of registers required */ private int registerCount; + + /** first register number to use for any temporary "spares" */ private int spareRegisterBase; + + /** current count of spare registers used */ private int borrowedSpareRegisters; /** really one greater than the max label */ @@ -62,7 +66,7 @@ public final class SsaMethod { /** the total width, in register-units, of the method's parameters */ private final int paramWidth; - /** true if this method has no 'this' pointer argument */ + /** true if this method has no {@code this} pointer argument */ private final boolean isStatic; /** @@ -73,6 +77,7 @@ public final class SsaMethod { /** indexed by register: the list of all insns that use a register */ private ArrayList<SsaInsn>[] useList; + /** A version of useList with each List unmodifiable */ private List<SsaInsn>[] unmodifiableUseList; @@ -81,47 +86,58 @@ public final class SsaMethod { * are about to be mapped into a non-SSA namespace. When true, * use and def lists are unavailable. * - * TODO remove this mode, plase the functionality elsewhere + * TODO: Remove this mode, and place the functionality elsewhere */ - private boolean backMode = false; + private boolean backMode; /** - * @param rmeth RopMethod to convert from + * @param ropMethod rop-form method to convert from * @param paramWidth the total width, in register-units, of the * method's parameters - * @param isStatic true if this method has no 'this' pointer argument - * @return SsaMethod representation + * @param isStatic {@code true} if this method has no {@code this} + * pointer argument */ - static SsaMethod newFromRopMethod(RopMethod rmeth, int paramWidth, - boolean isStatic) { - SsaMethod result; - - result = new SsaMethod(paramWidth, isStatic); + public static SsaMethod newFromRopMethod(RopMethod ropMethod, + int paramWidth, boolean isStatic) { + SsaMethod result = new SsaMethod(ropMethod, paramWidth, isStatic); - result.maxLabel = rmeth.getBlocks().getMaxLabel(); - result.registerCount = rmeth.getBlocks().getRegCount(); - result.spareRegisterBase = result.registerCount; - - result.convertRopToSsaBlocks(rmeth); + result.convertRopToSsaBlocks(ropMethod); return result; } /** + * Constructs an instance. + * + * @param ropMethod {@code non-null;} the original rop-form method that + * this instance is based on + * @param paramWidth the total width, in register-units, of the + * method's parameters + * @param isStatic {@code true} if this method has no {@code this} + * pointer argument + */ + private SsaMethod(RopMethod ropMethod, int paramWidth, boolean isStatic) { + this.paramWidth = paramWidth; + this.isStatic = isStatic; + this.backMode = false; + this.maxLabel = ropMethod.getBlocks().getMaxLabel(); + this.registerCount = ropMethod.getBlocks().getRegCount(); + this.spareRegisterBase = registerCount; + } + + /** * Builds a BitSet of block indices from a basic block list and a list - * of labels taken from Rop form + * of labels taken from Rop form. + * * @param blocks Rop blocks * @param labelList list of rop block labels * @return BitSet of block indices */ static BitSet bitSetFromLabelList(BasicBlockList blocks, IntList labelList) { + BitSet result = new BitSet(blocks.size()); - BitSet result; - - result = new BitSet(blocks.size()); - - for (int i = 0, sz = labelList.size() ; i < sz ; i++) { + for (int i = 0, sz = labelList.size(); i < sz; i++) { result.set(blocks.indexOfLabel(labelList.get(i))); } @@ -130,7 +146,8 @@ public final class SsaMethod { /** * Builds an IntList of block indices from a basic block list and a list - * of labels taken from Rop form + * of labels taken from Rop form. + * * @param ropBlocks Rop blocks * @param labelList list of rop block labels * @return IntList of block indices @@ -138,35 +155,27 @@ public final class SsaMethod { public static IntList indexListFromLabelList(BasicBlockList ropBlocks, IntList labelList) { - IntList result; + IntList result = new IntList(labelList.size()); - result = new IntList(labelList.size()); - - for (int i = 0, sz = labelList.size() ; i < sz ; i++) { + for (int i = 0, sz = labelList.size(); i < sz; i++) { result.add(ropBlocks.indexOfLabel(labelList.get(i))); } return result; } - private void convertRopToSsaBlocks( - RopMethod rmeth) { - - BasicBlockList ropBlocks; + private void convertRopToSsaBlocks(RopMethod rmeth) { + BasicBlockList ropBlocks = rmeth.getBlocks(); + int sz = ropBlocks.size(); - ropBlocks = rmeth.getBlocks(); - - blocks = new ArrayList<SsaBasicBlock>(ropBlocks.size() + 2); - - for (int i = 0, sz = ropBlocks.size() ; i < sz ; i++) { - SsaBasicBlock sbb; - - sbb = SsaBasicBlock.newFromRop(rmeth, i, this); + blocks = new ArrayList<SsaBasicBlock>(sz + 2); + for (int i = 0; i < sz; i++) { + SsaBasicBlock sbb = SsaBasicBlock.newFromRop(rmeth, i, this); blocks.add(sbb); } - // Add an no-op entry block + // Add an no-op entry block. int origEntryBlockIndex = rmeth.getBlocks() .indexOfLabel(rmeth.getFirstLabel()); @@ -174,18 +183,16 @@ public final class SsaMethod { = blocks.get(origEntryBlockIndex).insertNewPredecessor(); entryBlockIndex = entryBlock.getIndex(); - exitBlockIndex = -1; // this gets made later - + exitBlockIndex = -1; // This gets made later. } - /** * Creates an exit block and attaches it to the CFG if this method * exits. Methods that never exit will not have an exit block. This * is called after edge-splitting and phi insertion, since the edges * going into the exit block should not be considered in those steps. */ - void makeExitBlock() { + /*package*/ void makeExitBlock() { if (exitBlockIndex >= 0) { throw new RuntimeException("must be called at most once"); } @@ -196,7 +203,7 @@ public final class SsaMethod { blocks.add(exitBlock); - for (SsaBasicBlock block: blocks) { + for (SsaBasicBlock block : blocks) { block.exitBlockFixup(exitBlock); } @@ -209,22 +216,10 @@ public final class SsaMethod { } /** - * Constructor - * - * @param paramWidth the total width, in register-units, of the - * method's parameters - * @param isStatic true if this method has no 'this' pointer argument - */ - private SsaMethod(int paramWidth, boolean isStatic) { - this.paramWidth = paramWidth; - this.isStatic = isStatic; - } - - /** - * Gets a new GOTO insn. + * Gets a new {@code GOTO} insn. * * @param block block to which this GOTO will be added - * (not it's destination!) + * (not it's destination!) * @return an appropriately-constructed instance. */ private static SsaInsn getGoto(SsaBasicBlock block) { @@ -232,11 +227,11 @@ public final class SsaMethod { new PlainInsn(Rops.GOTO, SourcePosition.NO_INFO, null, RegisterSpecList.EMPTY), block); } - + /** - * Makes a new basic block for this method, - * which is empty besides a single <code>GOTO</code>. Successors and - * predecessors are not yet set. + * Makes a new basic block for this method, which is empty besides + * a single {@code GOTO}. Successors and predecessors are not yet + * set. * * @return new block */ @@ -265,22 +260,23 @@ public final class SsaMethod { } /** - * @return block index of exit block or -1 if there is none + * @return block index of exit block or {@code -1} if there is none */ public int getExitBlockIndex() { return exitBlockIndex; } /** - * @return null-ok; block of exit block or null if there is none + * @return {@code null-ok;} block of exit block or {@code null} if + * there is none */ public SsaBasicBlock getExitBlock() { return exitBlockIndex < 0 ? null : blocks.get(exitBlockIndex); } /** - * @param bi block index or -1 for none - * @return rop label or -1 if bi was -1 + * @param bi block index or {@code -1} for none + * @return rop label or {code -1} if {@code bi} was {@code -1} */ public int blockIndexToRopLabel(int bi) { if (bi < 0) { @@ -297,7 +293,7 @@ public final class SsaMethod { } /** - * @return the total width, in register units, of the method's + * @return the total width, in register units, of the method's * parameters */ public int getParamWidth() { @@ -305,27 +301,25 @@ public final class SsaMethod { } /** - * Returns true if this is a static method. + * Returns {@code true} if this is a static method. * - * @return true if this is a static method + * @return {@code true} if this is a static method */ public boolean isStatic() { return isStatic; } /** - * Borrow a register to use as a temp. Used in the phi removal process. + * Borrows a register to use as a temp. Used in the phi removal process. * Call returnSpareRegisters() when done. + * * @param category width (1 or 2) of the register * @return register number to use */ public int borrowSpareRegister(int category) { - int result; - - result = spareRegisterBase + borrowedSpareRegisters; + int result = spareRegisterBase + borrowedSpareRegisters; borrowedSpareRegisters += category; - registerCount = Math.max(registerCount, result + category); return result; @@ -339,7 +333,7 @@ public final class SsaMethod { } /** - * @return non-null; basic block list, do not modify. + * @return {@code non-null;} basic block list. Do not modify. */ public ArrayList<SsaBasicBlock> getBlocks() { return blocks; @@ -349,12 +343,12 @@ public final class SsaMethod { * Returns the count of reachable blocks in this method: blocks that have * predecessors (or are the start block) * - * @return >= 0; number of reachable basic blocks + * @return {@code >= 0;} number of reachable basic blocks */ public int getCountReachableBlocks() { int ret = 0; - for (SsaBasicBlock b: blocks) { + for (SsaBasicBlock b : blocks) { // Blocks that have been disconnected don't count. if (b.isReachable()) { ret++; @@ -366,16 +360,16 @@ public final class SsaMethod { /** * Remaps unversioned registers. + * * @param mapper maps old registers to new. */ public void mapRegisters(RegisterMapper mapper) { - - for (SsaBasicBlock block: getBlocks()) { - for (SsaInsn insn: block.getInsns()) { + for (SsaBasicBlock block : getBlocks()) { + for (SsaInsn insn : block.getInsns()) { insn.mapRegisters(mapper); } - } - + } + registerCount = mapper.getNewRegisterCount(); spareRegisterBase = registerCount; } @@ -425,7 +419,7 @@ public final class SsaMethod { useList = new ArrayList[registerCount]; - for (int i = 0 ; i < registerCount; i++) { + for (int i = 0; i < registerCount; i++) { useList[i] = new ArrayList(); } @@ -444,7 +438,7 @@ public final class SsaMethod { } /** * Adds specified insn to the uses list for all of its sources. - * @param insn non-null; insn to process + * @param insn {@code non-null;} insn to process */ private void addToUses(SsaInsn insn) { RegisterSpecList rl = insn.getSources(); @@ -458,7 +452,7 @@ public final class SsaMethod { unmodifiableUseList = new List[registerCount]; - for (int i = 0 ; i < registerCount; i++) { + for (int i = 0; i < registerCount; i++) { unmodifiableUseList[i] = Collections.unmodifiableList(useList[i]); } } @@ -466,15 +460,15 @@ public final class SsaMethod { /** * Updates the use list for a single change in source register. * - * @param insn non-null; insn being changed - * @param oldSource null-ok; The source that was used, if applicable - * @param newSource non-null; the new source being used + * @param insn {@code non-null;} insn being changed + * @param oldSource {@code null-ok;} The source that was used, if + * applicable + * @param newSource {@code non-null;} the new source being used */ - void onSourceChanged(SsaInsn insn, + /*package*/ void onSourceChanged(SsaInsn insn, RegisterSpec oldSource, RegisterSpec newSource) { - if (useList == null) return; - + if (oldSource != null) { int reg = oldSource.getReg(); useList[reg].remove(insn); @@ -491,11 +485,13 @@ public final class SsaMethod { /** * Updates the use list for a source list change. * - * @param insn insn non-null; insn being changed. insn.getSources() - * must return the new source list. - * @param oldSources null-ok; list of sources that were previously used. + * @param insn {@code insn non-null;} insn being changed. + * {@code insn.getSources()} must return the new source list. + * @param oldSources {@code null-ok;} list of sources that were + * previously used */ - void onSourcesChanged(SsaInsn insn, RegisterSpecList oldSources) { + /*package*/ void onSourcesChanged(SsaInsn insn, + RegisterSpecList oldSources) { if (useList == null) return; if (oldSources != null) { @@ -505,27 +501,28 @@ public final class SsaMethod { RegisterSpecList sources = insn.getSources(); int szNew = sources.size(); - for(int i = 0; i < szNew; i++) { + for (int i = 0; i < szNew; i++) { int reg = sources.get(i).getReg(); useList[reg].add(insn); - } + } } /** - * Removes a given <code>insn</code> from the use lists for the given - * <code>oldSources</code> (rather than the sources currently + * Removes a given {@code insn} from the use lists for the given + * {@code oldSources} (rather than the sources currently * returned by insn.getSources()). * - * @param insn non-null; insn in question - * @param oldSources null-ok; registers whose use lists <code>insn</code> - * should be removed form. + * @param insn {@code non-null;} insn in question + * @param oldSources {@code null-ok;} registers whose use lists + * {@code insn} should be removed form */ private void removeFromUseList(SsaInsn insn, RegisterSpecList oldSources) { if (oldSources == null) { return; } + int szNew = oldSources.size(); - for(int i = 0; i < szNew; i++) { + for (int i = 0; i < szNew; i++) { if (!useList[oldSources.get(i).getReg()].remove(insn)) { throw new RuntimeException("use not found"); } @@ -536,35 +533,35 @@ public final class SsaMethod { * Adds an insn to both the use and def lists. For use when adding * a new insn to the method. * - * @param insn non-null; insn to add + * @param insn {@code non-null;} insn to add */ - void onInsnAdded(SsaInsn insn) { + /*package*/ void onInsnAdded(SsaInsn insn) { onSourcesChanged(insn, null); updateOneDefinition(insn, null); } /** - * Removes an instruction from use and def lists. For use during - * instruction removal. - * - * @param insn non-null; insn to remove. - */ - void onInsnRemoved(SsaInsn insn) { - if (useList != null) { - removeFromUseList(insn, insn.getSources()); - } + * Removes an instruction from use and def lists. For use during + * instruction removal. + * + * @param insn {@code non-null;} insn to remove + */ + /*package*/ void onInsnRemoved(SsaInsn insn) { + if (useList != null) { + removeFromUseList(insn, insn.getSources()); + } - RegisterSpec resultReg = insn.getResult(); - if (definitionList != null && resultReg != null) { - definitionList[resultReg.getReg()] = null; - } - } + RegisterSpec resultReg = insn.getResult(); + if (definitionList != null && resultReg != null) { + definitionList[resultReg.getReg()] = null; + } + } /** * Indicates that the instruction list has changed or the SSA register * count has increased, so that internal datastructures that rely on * it should be rebuild. In general, the various other on* methods - * should be called in preference when changes occur if they are + * should be called in preference when changes occur if they are * applicable. */ public void onInsnsChanged() { @@ -579,19 +576,22 @@ public final class SsaMethod { /** * Updates a single definition. * - * @param insn non-null; insn who's result should be recorded as + * @param insn {@code non-null;} insn who's result should be recorded as * a definition - * @param oldResult null-ok; a previous result that should be no longer - * considered a definition by this insn + * @param oldResult {@code null-ok;} a previous result that should + * be no longer considered a definition by this insn */ - void updateOneDefinition(SsaInsn insn, RegisterSpec oldResult) { + /*package*/ void updateOneDefinition(SsaInsn insn, + RegisterSpec oldResult) { if (definitionList == null) return; + if (oldResult != null) { int reg = oldResult.getReg(); definitionList[reg] = null; } RegisterSpec resultReg = insn.getResult(); + if (resultReg != null) { int reg = resultReg.getReg(); @@ -604,7 +604,8 @@ public final class SsaMethod { } /** - * Returns the list of all source uses (not results) for a register + * Returns the list of all source uses (not results) for a register. + * * @param reg register in question * @return unmodifiable instruction list */ @@ -619,6 +620,7 @@ public final class SsaMethod { /** * Returns a modifiable copy of the register use list. + * * @return modifiable copy of the use-list, indexed by register */ public ArrayList<SsaInsn>[] getUseListCopy() { @@ -641,7 +643,7 @@ public final class SsaMethod { * local variable. Each SSA reg may be associated with at most one * local var. * - * @param spec non-null; ssa reg + * @param spec {@code non-null;} ssa reg * @return true if reg is ever associated with a local */ public boolean isRegALocal(RegisterSpec spec) { @@ -656,7 +658,7 @@ public final class SsaMethod { if (defn.getLocalAssignment() != null) return true; // If not, is there a mark-local insn? - for (SsaInsn use: getUseListForRegister(spec.getReg())) { + for (SsaInsn use : getUseListForRegister(spec.getReg())) { Insn insn = use.getOriginalRopInsn(); if (insn != null @@ -664,12 +666,13 @@ public final class SsaMethod { return true; } } - + return false; } /** * Sets the new register count after renaming. + * * @param newRegCount new register count */ /*package*/ void setNewRegCount(int newRegCount) { @@ -681,48 +684,52 @@ public final class SsaMethod { /** * Makes a new SSA register. For use after renaming has completed. * - * @return >=0 new SSA register. + * @return {@code >=0;} new SSA register. */ public int makeNewSsaReg() { int reg = registerCount++; spareRegisterBase = registerCount; onInsnsChanged(); - return reg; + return reg; } /** - * Visit all insns in this method - * @param visitor non-null; callback interface + * Visits all insns in this method. + * + * @param visitor {@code non-null;} callback interface */ public void forEachInsn(SsaInsn.Visitor visitor) { - for (SsaBasicBlock block: blocks) { + for (SsaBasicBlock block : blocks) { block.forEachInsn(visitor); } } /** * Visits each phi insn in this method - * @param v non-null; callback + * @param v {@code non-null;} callback. + * */ public void forEachPhiInsn(PhiInsn.Visitor v) { - for (SsaBasicBlock block: blocks) { + for (SsaBasicBlock block : blocks) { block.forEachPhiInsn(v); } } /** - * Walk the basic block tree in depth-first order, calling the visitor + * Walks the basic block tree in depth-first order, calling the visitor * method once for every block. This depth-first walk may be run forward * from the method entry point or backwards from the method exit points. + * * @param reverse true if this should walk backwards from the exit points - * @param v non-null; callback interface. <code>parent</code>is set + * @param v {@code non-null;} callback interface. {@code parent} is set * unless this is the root node */ public void forEachBlockDepthFirst(boolean reverse, SsaBasicBlock.Visitor v) { BitSet visited = new BitSet(blocks.size()); - // We push the parent first, then the child on the stack + + // We push the parent first, then the child on the stack. Stack<SsaBasicBlock> stack = new Stack<SsaBasicBlock>(); SsaBasicBlock rootBlock = reverse ? getExitBlock() : getEntryBlock(); @@ -732,7 +739,7 @@ public final class SsaMethod { return; } - stack.add(null); // start with null parent + stack.add(null); // Start with null parent. stack.add(rootBlock); while (stack.size() > 0) { @@ -741,7 +748,7 @@ public final class SsaMethod { if (!visited.get(cur.getIndex())) { BitSet children - = reverse ? cur.getPredecessors() : cur.getSuccessors(); + = reverse ? cur.getPredecessors() : cur.getSuccessors(); for (int i = children.nextSetBit(0); i >= 0 ; i = children.nextSetBit(i + 1)) { stack.add(cur); @@ -755,10 +762,10 @@ public final class SsaMethod { /** * Visits blocks in dom-tree order, starting at the current node. - * The <code>parent</code> parameter of the Visitor.visitBlock callback + * The {@code parent} parameter of the Visitor.visitBlock callback * is currently always set to null. * - * @param v non-null; callback interface + * @param v {@code non-null;} callback interface */ public void forEachBlockDepthFirstDom(SsaBasicBlock.Visitor v) { BitSet visited = new BitSet(getBlocks().size()); @@ -783,12 +790,12 @@ public final class SsaMethod { } /** - * Deletes all insns in the set from this method + * Deletes all insns in the set from this method. * - * @param deletedInsns non-null; insns to delete + * @param deletedInsns {@code non-null;} insns to delete */ public void deleteInsns(Set<SsaInsn> deletedInsns) { - for (SsaBasicBlock block: getBlocks()) { + for (SsaBasicBlock block : getBlocks()) { ArrayList<SsaInsn> insns = block.getInsns(); for (int i = insns.size() - 1; i >= 0; i--) { @@ -819,7 +826,7 @@ public final class SsaMethod { } /** - * Set "back-convert mode". Set during back-conversion when registers + * Sets "back-convert mode". Set during back-conversion when registers * are about to be mapped into a non-SSA namespace. When true, * use and def lists are unavailable. */ diff --git a/dx/src/com/android/dx/ssa/SsaRenamer.java b/dx/src/com/android/dx/ssa/SsaRenamer.java index 64bad2c88..8452c0308 100644 --- a/dx/src/com/android/dx/ssa/SsaRenamer.java +++ b/dx/src/com/android/dx/ssa/SsaRenamer.java @@ -54,11 +54,11 @@ import java.util.HashMap; * current block has been processed, this mapping table is then copied * and used as the initial state for child blocks.<p> */ -class SsaRenamer implements Runnable { - +public class SsaRenamer implements Runnable { + /** debug flag */ private static final boolean DEBUG = false; - /** Method we're processing */ + /** method we're processing */ private final SsaMethod ssaMeth; /** next available SSA register */ @@ -68,10 +68,10 @@ class SsaRenamer implements Runnable { private final int ropRegCount; /** - * Indexed by block index; register version state for each block start. + * indexed by block index; register version state for each block start. * This list is updated by each dom parent for its children. The only * sub-arrays that exist at any one time are the start states for blocks - * yet to be processed by a <code>BlockRenamer</code> instance. + * yet to be processed by a {@code BlockRenamer} instance. */ private final RegisterSpec[][] startsForBlocks; @@ -79,24 +79,25 @@ class SsaRenamer implements Runnable { private final ArrayList<LocalItem> ssaRegToLocalItems; /** - * Maps SSA registers back to the original rop number. - * Used for debug only. + * maps SSA registers back to the original rop number. Used for + * debug only. */ private IntList ssaRegToRopReg; /** * Constructs an instance of the renamer * - * @param ssaMeth non-null; un-renamed SSA method that will + * @param ssaMeth {@code non-null;} un-renamed SSA method that will * be renamed. */ - SsaRenamer (final SsaMethod ssaMeth) { + public SsaRenamer(SsaMethod ssaMeth) { ropRegCount = ssaMeth.getRegCount(); this.ssaMeth = ssaMeth; + /* * Reserve the first N registers in the SSA register space for - * "version 0" registers + * "version 0" registers. */ nextSsaReg = ropRegCount; startsForBlocks = new RegisterSpec[ssaMeth.getBlocks().size()][]; @@ -138,10 +139,10 @@ class SsaRenamer implements Runnable { * in-place. */ public void run() { - // Rename each block in dom-tree DFS order. ssaMeth.forEachBlockDepthFirstDom(new SsaBasicBlock.Visitor() { - public void visitBlock (SsaBasicBlock block, SsaBasicBlock unused) { + public void visitBlock (SsaBasicBlock block, + SsaBasicBlock unused) { new BlockRenamer(block).process(); } }); @@ -151,15 +152,17 @@ class SsaRenamer implements Runnable { if (DEBUG) { System.out.println("SSA\tRop"); - // We're going to compute the version of the rop register - // by keeping a running total of how many times the rop register - // has been mapped. + /* + * We're going to compute the version of the rop register + * by keeping a running total of how many times the rop + * register has been mapped. + */ int[] versions = new int[ropRegCount]; int sz = ssaRegToRopReg.size(); - for(int i = 0; i < sz; i++) { - int ropReg = ssaRegToRopReg.get(i); - System.out.println(i +"\t" + ropReg + "[" + for (int i = 0; i < sz; i++) { + int ropReg = ssaRegToRopReg.get(i); + System.out.println(i + "\t" + ropReg + "[" + versions[ropReg] + "]"); versions[ropReg]++; } @@ -167,9 +170,10 @@ class SsaRenamer implements Runnable { } /** - * Duplicates a RegisterSpec array - * @param orig non-null; array to duplicate - * @return non-null; new instance + * Duplicates a RegisterSpec array. + * + * @param orig {@code non-null;} array to duplicate + * @return {@code non-null;} new instance */ private static RegisterSpec[] dupArray(RegisterSpec[] orig) { RegisterSpec[] copy = new RegisterSpec[orig.length]; @@ -183,7 +187,7 @@ class SsaRenamer implements Runnable { * Gets a local variable item for a specified register. * * @param ssaReg register in SSA name space - * @return null-ok; Local variable name or null if none + * @return {@code null-ok;} Local variable name or null if none */ private LocalItem getLocalForNewReg(int ssaReg) { if (ssaReg < ssaRegToLocalItems.size()) { @@ -223,8 +227,8 @@ class SsaRenamer implements Runnable { } /** - * Returns true if a and b are equal or are both null - + * Returns true if a and b are equal or are both null. + * * @param a null-ok * @param b null-ok * @return Returns true if a and b are equal or are both null @@ -238,26 +242,26 @@ class SsaRenamer implements Runnable { * as appropriate. */ private class BlockRenamer implements SsaInsn.Visitor{ - /** non-null; block we're processing. */ + /** {@code non-null;} block we're processing. */ private final SsaBasicBlock block; /** - * non-null; indexed by old register name. The current top of the - * version stack as seen by this block. It's initialized from - * the ending state of its dom parent, updated as the block's - * instructions are processed, and then copied to each one of its - * dom children. + * {@code non-null;} indexed by old register name. The current + * top of the version stack as seen by this block. It's + * initialized from the ending state of its dom parent, + * updated as the block's instructions are processed, and then + * copied to each one of its dom children. */ private final RegisterSpec[] currentMapping; /** - * Contains the set of moves we need to keep - * to preserve local var info. All other moves will be deleted. + * contains the set of moves we need to keep to preserve local + * var info. All other moves will be deleted. */ private final HashSet<SsaInsn> movesToKeep; /** - * Maps the set of insns to replace after renaming is finished + * maps the set of insns to replace after renaming is finished * on the block. */ private final HashMap<SsaInsn, SsaInsn> insnsToReplace; @@ -265,10 +269,10 @@ class SsaRenamer implements Runnable { private final RenamingMapper mapper; /** - * Constructs a block renamer instance. Call <code>process</code> + * Constructs a block renamer instance. Call {@code process} * to process. * - * @param block non-null; block to process + * @param block {@code non-null;} block to process */ BlockRenamer(final SsaBasicBlock block) { this.block = block; @@ -287,8 +291,8 @@ class SsaRenamer implements Runnable { * as the current block's instructions are processed. */ private class RenamingMapper extends RegisterMapper { - - RenamingMapper() { + public RenamingMapper() { + // This space intentionally left blank. } /** {@inheritDoc} */ @@ -304,8 +308,8 @@ class SsaRenamer implements Runnable { int reg = registerSpec.getReg(); - // for debugging: assert that the mapped types are compatible - if(DEBUG) { + // For debugging: assert that the mapped types are compatible. + if (DEBUG) { RegisterSpec newVersion = currentMapping[reg]; if (newVersion.getBasicType() != Type.BT_VOID && registerSpec.getBasicFrameType() @@ -338,7 +342,7 @@ class SsaRenamer implements Runnable { updateSuccessorPhis(); - // Delete all move insns in this block + // Delete all move insns in this block. ArrayList<SsaInsn> insns = block.getInsns(); int szInsns = insns.size(); @@ -349,29 +353,27 @@ class SsaRenamer implements Runnable { replaceInsn = insnsToReplace.get(insn); if (replaceInsn != null) { - insns.set(i, replaceInsn); + insns.set(i, replaceInsn); } else if (insn.isNormalMoveInsn() && !movesToKeep.contains(insn)) { insns.remove(i); } } - // Store the start states for our dom children + // Store the start states for our dom children. boolean first = true; - for (SsaBasicBlock child: block.getDomChildren()) { + for (SsaBasicBlock child : block.getDomChildren()) { if (child != block) { - RegisterSpec[] childStart; - - // don't bother duplicating the array for the first child - childStart = first ? currentMapping - : dupArray(currentMapping); + // Don't bother duplicating the array for the first child. + RegisterSpec[] childStart = first ? currentMapping + : dupArray(currentMapping); startsForBlocks[child.getIndex()] = childStart; first = false; } } - // currentMapping is owned by a child now + // currentMapping is owned by a child now. } /** @@ -388,13 +390,13 @@ class SsaRenamer implements Runnable { * local. * <li> ensures that only one SSA register * at a time is considered to be associated with a local variable. When - * <code>currentMapping</code> is updated and the newly added element + * {@code currentMapping} is updated and the newly added element * is named, strip that name from any other SSA registers. * </ol> * - * @param ropReg >= 0 Rop register number - * @param ssaReg non-null; An SSA register that has just - * been added to <code>currentMapping</code> + * @param ropReg {@code >= 0;} rop register number + * @param ssaReg {@code non-null;} an SSA register that has just + * been added to {@code currentMapping} */ private void addMapping(int ropReg, RegisterSpec ssaReg) { int ssaRegNum = ssaReg.getReg(); @@ -413,15 +415,15 @@ class SsaRenamer implements Runnable { } } - // All further steps are for registers with local information + // All further steps are for registers with local information. if (ssaRegLocal == null) { return; } - // Record that this SSA reg has been associated with a local + // Record that this SSA reg has been associated with a local. setNameForSsaReg(ssaReg); - // Ensure that no other SSA regs are associated with this local + // Ensure that no other SSA regs are associated with this local. for (int i = currentMapping.length - 1; i >= 0; i--) { RegisterSpec cur = currentMapping[i]; @@ -436,7 +438,7 @@ class SsaRenamer implements Runnable { * {@inheritDoc} * * Phi insns have their result registers renamed. - * */ + */ public void visitPhiInsn(PhiInsn phi) { /* don't process sources for phi's */ processResultReg(phi); @@ -452,7 +454,7 @@ class SsaRenamer implements Runnable { */ public void visitMoveInsn(NormalSsaInsn insn) { /* - * for moves: copy propogate the move if we can, but don't + * For moves: copy propogate the move if we can, but don't * if we need to preserve local variable info and the * result has a different name than the source. */ @@ -464,7 +466,8 @@ class SsaRenamer implements Runnable { insn.mapSourceRegisters(mapper); int ssaSourceReg = insn.getSources().get(0).getReg(); - LocalItem sourceLocal = currentMapping[ropSourceReg].getLocalItem(); + LocalItem sourceLocal + = currentMapping[ropSourceReg].getLocalItem(); LocalItem resultLocal = ropResult.getLocalItem(); /* @@ -475,25 +478,26 @@ class SsaRenamer implements Runnable { */ LocalItem newLocal - = (resultLocal == null) ? sourceLocal : resultLocal; - + = (resultLocal == null) ? sourceLocal : resultLocal; LocalItem associatedLocal = getLocalForNewReg(ssaSourceReg); - // If we take the new local, will only one local have ever - // been associated with this SSA reg? + /* + * If we take the new local, will only one local have ever + * been associated with this SSA reg? + */ boolean onlyOneAssociatedLocal = associatedLocal == null || newLocal == null || newLocal.equals(associatedLocal); - + /* - * If we're going to copy-propogate, then the ssa register spec - * that's going to go into the mapping is made up of the - * source register number mapped from above, the type + * If we're going to copy-propogate, then the ssa register + * spec that's going to go into the mapping is made up of + * the source register number mapped from above, the type * of the result, and the name either from the result (if * specified) or inherited from the existing mapping. * - * The move source has incomplete type information - * in null object cases, so the result type is used. + * The move source has incomplete type information in null + * object cases, so the result type is used. */ RegisterSpec ssaReg = RegisterSpec.makeLocalOptional( @@ -509,15 +513,12 @@ class SsaRenamer implements Runnable { addMapping(ropResultReg, ssaReg); } else if (onlyOneAssociatedLocal && sourceLocal == null) { - /* * The register was previously unnamed. This means that a * local starts after it's first assignment in SSA form */ - RegisterSpecList ssaSources; - - ssaSources = RegisterSpecList.make( + RegisterSpecList ssaSources = RegisterSpecList.make( RegisterSpec.make(ssaReg.getReg(), ssaReg.getType(), newLocal)); @@ -528,12 +529,12 @@ class SsaRenamer implements Runnable { insnsToReplace.put(insn, newInsn); - // Just map as above + // Just map as above. addMapping(ropResultReg, ssaReg); } else { /* - * Do not copy-propogate, since the two registers - * have two different local-variable names + * Do not copy-propogate, since the two registers have + * two different local-variable names. */ processResultReg(insn); @@ -594,11 +595,12 @@ class SsaRenamer implements Runnable { ropReg = insn.getRopResultReg(); /* - * Never add a version 0 register as a phi operand. - * Version 0 registers represent the initial register state, - * and thus are never significant. Furthermore, - * the register liveness algorithm doesn't properly - * count them as "live in" at the beginning of the method. + * Never add a version 0 register as a phi + * operand. Version 0 registers represent the + * initial register state, and thus are never + * significant. Furthermore, the register liveness + * algorithm doesn't properly count them as "live + * in" at the beginning of the method. */ RegisterSpec stackTop = currentMapping[ropReg]; @@ -611,9 +613,7 @@ class SsaRenamer implements Runnable { BitSet successors = block.getSuccessors(); for (int i = successors.nextSetBit(0); i >= 0; i = successors.nextSetBit(i + 1)) { - SsaBasicBlock successor = ssaMeth.getBlocks().get(i); - successor.forEachPhiInsn(visitor); } } diff --git a/dx/src/com/android/dx/ssa/_tests/_DomFront.java b/dx/src/com/android/dx/ssa/_tests/_DomFront.java index 997da2143..3d891c9bb 100644 --- a/dx/src/com/android/dx/ssa/_tests/_DomFront.java +++ b/dx/src/com/android/dx/ssa/_tests/_DomFront.java @@ -19,7 +19,7 @@ package com.android.dx.ssa._tests; import junit.framework.TestCase; /** - * Test the class <code>com.android.dx.ssa.DomFront</code>. + * Test the class {@code com.android.dx.ssa.DomFront}. */ public class _DomFront extends TestCase { diff --git a/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java b/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java index d3ff7c78d..6416e84e8 100644 --- a/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java +++ b/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java @@ -106,7 +106,6 @@ public class FirstFitAllocator extends RegisterAllocator { } for (int j = i + 1; j < oldRegCount; j++) { - if (mapped.get(j) || isDefinitionMoveParam(j)) { continue; } diff --git a/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java b/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java index 14eac9057..0cffcfac1 100644 --- a/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java +++ b/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java @@ -40,9 +40,10 @@ import java.util.TreeMap; * kept together if possible. */ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { + /** local debug flag */ private static final boolean DEBUG = false; - /** maps local variable to a list of associated SSA registers*/ + /** maps local variable to a list of associated SSA registers */ private final Map<LocalItem, ArrayList<RegisterSpec>> localVariables; /** list of move-result-pesudo instructions seen in this method */ @@ -57,29 +58,28 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** Register mapper which will be our result */ private final InterferenceRegisterMapper mapper; - /** end of rop registers range (starting at 0) reserved for parameters. */ + /** end of rop registers range (starting at 0) reserved for parameters */ private final int paramRangeEnd; - /** set of Rop registers reserved for parameters or local variables. */ + /** set of rop registers reserved for parameters or local variables */ private final BitSet reservedRopRegs; - /** set of Rop registers that have been used by anything.*/ + /** set of rop registers that have been used by anything */ private final BitSet usedRopRegs; - /** true if converter should take steps to minimize rop-form registers*/ + /** true if converter should take steps to minimize rop-form registers */ private final boolean minimizeRegisters; - /** * Constructs instance. * - * @param ssaMeth non-null; method to process + * @param ssaMeth {@code non-null;} method to process * @param interference non-null interference graph for SSA registers * @param minimizeRegisters true if converter should take steps to * minimize rop-form registers */ public FirstFitLocalCombiningAllocator( - final SsaMethod ssaMeth, InterferenceGraph interference, + SsaMethod ssaMeth, InterferenceGraph interference, boolean minimizeRegisters) { super(ssaMeth, interference); @@ -122,22 +122,24 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { printLocalVars(); } - if(DEBUG) System.out.println("--->Mapping local-associated params"); + if (DEBUG) System.out.println("--->Mapping local-associated params"); handleLocalAssociatedParams(); - if(DEBUG) System.out.println("--->Mapping other params"); + if (DEBUG) System.out.println("--->Mapping other params"); handleUnassociatedParameters(); - if(DEBUG) System.out.println("--->Mapping invoke-range"); + if (DEBUG) System.out.println("--->Mapping invoke-range"); handleInvokeRangeInsns(); - - if(DEBUG) System.out.println("--->Mapping local-associated non-params"); + + if (DEBUG) { + System.out.println("--->Mapping local-associated non-params"); + } handleLocalAssociatedOther(); - if(DEBUG) System.out.println("--->Mapping check-cast results"); + if (DEBUG) System.out.println("--->Mapping check-cast results"); handleCheckCastResults(); - if(DEBUG) System.out.println("--->Mapping others"); + if (DEBUG) System.out.println("--->Mapping others"); handleNormalUnassociated(); return mapper; @@ -148,13 +150,13 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { */ private void printLocalVars() { System.out.println("Printing local vars"); - for (Map.Entry<LocalItem, ArrayList<RegisterSpec>> e: + for (Map.Entry<LocalItem, ArrayList<RegisterSpec>> e : localVariables.entrySet()) { StringBuilder regs = new StringBuilder(); regs.append('{'); regs.append(' '); - for(RegisterSpec reg: e.getValue()) { + for (RegisterSpec reg : e.getValue()) { regs.append('v'); regs.append(reg.getReg()); regs.append(' '); @@ -165,16 +167,16 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Maps all local-associated parameters to Rop registers. + * Maps all local-associated parameters to rop registers. */ private void handleLocalAssociatedParams() { - for (ArrayList<RegisterSpec> ssaRegs: localVariables.values()) { + for (ArrayList<RegisterSpec> ssaRegs : localVariables.values()) { int sz = ssaRegs.size(); int paramIndex = -1; int paramCategory = 0; - // First, find out if this local variable is a parameter - for (int i = 0 ; i < sz ; i++) { + // First, find out if this local variable is a parameter. + for (int i = 0; i < sz; i++) { RegisterSpec ssaSpec = ssaRegs.get(i); int ssaReg = ssaSpec.getReg(); @@ -188,31 +190,31 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } if (paramIndex < 0) { - // this local wasn't a parameter + // This local wasn't a parameter. continue; } - // Any remaining local-associated registers will be mapped later + // Any remaining local-associated registers will be mapped later. tryMapRegs(ssaRegs, paramIndex, paramCategory, true); } } /** * Gets the parameter index for SSA registers that are method parameters. - * -1 is returned for non-parameter registers. + * {@code -1} is returned for non-parameter registers. * - * @param ssaReg >=0 SSA register to look up - * @return parameter index or -1 if not a parameter + * @param ssaReg {@code >=0;} SSA register to look up + * @return parameter index or {@code -1} if not a parameter */ private int getParameterIndexForReg(int ssaReg) { SsaInsn defInsn = ssaMeth.getDefinitionForRegister(ssaReg); if (defInsn == null) { return -1; } - + Rop opcode = defInsn.getOpcode(); - // opcode == null for phi insns + // opcode == null for phi insns. if (opcode != null && opcode.getOpcode() == RegOps.MOVE_PARAM) { CstInsn origInsn = (CstInsn) defInsn.getOriginalRopInsn(); return ((CstInteger) origInsn.getConstant()).getValue(); @@ -222,20 +224,21 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Maps all local-associated registers that are not parameters. Tries to - * find an unreserved range that's wide enough for all of the SSA registers, - * and then tries to map them all to that range. If not all fit, - * a new range is tried until all registers have been fit. + * Maps all local-associated registers that are not parameters. + * Tries to find an unreserved range that's wide enough for all of + * the SSA registers, and then tries to map them all to that + * range. If not all fit, a new range is tried until all registers + * have been fit. */ private void handleLocalAssociatedOther() { - for (ArrayList<RegisterSpec> specs: localVariables.values()) { + for (ArrayList<RegisterSpec> specs : localVariables.values()) { int ropReg = 0; boolean done; do { int maxCategory = 1; - // compute max category for remaining unmapped registers + // Compute max category for remaining unmapped registers. int sz = specs.size(); for (int i = 0; i < sz; i++) { RegisterSpec ssaSpec = specs.get(i); @@ -250,7 +253,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { done = tryMapRegs(specs, ropReg, maxCategory, true); - // Increment for next call to findNext + // Increment for next call to findNext. ropReg++; } while (!done); } @@ -261,17 +264,19 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * used rop space as reserved. SSA registers that don't fit are left * unmapped. * - * @param specs non-null; SSA registers to attempt to map - * @param ropReg >=0 rop register to map to - * @param maxAllowedCategory 1 or 2, maximum category allowed in mapping. - * @param markReserved do so if true - * @return true if all registers wew mapped, false if some remain unmapped. + * @param specs {@code non-null;} SSA registers to attempt to map + * @param ropReg {@code >=0;} rop register to map to + * @param maxAllowedCategory {@code 1..2;} maximum category + * allowed in mapping. + * @param markReserved do so if {@code true} + * @return {@code true} if all registers were mapped, {@code false} + * if some remain unmapped */ private boolean tryMapRegs( ArrayList<RegisterSpec> specs, int ropReg, int maxAllowedCategory, boolean markReserved) { boolean remaining = false; - for(RegisterSpec spec: specs) { + for (RegisterSpec spec : specs) { if (ssaRegsMapped.get(spec.getReg())) { continue; } @@ -291,11 +296,11 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** * Tries to map an SSA register to a rop register. * - * @param ssaSpec non-null; SSA register - * @param ropReg >=0 rop register - * @param maxAllowedCategory 1 or 2, the maximum category that the SSA - * register is allowed to be. - * @return true if map succeeded, false if not. + * @param ssaSpec {@code non-null;} SSA register + * @param ropReg {@code >=0;} rop register + * @param maxAllowedCategory {@code 1..2;} the maximum category + * that the SSA register is allowed to be + * @return {@code true} if map succeeded, {@code false} if not */ private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) { @@ -310,22 +315,22 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Marks a range of Rop registers as "reserved for a local variable" + * Marks a range of rop registers as "reserved for a local variable." * - * @param ropReg >= 0 rop register to reserve - * @param category > 0 width to reserve + * @param ropReg {@code >= 0;} rop register to reserve + * @param category {@code > 0;} width to reserve */ private void markReserved(int ropReg, int category) { reservedRopRegs.set(ropReg, ropReg + category, true); } /** - * Checks to see if any Rop registers in the specified range are reserved - * for local variables or parameters + * Checks to see if any rop registers in the specified range are reserved + * for local variables or parameters. * - * @param ropRangeStart >= 0 lowest Rop register - * @param width > 0 number of Rop registers in range. - * @return true if any register in range is marked reserved + * @param ropRangeStart {@code >= 0;} lowest rop register + * @param width {@code > 0;} number of rop registers in range. + * @return {@code true} if any register in range is marked reserved */ private boolean rangeContainsReserved(int ropRangeStart, int width) { for (int i = ropRangeStart; i < (ropRangeStart + width); i++) { @@ -337,23 +342,23 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Returns true if given rop register represents the "this" pointer - * for a non-static method + * Returns true if given rop register represents the {@code this} pointer + * for a non-static method. * * @param startReg rop register * @return true if the "this" pointer is located here. */ private boolean isThisPointerReg(int startReg) { - // "this" is always the first parameter + // "this" is always the first parameter. return startReg == 0 && !ssaMeth.isStatic(); } /** - * Finds a range of unreserved Rop registers. + * Finds a range of unreserved rop registers. * - * @param startReg >= 0; a Rop register to start the search at - * @param width > 0; the width, in registers, required. - * @return >= 0; start of available register range. + * @param startReg {@code >= 0;} a rop register to start the search at + * @param width {@code > 0;} the width, in registers, required. + * @return {@code >= 0;} start of available register range. */ private int findNextUnreservedRopReg(int startReg, int width) { if (minimizeRegisters && !isThisPointerReg(startReg)) { @@ -381,12 +386,12 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** * Finds a range of rop regs that can be used for local variables. - * If <code>MIX_LOCALS_AND_OTHER</code> is false, this means any + * If {@code MIX_LOCALS_AND_OTHER} is {@code false}, this means any * rop register that has not yet been used. * - * @param startReg >= 0; a Rop register to start the search at - * @param width > 0; the width, in registers, required. - * @return >= 0; start of available register range. + * @param startReg {@code >= 0;} a rop register to start the search at + * @param width {@code > 0;} the width, in registers, required. + * @return {@code >= 0;} start of available register range. */ private int findRopRegForLocal(int startReg, int width) { if (minimizeRegisters && !isThisPointerReg(startReg)) { @@ -418,6 +423,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { */ private void handleUnassociatedParameters() { int szSsaRegs = ssaMeth.getRegCount(); + for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one above @@ -429,7 +435,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { RegisterSpec ssaSpec = getDefinitionSpecForSsaReg(ssaReg); if (paramIndex >= 0) { addMapping(ssaSpec, paramIndex); - } + } } } @@ -437,13 +443,14 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * Handles all insns that want a register range for their sources. */ private void handleInvokeRangeInsns() { - for(NormalSsaInsn insn: invokeRangeInsns) { + for (NormalSsaInsn insn : invokeRangeInsns) { adjustAndMapSourceRangeRange(insn); } } /** - * Handles check cast results to reuse the same source register if possible + * Handles check cast results to reuse the same source register if + * possible. */ private void handleCheckCastResults() { for (NormalSsaInsn insn : moveResultPseudoInsns) { @@ -498,11 +505,11 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Maps all non-parameter, non-local variable - * registers. + * Maps all non-parameter, non-local variable registers. */ private void handleNormalUnassociated() { int szSsaRegs = ssaMeth.getRegCount(); + for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) { if (ssaRegsMapped.get(ssaReg)) { // We already did this one @@ -525,30 +532,30 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Checks to see if <code>ssaSpec</code> can be mapped to - * <code>ropReg</code>. Checks interference graph and ensures + * Checks to see if {@code ssaSpec} can be mapped to + * {@code ropReg}. Checks interference graph and ensures * the range does not cross the parameter range. * - * @param ssaSpec non-null; SSA spec + * @param ssaSpec {@code non-null;} SSA spec * @param ropReg prosepctive new-namespace reg - * @return true if mapping is possible + * @return {@code true} if mapping is possible */ private boolean canMapReg(RegisterSpec ssaSpec, int ropReg) { int category = ssaSpec.getCategory(); return !(spansParamRange(ropReg, category) || mapper.interferes(ssaSpec, ropReg)); } - + /** - * Returns true if the specified Rop register + category - * will cross the boundry between the lower <code>paramWidth</code> + * Returns true if the specified rop register + category + * will cross the boundry between the lower {@code paramWidth} * registers reserved for method params and the upper registers. We cannot * allocate a register that spans the param block and the normal block, * because we will be moving the param block to high registers later. - * + * * @param ssaReg register in new namespace * @param category width that the register will have - * @return true in the case noted above. + * @return {@code true} in the case noted above */ private boolean spansParamRange(int ssaReg, int category) { return ((ssaReg < paramRangeEnd) @@ -561,7 +568,6 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { */ private void analyzeInstructions() { ssaMeth.forEachInsn(new SsaInsn.Visitor() { - /** {@inheritDoc} */ public void visitMoveInsn(NormalSsaInsn insn) { processInsn(insn); @@ -579,15 +585,16 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** * This method collects three types of instructions: + * * 1) Adds a local variable assignment to the - * <code>localVariables</code> map. + * {@code localVariables} map. * 2) Add move-result-pseudo to the - * <code>moveResultPseudoInsns</code> list. + * {@code moveResultPseudoInsns} list. * 3) Add invoke-range to the - * <code>invokeRangeInsns</code> list. + * {@code invokeRangeInsns} list. * - * @param insn non-null; insn that may represent a local variable - * assignment. + * @param insn {@code non-null;} insn that may represent a + * local variable assignment */ private void processInsn(SsaInsn insn) { RegisterSpec assignment; @@ -596,7 +603,8 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { if (assignment != null) { LocalItem local = assignment.getLocalItem(); - ArrayList<RegisterSpec> regList = localVariables.get(local); + ArrayList<RegisterSpec> regList + = localVariables.get(local); if (regList == null) { regList = new ArrayList<RegisterSpec>(); @@ -622,16 +630,16 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /** - * Adds a mapping from an SSA register to a Rop register. <code> - * canMapReg</code> should have already been called. + * Adds a mapping from an SSA register to a rop register. + * {@link #canMapReg} should have already been called. * - * @param ssaSpec non-null; SSA register to map from - * @param ropReg >=0; Rop register to map to + * @param ssaSpec {@code non-null;} SSA register to map from + * @param ropReg {@code >=0;} rop register to map to */ private void addMapping(RegisterSpec ssaSpec, int ropReg) { int ssaReg = ssaSpec.getReg(); - // An assertion + // An assertion. if (ssaRegsMapped.get(ssaReg) || !canMapReg(ssaSpec, ropReg)) { throw new RuntimeException( "attempt to add invalid register mapping"); @@ -639,8 +647,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { if (DEBUG) { System.out.printf("Add mapping s%d -> v%d c:%d\n", - ssaSpec.getReg(), ropReg, ssaSpec.getCategory()); - + ssaSpec.getReg(), ropReg, ssaSpec.getCategory()); } int category = ssaSpec.getCategory(); @@ -652,19 +659,18 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** * Maps the source registers of the specified instruction such that they - * will fall in a contiguous range in Rop form. Moves are inserted as + * will fall in a contiguous range in rop form. Moves are inserted as * necessary to allow the range to be allocated. * - * @param insn non-null; insn whos sources to process + * @param insn {@code non-null;} insn whos sources to process */ private void adjustAndMapSourceRangeRange(NormalSsaInsn insn) { - int newRegStart; - - newRegStart = findRangeAndAdjust(insn); + int newRegStart = findRangeAndAdjust(insn); RegisterSpecList sources = insn.getSources(); int szSources = sources.size(); int nextRopReg = newRegStart; + for (int i = 0; i < szSources; i++) { RegisterSpec source = sources.get(i); int sourceReg = source.getReg(); @@ -686,17 +692,20 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { int szSimilar = similarRegisters.size(); - // Try to map all SSA registers also associated with this local + /* + * Try to map all SSA registers also associated with + * this local. + */ for (int j = 0; j < szSimilar; j++) { RegisterSpec similarSpec = similarRegisters.get(j); int similarReg = similarSpec.getReg(); - // ...and don't map anything that's also a source... + // Don't map anything that's also a source. if (-1 != sources.indexOfRegister(similarReg)) { continue; } - // Registers left unmapped will get handled later + // Registers left unmapped will get handled later. tryMapReg(similarSpec, curRopReg, category); } } @@ -706,12 +715,12 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /** * Find a contiguous rop register range that fits the specified * instruction's sources. First, try to center the range around - * sources that have already been mapped to Rop registers. If that fails, + * sources that have already been mapped to rop registers. If that fails, * just find a new contiguous range that doesn't interfere. - - * @param insn non-null; the insn whose sources need to fit. Must be - * last insn in basic block. - * @return >= 0 rop register of start of range + * + * @param insn {@code non-null;} the insn whose sources need to + * fit. Must be last insn in basic block. + * @return {@code >= 0;} rop register of start of range */ private int findRangeAndAdjust(NormalSsaInsn insn) { RegisterSpecList sources = insn.getSources(); @@ -727,7 +736,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { rangeLength += categoriesForIndex[i]; } - // The highest score of fits tried so far + // the highest score of fits tried so far int maxScore = Integer.MIN_VALUE; // the high scoring range's start int resultRangeStart = -1; @@ -736,7 +745,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /* * First, go through each source that's already been mapped. Try - * to center the range around the Rop register this source is mapped + * to center the range around the rop register this source is mapped * to. */ int rangeStartOffset = 0; @@ -794,13 +803,12 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } /* - * Now, insert any moves required + * Now, insert any moves required. */ - for (int i = resultMovesRequired.nextSetBit(0); i >= 0 - ; i = resultMovesRequired.nextSetBit(i+1)) { - insn.changeOneSource(i, - insertMoveBefore(insn, sources.get(i))); + for (int i = resultMovesRequired.nextSetBit(0); i >= 0; + i = resultMovesRequired.nextSetBit(i+1)) { + insn.changeOneSource(i, insertMoveBefore(insn, sources.get(i))); } return resultRangeStart; @@ -811,14 +819,14 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * specified instruction. Does not bother trying to center the range * around an already-mapped source register; * - * @param insn non-null; insn to build range for - * @param rangeLength >=0 length required in register units. - * @param categoriesForIndex non-null; indexed by source index; - * the category for each source. - * @param outMovesRequired non-null; an output parameter indexed by + * @param insn {@code non-null;} insn to build range for + * @param rangeLength {@code >=0;} length required in register units + * @param categoriesForIndex {@code non-null;} indexed by source index; + * the category for each source + * @param outMovesRequired {@code non-null;} an output parameter indexed by * source index that will contain the set of sources which need - * moves inserted. - * @return the rop register that starts the fitting range. + * moves inserted + * @return the rop register that starts the fitting range */ private int findAnyFittingRange(NormalSsaInsn insn, int rangeLength, int[] categoriesForIndex, BitSet outMovesRequired) { @@ -842,15 +850,15 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * Attempts to build a plan for fitting a range of sources into rop * registers. * - * @param ropReg >=0 rop reg that begins range - * @param insn non-null; insn to plan range for - * @param categoriesForIndex non-null; indexed by source index; - * the category for each source. - * @param outMovesRequired non-null; an output parameter indexed by + * @param ropReg {@code >= 0;} rop reg that begins range + * @param insn {@code non-null;} insn to plan range for + * @param categoriesForIndex {@code non-null;} indexed by source index; + * the category for each source + * @param outMovesRequired {@code non-null;} an output parameter indexed by * source index that will contain the set of sources which need - * moves inserted. + * moves inserted * @return the width of the fit that that does not involve added moves or - * -1 if "no fit possible" + * {@code -1} if "no fit possible" */ private int fitPlanForRange(int ropReg, NormalSsaInsn insn, int[] categoriesForIndex, BitSet outMovesRequired) { @@ -860,7 +868,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { IntSet liveOut = insn.getBlock().getLiveOutRegs(); RegisterSpecList liveOutSpecs = ssaSetToSpecs(liveOut); - // An SSA reg may only be mapped into a range once + // An SSA reg may only be mapped into a range once. BitSet seen = new BitSet(ssaMeth.getRegCount()); for (int i = 0; i < szSources ; i++) { @@ -874,7 +882,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { if (ssaRegsMapped.get(ssaReg) && mapper.oldToNew(ssaReg) == ropReg) { - // A register already mapped appropriately + // This is a register that is already mapped appropriately. fitWidth += category; } else if (rangeContainsReserved(ropReg, category)) { fitWidth = -1; @@ -882,19 +890,20 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } else if (!ssaRegsMapped.get(ssaReg) && canMapReg(ssaSpec, ropReg) && !seen.get(ssaReg)) { - // A register that can be mapped appropriately + // This is a register that can be mapped appropriately. fitWidth += category; } else if (!mapper.areAnyPinned(liveOutSpecs, ropReg, category) && !mapper.areAnyPinned(sources, ropReg, category)) { /* - * A source that can be moved - * We can insert a move as long as: + * This is a source that can be moved. We can insert a + * move as long as: + * + * * no SSA register pinned to the desired rop reg + * is live out on the block * - * - no SSA register pinned to the desired rop reg - * is live out on the block - * - no SSA register pinned to desired rop reg is - * a source of this insn (since this may require - * overlapping moves, which we can't presently handle) + * * no SSA register pinned to desired rop reg is + * a source of this insn (since this may require + * overlapping moves, which we can't presently handle) */ outMovesRequired.set(i); @@ -912,7 +921,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * Converts a bit set of SSA registers into a RegisterSpecList containing * the definition specs of all the registers. * - * @param ssaSet non-null; set of SSA registers + * @param ssaSet {@code non-null;} set of SSA registers * @return list of RegisterSpecs as noted above */ RegisterSpecList ssaSetToSpecs(IntSet ssaSet) { @@ -924,21 +933,20 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { while (iter.hasNext()) { result.set(i++, getDefinitionSpecForSsaReg(iter.next())); } - + return result; } /** - * Gets a local item associated with an ssa register, if one exists + * Gets a local item associated with an ssa register, if one exists. * - * @param ssaReg >= 0 SSA register - * @return null-ok; associated local item or null + * @param ssaReg {@code >= 0;} SSA register + * @return {@code null-ok;} associated local item or null */ private LocalItem getLocalItemForReg(int ssaReg) { - for(Map.Entry<LocalItem, ArrayList<RegisterSpec>> entry: - localVariables.entrySet()) { - - for (RegisterSpec spec: entry.getValue()) { + for (Map.Entry<LocalItem, ArrayList<RegisterSpec>> entry : + localVariables.entrySet()) { + for (RegisterSpec spec : entry.getValue()) { if (spec.getReg() == ssaReg) { return entry.getKey(); } diff --git a/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java b/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java index abc5fca78..a639af561 100644 --- a/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java +++ b/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java @@ -34,14 +34,14 @@ import java.util.BitSet; * frequently are created when catch blocks are edge-split. */ public class IdenticalBlockCombiner { - - private RopMethod ropMethod; - private BasicBlockList blocks; - private BasicBlockList newBlocks; + private final RopMethod ropMethod; + private final BasicBlockList blocks; + private final BasicBlockList newBlocks; /** - * Constructs instance. Call <code>process()</code> to run. - * @param rm instance to process + * Constructs instance. Call {@code process()} to run. + * + * @param rm {@code non-null;} instance to process */ public IdenticalBlockCombiner(RopMethod rm) { ropMethod = rm; @@ -50,10 +50,11 @@ public class IdenticalBlockCombiner { } /** - * Runs algorithm. TODO: this is n^2, and could be made linear-ish with - * a hash. + * Runs algorithm. TODO: This is n^2, and could be made linear-ish with + * a hash. In particular, hash the contents of each block and only + * compare blocks with the same hash. * - * @return new method that has been processed + * @return {@code non-null;} new method that has been processed */ public RopMethod process() { int szBlocks = blocks.size(); @@ -78,14 +79,15 @@ public class IdenticalBlockCombiner { BasicBlock iBlock = blocks.labelToBlock(iLabel); - if (toDelete.get(iLabel) || iBlock.getSuccessors().size() > 1) { + if (toDelete.get(iLabel) + || iBlock.getSuccessors().size() > 1) { continue; } IntList toCombine = new IntList(); // ...and see if they can be combined with any other preds... - for (int j = i + 1; j <szPreds; j++) { + for (int j = i + 1; j < szPreds; j++) { int jLabel = preds.get(j); BasicBlock jBlock = blocks.labelToBlock(jLabel); @@ -101,7 +103,7 @@ public class IdenticalBlockCombiner { } } - for (int i = szBlocks - 1; i > 0; i--) { + for (int i = szBlocks - 1; i >= 0; i--) { if (toDelete.get(newBlocks.get(i).getLabel())) { newBlocks.set(i, null); } @@ -113,7 +115,14 @@ public class IdenticalBlockCombiner { return new RopMethod(newBlocks, ropMethod.getFirstLabel()); } - private boolean compareInsns(BasicBlock a, BasicBlock b) { + /** + * Helper method to compare the contents of two blocks. + * + * @param a {@code non-null;} a block to compare + * @param b {@code non-null;} another block to compare + * @return {@code true} iff the two blocks' instructions are the same + */ + private static boolean compareInsns(BasicBlock a, BasicBlock b) { return a.getInsns().contentEquals(b.getInsns()); } @@ -131,11 +140,7 @@ public class IdenticalBlockCombiner { for (int i = 0; i < szBetas; i++) { int betaLabel = betaLabels.get(i); BasicBlock bb = blocks.labelToBlock(betaLabel); - - IntList preds; - - preds = ropMethod.labelToPredecessors(bb.getLabel()); - + IntList preds = ropMethod.labelToPredecessors(bb.getLabel()); int szPreds = preds.size(); for (int j = 0; j < szPreds; j++) { @@ -147,19 +152,19 @@ public class IdenticalBlockCombiner { /** * Replaces one of a block's successors with a different label. Constructs - * an updated BasicBlock instance and places it in <code>newBlocks</code>. + * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { - IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); + if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } diff --git a/dx/src/com/android/dx/ssa/back/InterferenceGraph.java b/dx/src/com/android/dx/ssa/back/InterferenceGraph.java index 282420b8f..e6cde622a 100644 --- a/dx/src/com/android/dx/ssa/back/InterferenceGraph.java +++ b/dx/src/com/android/dx/ssa/back/InterferenceGraph.java @@ -34,14 +34,17 @@ import java.util.ArrayList; * A register interference graph */ public class InterferenceGraph { - /** interference graph, indexed by register in both dimensions */ + /** + * {@code non-null;} interference graph, indexed by register in + * both dimensions + */ private final ArrayList<IntSet> interference; /** * Creates a new graph. * - * @param countRegs >=0 the start count of registers in the namespace. - * New registers can be added subsequently. + * @param countRegs {@code >= 0;} the start count of registers in + * the namespace. New registers can be added subsequently. */ public InterferenceGraph(int countRegs) { interference = new ArrayList<IntSet>(countRegs); @@ -83,9 +86,9 @@ public class InterferenceGraph { /** * Merges the interference set for a register into a given bit set * - * @param reg >=0 register - * @param set non-null; interference set; will be merged with set for - * given register + * @param reg {@code >= 0;} register + * @param set {@code non-null;} interference set; will be merged + * with set for given register */ public void mergeInterferenceSet(int reg, IntSet set) { if (reg < interference.size()) { @@ -100,8 +103,10 @@ public class InterferenceGraph { */ private void ensureCapacity(int size) { int countRegs = interference.size(); + interference.ensureCapacity(size); - for (int i = countRegs ; i < size; i++) { + + for (int i = countRegs; i < size; i++) { interference.add(SetFactory.makeInterferenceSet(size)); } } diff --git a/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java b/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java index 5ae6e074a..cd3f7d2f6 100644 --- a/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java +++ b/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java @@ -28,28 +28,27 @@ import java.util.ArrayList; /** * From Appel "Modern Compiler Implementation in Java" algorithm 19.17 - * Calculate the live ranges for register <code>reg</code>.<p> + * Calculate the live ranges for register {@code reg}.<p> * * v = regV <p> * s = insn <p> * M = visitedBlocks <p> */ public class LivenessAnalyzer { - /** - * non-null; index by basic block indexed set of basic blocks + * {@code non-null;} index by basic block indexed set of basic blocks * that have already been visited. "M" as written in the original Appel * algorithm. */ private final BitSet visitedBlocks; /** - * non-null; set of blocks remaing to visit as "live out as block" + * {@code non-null;} set of blocks remaing to visit as "live out as block" */ private final BitSet liveOutBlocks; /** - * >=0; SSA register currently being analyzed. + * {@code >=0;} SSA register currently being analyzed. * "v" in the original Appel algorithm. */ private final int regV; @@ -61,33 +60,34 @@ public class LivenessAnalyzer { private final InterferenceGraph interference; /** block "n" in Appel 19.17 */ - SsaBasicBlock blockN; + private SsaBasicBlock blockN; - /** index of statement <code>s</code> in <code>blockN</code>*/ + /** index of statement {@code s} in {@code blockN} */ private int statementIndex; - /** the next function to call. one of the four constants below */ - private int nextFunction; + /** the next function to call */ + private NextFunction nextFunction; - /** constants for nextFunction */ - static final int LIVE_IN_AT_STATEMENT = 1; - static final int LIVE_OUT_AT_STATEMENT = 2; - static final int LIVE_OUT_AT_BLOCK = 3; - static final int DONE = 4; + /** constants for {@link #nextFunction} */ + private static enum NextFunction { + LIVE_IN_AT_STATEMENT, + LIVE_OUT_AT_STATEMENT, + LIVE_OUT_AT_BLOCK, + DONE; + } /** * Runs register liveness algorithm for a method, updating the - * live in/out information in <code>SsaBasicBlock</code> instances and + * live in/out information in {@code SsaBasicBlock} instances and * returning an interference graph. * - * @param ssaMeth non-null; Method to process. - * @return non-null; interference graph indexed by SSA registers in both - * directions. + * @param ssaMeth {@code non-null;} method to process + * @return {@code non-null;} interference graph indexed by SSA + * registers in both directions */ public static InterferenceGraph constructInterferenceGraph( SsaMethod ssaMeth) { int szRegs = ssaMeth.getRegCount(); - InterferenceGraph interference = new InterferenceGraph(szRegs); for (int i = 0; i < szRegs; i++) { @@ -102,42 +102,43 @@ public class LivenessAnalyzer { /** * Makes liveness analyzer instance for specific register. * - * @param ssaMeth non-null; method to process + * @param ssaMeth {@code non-null;} method to process * @param reg register whose liveness to analyze - * @param interference non-null; indexed by SSA reg in both dimensions; - * graph to update + * @param interference {@code non-null;} indexed by SSA reg in + * both dimensions; graph to update * */ - private LivenessAnalyzer(final SsaMethod ssaMeth, final int reg, + private LivenessAnalyzer(SsaMethod ssaMeth, int reg, InterferenceGraph interference) { + int blocksSz = ssaMeth.getBlocks().size(); + this.ssaMeth = ssaMeth; this.regV = reg; - visitedBlocks = new BitSet(ssaMeth.getBlocks().size()); - liveOutBlocks = new BitSet(ssaMeth.getBlocks().size()); + visitedBlocks = new BitSet(blocksSz); + liveOutBlocks = new BitSet(blocksSz); this.interference = interference; } /** - * The algorithm in Appel is presented in - * partial tail-recursion form. Obviously, that's not - * efficient in java, so this function serves - * as the dispatcher instead. + * The algorithm in Appel is presented in partial tail-recursion + * form. Obviously, that's not efficient in java, so this function + * serves as the dispatcher instead. */ private void handleTailRecursion() { - while (nextFunction != DONE) { + while (nextFunction != NextFunction.DONE) { switch (nextFunction) { case LIVE_IN_AT_STATEMENT: - nextFunction = DONE; + nextFunction = NextFunction.DONE; liveInAtStatement(); break; case LIVE_OUT_AT_STATEMENT: - nextFunction = DONE; + nextFunction = NextFunction.DONE; liveOutAtStatement(); break; case LIVE_OUT_AT_BLOCK: - nextFunction = DONE; + nextFunction = NextFunction.DONE; liveOutAtBlock(); break; @@ -147,23 +148,23 @@ public class LivenessAnalyzer { } /** - * From Appel algorithm 19.17 + * From Appel algorithm 19.17. */ public void run() { List<SsaInsn> useList = ssaMeth.getUseListForRegister(regV); - for (SsaInsn insn: useList) { - nextFunction = DONE; + for (SsaInsn insn : useList) { + nextFunction = NextFunction.DONE; if (insn instanceof PhiInsn) { - // If s is a phi-function with V as it's ith argument + // If s is a phi-function with V as it's ith argument. PhiInsn phi = (PhiInsn) insn; - for (SsaBasicBlock pred: phi.predBlocksForReg(regV, ssaMeth)) { - + for (SsaBasicBlock pred : + phi.predBlocksForReg(regV, ssaMeth)) { blockN = pred; - nextFunction = LIVE_OUT_AT_BLOCK; + nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } } else { @@ -175,7 +176,7 @@ public class LivenessAnalyzer { "insn not found in it's own block"); } - nextFunction = LIVE_IN_AT_STATEMENT; + nextFunction = NextFunction.LIVE_IN_AT_STATEMENT; handleTailRecursion(); } } @@ -184,13 +185,13 @@ public class LivenessAnalyzer { while ((nextLiveOutBlock = liveOutBlocks.nextSetBit(0)) >= 0) { blockN = ssaMeth.getBlocks().get(nextLiveOutBlock); liveOutBlocks.clear(nextLiveOutBlock); - nextFunction = LIVE_OUT_AT_BLOCK; + nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } } /** - * "v is live-out at n" + * "v is live-out at n." */ private void liveOutAtBlock() { if (! visitedBlocks.get(blockN.getIndex())) { @@ -204,15 +205,14 @@ public class LivenessAnalyzer { // Live out at last statement in blockN statementIndex = insns.size() - 1; - nextFunction = LIVE_OUT_AT_STATEMENT; + nextFunction = NextFunction.LIVE_OUT_AT_STATEMENT; } } /** - * "v is live-in at s" + * "v is live-in at s." */ private void liveInAtStatement() { - // if s is the first statement in block N if (statementIndex == 0) { // v is live-in at n @@ -224,23 +224,22 @@ public class LivenessAnalyzer { } else { // Let s' be the statement preceeding s statementIndex -= 1; - nextFunction = LIVE_OUT_AT_STATEMENT; + nextFunction = NextFunction.LIVE_OUT_AT_STATEMENT; } } /** - * "v is live-out at s" + * "v is live-out at s." */ private void liveOutAtStatement() { - SsaInsn statement = blockN.getInsns().get(statementIndex); RegisterSpec rs = statement.getResult(); if (!statement.isResultReg(regV)) { - if(rs != null) { + if (rs != null) { interference.add(regV, rs.getReg()); } - nextFunction = LIVE_IN_AT_STATEMENT; + nextFunction = NextFunction.LIVE_IN_AT_STATEMENT; } } @@ -253,12 +252,12 @@ public class LivenessAnalyzer { * as the result of another phi, and the phi removal move scheduler may * generate moves that over-write the live result. * - * @param ssaMeth non-null; method to pricess - * @param interference non-null; interference graph + * @param ssaMeth {@code non-null;} method to pricess + * @param interference {@code non-null;} interference graph */ private static void coInterferePhis(SsaMethod ssaMeth, InterferenceGraph interference) { - for (SsaBasicBlock b: ssaMeth.getBlocks()) { + for (SsaBasicBlock b : ssaMeth.getBlocks()) { List<SsaInsn> phis = b.getPhiInsns(); int szPhis = phis.size(); diff --git a/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java b/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java index cd3b2f1eb..f6dc961a3 100644 --- a/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java +++ b/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java @@ -29,11 +29,9 @@ import java.util.ArrayList; * about normal or wide categories. Used for debugging. */ public class NullRegisterAllocator extends RegisterAllocator { - /** {@inheritDoc} */ - public NullRegisterAllocator( - final SsaMethod ssaMeth, final InterferenceGraph interference) { - + public NullRegisterAllocator(SsaMethod ssaMeth, + InterferenceGraph interference) { super(ssaMeth, interference); } @@ -49,8 +47,7 @@ public class NullRegisterAllocator extends RegisterAllocator { public RegisterMapper allocateRegisters() { int oldRegCount = ssaMeth.getRegCount(); - BasicRegisterMapper mapper - = new BasicRegisterMapper(oldRegCount); + BasicRegisterMapper mapper = new BasicRegisterMapper(oldRegCount); for (int i = 0; i < oldRegCount; i++) { mapper.addMapping(i, i*2, 2); diff --git a/dx/src/com/android/dx/ssa/back/RegisterAllocator.java b/dx/src/com/android/dx/ssa/back/RegisterAllocator.java index 764b03ac2..e75eee186 100644 --- a/dx/src/com/android/dx/ssa/back/RegisterAllocator.java +++ b/dx/src/com/android/dx/ssa/back/RegisterAllocator.java @@ -34,10 +34,9 @@ import java.util.BitSet; import java.util.ArrayList; /** - * Base class of all register allocators + * Base class of all register allocators. */ public abstract class RegisterAllocator { - /** method being processed */ protected final SsaMethod ssaMeth; @@ -45,13 +44,13 @@ public abstract class RegisterAllocator { protected final InterferenceGraph interference; /** - * Creates an instance. Call <code>allocateRegisters</code> to run. + * Creates an instance. Call {@code allocateRegisters} to run. * @param ssaMeth method to process. * @param interference Interference graph, indexed by register in both * dimensions. */ - public RegisterAllocator( - final SsaMethod ssaMeth, final InterferenceGraph interference) { + public RegisterAllocator(SsaMethod ssaMeth, + InterferenceGraph interference) { this.ssaMeth = ssaMeth; this.interference = interference; } @@ -61,26 +60,26 @@ public abstract class RegisterAllocator { * of the namespace, and thus should be moved up to the top of the * namespace after phi removal. * - * @return true if params should be moved from low to high. + * @return {@code true} if params should be moved from low to high */ public abstract boolean wantsParamsMovedHigh(); /** * Runs the algorithm. - * @return a register mapper to apply to the <code>SsaMethod</code> + * + * @return a register mapper to apply to the {@code SsaMethod} */ public abstract RegisterMapper allocateRegisters(); /** * Returns the category (width) of the definition site of the register. - * Returns 1 for undefined registers. + * Returns {@code 1} for undefined registers. * * @param reg register - * @return 1 or 2 + * @return {@code 1..2} */ - protected int getCategoryForSsaReg(int reg) { - SsaInsn definition; - definition = ssaMeth.getDefinitionForRegister(reg); + protected final int getCategoryForSsaReg(int reg) { + SsaInsn definition = ssaMeth.getDefinitionForRegister(reg); if (definition == null) { // an undefined reg @@ -93,25 +92,26 @@ public abstract class RegisterAllocator { /** * Returns the RegisterSpec of the definition of the register. * - * @param reg >= 0 SSA register + * @param reg {@code >= 0;} SSA register * @return definition spec of the register or null if it is never defined - * (for the case of "version 0" SSA registers). + * (for the case of "version 0" SSA registers) */ - protected RegisterSpec getDefinitionSpecForSsaReg(int reg) { - SsaInsn definition; - definition = ssaMeth.getDefinitionForRegister(reg); + protected final RegisterSpec getDefinitionSpecForSsaReg(int reg) { + SsaInsn definition = ssaMeth.getDefinitionForRegister(reg); return definition == null ? null : definition.getResult(); } /** * Returns true if the definition site of this register is a - * move-param (ie, this is a method parameter) + * move-param (ie, this is a method parameter). + * * @param reg register in question - * @return true if this is a method parameter + * @return {@code true} if this is a method parameter */ protected boolean isDefinitionMoveParam(int reg) { SsaInsn defInsn = ssaMeth.getDefinitionForRegister(reg); + if (defInsn instanceof NormalSsaInsn) { NormalSsaInsn ndefInsn = (NormalSsaInsn) defInsn; @@ -127,19 +127,18 @@ public abstract class RegisterAllocator { * interference graph in the process. The insn currently must be the * last insn in a block. * - * @param insn non-null; insn to insert move before, must be last insn - * in block. - * @param reg non-null; SSA register to duplicate - * @return non-null; spec of new SSA register created by move + * @param insn {@code non-null;} insn to insert move before, must + * be last insn in block + * @param reg {@code non-null;} SSA register to duplicate + * @return {@code non-null;} spec of new SSA register created by move */ protected final RegisterSpec insertMoveBefore(SsaInsn insn, RegisterSpec reg) { - SsaBasicBlock block = insn.getBlock(); ArrayList<SsaInsn> insns = block.getInsns(); int insnIndex = insns.indexOf(insn); - if (insnIndex < 0 ) { + if (insnIndex < 0) { throw new IllegalArgumentException ( "specified insn is not in this block"); } @@ -155,19 +154,17 @@ public abstract class RegisterAllocator { } /* - * Get new register and make new move instruction + * Get new register and make new move instruction. */ - // new result must not have associated local variable + // The new result must not have an associated local variable. RegisterSpec newRegSpec = RegisterSpec.make(ssaMeth.makeNewSsaReg(), reg.getTypeBearer()); - SsaInsn toAdd; - - toAdd = SsaInsn.makeFromRop( - new PlainInsn(Rops.opMove(newRegSpec.getType()), - SourcePosition.NO_INFO, newRegSpec, - RegisterSpecList.make(reg)), block); + SsaInsn toAdd = SsaInsn.makeFromRop( + new PlainInsn(Rops.opMove(newRegSpec.getType()), + SourcePosition.NO_INFO, newRegSpec, + RegisterSpecList.make(reg)), block); insns.add(insnIndex, toAdd); @@ -179,17 +176,13 @@ public abstract class RegisterAllocator { */ IntSet liveOut = block.getLiveOutRegs(); - - RegisterSpec result = insn.getResult(); - int resultReg = (result == null) ? -1 : result.getReg(); - IntIterator liveOutIter = liveOut.iterator(); - while(liveOutIter.hasNext()) { + while (liveOutIter.hasNext()) { interference.add(newReg, liveOutIter.next()); } - // Everything that's a source in the last insn interferes + // Everything that's a source in the last insn interferes. RegisterSpecList sources = insn.getSources(); int szSources = sources.size(); diff --git a/dx/src/com/android/dx/ssa/back/SsaToRop.java b/dx/src/com/android/dx/ssa/back/SsaToRop.java index 1c59549af..0ecbead54 100644 --- a/dx/src/com/android/dx/ssa/back/SsaToRop.java +++ b/dx/src/com/android/dx/ssa/back/SsaToRop.java @@ -38,7 +38,9 @@ import com.android.dx.util.IntList; import com.android.dx.util.Hex; import java.util.ArrayList; +import java.util.Arrays; import java.util.BitSet; +import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -46,55 +48,67 @@ import java.util.List; * Converts a method in SSA form to ROP form. */ public class SsaToRop { - + /** local debug flag */ private static final boolean DEBUG = false; - /** non-null; method to process */ + /** {@code non-null;} method to process */ private final SsaMethod ssaMeth; /** - * true if the converter should attempt to minimize + * {@code true} if the converter should attempt to minimize * the rop-form register count */ private final boolean minimizeRegisters; - /** interference graph */ - private InterferenceGraph interference; + /** {@code non-null;} interference graph */ + private final InterferenceGraph interference; /** * Converts a method in SSA form to ROP form. - * @param ssaMeth input - * @return non-null; rop-form output + * + * @param ssaMeth {@code non-null;} method to process + * @param minimizeRegisters {@code true} if the converter should + * attempt to minimize the rop-form register count + * @return {@code non-null;} rop-form output */ public static RopMethod convertToRopMethod(SsaMethod ssaMeth, boolean minimizeRegisters) { return new SsaToRop(ssaMeth, minimizeRegisters).convert(); } - private SsaToRop(final SsaMethod ssaMethod, boolean minimizeRegisters) { + /** + * Constructs an instance. + * + * @param ssaMeth {@code non-null;} method to process + * @param minimizeRegisters {@code true} if the converter should + * attempt to minimize the rop-form register count + */ + private SsaToRop(SsaMethod ssaMethod, boolean minimizeRegisters) { this.minimizeRegisters = minimizeRegisters; this.ssaMeth = ssaMethod; + this.interference = + LivenessAnalyzer.constructInterferenceGraph(ssaMethod); } + /** + * Performs the conversion. + * + * @return {@code non-null;} rop-form output + */ private RopMethod convert() { - interference = LivenessAnalyzer.constructInterferenceGraph(ssaMeth); - if (DEBUG) { interference.dumpToStdout(); } - RegisterAllocator allocator; - RegisterMapper mapper; - - // These are other allocators for debugging or historical comparison - - //allocator = new NullRegisterAllocator(ssaMeth, interference); - //allocator = new FirstFitAllocator(ssaMeth, interference); + // These are other allocators for debugging or historical comparison: + // allocator = new NullRegisterAllocator(ssaMeth, interference); + // allocator = new FirstFitAllocator(ssaMeth, interference); - allocator = new FirstFitLocalCombiningAllocator(ssaMeth, interference, - minimizeRegisters); + RegisterAllocator allocator = + new FirstFitLocalCombiningAllocator(ssaMeth, interference, + minimizeRegisters); - mapper = allocator.allocateRegisters(); + RegisterMapper mapper = allocator.allocateRegisters(); if (DEBUG) { System.out.println("Printing reg map"); @@ -113,22 +127,20 @@ public class SsaToRop { removeEmptyGotos(); - RopMethod ropMethod; - - ropMethod = convertToRop(); - + RopMethod ropMethod = new RopMethod(convertBasicBlocks(), + ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex())); ropMethod = new IdenticalBlockCombiner(ropMethod).process(); return ropMethod; } - /** - * Removes all blocks containing only GOTOs from the control flow. Although - * much of this work will be done later when converting from rop to dex, - * not all simplification cases can be handled there. Furthermore, any no-op - * block between the exit block and blocks containing the real return or - * throw statements must be removed. + * Removes all blocks containing only GOTOs from the control flow. + * Although much of this work will be done later when converting + * from rop to dex, not all simplification cases can be handled + * there. Furthermore, any no-op block between the exit block and + * blocks containing the real return or throw statements must be + * removed. */ private void removeEmptyGotos() { final ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); @@ -139,8 +151,7 @@ public class SsaToRop { if ((insns.size() == 1) && (insns.get(0).getOpcode() == Rops.GOTO)) { - - BitSet preds = (BitSet)b.getPredecessors().clone(); + BitSet preds = (BitSet) b.getPredecessors().clone(); for (int i = preds.nextSetBit(0); i >= 0; i = preds.nextSetBit(i + 1)) { @@ -154,89 +165,49 @@ public class SsaToRop { } /** - * This method is not presently used. - * @return a list of registers ordered by most-frequently-used - * to least-frequently-used. Each register is listed once and only once. - */ - public int[] getRegistersByFrequency() { - int regCount = ssaMeth.getRegCount(); - Integer[] ret = new Integer[ssaMeth.getRegCount()]; - - for (int i = 0; i < regCount; i++) { - ret[i] = i; - } - - java.util.Arrays.sort(ret, new java.util.Comparator<Integer>() { - public int compare (Integer o1, Integer o2) { - return ssaMeth.getUseListForRegister(o2).size() - - ssaMeth.getUseListForRegister(o1).size(); - } - - public boolean equals(Object o) { - return o == this; - } - }); - - int result[] = new int[regCount]; - - for (int i = 0; i < regCount; i++) { - result[i] = ret[i]; - } - - return result; - } - - /** - * See Appel 19.6 - * To remove the phi instructions in an edge-split SSA representation - * we know we can always insert a move in a predecessor block + * See Appel 19.6. To remove the phi instructions in an edge-split + * SSA representation we know we can always insert a move in a + * predecessor block. */ private void removePhiFunctions() { - for (SsaBasicBlock block: ssaMeth.getBlocks()) { - // Add moves in all the pred blocks for each phi insn` - block.forEachPhiInsn(new PhiVisitor(block)); - // Delete the phi insns + ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); + + for (SsaBasicBlock block : blocks) { + // Add moves in all the pred blocks for each phi insn. + block.forEachPhiInsn(new PhiVisitor(blocks)); + + // Delete the phi insns. block.removeAllPhiInsns(); } /* - * After all move insns have been added: sort them so they don't - * destructively interfere + * After all move insns have been added, sort them so they don't + * destructively interfere. */ - for (SsaBasicBlock block: ssaMeth.getBlocks()) { + for (SsaBasicBlock block : blocks) { block.scheduleMovesFromPhis(); } } /** - * PhiSuccessorUpdater for adding move instructions to predecessors based - * on phi insns. + * Helper for {@link #removePhiFunctions}: PhiSuccessorUpdater for + * adding move instructions to predecessors based on phi insns. */ - private class PhiVisitor implements PhiInsn.Visitor { - SsaBasicBlock block; + private static class PhiVisitor implements PhiInsn.Visitor { + private final ArrayList<SsaBasicBlock> blocks; - PhiVisitor (final SsaBasicBlock block) { - this.block = block; + public PhiVisitor(ArrayList<SsaBasicBlock> blocks) { + this.blocks = blocks; } - public void visitPhiInsn (PhiInsn insn) { - RegisterSpecList sources; - RegisterSpec result; - ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); - - sources = insn.getSources(); - result = insn.getResult(); - + public void visitPhiInsn(PhiInsn insn) { + RegisterSpecList sources = insn.getSources(); + RegisterSpec result = insn.getResult(); int sz = sources.size(); - for (int i = 0; i <sz; i++) { - RegisterSpec source; - - source = sources.get(i); - - SsaBasicBlock predBlock; - - predBlock = blocks.get( + for (int i = 0; i < sz; i++) { + RegisterSpec source = sources.get(i); + SsaBasicBlock predBlock = blocks.get( insn.predBlockIndexForSourcesIndex(i)); predBlock.addMoveToEnd(result, source); @@ -250,9 +221,7 @@ public class SsaToRop { * Dalvik calling convention. */ private void moveParametersToHighRegisters() { - int paramWidth = ssaMeth.getParamWidth(); - BasicRegisterMapper mapper = new BasicRegisterMapper(ssaMeth.getRegCount()); int regCount = ssaMeth.getRegCount(); @@ -273,29 +242,25 @@ public class SsaToRop { ssaMeth.mapRegisters(mapper); } - private RopMethod convertToRop() { - return new RopMethod(convertBasicBlocks(), - ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex())); - } - /** * @return rop-form basic block list */ private BasicBlockList convertBasicBlocks() { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); - // Exit block may be null + + // Exit block may be null. SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); int ropBlockCount = ssaMeth.getCountReachableBlocks(); - // Don't count the exit block, if it exists + // Don't count the exit block, if it exists. ropBlockCount -= (exitBlock == null) ? 0 : 1; BasicBlockList result = new BasicBlockList(ropBlockCount); - // Convert all the reachable blocks except the exit block + // Convert all the reachable blocks except the exit block. int ropBlockIndex = 0; - for(SsaBasicBlock b : blocks) { + for (SsaBasicBlock b : blocks) { if (b.isReachable() && b != exitBlock) { result.set(ropBlockIndex++, convertBasicBlock(b)); } @@ -303,8 +268,8 @@ public class SsaToRop { // The exit block, which is discarded, must do nothing. if (exitBlock != null && exitBlock.getInsns().size() != 0) { - throw new RuntimeException - ("Exit block must have no insns when leaving SSA form"); + throw new RuntimeException( + "Exit block must have no insns when leaving SSA form"); } return result; @@ -314,11 +279,10 @@ public class SsaToRop { * Validates that a basic block is a valid end predecessor. It must * end in a RETURN or a THROW. Throws a runtime exception on error. * - * @param b non-null; block to validate + * @param b {@code non-null;} block to validate * @throws RuntimeException on error */ private void verifyValidExitPredecessor(SsaBasicBlock b) { - ArrayList<SsaInsn> insns = b.getInsns(); SsaInsn lastInsn = insns.get(insns.size() - 1); Rop opcode = lastInsn.getOpcode(); @@ -334,22 +298,21 @@ public class SsaToRop { * Converts a single basic block to rop form. * * @param block SSA block to process - * @return ROP block + * @return {@code non-null;} ROP block */ private BasicBlock convertBasicBlock(SsaBasicBlock block) { - BasicBlock result; IntList successorList = block.getRopLabelSuccessorList(); int primarySuccessorLabel = block.getPrimarySuccessorRopLabel(); - // Filter out any reference to the SSA form's exit block - // exit block may be null - SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); + // Filter out any reference to the SSA form's exit block. + // Exit block may be null. + SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); int exitRopLabel = (exitBlock == null) ? -1 : exitBlock.getRopLabel(); if (successorList.contains(exitRopLabel)) { if (successorList.size() > 1) { - throw new RuntimeException ( + throw new RuntimeException( "Exit predecessor must have no other successors" + Hex.u2(block.getRopLabel())); } else { @@ -362,7 +325,7 @@ public class SsaToRop { successorList.setImmutable(); - result = new BasicBlock( + BasicBlock result = new BasicBlock( block.getRopLabel(), convertInsns(block.getInsns()), successorList, primarySuccessorLabel); @@ -371,16 +334,14 @@ public class SsaToRop { } /** - * Converts an insn list to rop form - * @param ssaInsns non-null;old instructions - * @return non-null; immutable instruction list + * Converts an insn list to rop form. + * + * @param ssaInsns {@code non-null;} old instructions + * @return {@code non-null;} immutable instruction list */ private InsnList convertInsns(ArrayList<SsaInsn> ssaInsns) { - InsnList result; - int insnCount; - - insnCount = ssaInsns.size(); - result = new InsnList (insnCount); + int insnCount = ssaInsns.size(); + InsnList result = new InsnList(insnCount); for (int i = 0; i < insnCount; i++) { result.set(i, ssaInsns.get(i).toRopInsn()); @@ -390,4 +351,35 @@ public class SsaToRop { return result; } + + /** + * <b>Note:</b> This method is not presently used. + * + * @return a list of registers ordered by most-frequently-used to + * least-frequently-used. Each register is listed once and only + * once. + */ + public int[] getRegistersByFrequency() { + int regCount = ssaMeth.getRegCount(); + Integer[] ret = new Integer[regCount]; + + for (int i = 0; i < regCount; i++) { + ret[i] = i; + } + + Arrays.sort(ret, new Comparator<Integer>() { + public int compare(Integer o1, Integer o2) { + return ssaMeth.getUseListForRegister(o2).size() + - ssaMeth.getUseListForRegister(o1).size(); + } + }); + + int result[] = new int[regCount]; + + for (int i = 0; i < regCount; i++) { + result[i] = ret[i]; + } + + return result; + } } diff --git a/dx/src/com/android/dx/ssa/package-info.java b/dx/src/com/android/dx/ssa/package-info.java index 45d9ad6a3..582a327eb 100644 --- a/dx/src/com/android/dx/ssa/package-info.java +++ b/dx/src/com/android/dx/ssa/package-info.java @@ -19,7 +19,7 @@ package com.android.dx.ssa; /** * <h1>An introduction to SSA Form</h1> * - * This package contains classes associated with dx's <code>SSA</code> + * This package contains classes associated with dx's {@code SSA} * intermediate form. This form is a static-single-assignment representation of * Rop-form a method with Rop-form-like instructions (with the addition of a * {@link PhiInsn phi instriction}. This form is intended to make it easy to @@ -47,7 +47,7 @@ package com.android.dx.ssa; * <li> {@link PhiInsn} instances represent "phi" operators defined in SSA * literature. They must be the first N instructions in a basic block. * <li> {@link NormalSsaInsn} instances represent instructions that directly - * correspond to <code>Rop</code> form. + * correspond to {@code Rop} form. * </ul> * * <h3>Classes related to optimization steps</h3> @@ -74,14 +74,14 @@ package com.android.dx.ssa; * * <h3>Conversion into SSA Form</h3> * - * {@link SsaConverter#convertToSsaMethod} takes a <code>RopMethod</code> and - * returns a fully-converted <code>SsaMethod</code>. The conversion process + * {@link SsaConverter#convertToSsaMethod} takes a {@code RopMethod} and + * returns a fully-converted {@code SsaMethod}. The conversion process * is roughly as follows: * * <ol> * <li> The Rop-form method, its blocks and their instructions are directly - * wrapped in <code>SsaMethod</code>, <code>SsaBasicBlock</code> and - * <code>SsaInsn</code> instances. Nothing else changes. + * wrapped in {@code SsaMethod}, {@code SsaBasicBlock} and + * {@code SsaInsn} instances. Nothing else changes. * <li> Critical control-flow graph edges are {@link SsaConverter#edgeSplit * split} and new basic blocks inserted as required to meet the constraints * necessary for the ultimate SSA representation. @@ -89,7 +89,7 @@ package com.android.dx.ssa; * Rop registers to local variables necessary during phi placement. This * step could also be done in Rop form and then updated through the preceding * steps. - * <li> <code>Phi</code> instructions are {link SsaConverter#placePhiFunctions} + * <li> {@code Phi} instructions are {link SsaConverter#placePhiFunctions} * placed in a semi-pruned fashion, which requires computation of {@link * Dominators dominance graph} and each node's {@link DomFront * dominance-frontier set}. diff --git a/dx/src/com/android/dx/util/AnnotatedOutput.java b/dx/src/com/android/dx/util/AnnotatedOutput.java index 0d950414e..9b69a36b4 100644 --- a/dx/src/com/android/dx/util/AnnotatedOutput.java +++ b/dx/src/com/android/dx/util/AnnotatedOutput.java @@ -25,7 +25,7 @@ public interface AnnotatedOutput /** * Get whether this instance will actually keep annotations. * - * @return <code>true</code> iff annotations are being kept + * @return {@code true} iff annotations are being kept */ public boolean annotates(); @@ -34,7 +34,7 @@ public interface AnnotatedOutput * Annotators may use the result of calling this method to inform their * annotation activity. * - * @return <code>true</code> iff annotations are to be verbose + * @return {@code true} iff annotations are to be verbose */ public boolean isVerbose(); @@ -44,7 +44,7 @@ public interface AnnotatedOutput * annotation marks all subsequent output until another annotation * call. * - * @param msg non-null; the annotation message + * @param msg {@code non-null;} the annotation message */ public void annotate(String msg); @@ -55,9 +55,9 @@ public interface AnnotatedOutput * previous calls to this method, the new call "consumes" output * after all the output covered by the previous calls. * - * @param amt >= 0; the amount of output for this annotation to + * @param amt {@code >= 0;} the amount of output for this annotation to * cover - * @param msg non-null; the annotation message + * @param msg {@code non-null;} the annotation message */ public void annotate(int amt, String msg); @@ -73,7 +73,7 @@ public interface AnnotatedOutput * output, but annotaters are encouraged to attempt to avoid exceeding * the indicated width. * - * @return >= 1; the maximum width + * @return {@code >= 1;} the maximum width */ public int getAnnotationWidth(); } diff --git a/dx/src/com/android/dx/util/BitIntSet.java b/dx/src/com/android/dx/util/BitIntSet.java index c8588f8c0..db85571f4 100644 --- a/dx/src/com/android/dx/util/BitIntSet.java +++ b/dx/src/com/android/dx/util/BitIntSet.java @@ -44,7 +44,7 @@ public class BitIntSet implements IntSet { /** * Ensures that the bit set has the capacity to represent the given value. * - * @param value >= 0 value to represent + * @param value {@code >= 0;} value to represent */ private void ensureCapacity(int value) { if (value >= Bits.getMax(bits)) { @@ -118,12 +118,6 @@ public class BitIntSet implements IntSet { return ret; } - - /** @inheritDoc */ - public void remove() { - BitIntSet.this.remove(idx); - idx = Bits.findFirst(bits, idx+1); - } }; } diff --git a/dx/src/com/android/dx/util/Bits.java b/dx/src/com/android/dx/util/Bits.java index 0bc124c89..1f45bd3fe 100644 --- a/dx/src/com/android/dx/util/Bits.java +++ b/dx/src/com/android/dx/util/Bits.java @@ -17,7 +17,7 @@ package com.android.dx.util; /** - * Utilities for treating <code>int[]</code>s as bit sets. + * Utilities for treating {@code int[]}s as bit sets. */ public final class Bits { /** @@ -30,8 +30,8 @@ public final class Bits { /** * Constructs a bit set to contain bits up to the given index (exclusive). * - * @param max >= 0; the maximum bit index (exclusive) - * @return non-null; an appropriately-constructed instance + * @param max {@code >= 0;} the maximum bit index (exclusive) + * @return {@code non-null;} an appropriately-constructed instance */ public static int[] makeBitSet(int max) { int size = (max + 0x1f) >> 5; @@ -41,8 +41,8 @@ public final class Bits { /** * Gets the maximum index (exclusive) for the given bit set. * - * @param bits non-null; bit set in question - * @return >= 0; the maximum index (exclusive) that may be set + * @param bits {@code non-null;} bit set in question + * @return {@code >= 0;} the maximum index (exclusive) that may be set */ public static int getMax(int[] bits) { return bits.length * 0x20; @@ -51,8 +51,8 @@ public final class Bits { /** * Gets the value of the bit at the given index. * - * @param bits non-null; bit set to operate on - * @param idx >= 0, < getMax(set); which bit + * @param bits {@code non-null;} bit set to operate on + * @param idx {@code >= 0, < getMax(set);} which bit * @return the value of the indicated bit */ public static boolean get(int[] bits, int idx) { @@ -64,8 +64,8 @@ public final class Bits { /** * Sets the given bit to the given value. * - * @param bits non-null; bit set to operate on - * @param idx >= 0, < getMax(set); which bit + * @param bits {@code non-null;} bit set to operate on + * @param idx {@code >= 0, < getMax(set);} which bit * @param value the new value for the bit */ public static void set(int[] bits, int idx, boolean value) { @@ -80,10 +80,10 @@ public final class Bits { } /** - * Sets the given bit to <code>true</code>. + * Sets the given bit to {@code true}. * - * @param bits non-null; bit set to operate on - * @param idx >= 0, < getMax(set); which bit + * @param bits {@code non-null;} bit set to operate on + * @param idx {@code >= 0, < getMax(set);} which bit */ public static void set(int[] bits, int idx) { int arrayIdx = idx >> 5; @@ -92,10 +92,10 @@ public final class Bits { } /** - * Sets the given bit to <code>false</code>. + * Sets the given bit to {@code false}. * - * @param bits non-null; bit set to operate on - * @param idx >= 0, < getMax(set); which bit + * @param bits {@code non-null;} bit set to operate on + * @param idx {@code >= 0, < getMax(set);} which bit */ public static void clear(int[] bits, int idx) { int arrayIdx = idx >> 5; @@ -105,10 +105,10 @@ public final class Bits { /** * Returns whether or not the given bit set is empty, that is, whether - * no bit is set to <code>true</code>. + * no bit is set to {@code true}. * - * @param bits non-null; bit set to operate on - * @return <code>true</code> iff all bits are <code>false</code> + * @param bits {@code non-null;} bit set to operate on + * @return {@code true} iff all bits are {@code false} */ public static boolean isEmpty(int[] bits) { int len = bits.length; @@ -123,10 +123,10 @@ public final class Bits { } /** - * Gets the number of bits set to <code>true</code> in the given bit set. + * Gets the number of bits set to {@code true} in the given bit set. * - * @param bits non-null; bit set to operate on - * @return >= 0; the bit count (aka population count) of the set + * @param bits {@code non-null;} bit set to operate on + * @return {@code >= 0;} the bit count (aka population count) of the set */ public static int bitCount(int[] bits) { int len = bits.length; @@ -140,13 +140,13 @@ public final class Bits { } /** - * Returns whether any bits are set to <code>true</code> in the + * Returns whether any bits are set to {@code true} in the * specified range. * - * @param bits non-null; bit set to operate on - * @param start >= 0; index of the first bit in the range (inclusive) - * @param end >= 0; index of the last bit in the range (exclusive) - * @return <code>true</code> if any bit is set to <code>true</code> in + * @param bits {@code non-null;} bit set to operate on + * @param start {@code >= 0;} index of the first bit in the range (inclusive) + * @param end {@code >= 0;} index of the last bit in the range (exclusive) + * @return {@code true} if any bit is set to {@code true} in * the indicated range */ public static boolean anyInRange(int[] bits, int start, int end) { @@ -158,10 +158,10 @@ public final class Bits { * Finds the lowest-order bit set at or after the given index in the * given bit set. * - * @param bits non-null; bit set to operate on - * @param idx >= 0; minimum index to return - * @return >= -1; lowest-order bit set at or after <code>idx</code>, - * or <code>-1</code> if there is no appropriate bit index to return + * @param bits {@code non-null;} bit set to operate on + * @param idx {@code >= 0;} minimum index to return + * @return {@code >= -1;} lowest-order bit set at or after {@code idx}, + * or {@code -1} if there is no appropriate bit index to return */ public static int findFirst(int[] bits, int idx) { int len = bits.length; @@ -183,12 +183,12 @@ public final class Bits { /** * Finds the lowest-order bit set at or after the given index in the - * given <code>int</code>. + * given {@code int}. * * @param value the value in question * @param idx 0..31 the minimum bit index to return - * @return >= -1; lowest-order bit set at or after <code>idx</code>, - * or <code>-1</code> if there is no appropriate bit index to return + * @return {@code >= -1;} lowest-order bit set at or after {@code idx}, + * or {@code -1} if there is no appropriate bit index to return */ public static int findFirst(int value, int idx) { value &= ~((1 << idx) - 1); // Mask off too-low bits. @@ -197,13 +197,13 @@ public final class Bits { } /** - * Ors bit array <code>b</code> into bit array <code>a</code>. - * <code>a.length</code> must be greater than or equal to - * <code>b.length</code>. + * Ors bit array {@code b} into bit array {@code a}. + * {@code a.length} must be greater than or equal to + * {@code b.length}. * - * @param a non-null; int array to be ored with other argument. This + * @param a {@code non-null;} int array to be ored with other argument. This * argument is modified. - * @param b non-null; int array to be ored into <code>a</code>. This + * @param b {@code non-null;} int array to be ored into {@code a}. This * argument is not modified. */ public static void or(int[] a, int[] b) { diff --git a/dx/src/com/android/dx/util/ByteArray.java b/dx/src/com/android/dx/util/ByteArray.java index 3fcf29362..6bd6e5f10 100644 --- a/dx/src/com/android/dx/util/ByteArray.java +++ b/dx/src/com/android/dx/util/ByteArray.java @@ -21,28 +21,28 @@ import java.io.IOException; import java.io.InputStream; /** - * Wrapper for a <code>byte[]</code>, which provides read-only access and + * Wrapper for a {@code byte[]}, which provides read-only access and * can "reveal" a partial slice of the underlying array. * * <b>Note:</b> Multibyte accessors all use big-endian order. */ public final class ByteArray { - /** non-null; underlying array */ + /** {@code non-null;} underlying array */ private final byte[] bytes; - /** <code>>= 0</code>; start index of the slice (inclusive) */ + /** {@code >= 0}; start index of the slice (inclusive) */ private final int start; - /** <code>>= 0, <= bytes.length</code>; size computed as - * <code>end - start</code> (in the constructor) */ + /** {@code >= 0, <= bytes.length}; size computed as + * {@code end - start} (in the constructor) */ private final int size; /** * Constructs an instance. * - * @param bytes non-null; the underlying array - * @param start <code>>= 0</code>; start index of the slice (inclusive) - * @param end <code>>= start, <= bytes.length</code>; end index of + * @param bytes {@code non-null;} the underlying array + * @param start {@code >= 0;} start index of the slice (inclusive) + * @param end {@code >= start, <= bytes.length;} end index of * the slice (exclusive) */ public ByteArray(byte[] bytes, int start, int end) { @@ -68,9 +68,9 @@ public final class ByteArray { } /** - * Constructs an instance from an entire <code>byte[]</code>. + * Constructs an instance from an entire {@code byte[]}. * - * @param bytes non-null; the underlying array + * @param bytes {@code non-null;} the underlying array */ public ByteArray(byte[] bytes) { this(bytes, 0, bytes.length); @@ -79,7 +79,7 @@ public final class ByteArray { /** * Gets the size of the array, in bytes. * - * @return >= 0; the size + * @return {@code >= 0;} the size */ public int size() { return size; @@ -88,10 +88,10 @@ public final class ByteArray { /** * Returns a slice (that is, a sub-array) of this instance. * - * @param start <code>>= 0</code>; start index of the slice (inclusive) - * @param end <code>>= start, <= size()</code>; end index of + * @param start {@code >= 0;} start index of the slice (inclusive) + * @param end {@code >= start, <= size();} end index of * the slice (exclusive) - * @return non-null; the slice + * @return {@code non-null;} the slice */ public ByteArray slice(int start, int end) { checkOffsets(start, end); @@ -103,9 +103,9 @@ public final class ByteArray { * offset into this instance. * * @param offset offset into this instance - * @param bytes non-null; (alleged) underlying array - * @return corresponding offset into <code>bytes</code> - * @throws IllegalArgumentException thrown if <code>bytes</code> is + * @param bytes {@code non-null;} (alleged) underlying array + * @return corresponding offset into {@code bytes} + * @throws IllegalArgumentException thrown if {@code bytes} is * not the underlying array of this instance */ public int underlyingOffset(int offset, byte[] bytes) { @@ -117,10 +117,10 @@ public final class ByteArray { } /** - * Gets the <code>signed byte</code> value at a particular offset. + * Gets the {@code signed byte} value at a particular offset. * - * @param off <code>>= 0, < size(); offset to fetch - * @return <code>signed byte</code> at that offset + * @param off {@code >= 0, < size();} offset to fetch + * @return {@code signed byte} at that offset */ public int getByte(int off) { checkOffsets(off, off + 1); @@ -128,10 +128,10 @@ public final class ByteArray { } /** - * Gets the <code>signed short</code> value at a particular offset. + * Gets the {@code signed short} value at a particular offset. * - * @param off <code>>= 0, < (size() - 1); offset to fetch - * @return <code>signed short</code> at that offset + * @param off {@code >= 0, < (size() - 1);} offset to fetch + * @return {@code signed short} at that offset */ public int getShort(int off) { checkOffsets(off, off + 2); @@ -139,10 +139,10 @@ public final class ByteArray { } /** - * Gets the <code>signed int</code> value at a particular offset. + * Gets the {@code signed int} value at a particular offset. * - * @param off <code>>= 0, < (size() - 3); offset to fetch - * @return <code>signed int</code> at that offset + * @param off {@code >= 0, < (size() - 3);} offset to fetch + * @return {@code signed int} at that offset */ public int getInt(int off) { checkOffsets(off, off + 4); @@ -153,10 +153,10 @@ public final class ByteArray { } /** - * Gets the <code>signed long</code> value at a particular offset. + * Gets the {@code signed long} value at a particular offset. * - * @param off <code>>= 0, < (size() - 7); offset to fetch - * @return <code>signed int</code> at that offset + * @param off {@code >= 0, < (size() - 7);} offset to fetch + * @return {@code signed int} at that offset */ public long getLong(int off) { checkOffsets(off, off + 8); @@ -173,10 +173,10 @@ public final class ByteArray { } /** - * Gets the <code>unsigned byte</code> value at a particular offset. + * Gets the {@code unsigned byte} value at a particular offset. * - * @param off <code>>= 0, < size(); offset to fetch - * @return <code>unsigned byte</code> at that offset + * @param off {@code >= 0, < size();} offset to fetch + * @return {@code unsigned byte} at that offset */ public int getUnsignedByte(int off) { checkOffsets(off, off + 1); @@ -184,10 +184,10 @@ public final class ByteArray { } /** - * Gets the <code>unsigned short</code> value at a particular offset. + * Gets the {@code unsigned short} value at a particular offset. * - * @param off <code>>= 0, < (size() - 1); offset to fetch - * @return <code>unsigned short</code> at that offset + * @param off {@code >= 0, < (size() - 1);} offset to fetch + * @return {@code unsigned short} at that offset */ public int getUnsignedShort(int off) { checkOffsets(off, off + 2); @@ -196,11 +196,11 @@ public final class ByteArray { /** * Copies the contents of this instance into the given raw - * <code>byte[]</code> at the given offset. The given array must be + * {@code byte[]} at the given offset. The given array must be * large enough. * - * @param out non-null; array to hold the output - * @param offset non-null; index into <code>out</code> for the first + * @param out {@code non-null;} array to hold the output + * @param offset {@code non-null;} index into {@code out} for the first * byte of output */ public void getBytes(byte[] out, int offset) { @@ -226,7 +226,7 @@ public final class ByteArray { } /** - * Gets the <code>signed byte</code> value at the given offset, + * Gets the {@code signed byte} value at the given offset, * without doing any argument checking. * * @param off offset to fetch @@ -237,7 +237,7 @@ public final class ByteArray { } /** - * Gets the <code>unsigned byte</code> value at the given offset, + * Gets the {@code unsigned byte} value at the given offset, * without doing any argument checking. * * @param off offset to fetch @@ -248,26 +248,26 @@ public final class ByteArray { } /** - * Gets a <code>DataInputStream</code> that reads from this instance, + * Gets a {@code DataInputStream} that reads from this instance, * with the cursor starting at the beginning of this instance's data. * <b>Note:</b> The returned instance may be cast to {@link #GetCursor} * if needed. * - * @return non-null; an appropriately-constructed - * <code>DataInputStream</code> instance + * @return {@code non-null;} an appropriately-constructed + * {@code DataInputStream} instance */ public MyDataInputStream makeDataInputStream() { return new MyDataInputStream(makeInputStream()); } /** - * Gets a <code>InputStream</code> that reads from this instance, + * Gets a {@code InputStream} that reads from this instance, * with the cursor starting at the beginning of this instance's data. * <b>Note:</b> The returned instance may be cast to {@link #GetCursor} * if needed. * - * @return non-null; an appropriately-constructed - * <code>InputStream</code> instancex + * @return {@code non-null;} an appropriately-constructed + * {@code InputStream} instancex */ public MyInputStream makeInputStream() { return new MyInputStream(); @@ -280,7 +280,7 @@ public final class ByteArray { /** * Gets the current cursor. * - * @return 0..size(); the cursor + * @return {@code 0..size();} the cursor */ public int getCursor(); } @@ -345,7 +345,7 @@ public final class ByteArray { /** * Gets the current cursor. * - * @return 0..size(); the cursor + * @return {@code 0..size();} the cursor */ public int getCursor() { return cursor; @@ -357,8 +357,8 @@ public final class ByteArray { * simply so that the cursor of a wrapped {@link #MyInputStream} * instance may be easily determined. */ - public class MyDataInputStream extends DataInputStream { - /** non-null; the underlying {@link #MyInputStream} */ + public static class MyDataInputStream extends DataInputStream { + /** {@code non-null;} the underlying {@link #MyInputStream} */ private final MyInputStream wrapped; public MyDataInputStream(MyInputStream wrapped) { @@ -370,7 +370,7 @@ public final class ByteArray { /** * Gets the current cursor. * - * @return 0..size(); the cursor + * @return {@code 0..size();} the cursor */ public int getCursor() { return wrapped.getCursor(); diff --git a/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java b/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java index 457a603c5..5fcf5d8c3 100644 --- a/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java +++ b/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java @@ -22,7 +22,7 @@ import java.util.ArrayList; /** * Implementation of {@link AnnotatedOutput} which stores the written data - * into a <code>byte[]</code>. + * into a {@code byte[]}. * * <p><b>Note:</b> As per the {@link Output} interface, multi-byte * writes all use little-endian order.</p> @@ -38,26 +38,26 @@ public final class ByteArrayAnnotatedOutput */ private final boolean stretchy; - /** non-null; the data itself */ + /** {@code non-null;} the data itself */ private byte[] data; - /** >= 0; current output cursor */ + /** {@code >= 0;} current output cursor */ private int cursor; /** whether annotations are to be verbose */ private boolean verbose; /** - * null-ok; list of annotations, or <code>null</code> if this instance + * {@code null-ok;} list of annotations, or {@code null} if this instance * isn't keeping them */ private ArrayList<Annotation> annotations; - /** >= 40 (if used); the desired maximum annotation width */ + /** {@code >= 40 (if used);} the desired maximum annotation width */ private int annotationWidth; /** - * >= 8 (if used); the number of bytes of hex output to use + * {@code >= 8 (if used);} the number of bytes of hex output to use * in annotations */ private int hexCols; @@ -69,7 +69,7 @@ public final class ByteArrayAnnotatedOutput * capacity of the resulting instance. Also, the constructed * instance does not keep annotations by default. * - * @param data non-null; data array to use for output + * @param data {@code non-null;} data array to use for output */ public ByteArrayAnnotatedOutput(byte[] data) { this(data, false); @@ -87,7 +87,7 @@ public final class ByteArrayAnnotatedOutput /** * Internal constructor. * - * @param data non-null; data array to use for output + * @param data {@code non-null;} data array to use for output * @param stretchy whether the instance is to be stretchy */ private ByteArrayAnnotatedOutput(byte[] data, boolean stretchy) { @@ -105,25 +105,25 @@ public final class ByteArrayAnnotatedOutput } /** - * Gets the underlying <code>byte[]</code> of this instance, which + * Gets the underlying {@code byte[]} of this instance, which * may be larger than the number of bytes written * * @see #toByteArray * - * @return non-null; the <code>byte[]</code> + * @return {@code non-null;} the {@code byte[]} */ public byte[] getArray() { return data; } /** - * Constructs and returns a new <code>byte[]</code> that contains + * Constructs and returns a new {@code byte[]} that contains * the written contents exactly (that is, with no extra unwritten * bytes at the end). * * @see #getArray * - * @return non-null; an appropriately-constructed array + * @return {@code non-null;} an appropriately-constructed array */ public byte[] toByteArray() { byte[] result = new byte[cursor]; @@ -419,7 +419,7 @@ public final class ByteArrayAnnotatedOutput * be called only once per instance, and only before any data has been * written to the it. * - * @param annotationWidth >= 40; the desired maximum annotation width + * @param annotationWidth {@code >= 40;} the desired maximum annotation width * @param verbose whether or not to indicate verbose annotations */ public void enableAnnotations(int annotationWidth, boolean verbose) { @@ -474,7 +474,7 @@ public final class ByteArrayAnnotatedOutput /** * Writes the annotated content of this instance to the given writer. * - * @param out non-null; where to write to + * @param out {@code non-null;} where to write to */ public void writeAnnotationsTo(Writer out) throws IOException { int width2 = getAnnotationWidth(); @@ -538,7 +538,7 @@ public final class ByteArrayAnnotatedOutput * Reallocates the underlying array if necessary. Calls to this method * should be guarded by a test of {@link #stretchy}. * - * @param desiredSize >= 0; the desired minimum total size of the array + * @param desiredSize {@code >= 0;} the desired minimum total size of the array */ private void ensureCapacity(int desiredSize) { if (data.length < desiredSize) { @@ -552,25 +552,25 @@ public final class ByteArrayAnnotatedOutput * Annotation on output. */ private static class Annotation { - /** >= 0; start of annotated range (inclusive) */ + /** {@code >= 0;} start of annotated range (inclusive) */ private final int start; /** - * >= 0; end of annotated range (exclusive); - * <code>Integer.MAX_VALUE</code> if unclosed + * {@code >= 0;} end of annotated range (exclusive); + * {@code Integer.MAX_VALUE} if unclosed */ private int end; - /** non-null; annotation text */ + /** {@code non-null;} annotation text */ private final String text; /** * Constructs an instance. * - * @param start >= 0; start of annotated range - * @param end >= start; end of annotated range (exclusive) or - * <code>Integer.MAX_VALUE</code> if unclosed - * @param text non-null; annotation text + * @param start {@code >= 0;} start of annotated range + * @param end {@code >= start;} end of annotated range (exclusive) or + * {@code Integer.MAX_VALUE} if unclosed + * @param text {@code non-null;} annotation text */ public Annotation(int start, int end, String text) { this.start = start; @@ -581,8 +581,8 @@ public final class ByteArrayAnnotatedOutput /** * Constructs an instance. It is initally unclosed. * - * @param start >= 0; start of annotated range - * @param text non-null; annotation text + * @param start {@code >= 0;} start of annotated range + * @param text {@code non-null;} annotation text */ public Annotation(int start, String text) { this(start, Integer.MAX_VALUE, text); @@ -592,7 +592,7 @@ public final class ByteArrayAnnotatedOutput * Sets the end as given, but only if the instance is unclosed; * otherwise, do nothing. * - * @param end >= start; the end + * @param end {@code >= start;} the end */ public void setEndIfUnset(int end) { if (this.end == Integer.MAX_VALUE) { @@ -603,7 +603,7 @@ public final class ByteArrayAnnotatedOutput /** * Sets the end as given. * - * @param end >= start; the end + * @param end {@code >= start;} the end */ public void setEnd(int end) { this.end = end; @@ -630,7 +630,7 @@ public final class ByteArrayAnnotatedOutput /** * Gets the text. * - * @return non-null; the text + * @return {@code non-null;} the text */ public String getText() { return text; diff --git a/dx/src/com/android/dx/util/ExceptionWithContext.java b/dx/src/com/android/dx/util/ExceptionWithContext.java index 035546ed9..7f8523c15 100644 --- a/dx/src/com/android/dx/util/ExceptionWithContext.java +++ b/dx/src/com/android/dx/util/ExceptionWithContext.java @@ -24,7 +24,7 @@ import java.io.PrintWriter; */ public class ExceptionWithContext extends RuntimeException { - /** non-null; human-oriented context of the exception */ + /** {@code non-null;} human-oriented context of the exception */ private StringBuffer context; /** @@ -33,9 +33,9 @@ public class ExceptionWithContext * {@link ExceptionWithContext}, or a newly-constructed exception if it * was not. * - * @param ex non-null; the exception to augment - * @param str non-null; context to add - * @return non-null; an appropriate instance + * @param ex {@code non-null;} the exception to augment + * @param str {@code non-null;} context to add + * @return {@code non-null;} an appropriate instance */ public static ExceptionWithContext withContext(Throwable ex, String str) { ExceptionWithContext ewc; @@ -62,7 +62,7 @@ public class ExceptionWithContext /** * Constructs an instance. * - * @param cause null-ok; exception that caused this one + * @param cause {@code null-ok;} exception that caused this one */ public ExceptionWithContext(Throwable cause) { this(null, cause); @@ -72,7 +72,7 @@ public class ExceptionWithContext * Constructs an instance. * * @param message human-oriented message - * @param cause null-ok; exception that caused this one + * @param cause {@code null-ok;} exception that caused this one */ public ExceptionWithContext(String message, Throwable cause) { super((message != null) ? message : @@ -105,7 +105,7 @@ public class ExceptionWithContext /** * Adds a line of context to this instance. * - * @param str non-null; new context + * @param str {@code non-null;} new context */ public void addContext(String str) { if (str == null) { @@ -121,7 +121,7 @@ public class ExceptionWithContext /** * Gets the context. * - * @return non-null; the context + * @return {@code non-null;} the context */ public String getContext() { return context.toString(); @@ -130,7 +130,7 @@ public class ExceptionWithContext /** * Prints the message and context. * - * @param out non-null; where to print to + * @param out {@code non-null;} where to print to */ public void printContext(PrintStream out) { out.println(getMessage()); @@ -140,7 +140,7 @@ public class ExceptionWithContext /** * Prints the message and context. * - * @param out non-null; where to print to + * @param out {@code non-null;} where to print to */ public void printContext(PrintWriter out) { out.println(getMessage()); diff --git a/dx/src/com/android/dx/util/FileUtils.java b/dx/src/com/android/dx/util/FileUtils.java index 07a7c7e8d..3f51207e0 100644 --- a/dx/src/com/android/dx/util/FileUtils.java +++ b/dx/src/com/android/dx/util/FileUtils.java @@ -35,8 +35,8 @@ public final class FileUtils { * Reads the named file, translating {@link IOException} to a * {@link RuntimeException} of some sort. * - * @param fileName non-null; name of the file to read - * @return non-null; contents of the file + * @param fileName {@code non-null;} name of the file to read + * @return {@code non-null;} contents of the file */ public static byte[] readFile(String fileName) { File file = new File(fileName); @@ -47,8 +47,8 @@ public final class FileUtils { * Reads the given file, translating {@link IOException} to a * {@link RuntimeException} of some sort. * - * @param file non-null; the file to read - * @return non-null; contents of the file + * @param file {@code non-null;} the file to read + * @return {@code non-null;} contents of the file */ public static byte[] readFile(File file) { if (!file.exists()) { diff --git a/dx/src/com/android/dx/util/FixedSizeList.java b/dx/src/com/android/dx/util/FixedSizeList.java index 7b7d32521..17d773c05 100644 --- a/dx/src/com/android/dx/util/FixedSizeList.java +++ b/dx/src/com/android/dx/util/FixedSizeList.java @@ -23,11 +23,11 @@ import java.util.Arrays; */ public class FixedSizeList extends MutabilityControl implements ToHuman { - /** non-null; array of elements */ + /** {@code non-null;} array of elements */ private Object[] arr; /** - * Constructs an instance. All indices initially contain <code>null</code>. + * Constructs an instance. All indices initially contain {@code null}. * * @param size the size of the list */ @@ -94,10 +94,10 @@ public class FixedSizeList /** * Gets a customized string form for this instance. * - * @param prefix null-ok; prefix for the start of the result - * @param separator null-ok; separator to insert between each item - * @param suffix null-ok; suffix for the end of the result - * @return non-null; the custom string + * @param prefix {@code null-ok;} prefix for the start of the result + * @param separator {@code null-ok;} separator to insert between each item + * @param suffix {@code null-ok;} suffix for the end of the result + * @return {@code non-null;} the custom string */ public String toString(String prefix, String separator, String suffix) { return toString0(prefix, separator, suffix, false); @@ -108,10 +108,10 @@ public class FixedSizeList * only work if every element of the list implements {@link * ToHuman}. * - * @param prefix null-ok; prefix for the start of the result - * @param separator null-ok; separator to insert between each item - * @param suffix null-ok; suffix for the end of the result - * @return non-null; the custom string + * @param prefix {@code null-ok;} prefix for the start of the result + * @param separator {@code null-ok;} separator to insert between each item + * @param suffix {@code null-ok;} suffix for the end of the result + * @return {@code non-null;} the custom string */ public String toHuman(String prefix, String separator, String suffix) { return toString0(prefix, separator, suffix, true); @@ -126,7 +126,7 @@ public class FixedSizeList /** * Shrinks this instance to fit, by removing any unset - * (<code>null</code>) elements, leaving the remaining elements in + * ({@code null}) elements, leaving the remaining elements in * their original order. */ public void shrinkToFit() { @@ -165,12 +165,12 @@ public class FixedSizeList /** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this - * will throw <code>NullPointerException</code>. This method is + * will throw {@code NullPointerException}. This method is * protected so that subclasses may offer a safe type-checked * public interface to their clients. * - * @param n >= 0, < size(); which element - * @return non-null; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code non-null;} the indicated element */ protected final Object get0(int n) { try { @@ -188,13 +188,13 @@ public class FixedSizeList } /** - * Gets the indicated element, allowing <code>null</code>s to be + * Gets the indicated element, allowing {@code null}s to be * returned. This method is protected so that subclasses may * (optionally) offer a safe type-checked public interface to * their clients. * - * @param n >= 0, < size(); which element - * @return null-ok; the indicated element + * @param n {@code >= 0, < size();} which element + * @return {@code null-ok;} the indicated element */ protected final Object getOrNull0(int n) { return arr[n]; @@ -206,8 +206,8 @@ public class FixedSizeList * subclasses may offer a safe type-checked public interface to * their clients. * - * @param n >= 0, < size(); which element - * @param obj null-ok; the value to store + * @param n {@code >= 0, < size();} which element + * @param obj {@code null-ok;} the value to store */ protected final void set0(int n, Object obj) { throwIfImmutable(); @@ -239,11 +239,11 @@ public class FixedSizeList * Helper for {@link #toString} and {@link #toHuman}, which both of * those call to pretty much do everything. * - * @param prefix null-ok; prefix for the start of the result - * @param separator null-ok; separator to insert between each item - * @param suffix null-ok; suffix for the end of the result + * @param prefix {@code null-ok;} prefix for the start of the result + * @param separator {@code null-ok;} separator to insert between each item + * @param suffix {@code null-ok;} suffix for the end of the result * @param human whether the output is to be human - * @return non-null; the custom string + * @return {@code non-null;} the custom string */ private String toString0(String prefix, String separator, String suffix, boolean human) { diff --git a/dx/src/com/android/dx/util/Hex.java b/dx/src/com/android/dx/util/Hex.java index cf4c130d2..cb71e5e20 100644 --- a/dx/src/com/android/dx/util/Hex.java +++ b/dx/src/com/android/dx/util/Hex.java @@ -28,10 +28,10 @@ public final class Hex { } /** - * Formats a <code>long</code> as an 8-byte unsigned hex value. + * Formats a {@code long} as an 8-byte unsigned hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u8(long v) { char[] result = new char[16]; @@ -44,10 +44,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 4-byte unsigned hex value. + * Formats an {@code int} as a 4-byte unsigned hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u4(int v) { char[] result = new char[8]; @@ -60,10 +60,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 3-byte unsigned hex value. + * Formats an {@code int} as a 3-byte unsigned hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u3(int v) { char[] result = new char[6]; @@ -76,10 +76,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 2-byte unsigned hex value. + * Formats an {@code int} as a 2-byte unsigned hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u2(int v) { char[] result = new char[4]; @@ -92,12 +92,12 @@ public final class Hex { } /** - * Formats an <code>int</code> as either a 2-byte unsigned hex value + * Formats an {@code int} as either a 2-byte unsigned hex value * (if the value is small enough) or a 4-byte unsigned hex value (if * not). * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u2or4(int v) { if (v == (char) v) { @@ -108,10 +108,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 1-byte unsigned hex value. + * Formats an {@code int} as a 1-byte unsigned hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String u1(int v) { char[] result = new char[2]; @@ -124,10 +124,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 4-bit unsigned hex nibble. + * Formats an {@code int} as a 4-bit unsigned hex nibble. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String uNibble(int v) { char[] result = new char[1]; @@ -137,10 +137,10 @@ public final class Hex { } /** - * Formats a <code>long</code> as an 8-byte signed hex value. + * Formats a {@code long} as an 8-byte signed hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String s8(long v) { char[] result = new char[17]; @@ -161,10 +161,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 4-byte signed hex value. + * Formats an {@code int} as a 4-byte signed hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String s4(int v) { char[] result = new char[9]; @@ -185,10 +185,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 2-byte signed hex value. + * Formats an {@code int} as a 2-byte signed hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String s2(int v) { char[] result = new char[5]; @@ -209,10 +209,10 @@ public final class Hex { } /** - * Formats an <code>int</code> as a 1-byte signed hex value. + * Formats an {@code int} as a 1-byte signed hex value. * * @param v value to format - * @return non-null; formatted form + * @return {@code non-null;} formatted form */ public static String s1(int v) { char[] result = new char[3]; @@ -233,18 +233,18 @@ public final class Hex { } /** - * Formats a hex dump of a portion of a <code>byte[]</code>. The result + * Formats a hex dump of a portion of a {@code byte[]}. The result * is always newline-terminated, unless the passed-in length was zero, - * in which case the result is always the empty string (<code>""</code>). + * in which case the result is always the empty string ({@code ""}). * - * @param arr non-null; array to format - * @param offset >= 0; offset to the part to dump - * @param length >= 0; number of bytes to dump - * @param outOffset >= 0; first output offset to print - * @param bpl >= 0; number of bytes of output per line - * @param addressLength {2,4,6,8}; number of characters for each address + * @param arr {@code non-null;} array to format + * @param offset {@code >= 0;} offset to the part to dump + * @param length {@code >= 0;} number of bytes to dump + * @param outOffset {@code >= 0;} first output offset to print + * @param bpl {@code >= 0;} number of bytes of output per line + * @param addressLength {@code {2,4,6,8};} number of characters for each address * header - * @return non-null; a string of the dump + * @return {@code non-null;} a string of the dump */ public static String dump(byte[] arr, int offset, int length, int outOffset, int bpl, int addressLength) { diff --git a/dx/src/com/android/dx/util/HexParser.java b/dx/src/com/android/dx/util/HexParser.java index 4b6b7b2f7..3d0c99235 100644 --- a/dx/src/com/android/dx/util/HexParser.java +++ b/dx/src/com/android/dx/util/HexParser.java @@ -28,7 +28,7 @@ public final class HexParser { } /** - * Parses the given text as hex, returning a <code>byte[]</code> + * Parses the given text as hex, returning a {@code byte[]} * corresponding to the text. The format is simple: Each line may * start with a hex offset followed by a colon (which is verified * and presumably used just as a comment), and then consists of @@ -38,8 +38,8 @@ public final class HexParser { * of the subsequent characters is used, until the next double * quote. Quoted strings may not span multiple lines. * - * @param src non-null; the source string - * @return non-null; the parsed form + * @param src {@code non-null;} the source string + * @return {@code non-null;} the parsed form */ public static byte[] parse(String src) { int len = src.length(); diff --git a/dx/src/com/android/dx/util/IndentingWriter.java b/dx/src/com/android/dx/util/IndentingWriter.java index db4e0a2ad..92f0b5566 100644 --- a/dx/src/com/android/dx/util/IndentingWriter.java +++ b/dx/src/com/android/dx/util/IndentingWriter.java @@ -27,31 +27,31 @@ import java.io.Writer; * line. */ public final class IndentingWriter extends FilterWriter { - /** null-ok; optional prefix for every line */ + /** {@code null-ok;} optional prefix for every line */ private final String prefix; - /** > 0; the maximum output width */ + /** {@code > 0;} the maximum output width */ private final int width; - /** > 0; the maximum indent */ + /** {@code > 0;} the maximum indent */ private final int maxIndent; - /** >= 0; current output column (zero-based) */ + /** {@code >= 0;} current output column (zero-based) */ private int column; /** whether indent spaces are currently being collected */ private boolean collectingIndent; - /** >= 0; current indent amount */ + /** {@code >= 0;} current indent amount */ private int indent; /** * Constructs an instance. * - * @param out non-null; writer to send final output to - * @param width >= 0; the maximum output width (not including - * <code>prefix</code>), or <code>0</code> for no maximum - * @param prefix non-null; the prefix for each line + * @param out {@code non-null;} writer to send final output to + * @param width {@code >= 0;} the maximum output width (not including + * {@code prefix}), or {@code 0} for no maximum + * @param prefix {@code non-null;} the prefix for each line */ public IndentingWriter(Writer out, int width, String prefix) { super(out); @@ -78,9 +78,9 @@ public final class IndentingWriter extends FilterWriter { /** * Constructs a no-prefix instance. * - * @param out non-null; writer to send final output to - * @param width >= 0; the maximum output width (not including - * <code>prefix</code>), or <code>0</code> for no maximum + * @param out {@code non-null;} writer to send final output to + * @param width {@code >= 0;} the maximum output width (not including + * {@code prefix}), or {@code 0} for no maximum */ public IndentingWriter(Writer out, int width) { this(out, width, ""); diff --git a/dx/src/com/android/dx/util/IntIterator.java b/dx/src/com/android/dx/util/IntIterator.java index 88181b52e..4caa43946 100644 --- a/dx/src/com/android/dx/util/IntIterator.java +++ b/dx/src/com/android/dx/util/IntIterator.java @@ -35,10 +35,4 @@ public interface IntIterator { * @throws java.util.NoSuchElementException if no next element exists */ int next(); - - /** - * Removes a value from the collection underlying this iterator. - * May throw UnsupportedOperationException(). - */ -// void remove(); } diff --git a/dx/src/com/android/dx/util/IntList.java b/dx/src/com/android/dx/util/IntList.java index f60bbb5e2..c51c0282c 100644 --- a/dx/src/com/android/dx/util/IntList.java +++ b/dx/src/com/android/dx/util/IntList.java @@ -19,16 +19,16 @@ package com.android.dx.util; import java.util.Arrays; /** - * Simple list of <code>int</code>s. + * Simple list of {@code int}s. */ public final class IntList extends MutabilityControl { - /** non-null; immutable, no-element instance */ + /** {@code non-null;} immutable, no-element instance */ public static final IntList EMPTY = new IntList(0); - /** non-null; array of elements */ + /** {@code non-null;} array of elements */ private int[] values; - /** >= 0; current size of the list */ + /** {@code >= 0;} current size of the list */ private int size; /** whether the values are currently sorted */ @@ -78,7 +78,7 @@ public final class IntList extends MutabilityControl { /** * Constructs an empty instance. * - * @param initialCapacity >= 0; initial capacity of the list + * @param initialCapacity {@code >= 0;} initial capacity of the list */ public IntList(int initialCapacity) { super(true); @@ -165,7 +165,7 @@ public final class IntList extends MutabilityControl { /** * Gets the indicated value. * - * @param n >= 0, < size(); which element + * @param n {@code >= 0, < size();} which element * @return the indicated element's value */ public int get(int n) { @@ -184,7 +184,7 @@ public final class IntList extends MutabilityControl { /** * Sets the value at the given index. * - * @param n >= 0, < size(); which element + * @param n {@code >= 0, < size();} which element * @param value value to store */ public void set(int n, int value) { @@ -229,7 +229,7 @@ public final class IntList extends MutabilityControl { * current size (that is, insertion as a last element is legal but * no further). * - * @param n >=0 <=size(); index of where to insert + * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { @@ -252,7 +252,7 @@ public final class IntList extends MutabilityControl { * Removes an element at a given index, shifting elements at greater * indicies down one. * - * @param n >=0 < size(); index of element to remove + * @param n {@code >=0, < size();} index of element to remove */ public void removeIndex(int n) { if (n >= size) { @@ -307,7 +307,7 @@ public final class IntList extends MutabilityControl { /** * Pops N elements off the end of the list and decreasing the size by N. * - * @param n >= 0; number of elements to remove from end. + * @param n {@code >= 0;} number of elements to remove from end. * @exception IndexOutOfBoundsException if stack is smaller than N */ public void pop(int n) { @@ -319,7 +319,7 @@ public final class IntList extends MutabilityControl { /** * Shrinks the size of the list. * - * @param newSize >= 0; the new size + * @param newSize {@code >= 0;} the new size */ public void shrink(int newSize) { if (newSize < 0) { @@ -338,7 +338,7 @@ public final class IntList extends MutabilityControl { /** * Makes and returns a mutable copy of the list. * - * @return non-null; an appropriately-constructed instance + * @return {@code non-null;} an appropriately-constructed instance */ public IntList mutableCopy() { int sz = size; @@ -380,12 +380,12 @@ public final class IntList extends MutabilityControl { /** * Performs a binary search on a sorted list, returning the index of * the given value if it is present or - * <code>(-(insertion point) - 1)</code> if the value is not present. + * {@code (-(insertion point) - 1)} if the value is not present. * If the list is not sorted, then reverts to linear search and returns - * <code>-size()</code> if the element is not found. + * {@code -size()} if the element is not found. * * @param value value to find - * @return index of value or <code>(-(insertion point) - 1)</code> if the + * @return index of value or {@code (-(insertion point) - 1)} if the * value is not present */ public int binarysearch(int value) { diff --git a/dx/src/com/android/dx/util/IntSet.java b/dx/src/com/android/dx/util/IntSet.java index 10b6ee047..33b6bdd48 100644 --- a/dx/src/com/android/dx/util/IntSet.java +++ b/dx/src/com/android/dx/util/IntSet.java @@ -44,24 +44,24 @@ public interface IntSet { boolean has(int value); /** - * Merges <code>other</code> into this set, so this set becomes the + * Merges {@code other} into this set, so this set becomes the * union of the two. * - * @param other non-null; other set to merge with. + * @param other {@code non-null;} other set to merge with. */ void merge(IntSet other); /** * Returns the count of unique elements in this set. * - * @return > = 0; count of unique elements + * @return {@code > = 0;} count of unique elements */ int elements(); /** * Iterates the set * - * @return non-null; a set iterator + * @return {@code non-null;} a set iterator */ IntIterator iterator(); } diff --git a/dx/src/com/android/dx/util/LabeledItem.java b/dx/src/com/android/dx/util/LabeledItem.java index cc6a0d252..b4856cfc9 100644 --- a/dx/src/com/android/dx/util/LabeledItem.java +++ b/dx/src/com/android/dx/util/LabeledItem.java @@ -24,7 +24,7 @@ public interface LabeledItem { /* * Gets the label of this block. * - * @return >= 0; the label + * @return {@code >= 0;} the label */ public int getLabel(); } diff --git a/dx/src/com/android/dx/util/LabeledList.java b/dx/src/com/android/dx/util/LabeledList.java index 3168a38d0..28a148bd1 100644 --- a/dx/src/com/android/dx/util/LabeledList.java +++ b/dx/src/com/android/dx/util/LabeledList.java @@ -58,7 +58,7 @@ public class LabeledList extends FixedSizeList { /** * Gets the maximum label (exclusive) of any block added to this instance. * - * @return >= 0; the maximum label + * @return {@code >= 0;} the maximum label */ public int getMaxLabel() { int sz = labelToIndex.size(); @@ -102,8 +102,8 @@ public class LabeledList extends FixedSizeList { * Gets the index of the first item in the list with the given * label, if any. * - * @param label >= 0; the label to look for - * @return >= -1; the index of the so-labelled item, or <code>-1</code> + * @param label {@code >= 0;} the label to look for + * @return {@code >= -1;} the index of the so-labelled item, or {@code -1} * if none is found */ public int indexOfLabel(int label) { @@ -142,8 +142,8 @@ public class LabeledList extends FixedSizeList { /** * Sets the element at the given index. * - * @param n >= 0, < size(); which element - * @param item null-ok; the value to store + * @param n {@code >= 0, < size();} which element + * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); diff --git a/dx/src/com/android/dx/util/Leb128Utils.java b/dx/src/com/android/dx/util/Leb128Utils.java index dfd416f6b..6ed3a6181 100644 --- a/dx/src/com/android/dx/util/Leb128Utils.java +++ b/dx/src/com/android/dx/util/Leb128Utils.java @@ -41,7 +41,6 @@ public final class Leb128Utils { int count = 0; while (remaining != 0) { - value = remaining; remaining >>= 7; count++; } diff --git a/dx/src/com/android/dx/util/ListIntSet.java b/dx/src/com/android/dx/util/ListIntSet.java index a9f79afea..6d28a18e4 100644 --- a/dx/src/com/android/dx/util/ListIntSet.java +++ b/dx/src/com/android/dx/util/ListIntSet.java @@ -122,11 +122,6 @@ public class ListIntSet implements IntSet { return ints.get(idx++); } - - /** @inheritDoc */ - public void remove() { - throw new UnsupportedOperationException(); - } }; } diff --git a/dx/src/com/android/dx/util/MutabilityControl.java b/dx/src/com/android/dx/util/MutabilityControl.java index 8b3383b73..14e0f2ed6 100644 --- a/dx/src/com/android/dx/util/MutabilityControl.java +++ b/dx/src/com/android/dx/util/MutabilityControl.java @@ -36,7 +36,7 @@ public class MutabilityControl { /** * Constructs an instance, explicitly indicating the mutability. * - * @param mutable <code>true</code> iff this instance is mutable + * @param mutable {@code true} iff this instance is mutable */ public MutabilityControl(boolean mutable) { this.mutable = mutable; @@ -51,9 +51,9 @@ public class MutabilityControl { /** * Checks to see whether or not this instance is immutable. This is the - * same as calling <code>!isMutable()</code>. + * same as calling {@code !isMutable()}. * - * @return <code>true</code> iff this instance is immutable + * @return {@code true} iff this instance is immutable */ public final boolean isImmutable() { return !mutable; @@ -62,7 +62,7 @@ public class MutabilityControl { /** * Checks to see whether or not this instance is mutable. * - * @return <code>true</code> iff this instance is mutable + * @return {@code true} iff this instance is mutable */ public final boolean isMutable() { return mutable; diff --git a/dx/src/com/android/dx/util/Output.java b/dx/src/com/android/dx/util/Output.java index b3c37472b..5e737ae53 100644 --- a/dx/src/com/android/dx/util/Output.java +++ b/dx/src/com/android/dx/util/Output.java @@ -18,7 +18,7 @@ package com.android.dx.util; /** * Interface for a sink for binary output. This is similar to - * <code>java.util.DataOutput</code>, but no <code>IOExceptions</code> + * {@code java.util.DataOutput}, but no {@code IOExceptions} * are declared, and multibyte output is defined to be little-endian. */ public interface Output { @@ -26,7 +26,7 @@ public interface Output { * Gets the current cursor position. This is the same as the number of * bytes written to this instance. * - * @return >= 0; the cursor position + * @return {@code >= 0;} the cursor position */ public int getCursor(); @@ -34,34 +34,34 @@ public interface Output { * Asserts that the cursor is the given value. * * @param expectedCursor the expected cursor value - * @throws RuntimeException thrown if <code>getCursor() != - * expectedCursor</code> + * @throws RuntimeException thrown if {@code getCursor() != + * expectedCursor} */ public void assertCursor(int expectedCursor); /** - * Writes a <code>byte</code> to this instance. + * Writes a {@code byte} to this instance. * * @param value the value to write; all but the low 8 bits are ignored */ public void writeByte(int value); /** - * Writes a <code>short</code> to this instance. + * Writes a {@code short} to this instance. * * @param value the value to write; all but the low 16 bits are ignored */ public void writeShort(int value); /** - * Writes an <code>int</code> to this instance. + * Writes an {@code int} to this instance. * * @param value the value to write */ public void writeInt(int value); /** - * Writes a <code>long</code> to this instance. + * Writes a {@code long} to this instance. * * @param value the value to write */ @@ -73,7 +73,7 @@ public interface Output { * 7.6. * * @param value value to write, treated as an unsigned value - * @return 1..5; the number of bytes actually written + * @return {@code 1..5;} the number of bytes actually written */ public int writeUnsignedLeb128(int value); @@ -83,47 +83,47 @@ public interface Output { * 7.6. * * @param value value to write - * @return 1..5; the number of bytes actually written + * @return {@code 1..5;} the number of bytes actually written */ public int writeSignedLeb128(int value); /** * Writes a {@link ByteArray} to this instance. * - * @param bytes non-null; the array to write + * @param bytes {@code non-null;} the array to write */ public void write(ByteArray bytes); /** - * Writes a portion of a <code>byte[]</code> to this instance. + * Writes a portion of a {@code byte[]} to this instance. * - * @param bytes non-null; the array to write - * @param offset >= 0; offset into <code>bytes</code> for the first + * @param bytes {@code non-null;} the array to write + * @param offset {@code >= 0;} offset into {@code bytes} for the first * byte to write - * @param length >= 0; number of bytes to write + * @param length {@code >= 0;} number of bytes to write */ public void write(byte[] bytes, int offset, int length); /** - * Writes a <code>byte[]</code> to this instance. This is just - * a convenient shorthand for <code>write(bytes, 0, bytes.length)</code>. + * Writes a {@code byte[]} to this instance. This is just + * a convenient shorthand for {@code write(bytes, 0, bytes.length)}. * - * @param bytes non-null; the array to write + * @param bytes {@code non-null;} the array to write */ public void write(byte[] bytes); /** - * Writes the given number of <code>0</code> bytes. + * Writes the given number of {@code 0} bytes. * - * @param count >= 0; the number of zeroes to write + * @param count {@code >= 0;} the number of zeroes to write */ public void writeZeroes(int count); /** - * Adds extra bytes if necessary (with value <code>0</code>) to + * Adds extra bytes if necessary (with value {@code 0}) to * force alignment of the output cursor as given. * - * @param alignment > 0; the alignment; must be a power of two + * @param alignment {@code > 0;} the alignment; must be a power of two */ public void alignTo(int alignment); } diff --git a/dx/src/com/android/dx/util/ToHuman.java b/dx/src/com/android/dx/util/ToHuman.java index 89bf4f735..b3a31a5c4 100644 --- a/dx/src/com/android/dx/util/ToHuman.java +++ b/dx/src/com/android/dx/util/ToHuman.java @@ -23,9 +23,9 @@ package com.android.dx.util; public interface ToHuman { /** * Return the "human" string form of this instance. This is - * generally less "debuggy" than <code>toString()</code>. + * generally less "debuggy" than {@code toString()}. * - * @return non-null; the human string form + * @return {@code non-null;} the human string form */ public String toHuman(); } diff --git a/dx/src/com/android/dx/util/TwoColumnOutput.java b/dx/src/com/android/dx/util/TwoColumnOutput.java index cc9f7d4c6..a155c152f 100644 --- a/dx/src/com/android/dx/util/TwoColumnOutput.java +++ b/dx/src/com/android/dx/util/TwoColumnOutput.java @@ -28,34 +28,34 @@ import java.io.Writer; * one which goes on the right. */ public final class TwoColumnOutput { - /** non-null; underlying writer for final output */ + /** {@code non-null;} underlying writer for final output */ private final Writer out; - /** > 0; the left column width */ + /** {@code > 0;} the left column width */ private final int leftWidth; - /** non-null; pending left column output */ + /** {@code non-null;} pending left column output */ private final StringBuffer leftBuf; - /** non-null; pending right column output */ + /** {@code non-null;} pending right column output */ private final StringBuffer rightBuf; - /** non-null; left column writer */ + /** {@code non-null;} left column writer */ private final IndentingWriter leftColumn; - /** non-null; right column writer */ + /** {@code non-null;} right column writer */ private final IndentingWriter rightColumn; /** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * - * @param s1 non-null; first string - * @param width1 > 0; width of the first column - * @param spacer non-null; spacer string - * @param s2 non-null; second string - * @param width2 > 0; width of the second column - * @return non-null; an appropriately-formatted string + * @param s1 {@code non-null;} first string + * @param width1 {@code > 0;} width of the first column + * @param spacer {@code non-null;} spacer string + * @param s2 {@code non-null;} second string + * @param width2 {@code > 0;} width of the second column + * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { @@ -80,10 +80,10 @@ public final class TwoColumnOutput { /** * Constructs an instance. * - * @param out non-null; writer to send final output to - * @param leftWidth > 0; width of the left column, in characters - * @param rightWidth > 0; width of the right column, in characters - * @param spacer non-null; spacer string to sit between the two columns + * @param out {@code non-null;} writer to send final output to + * @param leftWidth {@code > 0;} width of the left column, in characters + * @param rightWidth {@code > 0;} width of the right column, in characters + * @param spacer {@code non-null;} spacer string to sit between the two columns */ public TwoColumnOutput(Writer out, int leftWidth, int rightWidth, String spacer) { @@ -118,10 +118,10 @@ public final class TwoColumnOutput { /** * Constructs an instance. * - * @param out non-null; stream to send final output to - * @param leftWidth >= 1; width of the left column, in characters - * @param rightWidth >= 1; width of the right column, in characters - * @param spacer non-null; spacer string to sit between the two columns + * @param out {@code non-null;} stream to send final output to + * @param leftWidth {@code >= 1;} width of the left column, in characters + * @param rightWidth {@code >= 1;} width of the right column, in characters + * @param spacer {@code non-null;} spacer string to sit between the two columns */ public TwoColumnOutput(OutputStream out, int leftWidth, int rightWidth, String spacer) { @@ -131,7 +131,7 @@ public final class TwoColumnOutput { /** * Gets the writer to use to write to the left column. * - * @return non-null; the left column writer + * @return {@code non-null;} the left column writer */ public Writer getLeft() { return leftColumn; @@ -140,7 +140,7 @@ public final class TwoColumnOutput { /** * Gets the writer to use to write to the right column. * - * @return non-null; the right column writer + * @return {@code non-null;} the right column writer */ public Writer getRight() { return rightColumn; @@ -226,8 +226,8 @@ public final class TwoColumnOutput { * Appends a newline to the given buffer via the given writer, but * only if it isn't empty and doesn't already end with one. * - * @param buf non-null; the buffer in question - * @param out non-null; the writer to use + * @param buf {@code non-null;} the buffer in question + * @param out {@code non-null;} the writer to use */ private static void appendNewlineIfNecessary(StringBuffer buf, Writer out) @@ -242,8 +242,8 @@ public final class TwoColumnOutput { /** * Writes the given number of spaces to the given writer. * - * @param out non-null; where to write - * @param amt >= 0; the number of spaces to write + * @param out {@code non-null;} where to write + * @param amt {@code >= 0;} the number of spaces to write */ private static void writeSpaces(Writer out, int amt) throws IOException { while (amt > 0) { diff --git a/dx/src/com/android/dx/util/Writers.java b/dx/src/com/android/dx/util/Writers.java index f10e400af..632b0821e 100644 --- a/dx/src/com/android/dx/util/Writers.java +++ b/dx/src/com/android/dx/util/Writers.java @@ -20,7 +20,7 @@ import java.io.PrintWriter; import java.io.Writer; /** - * Utilities for dealing with <code>Writer</code>s. + * Utilities for dealing with {@code Writer}s. */ public final class Writers { /** @@ -31,12 +31,12 @@ public final class Writers { } /** - * Makes a <code>PrintWriter</code> for the given <code>Writer</code>, + * Makes a {@code PrintWriter} for the given {@code Writer}, * returning the given writer if it already happens to be the right * class. * - * @param writer non-null; writer to (possibly) wrap - * @return non-null; an appropriate instance + * @param writer {@code non-null;} writer to (possibly) wrap + * @return {@code non-null;} an appropriate instance */ public static PrintWriter printWriterFor(Writer writer) { if (writer instanceof PrintWriter) { diff --git a/dx/src/com/android/dx/util/_tests/_Bits.java b/dx/src/com/android/dx/util/_tests/_Bits.java index e529b505f..a95fc14d7 100644 --- a/dx/src/com/android/dx/util/_tests/_Bits.java +++ b/dx/src/com/android/dx/util/_tests/_Bits.java @@ -21,7 +21,7 @@ import com.android.dx.util.Bits; import junit.framework.TestCase; /** - * Test the class <code>com.android.dx.util.Bits</code>. + * Test the class {@code com.android.dx.util.Bits}. */ public class _Bits extends TestCase { diff --git a/dx/src/com/android/dx/util/_tests/_IntList.java b/dx/src/com/android/dx/util/_tests/_IntList.java index 241e8be78..dadbd54fb 100644 --- a/dx/src/com/android/dx/util/_tests/_IntList.java +++ b/dx/src/com/android/dx/util/_tests/_IntList.java @@ -21,7 +21,7 @@ import com.android.dx.util.IntList; import junit.framework.TestCase; /** - * Test the class <code>com.android.dx.util.IntList</code>. + * Test the class {@code com.android.dx.util.IntList}. */ public class _IntList extends TestCase { |
