-
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
8322936: Update blessed-modifier-order.sh for default, sealed, and non-sealed #17242
Conversation
👋 Welcome back prappo! A progress list of the required criteria for merging this PR into |
@pavelrappo 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. |
@pavelrappo 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 14 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
echo "Tries to get it right even within javadoc comments," | ||
echo "and even if the list of modifiers spans 2 lines." | ||
echo | ||
echo "See:" | ||
echo "https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Modifier.html#toString-int-" |
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.
Looking at the latest docs for Modifier#toString()
it also needs a corresponding update
https://download.java.net/java/early_access/jdk23/docs/api/java.base/java/lang/reflect/Modifier.html#toString(int)
and if that is done, then we can keep referring to its javadoc.
References to javadoc and jls both have problems of becoming stale over time.
There is no way to reference the "latest" spec via a URL.
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.
it also needs a corresponding update
https://download.java.net/java/early_access/jdk23/docs/api/java.base/java/lang/reflect/Modifier.html#toString(int)
From the preceding discussion, it follows that it cannot be done: https://mail.openjdk.org/pipermail/core-libs-dev/2024-January/117381.html
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.
Thanks ... now I see ...
When I originally wrote this script I recall hitting some false positives - a price we pay for having this modify comments. Don't blindly apply all suggestions!
I don't recall considering "default".
It seems we no longer have a single canonical reference for modifier order.
(or more generally, a well-maintained high quality Java program style guide ...)
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.
Thanks ... now I see ...
FWIW, @jddarcy thinks we can still improve Modifier.toString(int)
. See this comment and its parent thread: #17239 (comment)
/integrate |
Going to push as commit 37a6172.
Your commit was automatically rebased without conflicts. |
@pavelrappo Pushed as commit 37a6172. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Are you planning on addressing this in a separate PR? If not, maybe you can at least open an issue in JBS. |
I was not planning to do that, but I sure can. I'll try to publish the PR within a week. Thanks. |
Please review this PR to update
blessed-modifier.order.sh
for thedefault
,sealed
,non-sealed
, andstrictfp
modifiers.In a discussion preceding this PR, it was agreed that the script should better refer to relevant JLS sections rather than to
java.lang.reflect.Modifier#toString
, which does not model Java source.the
sealed
andnon-sealed
class or interface modifiers were introduced in JEP 409, but have never been accounted forthe
default
method modifier was introduced in Java 8, but has not been explicitly accounted for. It's unclear whether it was an omission or a conscious decision. The current edition of JLS suggests that in compilable, modern and customary formatted code,default
appears alone and, thus, is always canonically ordered.However, a somewhat similar argument applies to the
public
modifier on an interface method. Its use is discouraged, yet the script would enforce its order ifpublic
appears not alone.So for completeness, this PR proposes to explicitly account for
default
.strictfp
class, interface, or method modifier became obsolete in JDK 17.I've run the updated script on JDK. The script found 8 missorted
sealed
and 20 missorteddefault
. The script also found 3 false positivedefault
:jdk/src/java.desktop/share/classes/java/awt/dnd/DragSource.java
Lines 526 to 527 in 249d553
jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java
Line 91 in 98da03a
jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java
Line 193 in 6765f90
None of those findings are addressed in this PR.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17242/head:pull/17242
$ git checkout pull/17242
Update a local copy of the PR:
$ git checkout pull/17242
$ git pull https://git.openjdk.org/jdk.git pull/17242/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17242
View PR using the GUI difftool:
$ git pr show -t 17242
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17242.diff
Webrev
Link to Webrev Comment