From d64eb52d1a0f0758aa790c03e31a99772e0feff5 Mon Sep 17 00:00:00 2001 From: mikaelpeltier Date: Tue, 22 Apr 2014 11:19:16 +0200 Subject: Update Dx project config to be the same than Jack - Fix all warnings or errors related to the new config. Change-Id: I18e70bfec36c49f02add069edbf442a70e9050cf --- dx/.settings/org.eclipse.jdt.core.prefs | 88 ++++++++++++++++++++++ .../com/android/jack/dx/dex/TableOfContents.java | 3 +- dx/src/com/android/jack/dx/dex/code/DalvInsn.java | 2 +- dx/src/com/android/jack/dx/dex/code/LocalList.java | 17 ++++- .../com/android/jack/dx/dex/file/CatchStructs.java | 17 ++--- .../android/jack/dx/dex/file/ClassDataItem.java | 2 +- .../android/jack/dx/dex/file/DebugInfoDecoder.java | 10 +-- .../android/jack/dx/dex/file/DebugInfoEncoder.java | 40 ++++------ .../com/android/jack/dx/dex/file/EncodedField.java | 2 +- .../android/jack/dx/dex/file/EncodedMethod.java | 7 +- .../android/jack/dx/dex/file/MemberIdsSection.java | 10 ++- .../android/jack/dx/dex/file/OffsettedItem.java | 12 +++ dx/src/com/android/jack/dx/io/DexBuffer.java | 7 +- dx/src/com/android/jack/dx/io/DexIndexPrinter.java | 2 +- .../jack/dx/io/instructions/AddressMap.java | 6 +- .../jack/dx/io/instructions/InstructionCodec.java | 12 +-- dx/src/com/android/jack/dx/merge/DexMerger.java | 26 ++++--- dx/src/com/android/jack/dx/merge/IndexMap.java | 28 +++---- dx/src/com/android/jack/dx/merge/TypeList.java | 2 +- .../jack/dx/rop/code/LocalVariableInfo.java | 5 +- dx/src/com/android/jack/dx/ssa/ConstCollector.java | 15 ++-- .../com/android/jack/dx/ssa/LocalVariableInfo.java | 5 +- dx/src/com/android/jack/dx/ssa/SsaBasicBlock.java | 2 +- dx/src/com/android/jack/dx/ssa/SsaMethod.java | 5 +- .../ssa/back/FirstFitLocalCombiningAllocator.java | 13 ++-- dx/src/com/android/jack/dx/ssa/back/SsaToRop.java | 10 ++- dx/src/com/android/jack/dx/util/ByteArray.java | 3 +- 27 files changed, 231 insertions(+), 120 deletions(-) (limited to 'dx') diff --git a/dx/.settings/org.eclipse.jdt.core.prefs b/dx/.settings/org.eclipse.jdt.core.prefs index 942db7e..159ed4a 100644 --- a/dx/.settings/org.eclipse.jdt.core.prefs +++ b/dx/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,10 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.CheckForNull +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -6,8 +12,90 @@ org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=1585 diff --git a/dx/src/com/android/jack/dx/dex/TableOfContents.java b/dx/src/com/android/jack/dx/dex/TableOfContents.java index 408dd29..0585c3d 100644 --- a/dx/src/com/android/jack/dx/dex/TableOfContents.java +++ b/dx/src/com/android/jack/dx/dex/TableOfContents.java @@ -250,7 +250,8 @@ public final class TableOfContents { @Override public String toString() { - return String.format("Section[type=%#x,off=%#x,size=%#x]", type, off, size); + return String.format("Section[type=%#x,off=%#x,size=%#x]", Short.valueOf(type), + Integer.valueOf(off), Integer.valueOf(size)); } } } diff --git a/dx/src/com/android/jack/dx/dex/code/DalvInsn.java b/dx/src/com/android/jack/dx/dex/code/DalvInsn.java index 4667d2f..9dcddd4 100644 --- a/dx/src/com/android/jack/dx/dex/code/DalvInsn.java +++ b/dx/src/com/android/jack/dx/dex/code/DalvInsn.java @@ -320,7 +320,7 @@ public abstract class DalvInsn { */ public final String identifierString() { if (address != -1) { - return String.format("%04x", address); + return String.format("%04x", Integer.valueOf(address)); } return Hex.u4(System.identityHashCode(this)); diff --git a/dx/src/com/android/jack/dx/dex/code/LocalList.java b/dx/src/com/android/jack/dx/dex/code/LocalList.java index 8f1c713..1c4c1f0 100644 --- a/dx/src/com/android/jack/dx/dex/code/LocalList.java +++ b/dx/src/com/android/jack/dx/dex/code/LocalList.java @@ -178,6 +178,14 @@ public final class LocalList extends FixedSizeList { return (compareTo((Entry) other) == 0); } + @Override + public int hashCode() { + int hashcode = address; + hashcode *= isStart() ? 1231 : 1237; + hashcode ^= spec.hashCode(); + return hashcode; + } + /** * Compares by (in priority order) address, end then start * disposition (variants of end are all consistered @@ -525,7 +533,7 @@ MakeState state = new MakeState(sz); */ public void snapshot(int address, RegisterSpecSet specs) { if (DEBUG) { - System.err.printf("%04x snapshot %s\n", address, specs); + System.err.printf("%04x snapshot %s\n", Integer.valueOf(address), specs); } int sz = specs.getMaxSize(); @@ -548,7 +556,7 @@ MakeState state = new MakeState(sz); } if (DEBUG) { - System.err.printf("%04x snapshot done\n", address); + System.err.printf("%04x snapshot done\n", Integer.valueOf(address)); } } @@ -561,7 +569,7 @@ MakeState state = new MakeState(sz); */ public void startLocal(int address, RegisterSpec startedLocal) { if (DEBUG) { - System.err.printf("%04x start %s\n", address, startedLocal); + System.err.printf("%04x start %s\n", Integer.valueOf(address), startedLocal); } int regNum = startedLocal.getReg(); @@ -691,7 +699,7 @@ add(address, Disposition.START, startedLocal); */ public void endLocal(int address, RegisterSpec endedLocal, Disposition disposition) { if (DEBUG) { - System.err.printf("%04x end %s\n", address, endedLocal); + System.err.printf("%04x end %s\n", Integer.valueOf(address), endedLocal); } int regNum = endedLocal.getReg(); @@ -785,6 +793,7 @@ regs.remove(endedLocal); // We found an end for the same register. endIndices[regNum] = at; + assert entry != null; if (entry.getAddress() == address) { /* * It's still the same address, so update the diff --git a/dx/src/com/android/jack/dx/dex/file/CatchStructs.java b/dx/src/com/android/jack/dx/dex/file/CatchStructs.java index 3426fac..79bf4b4 100644 --- a/dx/src/com/android/jack/dx/dex/file/CatchStructs.java +++ b/dx/src/com/android/jack/dx/dex/file/CatchStructs.java @@ -146,7 +146,7 @@ public final class CatchStructs { boolean catchesAll = list.catchesAll(); // Set the offset before we do any writing. - mapping.setValue(out.getCursor()); + mapping.setValue(Integer.valueOf(out.getCursor())); if (catchesAll) { // A size <= 0 means that the list ends with a catch-all. @@ -206,7 +206,7 @@ public final class CatchStructs { out.writeInt(start); out.writeShort(insnCount); - out.writeShort(handlerOffsets.get(one.getHandlers())); + out.writeShort(handlerOffsets.get(one.getHandlers()).intValue()); } out.write(encodedHandlers); @@ -224,13 +224,12 @@ public final class CatchStructs { private void annotateEntries(String prefix, PrintWriter printTo, AnnotatedOutput annotateTo) { finishProcessingIfNecessary(); - boolean consume = (annotateTo != null); - int amt1 = consume ? 6 : 0; - int amt2 = consume ? 2 : 0; + int amt1 = annotateTo != null ? 6 : 0; + int amt2 = annotateTo != null ? 2 : 0; int size = table.size(); String subPrefix = prefix + " "; - if (consume) { + if (annotateTo != null) { annotateTo.annotate(0, prefix + "tries:"); } else { printTo.println(prefix + "tries:"); @@ -243,7 +242,7 @@ public final class CatchStructs { subPrefix + "try " + Hex.u2or4(entry.getStart()) + ".." + Hex.u2or4(entry.getEnd()); String s2 = handlers.toHuman(subPrefix, ""); - if (consume) { + if (annotateTo != null) { annotateTo.annotate(amt1, s1); annotateTo.annotate(amt2, s2); } else { @@ -252,7 +251,7 @@ public final class CatchStructs { } } - if (!consume) { + if (annotateTo == null) { // Only emit the handler lists if we are consuming bytes. return; } @@ -266,7 +265,7 @@ public final class CatchStructs { for (Map.Entry mapping : handlerOffsets.entrySet()) { CatchHandlerList list = mapping.getKey(); - int offset = mapping.getValue(); + int offset = mapping.getValue().intValue(); if (lastList != null) { annotateAndConsumeHandlers(lastList, diff --git a/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java b/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java index 7e9ccce..a1b2872 100644 --- a/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java +++ b/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java @@ -369,7 +369,7 @@ int size = staticFields.size(); */ private static void encodeSize(DexFile file, AnnotatedOutput out, String label, int size) { if (out.annotates()) { - out.annotate(String.format(" %-21s %08x", label + "_size:", size)); + out.annotate(String.format(" %-21s %08x", label + "_size:", Integer.valueOf(size))); } out.writeUleb128(size); diff --git a/dx/src/com/android/jack/dx/dex/file/DebugInfoDecoder.java b/dx/src/com/android/jack/dx/dex/file/DebugInfoDecoder.java index acd7939..3672450 100644 --- a/dx/src/com/android/jack/dx/dex/file/DebugInfoDecoder.java +++ b/dx/src/com/android/jack/dx/dex/file/DebugInfoDecoder.java @@ -187,12 +187,12 @@ public class DebugInfoDecoder { @Override public String toString() { return String.format("[%x %s v%d %04x %04x %04x]", - address, + Integer.valueOf(address), isStart ? "start" : "end", - reg, - nameIndex, - typeIndex, - signatureIndex); + Integer.valueOf(reg), + Integer.valueOf(nameIndex), + Integer.valueOf(typeIndex), + Integer.valueOf(signatureIndex)); } } diff --git a/dx/src/com/android/jack/dx/dex/file/DebugInfoEncoder.java b/dx/src/com/android/jack/dx/dex/file/DebugInfoEncoder.java index 725200d..cb41406 100644 --- a/dx/src/com/android/jack/dx/dex/file/DebugInfoEncoder.java +++ b/dx/src/com/android/jack/dx/dex/file/DebugInfoEncoder.java @@ -169,7 +169,7 @@ public final class DebugInfoEncoder { if (DEBUG) { for (int i = 0; i < ret.length; i++) { - System.err.printf("byte %02x\n", (0xff & ret[i])); + System.err.printf("byte %02x\n", Integer.valueOf((0xff & ret[i]))); } } @@ -213,7 +213,7 @@ public final class DebugInfoEncoder { output.writeByte(DBG_SET_PROLOGUE_END); if (annotateTo != null || debugPrint != null) { - annotate(1, String.format("%04x: prologue end", address)); + annotate(1, String.format("%04x: prologue end", Integer.valueOf(address))); } int positionsSz = sortedPositions.size(); @@ -411,7 +411,8 @@ int nextAddrL = Integer.MAX_VALUE; // local variable output.writeUleb128(szParamTypes); if (annotate) { - annotate(output.getCursor() - mark, String.format("parameters_size: %04x", szParamTypes)); + annotate(output.getCursor() - mark, + String.format("parameters_size: %04x", Integer.valueOf(szParamTypes))); } /* @@ -499,11 +500,6 @@ for (LocalList.Entry arg : lastEntryForReg) { public int compare(PositionList.Entry a, PositionList.Entry b) { return a.getAddress() - b.getAddress(); } - - @Override - public boolean equals(Object obj) { - return obj == this; - } }); return result; } @@ -557,11 +553,6 @@ for (LocalList.Entry arg : lastEntryForReg) { public int compare(LocalList.Entry a, LocalList.Entry b) { return a.getRegister() - b.getRegister(); } - - @Override - public boolean equals(Object obj) { - return obj == this; - } }); return result; @@ -621,8 +612,8 @@ for (LocalList.Entry arg : lastEntryForReg) { emitUnsignedLeb128(entry.getRegister()); if (annotateTo != null || debugPrint != null) { - annotate(output.getCursor() - mark, - String.format("%04x: +local restart %s", address, entryAnnotationString(entry))); + annotate(output.getCursor() - mark, String.format("%04x: +local restart %s", + Integer.valueOf(address), entryAnnotationString(entry))); } if (DEBUG) { @@ -695,7 +686,7 @@ for (LocalList.Entry arg : lastEntryForReg) { if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, - String.format("%04x: +local %s", address, entryAnnotationString(entry))); + String.format("%04x: +local %s", Integer.valueOf(address), entryAnnotationString(entry))); } if (DEBUG) { @@ -722,8 +713,8 @@ for (LocalList.Entry arg : lastEntryForReg) { emitStringIndex(entry.getSignature()); if (annotateTo != null || debugPrint != null) { - annotate(output.getCursor() - mark, - String.format("%04x: +localx %s", address, entryAnnotationString(entry))); + annotate(output.getCursor() - mark, String.format("%04x: +localx %s", + Integer.valueOf(address), entryAnnotationString(entry))); } if (DEBUG) { @@ -746,7 +737,7 @@ for (LocalList.Entry arg : lastEntryForReg) { if (annotateTo != null || debugPrint != null) { annotate(output.getCursor() - mark, - String.format("%04x: -local %s", address, entryAnnotationString(entry))); + String.format("%04x: -local %s", Integer.valueOf(address), entryAnnotationString(entry))); } if (DEBUG) { @@ -802,7 +793,7 @@ for (LocalList.Entry arg : lastEntryForReg) { address += deltaAddress; if (annotateTo != null || debugPrint != null) { - annotate(1, String.format("%04x: line %d", address, line)); + annotate(1, String.format("%04x: line %d", Integer.valueOf(address), Integer.valueOf(line))); } } @@ -842,11 +833,11 @@ for (LocalList.Entry arg : lastEntryForReg) { line += deltaLines; if (annotateTo != null || debugPrint != null) { - annotate(output.getCursor() - mark, String.format("line = %d", line)); + annotate(output.getCursor() - mark, String.format("line = %d", Integer.valueOf(line))); } if (DEBUG) { - System.err.printf("Emitting advance_line for %d\n", deltaLines); + System.err.printf("Emitting advance_line for %d\n", Integer.valueOf(deltaLines)); } } @@ -865,11 +856,12 @@ for (LocalList.Entry arg : lastEntryForReg) { address += deltaAddress; if (annotateTo != null || debugPrint != null) { - annotate(output.getCursor() - mark, String.format("%04x: advance pc", address)); + annotate(output.getCursor() - mark, + String.format("%04x: advance pc", Integer.valueOf(address))); } if (DEBUG) { - System.err.printf("Emitting advance_pc for %d\n", deltaAddress); + System.err.printf("Emitting advance_pc for %d\n", Integer.valueOf(deltaAddress)); } } diff --git a/dx/src/com/android/jack/dx/dex/file/EncodedField.java b/dx/src/com/android/jack/dx/dex/file/EncodedField.java index cc3d068..46faa65 100644 --- a/dx/src/com/android/jack/dx/dex/file/EncodedField.java +++ b/dx/src/com/android/jack/dx/dex/file/EncodedField.java @@ -139,7 +139,7 @@ this.field = field; int accessFlags = getAccessFlags(); if (out.annotates()) { - out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); + out.annotate(0, String.format(" [%x] %s", Integer.valueOf(dumpSeq), field.toHuman())); out.annotate(Leb128Utils.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128Utils.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); diff --git a/dx/src/com/android/jack/dx/dex/file/EncodedMethod.java b/dx/src/com/android/jack/dx/dex/file/EncodedMethod.java index c75fa04..c7a65e4 100644 --- a/dx/src/com/android/jack/dx/dex/file/EncodedMethod.java +++ b/dx/src/com/android/jack/dx/dex/file/EncodedMethod.java @@ -70,6 +70,11 @@ public final class EncodedMethod extends EncodedMember implements Comparable entry : membersByPackage.entrySet()) { - formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); + formatter.format("%n%6d %s", Integer.valueOf(entry.getValue().get()), entry.getKey()); } return formatter.toString(); } finally { - formatter.close(); + if (formatter != null) { + formatter.close(); + } } } } diff --git a/dx/src/com/android/jack/dx/dex/file/OffsettedItem.java b/dx/src/com/android/jack/dx/dex/file/OffsettedItem.java index 6c294aa..020c3ab 100644 --- a/dx/src/com/android/jack/dx/dex/file/OffsettedItem.java +++ b/dx/src/com/android/jack/dx/dex/file/OffsettedItem.java @@ -104,6 +104,18 @@ public abstract class OffsettedItem extends Item implements Comparable> 28; // sign-extend @@ -87,7 +87,7 @@ public enum InstructionCodec { FORMAT_11X() { @Override - public DecodedInstruction decode(int opcodeUnit, CodeInput in) throws EOFException { + public DecodedInstruction decode(int opcodeUnit, CodeInput in) { int opcode = byte0(opcodeUnit); int a = byte1(opcodeUnit); return new OneRegisterDecodedInstruction(this, opcode, 0, null, 0, 0L, a); @@ -101,7 +101,7 @@ public enum InstructionCodec { FORMAT_10T() { @Override - public DecodedInstruction decode(int opcodeUnit, CodeInput in) throws EOFException { + public DecodedInstruction decode(int opcodeUnit, CodeInput in) { int baseAddress = in.cursor() - 1; int opcode = byte0(opcodeUnit); int target = (byte) byte1(opcodeUnit); // sign-extend diff --git a/dx/src/com/android/jack/dx/merge/DexMerger.java b/dx/src/com/android/jack/dx/merge/DexMerger.java index 1663983..ebf8f87 100644 --- a/dx/src/com/android/jack/dx/merge/DexMerger.java +++ b/dx/src/com/android/jack/dx/merge/DexMerger.java @@ -197,19 +197,21 @@ public final class DexMerger { new DexMerger(dexOut, new DexBuffer(), CollisionPolicy.FAIL, compactedSizes); result = compacter.mergeDexBuffers(); System.out.printf("Result compacted from %.1fKiB to %.1fKiB to save %.1fKiB%n", - dexOut.getLength() / 1024f, result.getLength() / 1024f, wastedByteCount / 1024f); + Float.valueOf(dexOut.getLength() / 1024f), + Float.valueOf(result.getLength() / 1024f), + Float.valueOf(wastedByteCount / 1024f)); } long elapsed = System.nanoTime() - start; System.out.printf("Merged dex A (%d defs/%.1fKiB) with dex B " + "(%d defs/%.1fKiB). Result is %d defs/%.1fKiB. Took %.1fs%n", - dexA.getTableOfContents().classDefs.size, - dexA.getLength() / 1024f, - dexB.getTableOfContents().classDefs.size, - dexB.getLength() / 1024f, - result.getTableOfContents().classDefs.size, - result.getLength() / 1024f, - elapsed / 1000000000f); + Integer.valueOf(dexA.getTableOfContents().classDefs.size), + Float.valueOf(dexA.getLength() / 1024f), + Integer.valueOf(dexB.getTableOfContents().classDefs.size), + Float.valueOf(dexB.getLength() / 1024f), + Integer.valueOf(result.getTableOfContents().classDefs.size), + Float.valueOf(result.getLength() / 1024f), + Float.valueOf(elapsed / 1000000000f)); return result; } @@ -245,11 +247,11 @@ public final class DexMerger { T b = null; while (true) { - if (a == null && aIndex < aSection.size) { + if (a == null && aIndex < aSection.size && inA != null) { aOffset = inA.getPosition(); a = read(inA, aIndexMap, aIndex); } - if (b == null && bIndex < bSection.size) { + if (b == null && bIndex < bSection.size && inB != null) { bOffset = inB.getPosition(); b = read(inB, bIndexMap, bIndex); } @@ -410,7 +412,7 @@ public final class DexMerger { @Override Integer read(DexBuffer.Section in, IndexMap indexMap, int index) { int stringIndex = in.readInt(); - return indexMap.adjustString(stringIndex); + return Integer.valueOf(indexMap.adjustString(stringIndex)); } @Override @@ -421,7 +423,7 @@ public final class DexMerger { @Override void write(Integer value) { - idsDefsOut.writeInt(value); + idsDefsOut.writeInt(value.intValue()); } }.mergeSorted(); } diff --git a/dx/src/com/android/jack/dx/merge/IndexMap.java b/dx/src/com/android/jack/dx/merge/IndexMap.java index 59904f3..d891d25 100644 --- a/dx/src/com/android/jack/dx/merge/IndexMap.java +++ b/dx/src/com/android/jack/dx/merge/IndexMap.java @@ -68,45 +68,45 @@ public final class IndexMap { * A type list, annotation set, annotation directory, or static value at * offset 0 is always empty. Always map offset 0 to 0. */ - this.typeListOffsets.put(0, 0); - this.annotationSetOffsets.put(0, 0); - this.annotationDirectoryOffsets.put(0, 0); - this.staticValuesOffsets.put(0, 0); + this.typeListOffsets.put(Integer.valueOf(0), Integer.valueOf(0)); + this.annotationSetOffsets.put(Integer.valueOf(0), Integer.valueOf(0)); + this.annotationDirectoryOffsets.put(Integer.valueOf(0), Integer.valueOf(0)); + this.staticValuesOffsets.put(Integer.valueOf(0), Integer.valueOf(0)); } public void putTypeListOffset(int oldOffset, int newOffset) { if (oldOffset <= 0 || newOffset <= 0) { throw new IllegalArgumentException(); } - typeListOffsets.put(oldOffset, newOffset); + typeListOffsets.put(Integer.valueOf(oldOffset), Integer.valueOf(newOffset)); } public void putAnnotationOffset(int oldOffset, int newOffset) { if (oldOffset <= 0 || newOffset <= 0) { throw new IllegalArgumentException(); } - annotationOffsets.put(oldOffset, newOffset); + annotationOffsets.put(Integer.valueOf(oldOffset), Integer.valueOf(newOffset)); } public void putAnnotationSetOffset(int oldOffset, int newOffset) { if (oldOffset <= 0 || newOffset <= 0) { throw new IllegalArgumentException(); } - annotationSetOffsets.put(oldOffset, newOffset); + annotationSetOffsets.put(Integer.valueOf(oldOffset), Integer.valueOf(newOffset)); } public void putAnnotationDirectoryOffset(int oldOffset, int newOffset) { if (oldOffset <= 0 || newOffset <= 0) { throw new IllegalArgumentException(); } - annotationDirectoryOffsets.put(oldOffset, newOffset); + annotationDirectoryOffsets.put(Integer.valueOf(oldOffset), Integer.valueOf(newOffset)); } public void putStaticValuesOffset(int oldOffset, int newOffset) { if (oldOffset <= 0 || newOffset <= 0) { throw new IllegalArgumentException(); } - staticValuesOffsets.put(oldOffset, newOffset); + staticValuesOffsets.put(Integer.valueOf(oldOffset), Integer.valueOf(newOffset)); } public int adjustString(int stringIndex) { @@ -141,23 +141,23 @@ public final class IndexMap { } public int adjustTypeListOffset(int typeListOffset) { - return typeListOffsets.get(typeListOffset); + return typeListOffsets.get(Integer.valueOf(typeListOffset)).intValue(); } public int adjustAnnotation(int annotationOffset) { - return annotationOffsets.get(annotationOffset); + return annotationOffsets.get(Integer.valueOf(annotationOffset)).intValue(); } public int adjustAnnotationSet(int annotationSetOffset) { - return annotationSetOffsets.get(annotationSetOffset); + return annotationSetOffsets.get(Integer.valueOf(annotationSetOffset)).intValue(); } public int adjustAnnotationDirectory(int annotationDirectoryOffset) { - return annotationDirectoryOffsets.get(annotationDirectoryOffset); + return annotationDirectoryOffsets.get(Integer.valueOf(annotationDirectoryOffset)).intValue(); } public int adjustStaticValues(int staticValuesOffset) { - return staticValuesOffsets.get(staticValuesOffset); + return staticValuesOffsets.get(Integer.valueOf(staticValuesOffset)).intValue(); } public MethodId adjust(MethodId methodId) { diff --git a/dx/src/com/android/jack/dx/merge/TypeList.java b/dx/src/com/android/jack/dx/merge/TypeList.java index 0c5b4f9..46c5dde 100644 --- a/dx/src/com/android/jack/dx/merge/TypeList.java +++ b/dx/src/com/android/jack/dx/merge/TypeList.java @@ -53,7 +53,7 @@ public final class TypeList implements Comparable { StringBuilder result = new StringBuilder(); result.append("("); for (int i = 0, typesLength = types.length; i < typesLength; i++) { - result.append(buffer != null ? buffer.typeNames().get(types[i]) : types[i]); + result.append(buffer != null ? buffer.typeNames().get(types[i]) : Short.valueOf(types[i])); } result.append(")"); return result.toString(); diff --git a/dx/src/com/android/jack/dx/rop/code/LocalVariableInfo.java b/dx/src/com/android/jack/dx/rop/code/LocalVariableInfo.java index 5086e47..bd00bc2 100644 --- a/dx/src/com/android/jack/dx/rop/code/LocalVariableInfo.java +++ b/dx/src/com/android/jack/dx/rop/code/LocalVariableInfo.java @@ -223,10 +223,11 @@ public final class LocalVariableInfo extends MutabilityControl { continue; } + Integer labelInteger = Integer.valueOf(label); if (blockStarts[label] == emptySet) { - System.out.printf("%04x: empty set\n", label); + System.out.printf("%04x: empty set\n", labelInteger); } else { - System.out.printf("%04x: %s\n", label, blockStarts[label]); + System.out.printf("%04x: %s\n", labelInteger, blockStarts[label]); } } } diff --git a/dx/src/com/android/jack/dx/ssa/ConstCollector.java b/dx/src/com/android/jack/dx/ssa/ConstCollector.java index aa73c2a..4fb3fd6 100644 --- a/dx/src/com/android/jack/dx/ssa/ConstCollector.java +++ b/dx/src/com/android/jack/dx/ssa/ConstCollector.java @@ -179,7 +179,7 @@ public class ConstCollector { insn = predInsns.get(predInsns.size() - 1); } - if (insn.canThrow()) { + if (insn != null && insn.canThrow()) { /* * Don't move anything other than strings -- the risk * of changing where an exception is thrown is too high. @@ -215,16 +215,16 @@ public class ConstCollector { Integer has = countUses.get(cst); if (has == null) { - countUses.put(cst, 1); + countUses.put(cst, Integer.valueOf(1)); } else { - countUses.put(cst, has + 1); + countUses.put(cst, Integer.valueOf(has.intValue() + 1)); } } // Collect constants that have been reused. ArrayList constantList = new ArrayList(); for (Map.Entry entry : countUses.entrySet()) { - if (entry.getValue() > 1) { + if (entry.getValue().intValue() > 1) { constantList.add(entry.getKey()); } } @@ -234,7 +234,7 @@ public class ConstCollector { @Override public int compare(Constant a, Constant b) { int ret; - ret = countUses.get(b) - countUses.get(a); + ret = countUses.get(b).intValue() - countUses.get(a).intValue(); if (ret == 0) { /* @@ -246,11 +246,6 @@ public class ConstCollector { return ret; } - - @Override - public boolean equals(Object obj) { - return obj == this; - } }); return constantList; diff --git a/dx/src/com/android/jack/dx/ssa/LocalVariableInfo.java b/dx/src/com/android/jack/dx/ssa/LocalVariableInfo.java index 8bc7634..14c3799 100644 --- a/dx/src/com/android/jack/dx/ssa/LocalVariableInfo.java +++ b/dx/src/com/android/jack/dx/ssa/LocalVariableInfo.java @@ -221,10 +221,11 @@ public class LocalVariableInfo extends MutabilityControl { continue; } + Integer indexInteger = Integer.valueOf(index); if (blockStarts[index] == emptySet) { - System.out.printf("%04x: empty set\n", index); + System.out.printf("%04x: empty set\n", indexInteger); } else { - System.out.printf("%04x: %s\n", index, blockStarts[index]); + System.out.printf("%04x: %s\n", indexInteger, blockStarts[index]); } } } diff --git a/dx/src/com/android/jack/dx/ssa/SsaBasicBlock.java b/dx/src/com/android/jack/dx/ssa/SsaBasicBlock.java index 2d16474..e8d7a06 100644 --- a/dx/src/com/android/jack/dx/ssa/SsaBasicBlock.java +++ b/dx/src/com/android/jack/dx/ssa/SsaBasicBlock.java @@ -740,7 +740,7 @@ for (int i = successors.nextSetBit(0); i >= 0; i = successors.nextSetBit(i + 1)) } // At least one insn will be set above. - + assert insnToSplit != null; RegisterSpec result = insnToSplit.getResult(); RegisterSpec tempSpec = result.withReg(parent.borrowSpareRegister(result.getCategory())); diff --git a/dx/src/com/android/jack/dx/ssa/SsaMethod.java b/dx/src/com/android/jack/dx/ssa/SsaMethod.java index 314bddb..047fff8 100644 --- a/dx/src/com/android/jack/dx/ssa/SsaMethod.java +++ b/dx/src/com/android/jack/dx/ssa/SsaMethod.java @@ -845,8 +845,9 @@ public final class SsaMethod { int insnsSz = insns.size(); SsaInsn lastInsn = (insnsSz == 0) ? null : insns.get(insnsSz - 1); - if (block != getExitBlock() && (insnsSz == 0 || lastInsn.getOriginalRopInsn() == null - || lastInsn.getOriginalRopInsn().getOpcode().getBranchingness() == Rop.BRANCH_NONE)) { + if (block != getExitBlock() && (insnsSz == 0 + || (lastInsn != null && ((lastInsn.getOriginalRopInsn() == null) + || lastInsn.getOriginalRopInsn().getOpcode().getBranchingness() == Rop.BRANCH_NONE)))) { // We managed to eat a throwable insn Insn gotoInsn = diff --git a/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java b/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java index ff17fe9..697caaa 100644 --- a/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java +++ b/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java @@ -766,8 +766,8 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { } if (DEBUG) { - System.out.printf("Add mapping s%d -> v%d c:%d\n", ssaSpec.getReg(), ropReg, - ssaSpec.getCategory()); + System.out.printf("Add mapping s%d -> v%d c:%d\n", Integer.valueOf(ssaSpec.getReg()), + Integer.valueOf(ropReg), Integer.valueOf(ssaSpec.getCategory())); } int category = ssaSpec.getCategory(); @@ -922,10 +922,11 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { /* * 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))); + if (resultMovesRequired != null) { + for (int i = resultMovesRequired.nextSetBit(0); i >= 0; + i = resultMovesRequired.nextSetBit(i + 1)) { + insn.changeOneSource(i, insertMoveBefore(insn, sources.get(i))); + } } return resultRangeStart; diff --git a/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java b/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java index 013c0f0..8175cf2 100644 --- a/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java +++ b/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java @@ -223,7 +223,8 @@ public class SsaToRop { } if (DEBUG) { - System.out.printf("Moving %d registers from 0 to %d\n", paramWidth, regCount - paramWidth); + System.out.printf("Moving %d registers from 0 to %d\n", Integer.valueOf(paramWidth), + Integer.valueOf(regCount - paramWidth)); } ssaMeth.mapRegisters(mapper); @@ -346,20 +347,21 @@ public class SsaToRop { Integer[] ret = new Integer[regCount]; for (int i = 0; i < regCount; i++) { - ret[i] = i; + ret[i] = Integer.valueOf(i); } Arrays.sort(ret, new Comparator() { @Override public int compare(Integer o1, Integer o2) { - return ssaMeth.getUseListForRegister(o2).size() - ssaMeth.getUseListForRegister(o1).size(); + return ssaMeth.getUseListForRegister(o2.intValue()).size() + - ssaMeth.getUseListForRegister(o1.intValue()).size(); } }); int result[] = new int[regCount]; for (int i = 0; i < regCount; i++) { - result[i] = ret[i]; + result[i] = ret[i].intValue(); } return result; diff --git a/dx/src/com/android/jack/dx/util/ByteArray.java b/dx/src/com/android/jack/dx/util/ByteArray.java index 29d9ca5..2b2167a 100644 --- a/dx/src/com/android/jack/dx/util/ByteArray.java +++ b/dx/src/com/android/jack/dx/util/ByteArray.java @@ -17,7 +17,6 @@ package com.android.jack.dx.util; import java.io.DataInputStream; -import java.io.IOException; import java.io.InputStream; /** @@ -294,7 +293,7 @@ public final class ByteArray { } @Override - public int read() throws IOException { + public int read() { if (cursor >= size) { return -1; } -- cgit v1.1