Skip to content

Commit

Permalink
segregate constrained methods to low priority
Browse files Browse the repository at this point in the history
  • Loading branch information
mebigfatguy committed Dec 18, 2024
1 parent 02e31c4 commit 931b2e6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.bcel.classfile.LocalVariableTable;
import org.apache.bcel.classfile.Method;

import com.mebigfatguy.fbcontrib.collect.MethodInfo;
import com.mebigfatguy.fbcontrib.collect.Statistics;
import com.mebigfatguy.fbcontrib.utils.BugType;
import com.mebigfatguy.fbcontrib.utils.SerialVersionCalc;
Expand Down Expand Up @@ -274,8 +275,10 @@ public void visitCode(Code obj) {
super.visitCode(obj);

if ("Ljava/util/Collection;".equals(declaredReturnType) && !"Ljava/util/Collection;".equals(actualReturnType)) {
MethodInfo mi = Statistics.getStatistics().getMethodStatistics(getClassName(), getMethodName(), getMethodSig());

bugReporter.reportBug(
new BugInstance(this, BugType.IMC_IMMATURE_CLASS_COLLECTION_RETURN.name(), NORMAL_PRIORITY)
new BugInstance(this, BugType.IMC_IMMATURE_CLASS_COLLECTION_RETURN.name(), mi == null || mi.isDerived() ? LOW_PRIORITY : NORMAL_PRIORITY)
.addClass(this).addMethod(this).addSourceLine(this, 0));
}
}
Expand Down

0 comments on commit 931b2e6

Please sign in to comment.