[Fb-contrib-commit] SF.net SVN: fb-contrib:[1590] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-08-22 04:43:34
|
Revision: 1590
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1590&view=rev
Author: dbrosius
Date: 2010-08-22 04:43:28 +0000 (Sun, 22 Aug 2010)
Log Message:
-----------
catch someMethod().staticMethod();
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2010-08-22 04:40:23 UTC (rev 1589)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2010-08-22 04:43:28 UTC (rev 1590)
@@ -35,7 +35,7 @@
{
enum State {SEEN_NOTHING, SEEN_INVOKE, SEEN_POP}
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private LineNumberTable lnTable;
private State state;
private int invokePC;
@@ -58,6 +58,7 @@
lnTable = obj.getLineNumberTable();
if (lnTable != null) {
state = State.SEEN_NOTHING;
+ invokePC = -1;
super.visitCode(obj);
}
} finally {
@@ -76,8 +77,8 @@
switch (state)
{
case SEEN_NOTHING:
- if ((seen == INVOKEINTERFACE)
- || (seen == INVOKEVIRTUAL)) {
+ if (seen == INVOKEINTERFACE
+ || seen == INVOKEVIRTUAL) {
String sig = getSigConstantOperand();
Type retType = Type.getReturnType(sig);
if (retType.getSignature().startsWith("L")) {
@@ -99,7 +100,7 @@
break;
case SEEN_POP:
- if ((seen >= ACONST_NULL) && (seen <= DCONST_1)) {
+ if (seen >= ACONST_NULL && seen <= DCONST_1 || seen == INVOKESTATIC) {
if (lnTable.getSourceLine(invokePC) == lnTable.getSourceLine(getPC())) {
bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY)
.addClass(this)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|