[Fb-contrib-commit] SF.net SVN: fb-contrib: [648] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-09-14 04:42:08
|
Revision: 648 http://svn.sourceforge.net/fb-contrib/?rev=648&view=rev Author: dbrosius Date: 2006-09-13 21:42:03 -0700 (Wed, 13 Sep 2006) Log Message: ----------- add StringBuffer to LSYC for classes compiled in 1.5 Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-09-12 04:05:23 UTC (rev 647) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-09-14 04:42:03 UTC (rev 648) @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; +import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; @@ -45,10 +46,11 @@ */ public class LocalSynchronizedCollection extends BytecodeScanningDetector { - private static Set<String> syncCtors = new HashSet<String>(); + private static Map<String, Integer> syncCtors = new HashMap<String, Integer>(); static { - syncCtors.add("java/util/Vector"); - syncCtors.add("java/util/Hashtable"); + syncCtors.put("java/util/Vector", Integer14.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/util/Hashtable", Integer14.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/lang/StringBuffer", Integer14.valueOf(Constants.MAJOR_1_5)); } private static Set<String> syncMethods = new HashSet<String>(); static { @@ -63,6 +65,8 @@ private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, CollectionRegInfo> syncRegs; + private int classVersion; + /** * constructs a LSYC detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -81,6 +85,7 @@ try { stack = new OpcodeStack(); syncRegs = new HashMap<Integer, CollectionRegInfo>(); + classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { stack = null; @@ -137,7 +142,8 @@ if (seen == INVOKESPECIAL) { if ("<init>".equals(getNameConstantOperand())) { - if (syncCtors.contains(getClassConstantOperand())) { + Integer minVersion = syncCtors.get(getClassConstantOperand()); + if ((minVersion != null) && (classVersion >= minVersion.intValue())) { tosIsSyncColReg = Integer14.valueOf(-1); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |