[Fb-contrib-commit] SF.net SVN: fb-contrib: [532] trunk/fb-contrib/samples
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-05-12 04:36:48
|
Revision: 532 Author: dbrosius Date: 2006-05-11 21:36:39 -0700 (Thu, 11 May 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=532&view=rev Log Message: ----------- fix false positive when a field is 'returned' from the first part of a trinary. Modified Paths: -------------- trunk/fb-contrib/samples/NMCS_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java Modified: trunk/fb-contrib/samples/NMCS_Sample.java =================================================================== --- trunk/fb-contrib/samples/NMCS_Sample.java 2006-05-11 23:32:58 UTC (rev 531) +++ trunk/fb-contrib/samples/NMCS_Sample.java 2006-05-12 04:36:39 UTC (rev 532) @@ -18,6 +18,8 @@ private Set<String> test3 = new HashSet<String>(); + private List<String> test4 = new Vector<String>(); + public String test1() { StringBuffer sb = new StringBuffer(); @@ -46,4 +48,9 @@ return temp; } + public List<String> test4(boolean b) + { + return b ? test4 : new Vector<String>(); + } + } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-11 23:32:58 UTC (rev 531) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-12 04:36:39 UTC (rev 532) @@ -266,10 +266,18 @@ String fieldName = getNameConstantOperand(); collectionFields.remove(fieldName); break; + + case GOTO: + case GOTO_W: + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + FieldAnnotation fa = item.getField(); + if (fa != null) { + collectionFields.remove(fa.getFieldName()); + } + } + break; } - - //look for code that alters the collection, passes it to a method, returns it, etc - //watch out for aliases } finally { stack.sawOpcode(this, seen); if (isSyncCollection) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |