-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8265684: implement Sealed Classes as a standard feature in Java, javadoc changes #3613
8265684: implement Sealed Classes as a standard feature in Java, javadoc changes #3613
Conversation
👋 Welcome back vromero! A progress list of the required criteria for merging this PR into |
@vicente-romero-oracle The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, I think you have have deleted too much.
Although the code will work as you propose, at some point there will be new preview language features, and I think it would be better to leave a skeleton of the code in place, even if the set of preview language features is empty for now.
I think it would be better to limit the deletions to those lines of code that are specific to sealed classes and permits.
private static final Set<String> previewModifiers | ||
= Set.of("sealed", "non-sealed"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than delete those lines, for future support it might be better just to set previewModifiers to Collections.emptySet()
if (previewModifiers.contains(modifiersPart)) { | ||
mods.add(modifiersPart); | ||
mods.add(HtmlTree.SUP(links.createLink(htmlIds.forPreviewSection(typeElement), | ||
contents.previewMark))); | ||
} else { | ||
mods.add(modifiersPart); | ||
} | ||
|
||
mods.add(modifiersPart); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment, to leave previewModifiers in place as an empty set
private List<Content> getPreviewNotes(TypeElement el) { | ||
String className = el.getSimpleName().toString(); | ||
List<Content> result = new ArrayList<>(); | ||
PreviewSummary previewAPITypes = utils.declaredUsingPreviewAPIs(el); | ||
Set<TypeElement> previewAPI = new HashSet<>(previewAPITypes.previewAPI); | ||
Set<TypeElement> reflectivePreviewAPI = new HashSet<>(previewAPITypes.reflectivePreviewAPI); | ||
Set<TypeElement> declaredUsingPreviewFeature = new HashSet<>(previewAPITypes.declaredUsingPreviewFeature); | ||
Set<DeclarationPreviewLanguageFeatures> previewLanguageFeatures = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider not deleting this; just leave it empty
if (previewLanguageFeatures.contains(DeclarationPreviewLanguageFeatures.SEALED_PERMITS)) { | ||
previewLanguageFeatures.remove(DeclarationPreviewLanguageFeatures.SEALED); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines should go, because they specifically refer to SEALED stuff, but the rest of the block could stay
private Content withPreviewFeatures(String key, String className, String featureName, List<String> features) { | ||
String[] sep = new String[] {""}; | ||
ContentBuilder featureCodes = new ContentBuilder(); | ||
features.stream() | ||
.forEach(c -> { | ||
featureCodes.add(sep[0]); | ||
featureCodes.add(HtmlTree.CODE(new ContentBuilder().add(c))); | ||
sep[0] = ", "; | ||
}); | ||
return contents.getContent(key, | ||
HtmlTree.CODE(Text.of(className)), | ||
new HtmlTree(TagName.EM).add(featureName), | ||
featureCodes); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing here seems specific to SEALED, so leave it
Content link = | ||
classWriter.links.createLink(classWriter.htmlIds.forPreviewSection(typeElement), | ||
classWriter.contents.previewMark); | ||
permitsSpan.add(HtmlTree.SUP(link)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, yes, this is specific to permits, part of the sealed feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending who goes first, there may be a merge conflict with removing some of
the @SuppressWarnings
annotations.
public void testPartialMultiplePermitsWithSubtypes1(Path base) throws IOException { | ||
Path src = base.resolve("src"); | ||
tb.writeJavaFiles(src, | ||
"package p; public sealed class A permits B,C,D { }", | ||
"package p; public final class B extends A { }", | ||
"package p; public final class C extends A { }", | ||
"package p; sealed class D extends A permits D1, D2 { }", | ||
"package p; sealed class D extends A permits D1, D2 { }", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) don't delete the spaces; the class names were previously vertically aligned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done, thank for the review
@vicente-romero-oracle This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/issue add |
@vicente-romero-oracle Command syntax:
Some examples:
If issues are specified only by their ID, the title will be automatically retrieved from JBS. The project prefix ( |
/integrate |
@vicente-romero-oracle Since your change was applied there have been 4 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 7dcb9fd. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review the javadoc related changes to make sealed classes a final feature in Java. The patch is mostly removing preview features related code that is not necessary anymore in javadoc.
TIA
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3613/head:pull/3613
$ git checkout pull/3613
Update a local copy of the PR:
$ git checkout pull/3613
$ git pull https://git.openjdk.java.net/jdk pull/3613/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3613
View PR using the GUI difftool:
$ git pr show -t 3613
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3613.diff