Skip to content

JDK-8250768: javac should be adapted to changes in JEP 12 #703

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

Closed
wants to merge 59 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Oct 16, 2020

This is an update to javac and javadoc, to introduce support for Preview APIs, and generally improve javac and javadoc behavior to more closely adhere to JEP 12.

The notable changes are:

  • adding support for Preview APIs (javac until now supported primarily only preview language features, and APIs associated with preview language features). This includes:
    • the @PreviewFeature annotation has boolean attribute "reflective", which should be true for reflective Preview APIs, false otherwise. This replaces the existing "essentialAPI" attribute with roughly inverted meaning.
    • the preview warnings for preview APIs are auto-suppressed as described in the JEP 12. E.g. the module that declares the preview API is free to use it without warnings
  • improving error/warning messages. Please see [1] for a list of cases/examples.
  • class files are only marked as preview if they are using a preview feature. [1] also shows if a class file is marked as preview or not.
  • the PreviewFeature annotation has been moved to jdk.internal.javac package (originally was in the jdk.internal package).
  • Preview API in JDK's javadoc no longer needs to specify @Preview tag in the source files. javadoc will auto-generate a note for @PreviewFeature elements, see e.g. [2] and [3] (non-reflective and reflective API, respectively). A summary of preview elements is also provided [4]. Existing uses of @Preview have been updated/removed.
  • non-JDK javadoc is also enhanced to auto-generate preview notes for uses of Preview elements, and for declaring elements using preview language features [5].

Please also see the CSR [6] for more information.

[1] http://cr.openjdk.java.net/~jlahoda/8250768/JEP12-errors-warnings-v6.html
[2] http://cr.openjdk.java.net/~jlahoda/8250768/jdk.javadoc.00/api/java.base/java/lang/Record.html
[3] http://cr.openjdk.java.net/~jlahoda/8250768/jdk.javadoc.00/api/java.compiler/javax/lang/model/element/RecordComponentElement.html
[4] http://cr.openjdk.java.net/~jlahoda/8250768/jdk.javadoc.00/api/preview-list.html
[5] http://cr.openjdk.java.net/~jlahoda/8250768/test.javadoc.00/
[6] https://bugs.openjdk.java.net/browse/JDK-8250769


Progress

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

Issue

  • JDK-8250768: javac should be adapted to changes in JEP 12

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/703/head:pull/703
$ git checkout pull/703

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 16, 2020

👋 Welcome back jlahoda! 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.

@jonathan-gibbons
Copy link
Contributor

jonathan-gibbons commented Nov 6, 2020 via email

@lahodaj
Copy link
Contributor Author

lahodaj commented Nov 6, 2020

Thanks for noticing Chris and @jonathan-gibbons. Fixed in 61264fe, updated javadoc:
http://cr.openjdk.java.net/~jlahoda/8250768/jdk.javadoc.02/api/preview-list.html

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.

I have a mild queasiness about this new overloaded use of the word "Summary", since "summary tables" are normally the summary of the contents of a declaration, like fields and methods of a class.

That being said, the usage is primarily internal, and I have no overwhelmingly wonderful alternative, and (overloading aside) the term is accurate.

So, OK for now. We can change it later if we want to.

I like how you managed to merge both the builder and writer for the new summary classes.

@@ -2942,4 +2944,256 @@ public String toString() {
return first + ":" + second;
}
}

/**
* Return the set of preview language features used to declare the given element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Returns"

Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build changes still good.

@openjdk
Copy link

openjdk bot commented Dec 9, 2020

@lahodaj this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8250768
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Dec 9, 2020
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 6, 2021

@lahodaj This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Jan 7, 2021
@lahodaj
Copy link
Contributor Author

lahodaj commented Jan 7, 2021

I've merged the PR with the recent mainline, and I'd like to integrate sometime soon. Please let me know if there's any issue with that. Thanks!

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.

I've looked at all the files that were marked as changed since I last looked at them.

There's one suggested enhancement to reduce string bashing between Utils and ClassWriterImpl that could be done now or later.

There's a pending conflict with a PR of mine to change to use a new type HtmlId for HTML ids. This JEP12 work has been in progress for a while, and so it would be good to get it in before the HtmlId work, and I'll deal with the merge conflict in due course.

@@ -188,15 +192,34 @@ protected TypeElement getCurrentPageElement() {

@Override @SuppressWarnings("preview")
public void addClassSignature(String modifiers, Content classInfoTree) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems less than ideal for this method to take a String and to then have to take it apart and reassemble it. It looks like it should be possible (and conceptually better) to change the signature to List<String> and to make the corresponding change to utils.modifiersToString, probably renaming it as utils.modifiersToStrings or something like that, and dropping the always-true argument for trailingSpace.

But, the code is OK as is, and the suggestion is just for an enhancement, so is OK to defer it, if you would prefer.

@@ -0,0 +1,303 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) now 2021

*/
public abstract class SummaryListWriter<L extends SummaryAPIListBuilder> extends SubWriterHolderWriter {

private String getAnchorName(SummaryElementKind kind) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads-up: at some point this will conflict with another change in progress/review, to introduce a new type HtmlId to use instead of String for ids.

* @param headerKey table header key for the summary table
* @param contentTree the content tree to which the summary table will be added
*/
protected void addSummaryAPI(SortedSet<Element> apiList, String id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads-up, here's another occurrence of where there will be a conflict for ids.

@@ -151,8 +151,6 @@ doclet.AnnotationInterfaces=Annotation Interfaces
doclet.Exceptions=Exceptions
doclet.Errors=Errors
doclet.Classes=Classes
doclet.packages=packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm mildly surprised to see all these items being removed...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were used from DeprecatedListWriter.getSummaryKey which is removed by this patch (and is unused in the current mainline, as far as I know).

@@ -0,0 +1,225 @@
/*
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Year

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I assume you will do a bulk update for affected files.

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Jan 8, 2021
@jonathan-gibbons
Copy link
Contributor

jonathan-gibbons commented Jan 8, 2021 via email

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Jan 8, 2021
@lahodaj
Copy link
Contributor Author

lahodaj commented Jan 11, 2021

/integrate

@openjdk openjdk bot closed this Jan 11, 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 Jan 11, 2021
@openjdk
Copy link

openjdk bot commented Jan 11, 2021

@lahodaj Since your change was applied there have been 22 commits pushed to the master branch:

  • 18a37f9: 8259368: Zero: UseCompressedClassPointers does not depend on UseCompressedOops
  • a03e22b: 8253910: UseCompressedClassPointers depends on UseCompressedOops in vmError.cpp
  • e0d748d: 8258606: os::print_signal_handlers() should resolve the function name of the handlers
  • bd34418: 8258445: Move make/templates to make/data
  • d21a0ea: 8258449: Move make/hotspot/symbols to make/data
  • 3974fd4: 8259451: Zero: skip serviceability/sa tests, set vm.hasSA to false
  • bb247b0: 8259392: Zero error reporting is broken after JDK-8255711
  • 2806bf2: 8259475: Fix bad merge in compilerOracle
  • b72de3c: 8259385: Cleanup unused assignment
  • 9154f64: 8254973: CompletableFuture.ThreadPerTaskExecutor does not throw NPE in #execute
  • ... and 12 more: https://git.openjdk.java.net/jdk/compare/090bd3afc37555582bde61d03e2e32350ae5d714...master

Your commit was automatically rebased without conflicts.

Pushed as commit 2354882.

💡 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
build build-dev@openjdk.org compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated javadoc javadoc-dev@openjdk.org kulla kulla-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

6 participants