Commit 8340deb6 authored by ebruneton's avatar ebruneton
Browse files

removed unnecessary parentheses

parent 0b967aef
......@@ -118,9 +118,9 @@ public class Analysis implements Opcodes {
Object insn = m.instructions.get(i);
int opcode = ((AbstractInsnNode) insn).getOpcode();
if ((opcode >= ILOAD && opcode <= ALOAD) || opcode == IINC) {
int var = (opcode == IINC
int var = opcode == IINC
? ((IincInsnNode) insn).var
: ((VarInsnNode) insn).var);
: ((VarInsnNode) insn).var;
Frame f = frames[i];
if (f != null) {
Set s = ((SourceValue) f.getLocal(var)).insns;
......
......@@ -96,7 +96,7 @@ public class Annotations {
}
public void visitCode() {
int var = ((access & Opcodes.ACC_STATIC) == 0) ? 1 : 0;
int var = (access & Opcodes.ACC_STATIC) == 0 ? 1 : 0;
for (int p = 0; p < params.size(); ++p) {
int param = ((Integer) params.get(p)).intValue();
for (int i = 0; i < param; ++i) {
......
......@@ -163,8 +163,8 @@ public class DependencyTracker {
int b = (int) ((float) count * maxcolor / max);
g.setColor(colors.get(b));
g.fillRect(CELL_PAD + (x * (CELLS_SIZE + CELL_PAD)),
CELL_PAD + (y * (CELLS_SIZE + CELL_PAD)),
g.fillRect(CELL_PAD + x * (CELLS_SIZE + CELL_PAD),
CELL_PAD + y * (CELLS_SIZE + CELL_PAD),
CELLS_SIZE,
CELLS_SIZE);
}
......
......@@ -211,7 +211,7 @@ public class ByteVector {
// if we find that this assumption is wrong, we continue with the
// general method.
data[len++] = (byte) (charLength >>> 8);
data[len++] = (byte) (charLength);
data[len++] = (byte) charLength;
for (int i = 0; i < charLength; ++i) {
char c = s.charAt(i);
if (c >= '\001' && c <= '\177') {
......@@ -229,7 +229,7 @@ public class ByteVector {
}
}
data[length] = (byte) (byteLength >>> 8);
data[length + 1] = (byte) (byteLength);
data[length + 1] = (byte) byteLength;
if (length + 2 + byteLength > data.length) {
length = len;
enlarge(2 + byteLength);
......
......@@ -640,7 +640,7 @@ public class Type {
* <tt>double</tt>, and 1 otherwise.
*/
public int getSize() {
return (sort == LONG || sort == DOUBLE ? 2 : 1);
return sort == LONG || sort == DOUBLE ? 2 : 1;
}
/**
......
......@@ -159,7 +159,7 @@ public class CodeSizeEvaluator extends MethodAdapter implements Opcodes {
}
public void visitIincInsn(final int var, final int increment) {
if ((var > 255) || (increment > 127) || (increment < -128)) {
if (var > 255 || increment > 127 || increment < -128) {
minSize += 6;
maxSize += 6;
} else {
......@@ -177,8 +177,8 @@ public class CodeSizeEvaluator extends MethodAdapter implements Opcodes {
final Label dflt,
final Label[] labels)
{
minSize += 13 + (labels.length * 4);
maxSize += 16 + (labels.length * 4);
minSize += 13 + labels.length * 4;
maxSize += 16 + labels.length * 4;
if (mv != null) {
mv.visitTableSwitchInsn(min, max, dflt, labels);
}
......@@ -189,8 +189,8 @@ public class CodeSizeEvaluator extends MethodAdapter implements Opcodes {
final int[] keys,
final Label[] labels)
{
minSize += 9 + (keys.length * 8);
maxSize += 12 + (keys.length * 8);
minSize += 9 + keys.length * 8;
maxSize += 12 + keys.length * 8;
if (mv != null) {
mv.visitLookupSwitchInsn(dflt, keys, labels);
}
......
......@@ -413,7 +413,7 @@ public class GeneratorAdapter extends LocalVariablesSorter {
* variables array.
*/
private int getArgIndex(final int arg) {
int index = ((access & Opcodes.ACC_STATIC) == 0 ? 1 : 0);
int index = (access & Opcodes.ACC_STATIC) == 0 ? 1 : 0;
for (int i = 0; i < arg; i++) {
index += argumentTypes[i].getSize();
}
......
......@@ -92,7 +92,7 @@ public class LocalVariablesSorter extends MethodAdapter {
{
super(mv);
Type[] args = Type.getArgumentTypes(desc);
nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1;
nextLocal = (Opcodes.ACC_STATIC & access) != 0 ? 0 : 1;
for (int i = 0; i < args.length; i++) {
nextLocal += args[i].getSize();
}
......@@ -182,7 +182,7 @@ public class LocalVariablesSorter extends MethodAdapter {
int number = 0; // old local variable number
for (; number < nLocal; ++number) {
Object t = local[number];
int size = (t == Opcodes.LONG || t == Opcodes.DOUBLE ? 2 : 1);
int size = t == Opcodes.LONG || t == Opcodes.DOUBLE ? 2 : 1;
if (t != Opcodes.TOP) {
setFrameLocal(remap(index, size), t);
}
......
......@@ -267,8 +267,8 @@ public class SerialVersionUIDAdder extends ClassAdapter {
| Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
| Opcodes.ACC_FINAL | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT);
if (((access & Opcodes.ACC_PRIVATE) == 0)
|| ((access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0))
if ((access & Opcodes.ACC_PRIVATE) == 0
|| (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0)
{
svuidFields.add(new Item(name, mods, desc));
}
......
......@@ -525,7 +525,7 @@ public class ASMifierClassVisitor extends ASMifierAbstractVisitor implements
first = false;
}
if ((access & Opcodes.ACC_ANNOTATION) != 0
&& ((access & ACCESS_CLASS) != 0))
&& (access & ACCESS_CLASS) != 0)
{
if (!first) {
buf.append(" + ");
......
......@@ -380,15 +380,15 @@ public class CheckClassAdapter extends ClassAdapter {
throw new IllegalArgumentException("Invalid access flags: "
+ access);
}
int pub = ((access & Opcodes.ACC_PUBLIC) != 0 ? 1 : 0);
int pri = ((access & Opcodes.ACC_PRIVATE) != 0 ? 1 : 0);
int pro = ((access & Opcodes.ACC_PROTECTED) != 0 ? 1 : 0);
int pub = (access & Opcodes.ACC_PUBLIC) != 0 ? 1 : 0;
int pri = (access & Opcodes.ACC_PRIVATE) != 0 ? 1 : 0;
int pro = (access & Opcodes.ACC_PROTECTED) != 0 ? 1 : 0;
if (pub + pri + pro > 1) {
throw new IllegalArgumentException("public private and protected are mutually exclusive: "
+ access);
}
int fin = ((access & Opcodes.ACC_FINAL) != 0 ? 1 : 0);
int abs = ((access & Opcodes.ACC_ABSTRACT) != 0 ? 1 : 0);
int fin = (access & Opcodes.ACC_FINAL) != 0 ? 1 : 0;
int abs = (access & Opcodes.ACC_ABSTRACT) != 0 ? 1 : 0;
if (fin + abs > 1) {
throw new IllegalArgumentException("final and abstract are mutually exclusive: "
+ access);
......
......@@ -86,7 +86,7 @@ public class CheckMethodAdapter extends MethodAdapter {
+ "KLBBBBBBFFFFGGGGAECEBBEEBBAMHHAA";
TYPE = new int[s.length()];
for (int i = 0; i < TYPE.length; ++i) {
TYPE[i] = (s.charAt(i) - 'A' - 1);
TYPE[i] = s.charAt(i) - 'A' - 1;
}
}
......@@ -786,7 +786,7 @@ public class CheckMethodAdapter extends MethodAdapter {
throw new IllegalArgumentException("Invalid " + msg
+ " (must be a valid Java identifier): " + name);
}
int max = (end == -1 ? name.length() : end);
int max = end == -1 ? name.length() : end;
for (int i = start + 1; i < max; ++i) {
if (!Character.isJavaIdentifierPart(name.charAt(i))) {
throw new IllegalArgumentException("Invalid " + msg
......@@ -856,7 +856,7 @@ public class CheckMethodAdapter extends MethodAdapter {
throw new IllegalArgumentException("Invalid " + msg
+ " (must not be null or empty)");
}
int max = (end == -1 ? name.length() : end);
int max = end == -1 ? name.length() : end;
try {
int begin = start;
int slash;
......
......@@ -110,9 +110,9 @@ public class TraceSignatureVisitor implements SignatureVisitor {
}
public SignatureVisitor visitInterface() {
separator = seenInterface ? ", " : (isInterface
separator = seenInterface ? ", " : isInterface
? " extends "
: " implements ");
: " implements ";
seenInterface = true;
startType();
return this;
......
......@@ -1094,7 +1094,7 @@ public class ASMContentHandler extends DefaultHandler implements Opcodes {
public final void begin(final String element, final Attributes attrs)
throws SAXException
{
Opcode o = ((Opcode) OPCODES.get(element));
Opcode o = (Opcode) OPCODES.get(element);
if (o == null) {
throw new SAXException("Invalid element: " + element + " at "
+ match);
......
......@@ -369,7 +369,7 @@ public class Processor {
if (arg instanceof Throwable) {
((Throwable) arg).printStackTrace();
} else {
if ((n % 100) == 0) {
if (n % 100 == 0) {
System.err.println(n + " " + arg);
}
}
......@@ -425,7 +425,7 @@ public class Processor {
int n = m.process();
long l2 = System.currentTimeMillis();
System.err.println(n);
System.err.println("" + (l2 - l1) + "ms " + (1000f * n / (l2 - l1))
System.err.println("" + (l2 - l1) + "ms " + 1000f * n / (l2 - l1)
+ " resources/sec");
}
......
......@@ -73,7 +73,7 @@ public class GASMifierMethodVisitor extends ASMifierAbstractVisitor implements
this.access = access;
this.labelNames = new HashMap();
this.argumentTypes = Type.getArgumentTypes(desc);
int nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1;
int nextLocal = (Opcodes.ACC_STATIC & access) != 0 ? 0 : 1;
for (int i = 0; i < argumentTypes.length; i++) {
nextLocal += argumentTypes[i].getSize();
}
......@@ -622,7 +622,7 @@ public class GASMifierMethodVisitor extends ASMifierAbstractVisitor implements
}
private int getArgIndex(final int var) {
int nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1;
int nextLocal = (Opcodes.ACC_STATIC & access) != 0 ? 0 : 1;
int i = 0;
while (nextLocal != var) {
nextLocal += argumentTypes[i++].getSize();
......
......@@ -1588,7 +1588,7 @@ public class JSRInlinerAdapterUnitTest extends TestCase {
// first instance of first sub try/catch handlers:
TRYCATCH(L_1, C2_1, C2_1);
TRYCATCH(OT_1, OC_1, OC); // note: reuses handler code from main
// sub
// sub
// second instance of first sub try/catch handlers:
TRYCATCH(L_2, C2_2, C2_2);
......
......@@ -61,7 +61,7 @@ import java.io.*;
* This class is derived from <em>Attribute</em> and represents a reference to
* a <href="http://wwwipd.ira.uka.de/~pizza/gj/">GJ</a> attribute.
*
* @version $Id: Signature.java,v 1.1.2.3 2006-06-22 13:16:09 ebruneton Exp $
* @version $Id: Signature.java,v 1.1.2.4 2006-06-22 13:49:03 ebruneton Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
*/
......@@ -245,8 +245,8 @@ public final class Signature extends Attribute {
ch = in.read();
// System.out.println("within ident:"+ (char)ch);
} while ((ch != -1)
&& (Character.isJavaIdentifierPart((char) ch) || (ch == '/')));
} while (ch != -1
&& (Character.isJavaIdentifierPart((char) ch) || ch == '/'));
buf.append(buf2.toString().replace('/', '.'));
......@@ -266,13 +266,13 @@ public final class Signature extends Attribute {
matchIdent(in, buf);
ch = in.read();
if ((ch == '<') || ch == '(') { // Parameterized or method
if (ch == '<' || ch == '(') { // Parameterized or method
// System.out.println("Enter <");
buf.append((char) ch);
matchGJIdent(in, buf);
while (((ch = in.read()) != '>') && (ch != ')')) { // List of
// parameters
while ((ch = in.read()) != '>' && ch != ')') { // List of
// parameters
if (ch == -1) {
throw new RuntimeException("Illegal signature: "
+ in.getData() + " reaching EOF");
......@@ -314,7 +314,7 @@ public final class Signature extends Attribute {
}
public static final boolean isFormalParameterList(final String s) {
return s.startsWith("<") && (s.indexOf(':') > 0);
return s.startsWith("<") && s.indexOf(':') > 0;
}
public static final boolean isActualParameterList(final String s) {
......
......@@ -97,7 +97,7 @@ public class StringRepresentation extends
public StringRepresentation(final Node n) {
// this.n = n;
n.accept(this); // assign a string representation to field 'tostring' if
// we know n's class.
// we know n's class.
}
/**
......@@ -115,8 +115,8 @@ public class StringRepresentation extends
// want to know that this class has also to be adapted.
if (tostring == null) {
tostring = "";// throw new AssertionViolatedException("Please
// adapt '"+getClass()+"' to deal with objects of
// class '"+n.getClass()+"'.");
// adapt '"+getClass()+"' to deal with objects of
// class '"+n.getClass()+"'.");
}
return tostring;
}
......
......@@ -76,7 +76,8 @@ public final class ModifiedPass3bVerifier {
private static final class InstructionContextQueue {
private final Vector ics = new Vector(); // Type: InstructionContext
private final Vector ecs = new Vector(); // Type: ArrayList (of
// InstructionContext)
// InstructionContext)
public void add(
final InstructionContext ic,
......@@ -157,11 +158,11 @@ public final class ModifiedPass3bVerifier {
InstructionContextQueue icq = new InstructionContextQueue();
start.execute(vanillaFrame, new ArrayList(), icv, ev); // new
// ArrayList()
// <=> no
// Instruction
// was executed
// before
// ArrayList()
// <=> no
// Instruction
// was executed
// before
// => Top-Level routine (no jsr call before)
icq.add(start, new ArrayList());
......@@ -180,15 +181,15 @@ public final class ModifiedPass3bVerifier {
icq.remove(0);
}
ArrayList oldchain = (ArrayList) (ec.clone());
ArrayList newchain = (ArrayList) (ec.clone());
ArrayList oldchain = (ArrayList) ec.clone();
ArrayList newchain = (ArrayList) ec.clone();
newchain.add(u);
if ((u.getInstruction().getInstruction()) instanceof RET) {
if (u.getInstruction().getInstruction() instanceof RET) {
// System.err.println(u);
// We can only follow _one_ successor, the one after the
// JSR that was recently executed.
RET ret = (RET) (u.getInstruction().getInstruction());
RET ret = (RET) u.getInstruction().getInstruction();
ReturnaddressType t = (ReturnaddressType) u.getOutFrame(oldchain)
.getLocals()
.get(ret.getIndex());
......@@ -222,8 +223,9 @@ public final class ModifiedPass3bVerifier {
throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"
+ oldchain + "'.");
}
JsrInstruction jsr = (JsrInstruction) (lastJSR.getInstruction().getInstruction());
if (theSuccessor != (cfg.contextOf(jsr.physicalSuccessor()))) {
JsrInstruction jsr = (JsrInstruction) lastJSR.getInstruction()
.getInstruction();
if (theSuccessor != cfg.contextOf(jsr.physicalSuccessor())) {
throw new AssertionViolatedException("RET '"
+ u.getInstruction()
+ "' info inconsistent: jump back to '"
......@@ -340,7 +342,7 @@ public final class ModifiedPass3bVerifier {
ev.setConstantPoolGen(constantPoolGen);
Method[] methods = jc.getMethods(); // Method no "method_no" exists, we
// ran Pass3a before on it!
// ran Pass3a before on it!
try {
......@@ -352,7 +354,7 @@ public final class ModifiedPass3bVerifier {
// //////////// DFA BEGINS HERE ////////////////
if (!(mg.isAbstract() || mg.isNative())) { // IF mg HAS CODE (See
// pass 2)
// pass 2)
ControlFlowGraph cfg = new ControlFlowGraph(mg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment