[Fb-contrib-commit] SF.net SVN: fb-contrib: [410] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-07 14:27:48
|
Revision: 410 Author: dbrosius Date: 2006-04-07 07:27:43 -0700 (Fri, 07 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=410&view=rev Log Message: ----------- prescreen for NEWARRAY or ANEWARRAY Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-04-07 13:58:31 UTC (rev 409) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-04-07 14:27:43 UTC (rev 410) @@ -18,13 +18,17 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.BitSet; import java.util.HashMap; import java.util.Map; +import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.VersionTransition; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -73,15 +77,28 @@ } /** + * looks for methods that contain a NEWARRAY or ANEWARRAY opcodes + * + * @param method the context object of the current method + * @return if the class uses synchronization + */ + public boolean prescreen(Method method) { + BitSet bytecodeSet = VersionTransition.getBytecodeSet(getClassContext(), method); + return (bytecodeSet != null) && (bytecodeSet.get(Constants.NEWARRAY) || bytecodeSet.get(Constants.ANEWARRAY)); + } + + /** * implements the visitor to reset the stack of opcodes * * @param obj the context object for the currently parsed code block */ @Override public void visitCode(Code obj) { - stack.resetForMethodEntry(this); - wrappers.clear(); - super.visitCode(obj); + if (prescreen(getMethod())) { + stack.resetForMethodEntry(this); + wrappers.clear(); + super.visitCode(obj); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |