Skip to content
Snippets Groups Projects
Commit 486bb7fe authored by jeffliu's avatar jeffliu
Browse files

[124920] Create a tool that generates a report of adopters' usage of WTP code

parent 758b7e1d
No related branches found
No related tags found
No related merge requests found
......@@ -120,54 +120,57 @@ public class APIRefCompatibilityScanner implements IPlatformRunnable
PluginRef pluginRef = (PluginRef)it.next();
String pluginId = pluginRef.getId();
ILocation loc = (ILocation)pluginId2APIInfo.get(pluginId);
ComponentAPI compAPI = new ComponentAPI();
compAPI.setLocation(loc);
compAPI.load();
for (Iterator it2 = pluginRef.getClassRefs().iterator(); it2.hasNext();)
if (loc != null)
{
ClassRef classRef = (ClassRef)it2.next();
String className = classRef.getName();
if (className.endsWith("[]"))
className = className.substring(0, className.length() - 2);
int i = className.lastIndexOf('.');
String pkgName = (i != -1) ? className.substring(0, i) : "";
String localName = (i != -1) ? className.substring(i + 1) : className;
PackageAPI pkgAPI = compAPI.getPackageAPI(pkgName);
if (pkgAPI != null)
ComponentAPI compAPI = new ComponentAPI();
compAPI.setLocation(loc);
compAPI.load();
for (Iterator it2 = pluginRef.getClassRefs().iterator(); it2.hasNext();)
{
ClassAPI classAPI = pkgAPI.getClassAPI(localName);
if (classAPI != null)
ClassRef classRef = (ClassRef)it2.next();
String className = classRef.getName();
if (className.endsWith("[]"))
className = className.substring(0, className.length() - 2);
int i = className.lastIndexOf('.');
String pkgName = (i != -1) ? className.substring(0, i) : "";
String localName = (i != -1) ? className.substring(i + 1) : className;
PackageAPI pkgAPI = compAPI.getPackageAPI(pkgName);
if (pkgAPI != null)
{
for (Iterator it3 = classRef.getMethodRefs().iterator(); it3.hasNext();)
ClassAPI classAPI = pkgAPI.getClassAPI(localName);
if (classAPI != null)
{
MethodRef methodRef = (MethodRef)it3.next();
String name = methodRef.getName();
String desc = methodRef.getDescriptor();
if (hasMethod(classAPI, name, desc))
for (Iterator it3 = classRef.getMethodRefs().iterator(); it3.hasNext();)
{
classRef.removeMethodRef(name, desc);
MethodRef methodRef = (MethodRef)it3.next();
String name = methodRef.getName();
String desc = methodRef.getDescriptor();
if (hasMethod(classAPI, name, desc))
{
classRef.removeMethodRef(name, desc);
}
}
}
for (Iterator it3 = classRef.getFieldRefs().iterator(); it3.hasNext();)
{
FieldRef fieldRef = (FieldRef)it3.next();
String name = fieldRef.getName();
String desc = fieldRef.getDescriptor();
if (hasField(classAPI, name))
for (Iterator it3 = classRef.getFieldRefs().iterator(); it3.hasNext();)
{
classRef.removeFieldRef(name, desc);
FieldRef fieldRef = (FieldRef)it3.next();
String name = fieldRef.getName();
String desc = fieldRef.getDescriptor();
if (hasField(classAPI, name))
{
classRef.removeFieldRef(name, desc);
}
}
if (classRef.getMethodRefs().isEmpty() && classRef.getFieldRefs().isEmpty())
{
pluginRef.removeClassRef(classRef.getName());
}
}
if (classRef.getMethodRefs().isEmpty() && classRef.getFieldRefs().isEmpty())
{
pluginRef.removeClassRef(classRef.getName());
}
}
}
}
if (pluginRef.getClassRefs().isEmpty())
{
refs.removePluginRef(pluginId);
if (pluginRef.getClassRefs().isEmpty())
{
refs.removePluginRef(pluginId);
}
}
}
if (!refs.getPluginRefs().isEmpty())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment