Skip to content

Commit 1884101

Browse files
7903852: apidiff: IllegalArgumentException for RECORD_COMPONENT
Reviewed-by: prappo, iris
1 parent 10a494c commit 1884101

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/share/classes/jdk/codetools/apidiff/model/API.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import javax.lang.model.element.ModuleElement;
5959
import javax.lang.model.element.Name;
6060
import javax.lang.model.element.PackageElement;
61+
import javax.lang.model.element.RecordComponentElement;
6162
import javax.lang.model.element.TypeElement;
6263
import javax.lang.model.element.TypeParameterElement;
6364
import javax.lang.model.element.VariableElement;
@@ -965,8 +966,17 @@ public String visitExecutable(ExecutableElement ee, APIDocs d) {
965966
return d.getDescription(signatureVisitor.getSignature(ee));
966967
}
967968

969+
@Override
970+
public String visitRecordComponent(RecordComponentElement tpe, APIDocs d) {
971+
// record components do not have distinct API descriptions of their own:
972+
// they are documented by @param tags in the enclosing element
973+
throw new IllegalArgumentException(tpe.getKind() + " " + tpe.getSimpleName());
974+
}
975+
968976
@Override
969977
public String visitTypeParameter(TypeParameterElement tpe, APIDocs d) {
978+
// type parameters do not have distinct API descriptions of their own:
979+
// they are documented by @param tags in the enclosing element
970980
throw new IllegalArgumentException(tpe.getKind() + " " + tpe.getSimpleName());
971981
}
972982

src/share/classes/jdk/codetools/apidiff/model/RecordComponentComparator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public boolean compare(Position rcPos, APIMap<Element> rcMap) {
7070
allEqual = checkMissing(rcPos, rcMap);
7171
if (rcMap.size() > 1) {
7272
allEqual &= compareSignatures(rcPos, rcMap);
73-
allEqual &= compareDocComments(rcPos, rcMap);
74-
allEqual &= compareApiDescriptions(rcPos, rcMap);
73+
// note that record components do not have distinct API descriptions or doc comments
74+
// of their own; they are documented by @param tags in the enclosing element
7575
}
7676
} finally {
7777
reporter.completed(rcPos, allEqual);

src/share/classes/jdk/codetools/apidiff/model/TypeParameterComparator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public boolean compare(Position pos, APIMap<TypeParameterElement> map) {
8989
allEquals &= compareNames(pos, map)
9090
& compareBounds(pos, map)
9191
& new AnnotationComparator(map.keySet(), accessKind, reporter).compareAll(pos, map);
92+
// note that type parameters do not have distinct API descriptions or doc comments
93+
// of their own; they are documented by @param tags in the enclosing element
94+
9295

9396
return allEquals;
9497
}

0 commit comments

Comments
 (0)