[Fb-contrib-commit] SF.net SVN: fb-contrib:[1078] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2009-01-18 07:11:37
|
Revision: 1078 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1078&view=rev Author: dbrosius Date: 2009-01-18 07:11:31 +0000 (Sun, 18 Jan 2009) Log Message: ----------- don't report classes that implement calendar, other than GregorianCalendar - as odd as that is Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-01-02 02:10:49 UTC (rev 1077) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-01-18 07:11:31 UTC (rev 1078) @@ -62,6 +62,15 @@ collectionInterfaces.add("java/util/SortedMap"); } + private static JavaClass calendarClass; + static { + try { + calendarClass = Repository.lookupClass("java/util.Calendar"); + } catch (ClassNotFoundException cnfe) { + calendarClass = null; + } + } + private final BugReporter bugReporter; private OpcodeStack stack; private int lastPCs[]; @@ -434,10 +443,18 @@ String itemSig = item.getSignature(); //Rule out java.lang.Object as mergeJumps can throw away type info (BUG) if (!"Ljava/lang/Object;".equals(itemSig) && !"Ljava/util/Calendar;".equals(itemSig) && !"Ljava/util/GregorianCalendar;".equals(itemSig)) { - bugReporter.reportBug(new BugInstance(this, "SPP_INVALID_CALENDAR_COMPARE", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + try { + JavaClass cls = Repository.lookupClass(itemSig.substring(1, itemSig.length() - 1)); + if (!cls.implementationOf(calendarClass)) { + bugReporter.reportBug(new BugInstance(this, "SPP_INVALID_CALENDAR_COMPARE", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |