Skip to content
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

Closed

Conversation

vicente-romero-oracle
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle commented Apr 22, 2021

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

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8265684: implement Sealed Classes as a standard feature in Java, javadoc changes

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 22, 2021

👋 Welcome back vromero! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 22, 2021
@openjdk
Copy link

openjdk bot commented Apr 22, 2021

@vicente-romero-oracle The following label will be automatically applied to this pull request:

  • javadoc

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.

@openjdk openjdk bot added the javadoc javadoc-dev@openjdk.org label Apr 22, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 22, 2021

Copy link
Contributor

@jonathan-gibbons jonathan-gibbons left a 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.

Comment on lines 85 to 89
private static final Set<String> previewModifiers
= Set.of("sealed", "non-sealed");

Copy link
Contributor

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()

Comment on lines 195 to 193
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);
Copy link
Contributor

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<>();
Copy link
Contributor

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

Comment on lines -2259 to -2262
if (previewLanguageFeatures.contains(DeclarationPreviewLanguageFeatures.SEALED_PERMITS)) {
previewLanguageFeatures.remove(DeclarationPreviewLanguageFeatures.SEALED);
}
Copy link
Contributor

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

Comment on lines 2281 to 2296
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);
}

Copy link
Contributor

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

Comment on lines -188 to -191
Content link =
classWriter.links.createLink(classWriter.htmlIds.forPreviewSection(typeElement),
classWriter.contents.previewMark);
permitsSpan.add(HtmlTree.SUP(link));
Copy link
Contributor

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

Copy link
Contributor

@jonathan-gibbons jonathan-gibbons left a 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 { }",
Copy link
Contributor

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

Copy link
Contributor Author

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

@openjdk
Copy link

openjdk bot commented Apr 30, 2021

@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:

8265684: implement Sealed Classes as a standard feature in Java, javadoc changes

Reviewed-by: jjg

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 master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 30, 2021
@vicente-romero-oracle
Copy link
Contributor Author

/issue add

@openjdk
Copy link

openjdk bot commented May 20, 2021

@vicente-romero-oracle Command syntax:

  • /issue [add|remove] <id>[,<id>,...]
  • /issue [add] <id>: <description>
  • `/issue create [PX] /[subcomponent]

Some examples:

  • /issue add JDK-1234567,4567890
  • /issue remove JDK-4567890
  • /issue 1234567: Use this exact title
  • `/issue create hotspot/jfr
  • `/issue create P4 core-libs/java.nio

If issues are specified only by their ID, the title will be automatically retrieved from JBS. The project prefix (JDK- in the above examples) is optional. Separate multiple issue IDs using either spaces or commas.

@vicente-romero-oracle
Copy link
Contributor Author

/integrate

@openjdk openjdk bot closed this May 20, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 20, 2021
@openjdk
Copy link

openjdk bot commented May 20, 2021

@vicente-romero-oracle Since your change was applied there have been 4 commits pushed to the master branch:

  • 0fa9223: 8260517: implement Sealed Classes as a standard feature in Java
  • 31b98e1: 8265319: implement Sealed Classes as a standard feature in Java, javax.lang.model changes
  • 726785b: 8267155: runtime/os/TestTracePageSizes times out
  • 8e3549f: 8266332: Adler32 intrinsic for x86 64-bit platforms

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated javadoc javadoc-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants