[118591] Methods overridden should inherit javadocs from super class
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/API2ComponentAPI.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/API2ComponentAPI.java
index a842646..2a2b449 100644
--- a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/API2ComponentAPI.java
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/API2ComponentAPI.java
@@ -291,7 +291,8 @@
int i = className.lastIndexOf('.');
String packageName = (i != -1) ? className.substring(0, i) : "";
String localName = (i != -1) ? className.substring(i + 1) : className;
- boolean isAPI = isAPI(reader, pluginId, packageName, localName);
+ ClassAPIInfo classAPIInfo = isAPI(reader, pluginId, packageName, localName);
+ boolean isAPI = classAPIInfo.api;
if (readInterface)
{
String superClassName = new String(reader.getSuperclassName()).replace('/', '.');
@@ -347,7 +348,7 @@
int methodAccessFlag = methods[j].getAccessFlags();
if (!Modifier.isPrivate(methodAccessFlag))
{
- if (!isExclusive || Modifier.isPublic(methodAccessFlag) || Modifier.isProtected(methodAccessFlag))
+ if (!isExclusive || Modifier.isPublic(methodAccessFlag) || (classAPIInfo.subclass && Modifier.isProtected(methodAccessFlag)))
{
MethodAPI methodAPI = new MethodAPI();
methodAPI.setName(new String(methods[j].getName()));
@@ -408,17 +409,17 @@
return true;
}
- private boolean isAPI(IClassFileReader reader, String pluginId, String packageName, String localName)
+ private ClassAPIInfo isAPI(IClassFileReader reader, String pluginId, String packageName, String localName)
{
boolean innerClass = localName.indexOf('$') != -1;
int classAccessFlag = reader.getAccessFlags();
if (Modifier.isPrivate(classAccessFlag))
{
- return false;
+ return new ClassAPIInfo(false, false);
}
else if (innerClass && !Modifier.isPublic(classAccessFlag) && !Modifier.isProtected(classAccessFlag))
{
- return false;
+ return new ClassAPIInfo(false, false);
}
else
{
@@ -431,7 +432,7 @@
// package protected, check exclusive
if (pkg.isExclusive() && !Modifier.isPublic(classAccessFlag) && !Modifier.isProtected(classAccessFlag))
{
- return false;
+ return new ClassAPIInfo(false, false);
}
Type type;
int innerClassSep = localName.indexOf('$');
@@ -443,26 +444,26 @@
{
if (!type.isReference() && !type.isSubclass() && !type.isImplement() && !type.isInstantiate())
{
- return false;
+ return new ClassAPIInfo(false, false);
}
else
{
- return true;
+ return new ClassAPIInfo(true, type.isSubclass());
}
}
else
{
- return pkg.isApi();
+ return new ClassAPIInfo(pkg.isApi(), true);
}
}
else
{
- return false;
+ return new ClassAPIInfo(false, false);
}
}
else
{
- return false;
+ return new ClassAPIInfo(false, false);
}
}
}
@@ -581,6 +582,18 @@
}
}
+ private class ClassAPIInfo
+ {
+ public boolean api;
+ public boolean subclass;
+
+ public ClassAPIInfo(boolean api, boolean subclass)
+ {
+ this.api = api;
+ this.subclass = subclass;
+ }
+ }
+
private class ClassHierarchyInfo
{
private String superClass;
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/violation/NonAPIDependencyScanner.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/violation/NonAPIDependencyScanner.java
index c0f2bbb..d10e1cb 100644
--- a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/violation/NonAPIDependencyScanner.java
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/api/violation/NonAPIDependencyScanner.java
@@ -232,26 +232,27 @@
private ComponentAPIViolation getViolations(ComponentAPI compAPI)
{
+ String compName = compAPI.getName();
ComponentAPIViolation v = new ComponentAPIViolation();
- v.setName(compAPI.getName());
+ v.setName(compName);
for (Iterator it = compAPI.getPackageAPIs().iterator(); it.hasNext();)
- v.addAllViolations(genAPIViolation((PackageAPI)it.next()));
+ v.addAllViolations(genAPIViolation((PackageAPI)it.next(), compName));
return v;
}
- private List genAPIViolation(PackageAPI pkgAPI)
+ private List genAPIViolation(PackageAPI pkgAPI, String compName)
{
List classViolations = new ArrayList();
for (Iterator it = pkgAPI.getClassAPIs().iterator(); it.hasNext();)
{
- ClassViolation classViolation = getViolations((ClassAPI)it.next());
+ ClassViolation classViolation = getViolations((ClassAPI)it.next(), compName);
if (classViolation != null)
classViolations.add(classViolation);
}
return classViolations;
}
- private ClassViolation getViolations(ClassAPI classAPI)
+ private ClassViolation getViolations(ClassAPI classAPI, String compName)
{
ClassViolation classViolation = new ClassViolation();
classViolation.setName(classAPI.getName());
@@ -260,9 +261,9 @@
if (superClassName != null)
{
if (isInterface(classAPI.getAccess()))
- isSuperClassAPI = isAPI(superClassName, false, false, true, false);
+ isSuperClassAPI = isAPI(compName, superClassName, false, false, true, false);
else
- isSuperClassAPI = isAPI(superClassName, false, true, false, false);
+ isSuperClassAPI = isAPI(compName, superClassName, false, true, false, false);
if (!isSuperClassAPI)
{
SuperViolation superViolation = new SuperViolation();
@@ -278,7 +279,7 @@
String desc = methodAPI.getDescriptor();
String returnTypeDesc = Signature.getReturnType(desc);
String returnType = toFullyQualifiedName(returnTypeDesc);
- if (Signature.getTypeSignatureKind(returnTypeDesc) != Signature.BASE_TYPE_SIGNATURE && !isAPI(returnType, true, false, false, false))
+ if (Signature.getTypeSignatureKind(returnTypeDesc) != Signature.BASE_TYPE_SIGNATURE && !isAPI(compName, returnType, true, false, false, false))
{
ReturnViolation returnViolation = new ReturnViolation();
returnViolation.setName(returnType);
@@ -288,7 +289,7 @@
for (int j = 0; j < params.length; j++)
{
String param = toFullyQualifiedName(params[j]);
- if (Signature.getTypeSignatureKind(params[j]) != Signature.BASE_TYPE_SIGNATURE && !isAPI(param, true, false, false, false))
+ if (Signature.getTypeSignatureKind(params[j]) != Signature.BASE_TYPE_SIGNATURE && !isAPI(compName, param, true, false, false, false))
{
ParamViolation paramViolation = new ParamViolation();
paramViolation.setName(param);
@@ -299,7 +300,7 @@
for (int j = 0; j < throwTypes.length; j++)
{
String throwType = toFullyQualifiedName(throwTypes[j]);
- if (Signature.getTypeSignatureKind(throwTypes[j]) != Signature.BASE_TYPE_SIGNATURE && !isAPI(throwType, true, false, false, false))
+ if (Signature.getTypeSignatureKind(throwTypes[j]) != Signature.BASE_TYPE_SIGNATURE && !isAPI(compName, throwType, true, false, false, false))
{
ThrowViolation throwViolation = new ThrowViolation();
throwViolation.setName(throwType);
@@ -314,7 +315,7 @@
FieldAPI fieldAPI = (FieldAPI)it.next();
String desc = new String(fieldAPI.getDescriptor());
String field = toFullyQualifiedName(desc);
- if (Signature.getTypeSignatureKind(desc) != Signature.BASE_TYPE_SIGNATURE && !isAPI(field, true, false, false, false))
+ if (Signature.getTypeSignatureKind(desc) != Signature.BASE_TYPE_SIGNATURE && !isAPI(compName, field, true, false, false, false))
{
FieldViolation fieldViolation = new FieldViolation();
fieldViolation.setName(fieldAPI.getName());
@@ -361,7 +362,7 @@
return true;
}
- private boolean isAPI(String className, boolean ref, boolean subclass, boolean implement, boolean instantiate)
+ private boolean isAPI(String compName, String className, boolean ref, boolean subclass, boolean implement, boolean instantiate)
{
if (include(className))
{
@@ -398,9 +399,9 @@
{
if (ref && !type.isReference())
return false;
- if (subclass && !type.isSubclass())
+ if (subclass && !type.isSubclass() && !((compXML.getName().equals(compName) || compXML.getPlugin(compName) != null) && type.isReference()))
return false;
- if (implement && !type.isImplement())
+ if (implement && !type.isImplement() && !((compXML.getName().equals(compName) || compXML.getPlugin(compName) != null) && type.isReference()))
return false;
if (instantiate && !type.isInstantiate())
return false;
diff --git a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/model/ComponentXML.java b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/model/ComponentXML.java
index 5299de7..04ad4fa 100644
--- a/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/model/ComponentXML.java
+++ b/archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/model/ComponentXML.java
@@ -159,6 +159,13 @@
return plugins.values();
}
+ public Plugin getPlugin(String id)
+ {
+ if (plugins == null)
+ return null;
+ return (Plugin)plugins.get(id);
+ }
+
public void addPlugin(Plugin plugin)
{
if (plugins == null)