[Fb-contrib-commit] SF.net SVN: fb-contrib: [884] trunk/fb-contrib
Brought to you by:
dbrosius
From: <dbr...@us...> - 2007-05-27 21:13:54
|
Revision: 884 http://svn.sourceforge.net/fb-contrib/?rev=884&view=rev Author: dbrosius Date: 2007-05-27 14:13:53 -0700 (Sun, 27 May 2007) Log Message: ----------- don't report .intern on static strings in static initializers Modified Paths: -------------- trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-04-29 19:37:54 UTC (rev 883) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-05-27 21:13:53 UTC (rev 884) @@ -5,6 +5,7 @@ { private static final double pi = 3.14; private static final double e = 2.72; + public static final String FALSE_POSITIVE = "INTERN_OK_HERE".intern(); static enum Flap { Smack, Jack }; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-04-29 19:37:54 UTC (rev 883) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-05-27 21:13:53 UTC (rev 884) @@ -165,13 +165,17 @@ } } else if ("java/lang/String".equals(className)) { if ("intern".equals(methodName)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - if (item.getConstant() != null) { - bugReporter.reportBug(new BugInstance(this, "SPP_INTERN_ON_CONSTANT", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + String owningMethod = getMethod().getName(); + if (!"<clinit>".equals(owningMethod)) + { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (item.getConstant() != null) { + bugReporter.reportBug(new BugInstance(this, "SPP_INTERN_ON_CONSTANT", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |