[jdk11u-dev] RFR: 8253700: spurious "extends Throwable" at end of Optional.orElseThrow method declaration
Amos Shi
ashi at openjdk.org
Fri Jun 14 01:32:51 UTC 2024
Backport of [JDK-8253700](https://bugs.openjdk.org/browse/JDK-8253700)
- This is an unclean backport, contains two commits
- Commit 1. is generated by `git patch` command, is a clean apply of the original commit
- Commit 2. contains
- a, Manual merge of the following `.rej` files
- b. Manually fixed the `TestThrows.java` on Java 11 compile error, and fixed the test case to match the `javadoc` 11 output
`.rej` files
- `src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java.rej`
- This file has been manually merged into the `commit 2`
@@ -51,6 +51,7 @@
import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.MEMBER;
import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS;
import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.RECEIVER_TYPE;
+import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.THROWS_TYPE;
/**
* Print method and constructor info.
@@ -254,19 +255,16 @@
*/
protected Content getExceptions(ExecutableElement member) {
List<? extends TypeMirror> exceptions = utils.asInstantiatedMethodType(typeElement, member).getThrownTypes();
- Content htmltree = new ContentBuilder();
- if (!exceptions.isEmpty()) {
- Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
- htmltree.add(link);
- for (int i = 1; i < exceptions.size(); i++) {
- htmltree.add(",");
- htmltree.add(DocletConstants.NL);
- Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
- exceptions.get(i)));
- htmltree.add(exceptionLink);
+ Content htmlTree = new ContentBuilder();
+ for (TypeMirror t : exceptions) {
+ if (!htmlTree.isEmpty()) {
+ htmlTree.add(",");
+ htmlTree.add(DocletConstants.NL);
}
+ Content link = writer.getLink(new LinkInfoImpl(configuration, THROWS_TYPE, t));
+ htmlTree.add(link);
}
- return htmltree;
+ return htmlTree;
}
protected TypeElement implementsMethodInIntfac(ExecutableElement method,
- `src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkInfoImpl.java.rej`
- This file has been manually merged into the `commit 2`
@@ -208,14 +208,19 @@
PROPERTY_COPY,
/**
- * A receiver type
+ * A receiver type.
*/
RECEIVER_TYPE,
/**
- * A record component within a class signature
+ * A record component within a class signature.
*/
- RECORD_COMPONENT
+ RECORD_COMPONENT,
+
+ /**
+ * A type thrown from a method.
+ */
+ THROWS_TYPE
}
public final HtmlConfiguration configuration;
Testing
- Local: Test passed on MacOS 14.5
- `TestThrows.java`: Test results: passed: 1
- Pipeline:
- Testing Machine:
-------------
Commit messages:
- Backport 8cf8e463c623b3908befb0af289749b47a793267 Manual Merge and Fix Java 11 compile errors
- Backport 8cf8e463c623b3908befb0af289749b47a793267
Changes: https://git.openjdk.org/jdk11u-dev/pull/2772/files
Webrev: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=2772&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8253700
Stats: 107 lines in 3 files changed: 100 ins; 2 del; 5 mod
Patch: https://git.openjdk.org/jdk11u-dev/pull/2772.diff
Fetch: git fetch https://git.openjdk.org/jdk11u-dev.git pull/2772/head:pull/2772
PR: https://git.openjdk.org/jdk11u-dev/pull/2772
More information about the jdk-updates-dev
mailing list