Clean up some TODOs

This commit is contained in:
Ben Gruver
2013-04-30 21:28:18 -07:00
parent d8d16fd844
commit 936cc551f7
12 changed files with 50 additions and 28 deletions

View File

@ -320,7 +320,6 @@ public class AnalyzedInstruction implements Comparable<AnalyzedInstruction> {
}
public int compareTo(AnalyzedInstruction analyzedInstruction) {
//TODO: out of curiosity, check the disassembly of this to see if it retrieves the value of analyzedInstruction.instructionIndex for every access. It should, because the field is final. What about if we set the field to non-final?
if (instructionIndex < analyzedInstruction.instructionIndex) {
return -1;
} else if (instructionIndex == analyzedInstruction.instructionIndex) {

View File

@ -307,9 +307,6 @@ public class RegisterType {
return RegisterType.getRegisterType(mergedCategory, mergedType);
}
// TODO: consider making TypeProto extend/implement RegisterType?
// TODO: add a getReferenceRegisterType convenience method
@Nonnull
public static RegisterType getRegisterType(byte category, @Nullable TypeProto typeProto) {
switch (category) {

View File

@ -77,7 +77,6 @@ public class BaseDexBuffer {
}
public long readLong(int offset) {
// TODO: use | or +?
byte[] buf = this.buf;
return (buf[offset] & 0xff) |
((buf[offset+1] & 0xff) << 8) |

View File

@ -164,9 +164,6 @@ public class DexBackedClassDef extends BaseTypeReference implements ClassDef {
public Iterator<DexBackedField> iterator() {
return new VariableSizeLookaheadIterator<DexBackedField>(dexFile, fieldsStartOffset) {
private int count;
// TODO: consider implementing and using two MutableFieldReference classes.
// this would prevent creating a lot of throw-away ImmutableFieldReference objects while
// iterating
@Nullable private FieldReference previousField;
private int previousIndex;
@ -225,9 +222,6 @@ public class DexBackedClassDef extends BaseTypeReference implements ClassDef {
public Iterator<DexBackedField> iterator() {
return new VariableSizeLookaheadIterator<DexBackedField>(dexFile, fieldsStartOffset) {
private int count;
// TODO: consider implementing and using two MutableFieldReference classes.
// this would prevent creating a lot of throw-away ImmutableFieldReference objects while
// iterating
@Nullable private FieldReference previousField;
private int previousIndex;
@ -296,9 +290,6 @@ public class DexBackedClassDef extends BaseTypeReference implements ClassDef {
public Iterator<DexBackedMethod> iterator() {
return new VariableSizeLookaheadIterator<DexBackedMethod>(dexFile, methodsStartOffset) {
private int count;
// TODO: consider implementing and using two MutableMethodReference classes.
// this would prevent creating a lot of throw-away ImmutableMethodReference objects while
// iterating
@Nullable private MethodReference previousMethod;
private int previousIndex;
@ -355,9 +346,6 @@ public class DexBackedClassDef extends BaseTypeReference implements ClassDef {
public Iterator<DexBackedMethod> iterator() {
return new VariableSizeLookaheadIterator<DexBackedMethod>(dexFile, methodsStartOffset) {
private int count;
// TODO: consider implementing and using two MutableMethodReference classes.
// this would prevent creating a lot of throw-away ImmutableMethodReference objects while
// iterating
@Nullable private MethodReference previousMethod;
private int previousIndex;

View File

@ -87,7 +87,6 @@ public class DexBackedMethodImplementation implements MethodImplementation {
@Nonnull
@Override
public List<? extends DexBackedTryBlock> getTryBlocks() {
// TODO: provide utility to put try blocks into a "canonical", easy to use format, which more closely matches java's try blocks
final int triesSize = dexFile.readUshort(codeOffset + CodeItem.TRIES_SIZE_OFFSET);
if (triesSize > 0) {
int instructionsSize = dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET);

View File

@ -145,7 +145,6 @@ public abstract class DexBackedInstruction implements Instruction {
return new DexBackedSparseSwitchPayload(dexFile, instructionStartOffset);
case ArrayPayload:
return new DexBackedArrayPayload(dexFile, instructionStartOffset);
//TODO: temporary, until we get all instructions implemented
default:
throw new ExceptionWithContext("Unexpected opcode format: %s", opcode.format.toString());
}

View File

@ -88,8 +88,6 @@ public interface Annotation extends Comparable<Annotation> {
* This Annotation is equal to another Annotation if all of it's "fields" are equal. That is, if the return values
* of getVisibility(), getType(), and getElements() are all equal.
*
* TODO: when an Annotation is used in a set, need to specify that the uniqueness in the set is based on annotation type
*
* @param o The object to be compared for equality with this Annotation
* @return true if the specified object is equal to this Annotation
*/

View File

@ -128,7 +128,6 @@ public abstract class ImmutableInstruction implements Instruction {
return ImmutableSparseSwitchPayload.of((SparseSwitchPayload) instruction);
case ArrayPayload:
return ImmutableArrayPayload.of((ArrayPayload) instruction);
//TODO: temporary, until we get all instructions implemented
default:
throw new RuntimeException("Unexpected instruction type");
}

View File

@ -40,7 +40,6 @@ import java.io.Writer;
public final class ReferenceUtil {
public static String getShortMethodDescriptor(MethodReference methodReference) {
// TODO: try using a thread local StringBuilder
StringBuilder sb = new StringBuilder();
sb.append(methodReference.getName());
sb.append('(');
@ -53,7 +52,6 @@ public final class ReferenceUtil {
}
public static String getMethodDescriptor(MethodReference methodReference) {
// TODO: try using a thread local StringBuilder
StringBuilder sb = new StringBuilder();
sb.append(methodReference.getDefiningClass());
sb.append("->");
@ -80,7 +78,6 @@ public final class ReferenceUtil {
}
public static String getFieldDescriptor(FieldReference fieldReference) {
// TODO: try using a thread local StringBuilder
StringBuilder sb = new StringBuilder();
sb.append(fieldReference.getDefiningClass());
sb.append("->");
@ -91,7 +88,6 @@ public final class ReferenceUtil {
}
public static String getShortFieldDescriptor(FieldReference fieldReference) {
// TODO: try using a thread local StringBuilder
StringBuilder sb = new StringBuilder();
sb.append(fieldReference.getName());
sb.append(':');