[Fb-contrib-commit] SF.net SVN: fb-contrib: [537] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-05-16 03:10:57
|
Revision: 537 Author: dbrosius Date: 2006-05-15 20:10:39 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=537&view=rev Log Message: ----------- don't report NMCS on fields that are passed as parameters to methods in ordinary methods Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-15 03:31:05 UTC (rev 536) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-16 03:10:39 UTC (rev 537) @@ -288,7 +288,12 @@ } } } + removeCollectionParameters(); break; + + case INVOKESTATIC: + removeCollectionParameters(); + break; case ARETURN: if (stack.getStackDepth() > 0) { @@ -372,6 +377,24 @@ } } } + + /** + * removes collection fields that are passed to other methods as arguments + * + * @param seen the opcode of the currently parsed instruction + */ + private void removeCollectionParameters() { + int parmCount = Type.getArgumentTypes(getSigConstantOperand()).length; + if (stack.getStackDepth() >= parmCount) { + for (int i = 0; i < parmCount; i++) { + OpcodeStack.Item item = stack.getStackItem(i); + FieldAnnotation fa = item.getField(); + if (fa != null) { + collectionFields.remove(fa.getFieldName()); + } + } + } + } /** * holds information about a field, namely the annotation and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |