diff --git a/src/share/classes/jdk/codetools/apidiff/model/API.java b/src/share/classes/jdk/codetools/apidiff/model/API.java index 110bc1e..96c434a 100644 --- a/src/share/classes/jdk/codetools/apidiff/model/API.java +++ b/src/share/classes/jdk/codetools/apidiff/model/API.java @@ -58,6 +58,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.Name; import javax.lang.model.element.PackageElement; +import javax.lang.model.element.RecordComponentElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.VariableElement; @@ -965,8 +966,17 @@ public String visitExecutable(ExecutableElement ee, APIDocs d) { return d.getDescription(signatureVisitor.getSignature(ee)); } + @Override + public String visitRecordComponent(RecordComponentElement tpe, APIDocs d) { + // record components do not have distinct API descriptions of their own: + // they are documented by @param tags in the enclosing element + throw new IllegalArgumentException(tpe.getKind() + " " + tpe.getSimpleName()); + } + @Override public String visitTypeParameter(TypeParameterElement tpe, APIDocs d) { + // type parameters do not have distinct API descriptions of their own: + // they are documented by @param tags in the enclosing element throw new IllegalArgumentException(tpe.getKind() + " " + tpe.getSimpleName()); } diff --git a/src/share/classes/jdk/codetools/apidiff/model/RecordComponentComparator.java b/src/share/classes/jdk/codetools/apidiff/model/RecordComponentComparator.java index f246ad5..96d7e3e 100644 --- a/src/share/classes/jdk/codetools/apidiff/model/RecordComponentComparator.java +++ b/src/share/classes/jdk/codetools/apidiff/model/RecordComponentComparator.java @@ -70,8 +70,8 @@ public boolean compare(Position rcPos, APIMap rcMap) { allEqual = checkMissing(rcPos, rcMap); if (rcMap.size() > 1) { allEqual &= compareSignatures(rcPos, rcMap); - allEqual &= compareDocComments(rcPos, rcMap); - allEqual &= compareApiDescriptions(rcPos, rcMap); + // note that record components do not have distinct API descriptions or doc comments + // of their own; they are documented by @param tags in the enclosing element } } finally { reporter.completed(rcPos, allEqual); diff --git a/src/share/classes/jdk/codetools/apidiff/model/TypeParameterComparator.java b/src/share/classes/jdk/codetools/apidiff/model/TypeParameterComparator.java index fcc4d67..7eeff80 100644 --- a/src/share/classes/jdk/codetools/apidiff/model/TypeParameterComparator.java +++ b/src/share/classes/jdk/codetools/apidiff/model/TypeParameterComparator.java @@ -89,6 +89,9 @@ public boolean compare(Position pos, APIMap map) { allEquals &= compareNames(pos, map) & compareBounds(pos, map) & new AnnotationComparator(map.keySet(), accessKind, reporter).compareAll(pos, map); + // note that type parameters do not have distinct API descriptions or doc comments + // of their own; they are documented by @param tags in the enclosing element + return allEquals; }