[Fb-contrib-commit] SF.net SVN: fb-contrib:[1472] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-01-11 04:09:06
|
Revision: 1472
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1472&view=rev
Author: dbrosius
Date: 2010-01-11 04:08:55 +0000 (Mon, 11 Jan 2010)
Log Message:
-----------
now using 1.5 --> use enums
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2010-01-11 04:06:45 UTC (rev 1471)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2010-01-11 04:08:55 UTC (rev 1472)
@@ -43,13 +43,11 @@
*/
public class SloppyClassReflection extends BytecodeScanningDetector
{
- private static final int COLLECT = -1;
- private static final int SEEN_NOTHING = 0;
- private static final int SEEN_LDC = 1;
+ enum State {COLLECT, SEEN_NOTHING, SEEN_LDC}
private final BugReporter bugReporter;
private Set<String> refClasses;
- private int state;
+ private State state;
private String clsName;
/**
@@ -71,9 +69,9 @@
try {
refClasses = new HashSet<String>();
refClasses.add(classContext.getJavaClass().getClassName());
- state = COLLECT;
+ state = State.COLLECT;
super.visitClassContext(classContext);
- state = SEEN_NOTHING;
+ state = State.SEEN_NOTHING;
super.visitClassContext(classContext);
} finally {
refClasses = null;
@@ -90,7 +88,7 @@
if ("<clinit>".equals(obj.getName()))
return;
- if (state == COLLECT) {
+ if (state == State.COLLECT) {
Type[] argTypes = obj.getArgumentTypes();
for (Type t : argTypes)
addType(t);
@@ -109,13 +107,13 @@
}
}
} else
- state = SEEN_NOTHING;
+ state = State.SEEN_NOTHING;
super.visitMethod(obj);
}
@Override
public void visitField(Field obj) {
- if (state == COLLECT) {
+ if (state == State.COLLECT) {
Type t = obj.getType();
addType(t);
}
@@ -149,7 +147,7 @@
Constant c = getConstantRefOperand();
if (c instanceof ConstantString) {
clsName = ((ConstantString) c).getBytes(getConstantPool());
- state = SEEN_LDC;
+ state = State.SEEN_LDC;
}
}
break;
@@ -165,7 +163,7 @@
.addSourceLine(this));
}
}
- state = SEEN_NOTHING;
+ state = State.SEEN_NOTHING;
break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|