Skip to content
Permalink
Browse files
Inline variable. Remove redundant local variable. (#283)
  • Loading branch information
arturobernalg committed Apr 22, 2022
1 parent 3030ba1 commit d05139856794546135d10f96bfb3a209325dd69b
Showing 5 changed files with 8 additions and 19 deletions.
@@ -184,8 +184,7 @@ public ClassFileEntry getValue(final long value, final String type, final Segmen
return getValue(layout, value, pool);
}
if (type.equals("Ljava/lang/String;")) { //$NON-NLS-1$
final ClassFileEntry value2 = getValue("KS", value, pool); //$NON-NLS-1$
return value2;
return getValue("KS", value, pool);
}
return getValue("K" + type + layout.substring(2), value, //$NON-NLS-1$
pool);
@@ -266,13 +266,12 @@ public String[][] parseReferences(final String name, final InputStream in, final
}
result1[i1] = reference[index];
}
final String[] refs = result1;
// TODO Merge the decode and parsing of a multiple structure into one
int pos = 0;
for (int i = 0; i < count; i++) {
final int num = counts[i];
result[i] = new String[num];
System.arraycopy(refs, pos, result[i], 0, num);
System.arraycopy(result1, pos, result[i], 0, num);
pos += num;
}
return result;
@@ -357,12 +356,11 @@ public CPUTF8[][] parseCPUTF8References(final String name, final InputStream in,
final int index = indices[i1];
result1[i1] = segment.getCpBands().cpUTF8Value(index);
}
final CPUTF8[] refs = result1;
int pos = 0;
for (int i = 0; i < counts.length; i++) {
final int num = counts[i];
result[i] = new CPUTF8[num];
System.arraycopy(refs, pos, result[i], 0, num);
System.arraycopy(result1, pos, result[i], 0, num);
pos += num;
}
return result;
@@ -452,12 +450,11 @@ protected CPUTF8[][] parseCPSignatureReferences(final String name, final InputSt
final int index = indices[i1];
result1[i1] = segment.getCpBands().cpSignatureValue(index);
}
final CPUTF8[] refs = result1;
int pos = 0;
for (int i = 0; i < counts.length; i++) {
final int num = counts[i];
result[i] = new CPUTF8[num];
System.arraycopy(refs, pos, result[i], 0, num);
System.arraycopy(result1, pos, result[i], 0, num);
pos += num;
}
return result;
@@ -226,10 +226,8 @@ private void parseFieldAttrBands(final InputStream in) throws IOException, Pack2
}
}

final int backwardsCallsUsed = parseFieldMetadataBands(in, fieldAttrCalls);

// Parse non-predefined attribute bands
int backwardsCallIndex = backwardsCallsUsed;
int backwardsCallIndex = parseFieldMetadataBands(in, fieldAttrCalls);
final int limit = options.hasFieldFlagsHi() ? 62 : 31;
final AttributeLayout[] otherLayouts = new AttributeLayout[limit + 1];
final int[] counts = new int[limit + 1];
@@ -352,11 +350,8 @@ private void parseMethodAttrBands(final InputStream in) throws IOException, Pack
}
}

// Parse method metadata bands
final int backwardsCallsUsed = parseMethodMetadataBands(in, methodAttrCalls);

// Parse non-predefined attribute bands
int backwardsCallIndex = backwardsCallsUsed;
int backwardsCallIndex = parseMethodMetadataBands(in, methodAttrCalls);
final int limit = options.hasMethodFlagsHi() ? 62 : 31;
final AttributeLayout[] otherLayouts = new AttributeLayout[limit + 1];
final int[] counts = new int[limit + 1];
@@ -154,13 +154,12 @@ public ConstantPoolEntry getClassPoolEntry(final String name) {
public ConstantPoolEntry getInitMethodPoolEntry(final int cp, final long value, final String desiredClassName)
throws Pack200Exception {
int realIndex = -1;
final String desiredRegex = REGEX_MATCH_INIT;
if (cp != CP_METHOD) {
// TODO really an error?
throw new Error("Nothing but CP_METHOD can be an <init>");
}
realIndex = matchSpecificPoolEntryIndex(bands.getCpMethodClass(), bands.getCpMethodDescriptor(),
desiredClassName, desiredRegex, (int) value);
desiredClassName, REGEX_MATCH_INIT, (int) value);
return getConstantPoolEntry(cp, realIndex);
}

@@ -34,8 +34,7 @@ public NewInitMethodRefForm(final int opcode, final String name, final int[] rew

@Override
protected String context(final OperandManager operandManager) {
final String result = operandManager.getNewClass();
return result;
return operandManager.getNewClass();
}

@Override

0 comments on commit d051398

Please sign in to comment.