[Fb-contrib-commit] SF.net SVN: fb-contrib:[1098] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-02-21 08:18:12
|
Revision: 1098
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1098&view=rev
Author: dbrosius
Date: 2009-02-21 08:18:02 +0000 (Sat, 21 Feb 2009)
Log Message:
-----------
add org.apache.xerces to the list of internal packages
Modified Paths:
--------------
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2009-02-21 06:01:17 UTC (rev 1097)
+++ trunk/fb-contrib/etc/messages.xml 2009-02-21 08:18:02 UTC (rev 1098)
@@ -893,9 +893,14 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse">
<Details>
<![CDATA[
- <p>looks for classes that rely on sun internal classes in the package com.sun.xxxx. As these classes
- are not officially released from sun, they are subject to change or removal, and thus,
+ <p>looks for classes that rely on internal classes in the various apis or libraries. As these
+ classes are not officially released from the api vendor, they are subject to change or removal, and thus,
should not be counted on.</p>
+ Packages that shouldn't be used are:
+ <ul>
+ <li>com.sun.xxx</li>
+ <li>org.apache.xerces.xxx</li>
+ </ul>
]]>
</Details>
</Detector>
@@ -2347,13 +2352,18 @@
</BugPattern>
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
- <ShortDescription>class relies on internal sun classes</ShortDescription>
- <LongDescription>class {0} relies on internal sun classes</LongDescription>
+ <ShortDescription>class relies on internal api classes</ShortDescription>
+ <LongDescription>class {0} relies on internal api classes</LongDescription>
<Details>
<![CDATA[
- <p>This class makes use of internal sun classes in the package com.sun.xxx. As these
+ <p>This class makes use of internal api classes. As these
classes are not documented, nor externally released as part of the api, they are subject
to change or removal. You should not be using these classes.</p>
+ Packages that shouldn't be used are:
+ <ul>
+ <li>com.sun.xxx</li>
+ <li>org.apache.xerces.xxx</li>
+ </ul>
]]>
</Details>
</BugPattern>
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-02-21 06:01:17 UTC (rev 1097)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-02-21 08:18:02 UTC (rev 1098)
@@ -38,8 +38,11 @@
{
private final BugReporter bugReporter;
private static final Set<String> internalPackages = new HashSet<String>();
+ private static final Set<String> externalPackages = new HashSet<String>();
static {
internalPackages.add("com/sun/");
+ internalPackages.add("org/apache/xerces/");
+ externalPackages.add("org/apache/xerces/xni/");
}
/**
@@ -51,7 +54,7 @@
}
/**
- * implements the visitor to look for classes that reference com.sun.xxx classes
+ * implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes
* by looking for class constants in the constant pool
*
* @param classContext the context object of the currently parsed class
@@ -88,11 +91,23 @@
* @returns whether the class is internal
*/
private boolean isInternal(String clsName) {
+ boolean internal = false;
for (String internalPackage : internalPackages) {
- if (clsName.startsWith(internalPackage))
- return true;
+ if (clsName.startsWith(internalPackage)) {
+ internal = true;
+ break;
+ }
}
- return false;
+ if (internal) {
+ for (String externalPackage : externalPackages) {
+ if (clsName.startsWith(externalPackage)) {
+ internal = false;
+ break;
+ }
+ }
+ }
+
+ return internal;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|