Skip to content
Snippets Groups Projects
Commit 425c058c authored by jeffliu's avatar jeffliu
Browse files

[94771] API Reporting Tool: Some APIs are using non-API types

parent ac88cc9d
No related branches found
No related tags found
No related merge requests found
......@@ -385,13 +385,22 @@ public class ComponentAPIEmitter extends AbstractEmitter implements IClazzVisito
{
if (typeName != null)
{
// If not overwritten, inner class inherts usages from base class
int i = typeName.indexOf('$');
String baseTypeName = (i != -1) ? typeName.substring(0, i) : null;
Type baseType = null;
List types = pkg.getTypes();
for (Iterator it = types.iterator(); it.hasNext();)
{
Type type = (Type)it.next();
if (typeName.equals(type.getName()))
String name = type.getName();
if (typeName.equals(name))
return type;
if (baseTypeName != null && baseType == null && baseTypeName.equals(name))
baseType = type;
}
if (baseType != null)
return baseType;
}
return null;
}
......
......@@ -278,10 +278,15 @@ public class ComponentAPIViolationEmitter extends AbstractEmitter
Package pkg = (Package)pkgIt.next();
if (pkgName.equals(pkg.getName()))
{
// if not overwritten, inner class inherits usages from base class
int index = typeName.indexOf('$');
String baseTypeName = (index != -1) ? typeName.substring(0, index) : null;
Type baseType = null;
for (Iterator typeIt = pkg.getTypes().iterator(); typeIt.hasNext();)
{
Type type = (Type)typeIt.next();
if (typeName.equals(type.getName()))
String name = type.getName();
if (typeName.equals(name))
{
if (ref && !type.isReference())
return false;
......@@ -293,6 +298,22 @@ public class ComponentAPIViolationEmitter extends AbstractEmitter
return false;
return true;
}
if (baseTypeName != null && baseType == null && baseTypeName.equals(name))
{
baseType = type;
}
}
if (baseType != null)
{
if (ref && !baseType.isReference())
return false;
if (subclass && !baseType.isSubclass())
return false;
if (implement && !baseType.isImplement())
return false;
if (instantiate && !baseType.isInstantiate())
return false;
return true;
}
return pkg.isApi();
}
......
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