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

8254979: Class.getSimpleName() returns non-empty for lambda and method #3038

Closed
wants to merge 1 commit into from

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Mar 16, 2021

java.lang.Class has a number of methods to return some kind of textual token associated with the class, including a type name, canonical name, simple name, and separately the results of toString().

Bug 8254979 notes that getSimpleName mentions returning the name in source code, but operationally returns a non-null result for synthetic classes, ones without benefit of source code representation. Since it is useful to return a non-null result in such cases, I've updated the spec to mention this case. The names of synthetic classes are not covered by the JLS; using a "$" in such names is customary, but not strictly required. The synthetic classes used to implement lambdas and method references as cited in the bug report include "$"'s.

Looking over the other "getFooName" methods, I don't think they need to be updated to handle this case.


Progress

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

Issue

  • JDK-8254979: Class.getSimpleName() returns non-empty for lambda and method

Reviewers

Download

To checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3038/head:pull/3038
$ git checkout pull/3038

To update a local copy of the PR:
$ git checkout pull/3038
$ git pull https://git.openjdk.java.net/jdk pull/3038/head

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Mar 16, 2021

👋 Welcome back darcy! 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 label Mar 16, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 16, 2021

@jddarcy The following label will be automatically applied to this pull request:

  • core-libs

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 core-libs label Mar 16, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 16, 2021

Webrevs

@openjdk
Copy link

@openjdk openjdk bot commented Mar 17, 2021

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

8254979: Class.getSimpleName() returns non-empty for lambda and method

Reviewed-by: rriggs, mchung

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 41 new commits pushed to the master branch:

  • cdf78e4: 8262298: G1BarrierSetC2::step_over_gc_barrier fails with assert "bad barrier shape"
  • 7674da4: 8262398: Shenandoah: Disable nmethod barrier and stack watermark when running with passive mode
  • 4f4ca0e: 8261671: X86 I2L conversion can be skipped for certain masked positive values
  • 5d87a21: 8263361: Incorrect arraycopy stub selected by C2 for SATB collectors
  • e152cc0: 8263677: Improve Character.isLowerCase/isUpperCase lookups
  • b63b5d4: 8263732: ProblemList serviceability/sa/ClhsdbSymbol.java on ZGC
  • 000012a: 8148937: (str) Adapt StringJoiner for Compact Strings
  • a707fcb: 8263723: [BACKOUT] MoveAndUpdateClosure::do_addr calls function with side-effects in an assert
  • 86e9cd9: 8263667: Avoid running GitHub actions on branches named pr/*
  • 41276eb: 8259863: doc: JShell snippet doesn't compile
  • ... and 31 more: https://git.openjdk.java.net/jdk/compare/8c1112a690480340bb9d69bfaa463b5619829808...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Mar 17, 2021
@jddarcy
Copy link
Member Author

@jddarcy jddarcy commented Mar 17, 2021

/integrate

@openjdk openjdk bot closed this Mar 17, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Mar 17, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 17, 2021

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

  • 83a49ef: 8263753: two new tests from JDK-8261671 fail with "Error. can not find ClassFileInstaller in test directory or libraries"
  • 24afa36: 8263726: divideToIntegralValue typo on BigDecimal documentation
  • cdf78e4: 8262298: G1BarrierSetC2::step_over_gc_barrier fails with assert "bad barrier shape"
  • 7674da4: 8262398: Shenandoah: Disable nmethod barrier and stack watermark when running with passive mode
  • 4f4ca0e: 8261671: X86 I2L conversion can be skipped for certain masked positive values
  • 5d87a21: 8263361: Incorrect arraycopy stub selected by C2 for SATB collectors
  • e152cc0: 8263677: Improve Character.isLowerCase/isUpperCase lookups
  • b63b5d4: 8263732: ProblemList serviceability/sa/ClhsdbSymbol.java on ZGC
  • 000012a: 8148937: (str) Adapt StringJoiner for Compact Strings
  • a707fcb: 8263723: [BACKOUT] MoveAndUpdateClosure::do_addr calls function with side-effects in an assert
  • ... and 33 more: https://git.openjdk.java.net/jdk/compare/8c1112a690480340bb9d69bfaa463b5619829808...master

Your commit was automatically rebased without conflicts.

Pushed as commit 26234b5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@@ -779,10 +779,9 @@ public boolean isAnnotation() {
}

/**
* Returns {@code true} if and only if this class has the synthetic modifier
* bit set.
*{@return {@code true} if and only if this class has the synthetic modifier

Choose a reason for hiding this comment

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

The braces around return tag are allowed? "{@return ...} vs. "@return ..." Seems inconsistent with other uses of return tags.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 17, 2021

Mailing list message from Joe Darcy on core-libs-dev:

Hello,

On 3/17/2021 3:56 PM, jmehrens wrote:

On Tue, 16 Mar 2021 22:24:55 GMT, Joe Darcy <darcy at openjdk.org> wrote:

[snip]

780:
781: /**
782: *{@return {@code true} if and only if this class has the synthetic modifier
The braces around return tag are allowed? "{@return ...} vs. "@return ..." Seems inconsistent with other uses of return tags.

Yes; after a recently-added javadoc feature in JDK 16:

??? JDK-8075778: Add javadoc tag to avoid duplication of return
information in simple situations.
??? https://bugs.openjdk.java.net/browse/JDK-8075778

The usage allow an explicit @return tag to be elided when it is the same
as the first sentence of the javadoc.

The docs in the java.compiler module have been updated to use the feature.

HTH,

-Joe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs integrated
4 participants