[Fb-contrib-commit] SF.net SVN: fb-contrib:[1569] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-06-09 04:53:53
|
Revision: 1569
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1569&view=rev
Author: dbrosius
Date: 2010-06-09 04:53:45 +0000 (Wed, 09 Jun 2010)
Log Message:
-----------
warnings
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -28,7 +28,7 @@
{
private int numMethodCalls;
- public CollectStatistics(BugReporter bugReporter) {
+ public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) {
Statistics.getStatistics().clear();
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -202,11 +202,11 @@
* catch exceptions that are thrown, but doing so would be prohibitively slow.
* But it should catch some problems.
*
- * @param fbInfo the finally block the pc is currently in
+ * @param fBlockInfo the finally block the pc is currently in
*
* @return if all exceptions are caught inside this finally block
*/
- private boolean catchBlockInFinally(FinallyBlockInfo fbInfo) {
+ private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) {
CodeException[] catchExceptions = getCode().getExceptionTable();
if ((catchExceptions == null) || (catchExceptions.length == 0))
@@ -215,7 +215,7 @@
int pc = getPC();
for (CodeException ex : catchExceptions) {
if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc)) {
- if (ex.getStartPC() >= fbInfo.startPC) {
+ if (ex.getStartPC() >= fBlockInfo.startPC) {
return true;
}
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -35,7 +35,7 @@
*/
public class AbstractClassEmptyMethods extends BytecodeScanningDetector
{
- enum State {SAW_NOTHING, SAW_NEW, SAW_DUP, SAW_LDC, SAW_INVOKESPECIAL, SAW_DONE};
+ enum State {SAW_NOTHING, SAW_NEW, SAW_DUP, SAW_LDC, SAW_INVOKESPECIAL, SAW_DONE}
private static JavaClass EXCEPTION_CLASS;
static {
@@ -45,7 +45,7 @@
//ignore
}
}
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private String methodName;
private State state;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -41,7 +41,7 @@
*/
public class ConstantListIndex extends BytecodeScanningDetector
{
- enum State {SAW_NOTHING, SAW_CONSTANT_0, SAW_CONSTANT};
+ enum State {SAW_NOTHING, SAW_CONSTANT_0, SAW_CONSTANT}
private static final String MAX_ICONST0_LOOP_DISTANCE_PROPERTY = "fb-contrib.cli.maxloopdistance";
private static final Set<String> ubiquitousMethods = new HashSet<String>();
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -64,14 +64,14 @@
/**
* overrides the visitor to accept classes derived from non java.lang.Object classes.
*
- * @param classContext the context object of the currently parsed class
+ * @param clsContext the context object of the currently parsed class
*/
- public void visitClassContext(ClassContext classContext) {
+ public void visitClassContext(ClassContext clsContext) {
try {
- JavaClass cls = classContext.getJavaClass();
+ JavaClass cls = clsContext.getJavaClass();
String superName = cls.getSuperclassName();
if (!"java.lang.Object".equals(superName)) {
- this.classContext = classContext;
+ this.classContext = clsContext;
superclassCode = new HashMap<String, Code>();
JavaClass superCls = cls.getSuperClass();
childPoolGen = new ConstantPoolGen(cls.getConstantPool());
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -35,7 +35,7 @@
*/
public class DateComparison extends BytecodeScanningDetector
{
- enum State {SAW_NOTHING, SAW_LOAD1_1, SAW_LOAD1_2, SAW_CMP1, SAW_IFNE, SAW_LOAD2_1, SAW_LOAD2_2, SAW_CMP2};
+ enum State {SAW_NOTHING, SAW_LOAD1_1, SAW_LOAD1_2, SAW_CMP1, SAW_IFNE, SAW_LOAD2_1, SAW_LOAD2_2, SAW_CMP2}
private static final Set<String> dateClasses = new HashSet<String>();
static {
@@ -44,7 +44,7 @@
dateClasses.add("java.sql.Timestamp");
}
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private State state;
private int register1_1;
private int register1_2;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -39,7 +39,7 @@
*/
public class DeprecatedTypesafeEnumPattern extends BytecodeScanningDetector
{
- enum State {SAW_NOTHING, SAW_INVOKESPECIAL, SAW_BUG};
+ enum State {SAW_NOTHING, SAW_INVOKESPECIAL, SAW_BUG}
private final BugReporter bugReporter;
private int firstEnumPC;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -250,11 +250,11 @@
/** remove catchinfo blocks from the map where the handler end is before the current pc
*
- * @param catchInfos the exception handlers installed
+ * @param infos the exception handlers installed
* @param pc the current pc
*/
- private void removeFinishedCatchBlocks(List<CatchInfo> catchInfos, int pc) {
- Iterator<CatchInfo> it = catchInfos.iterator();
+ private void removeFinishedCatchBlocks(List<CatchInfo> infos, int pc) {
+ Iterator<CatchInfo> it = infos.iterator();
while (it.hasNext()) {
if (it.next().getFinish() < pc)
it.remove();
@@ -263,13 +263,13 @@
/** reduces the end pc based on the optional LocalVariableTable's exception register scope
*
- * @param catchInfos the list of active catch blocks
+ * @param infos the list of active catch blocks
* @param pc the current pc
*/
- private void updateEndPCsOnCatchRegScope(List<CatchInfo> catchInfos, int pc, int seen)
+ private void updateEndPCsOnCatchRegScope(List<CatchInfo> infos, int pc, int seen)
{
if (lvt != null) {
- for (CatchInfo ci : catchInfos) {
+ for (CatchInfo ci : infos) {
if (ci.getStart() == pc) {
if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
int exReg = RegisterUtils.getAStoreReg(this, seen);
@@ -286,13 +286,13 @@
/** returns an array of catch types that the current pc is in
*
- * @param catchInfos the list of catch infos for this method
+ * @param infos the list of catch infos for this method
* @param pc the current pc
* @return an set of catch exception types that the pc is currently in
*/
- public Set<String> findPossibleCatchSignatures(List<CatchInfo> catchInfos, int pc) {
+ public Set<String> findPossibleCatchSignatures(List<CatchInfo> infos, int pc) {
Set<String> catchTypes = new HashSet<String>();
- ListIterator<CatchInfo> it = catchInfos.listIterator(catchInfos.size());
+ ListIterator<CatchInfo> it = infos.listIterator(infos.size());
while (it.hasPrevious()) {
CatchInfo ci = it.previous();
if ((pc >= ci.getStart()) && (pc < ci.getFinish())) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -37,7 +37,7 @@
*/
public class FloatingPointLoops extends BytecodeScanningDetector
{
- enum State {SAW_LOAD, SAW_CMPX, SAW_IFX, SAW_STORE};
+ enum State {SAW_LOAD, SAW_CMPX, SAW_IFX, SAW_STORE}
BugReporter bugReporter;
private Set<FloatForLoop> forLoops = new HashSet<FloatForLoop>();
@@ -91,8 +91,8 @@
public class FloatForLoop
{
private State state;
- private int loopPC;
- private int loopReg;
+ private final int loopPC;
+ private final int loopReg;
private int gotoPC;
public FloatForLoop(int reg, int pc) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -35,7 +35,7 @@
*/
public class ImproperPropertiesUse extends BytecodeScanningDetector {
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private OpcodeStack stack;
/**
@@ -51,6 +51,7 @@
*
* @param classContext the context object of the currently parsed class
*/
+ @Override
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
@@ -65,6 +66,7 @@
*
* @param obj the context object for the currently parsed code block
*/
+ @Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
super.visitCode(obj);
@@ -76,6 +78,8 @@
*
* @param seen the currently parsed op code
*/
+
+ @Override
public void sawOpcode(int seen) {
try {
if (seen == INVOKEVIRTUAL) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -63,7 +63,7 @@
public String getDescription() {
return key;
}
- };
+ }
BugReporter bugReporter;
OpcodeStack stack;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -142,12 +142,12 @@
/**
* collects all the valid exception objects (ones where start and finish are before the target
*
- * @param exceptions the exceptions from the class file
+ * @param exs the exceptions from the class file
* @return the filtered exceptions
*/
- public CodeException[] collectExceptions(CodeException[] exceptions) {
+ public CodeException[] collectExceptions(CodeException[] exs) {
List<CodeException> filteredEx = new ArrayList<CodeException>();
- for (CodeException ce : exceptions) {
+ for (CodeException ce : exs) {
if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) {
filteredEx.add(ce);
}
@@ -303,10 +303,10 @@
/** returns whether the method called might be a method that builds an exception using
* the original exception. It does so by looking to see if the method returns an exception,
* and if one of the parameters is the original exception
- * @param exReg the register of the original exception caught
+ * @param excReg the register of the original exception caught
* @return whether this method call could be an exception builder method
*/
- public boolean isPossibleExBuilder(int exReg) throws ClassNotFoundException {
+ public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException {
String sig = getSigConstantOperand();
Type returnType = Type.getReturnType(sig);
String returnSig = returnType.getSignature();
@@ -318,7 +318,7 @@
if (stack.getStackDepth() >= numParms) {
for (int p = 0; p < numParms; p++) {
OpcodeStack.Item item = stack.getStackItem(p);
- if (item.getRegisterNumber() == exReg)
+ if (item.getRegisterNumber() == excReg)
{
return true;
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -37,7 +37,7 @@
*/
public class MisleadingOverloadModel extends PreorderVisitor implements Detector
{
- enum MethodFoundType {Instance, Static, Both};
+ enum MethodFoundType {Instance, Static, Both}
private final BugReporter bugReporter;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -22,12 +22,9 @@
import java.util.HashMap;
import java.util.Map;
-import com.mebigfatguy.fbcontrib.utils.XClassUtils;
-
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
-import edu.umd.cs.findbugs.ba.XMethod;
/**
* looks for method calls that are unsafe or might indicate bugs.
@@ -35,8 +32,8 @@
public class MoreDumbMethods extends BytecodeScanningDetector
{
private static class ReportInfo {
- private String bugPattern;
- private int bugPriority;
+ private final String bugPattern;
+ private final int bugPriority;
ReportInfo(String pattern, int priority) {
bugPattern = pattern;
@@ -115,7 +112,6 @@
}
private final BugReporter bugReporter;
- private final XClassUtils classUtil = new XClassUtils();
/**
* constructs an MDM detector given the reporter to report bugs on
@@ -137,18 +133,6 @@
reportBug(info);
}
}
-
-// ReportInfo info = null;
-// if (seen == INVOKESPECIAL || seen == INVOKESTATIC) {
-// // static method invocation: no dispatch, straight call
-// info = dumbMethods.get(getMethodSignature());
-// } else if (seen == INVOKEVIRTUAL || seen == INVOKEINTERFACE) {
-// // virtual method invocation: dispatch is based on the class
-// info = dumbMethods.get(getVirtualMethodSignature());
-// }
-// if (info != null) {
-// reportBug(info);
-// }
}
private String getMethodSignature() {
@@ -157,20 +141,8 @@
final String methodSig = getSigConstantOperand();
return String.format("%s.%s%s", className, methodName, methodSig);
}
-
- private String getVirtualMethodSignature() {
- final XMethod declaredMethod = classUtil.getXMethod(
- getClassConstantOperand(), getNameConstantOperand(),
- getSigConstantOperand());
- final String className = declaredMethod.getClassDescriptor()
- .getClassName();
- final String methodName = declaredMethod.getName();
- final String methodSig = declaredMethod.getSignature();
- return String.format("%s.%s%s", className, methodName, methodSig);
- }
-
private void reportBug(ReportInfo info) {
bugReporter.reportBug(new BugInstance(this, info.getPattern(), info.getPriority())
.addClass(this)
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -123,7 +123,7 @@
* @return the map of possible attributes/types
*/
private Map<String, String> getAttributes(JavaClass cls) {
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, String> atts = new HashMap<String, String>();
Method[] methods = cls.getMethods();
for (Method m : methods) {
String name = m.getName();
@@ -136,13 +136,13 @@
if (validAttrTypes.contains(parmSig)) {
Code code = m.getCode();
if ((code != null) && (code.getCode().length < MAX_ATTRIBUTE_CODE_LENGTH)) {
- attributes.put(name + ":" + sig, parmSig);
+ atts.put(name + ":" + sig, parmSig);
}
}
}
}
}
- return attributes;
+ return atts;
}
/**
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -34,7 +34,7 @@
public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector {
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private OpcodeStack stack;
/** allocation number, info where allocated */
private Map<Integer, AllocationInfo> allocations;
@@ -46,6 +46,7 @@
this.bugReporter = bugReporter;
}
+ @Override
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
@@ -59,6 +60,7 @@
}
}
+ @Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
allocations.clear();
@@ -74,9 +76,9 @@
.addSourceLine(getClassContext(), this, info.allocationPC));
}
}
-
}
-
+
+ @Override
public void sawOpcode(int seen) {
boolean sawAllocation = false;
Integer sawAllocationNumber = null;
@@ -117,12 +119,12 @@
if ("<init>".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) {
String clsName = getClassConstantOperand();
if (!"java/lang/StringBuffer".equals(clsName) && !"java/lang/StringBuilder".equals(clsName)) {
- allocations.put(Integer.valueOf(nextAllocationNumber), new AllocationInfo(getPC()));
+ sawAllocationNumber = Integer.valueOf(nextAllocationNumber);
+ allocations.put(sawAllocationNumber, new AllocationInfo(getPC()));
sawAllocation = true;
- sawAllocationNumber = nextAllocationNumber;
}
}
- //FALL_THRU
+ //$FALL-THROUGH$
case INVOKEINTERFACE:
case INVOKEVIRTUAL:
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -197,10 +197,10 @@
XField field = itm.getXField();
if (field != null) {
if (bloatableFields.containsKey(field)) {
- String methodName = getNameConstantOperand();
- if (decreasingMethods.contains(methodName)) {
+ String mName = getNameConstantOperand();
+ if (decreasingMethods.contains(mName)) {
bloatableFields.remove(field);
- } else if (increasingMethods.contains(methodName)) {
+ } else if (increasingMethods.contains(mName)) {
if (bloatableFields.get(field) == null) {
SourceLineAnnotation sla = SourceLineAnnotation.fromVisitedInstruction(this);
bloatableFields.put(field, sla);
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -255,7 +255,7 @@
} else {
if (reg >= 0) {
localMethodCalls.remove(Integer.valueOf(reg));
- } else {
+ } else if (field != null) {
fieldMethodCalls.remove(field.getName());
}
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -47,9 +47,9 @@
static {
queryMethods.add("execute");
queryMethods.add("executeQuery");
- };
+ }
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
List<Integer> queryLocations;
List<LoopLocation> loops;
@@ -127,8 +127,8 @@
* holds the start and end position of a loop
*/
private static class LoopLocation {
- private int startPC;
- private int endPC;
+ private final int startPC;
+ private final int endPC;
public LoopLocation(int start, int end) {
startPC = start;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -191,9 +191,9 @@
|| (seen == INVOKESPECIAL)
|| (seen == INVOKESTATIC)) {
String clsName = getClassConstantOperand();
- String methodName = getNameConstantOperand();
- String methodInfo = clsName + ":" + methodName;
- String thisMethodInfo = (clsName.equals(getClassName())) ? (methodName + ":" + methodSig) : "0";
+ String mName = getNameConstantOperand();
+ String methodInfo = clsName + ":" + mName;
+ String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ":" + methodSig) : "0";
if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) {
if (isListenerMethod) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -174,15 +174,15 @@
/**
* looks for duplicate arguments that are not constants
*
- * @param stack the stack to look thru
+ * @param opStack the stack to look thru
* @param parms the arguments to the method being called
* @return if there are duplicates
*/
- private boolean duplicateArguments(OpcodeStack stack, Type[] parms)
+ private boolean duplicateArguments(OpcodeStack opStack, Type[] parms)
{
Set<String> args = new HashSet<String>();
for (int i = 0; i < parms.length; i++) {
- OpcodeStack.Item item = stack.getStackItem(i);
+ OpcodeStack.Item item = opStack.getStackItem(i);
String signature = item.getSignature();
if (signature.startsWith("L") && !signature.startsWith("Ljava/lang/") && (item.getConstant() == null)) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -42,7 +42,7 @@
private static Map<JavaClass, String> compareClasses = new HashMap<JavaClass, String>();
static {
try {
- compareClasses.put(Repository.lookupClass("java/lang/Comparable"), "compareTo:1:I");;
+ compareClasses.put(Repository.lookupClass("java/lang/Comparable"), "compareTo:1:I");
compareClasses.put(Repository.lookupClass("java/util/Comparator"), "compare:2:I");
} catch (ClassNotFoundException cnfe) {
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -159,8 +159,8 @@
private Method findCalledMethod() {
try {
- JavaClass cls = Repository.lookupClass(getClassConstantOperand());
- Method[] methods = cls.getMethods();
+ JavaClass clss = Repository.lookupClass(getClassConstantOperand());
+ Method[] methods = clss.getMethods();
String calledMethod = getNameConstantOperand();
String calledSignature = getSigConstantOperand();
for (Method m : methods) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -212,9 +212,9 @@
}
}
- private boolean syncIsMap(Object syncObject, Object collectionInfo) {
- if ((syncObject != null) && (collectionInfo != null) && syncObject.getClass().equals(collectionInfo.getClass()))
- return syncObject.equals(collectionInfo);
+ private boolean syncIsMap(Object syncObject, Object colInfo) {
+ if ((syncObject != null) && (colInfo != null) && syncObject.getClass().equals(colInfo.getClass()))
+ return syncObject.equals(colInfo);
//Something went wrong... don't report
return true;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -31,7 +31,7 @@
public class UseVarArgs extends PreorderVisitor implements Detector
{
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private JavaClass javaClass;
public UseVarArgs(BugReporter bugReporter) {
@@ -49,6 +49,7 @@
}
}
+ @Override
public void visitMethod(Method obj) {
try {
if (obj.isSynthetic()) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-07 02:59:33 UTC (rev 1568)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-09 04:53:45 UTC (rev 1569)
@@ -242,7 +242,7 @@
if (uo != null) {
if (uo instanceof Boolean) {
int reg = RegisterUtils.getAStoreReg(this, seen);
- localWOCollections.put(reg, Integer.valueOf(getPC()));
+ localWOCollections.put(Integer.valueOf(reg), Integer.valueOf(getPC()));
} else {
clearUserValue(item);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|