Skip to content

JDK-8300857: State return value for Types.asElement(NoType) explicitly #12159

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 4 commits into from

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Jan 24, 2023

Just sending out the proposed API changes for now, will add tests later.

Please also review the corresponding CSR JDK-8300951.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change requires CSR request JDK-8300951 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issues

  • JDK-8300857: State return value for Types.asElement(NoType) explicitly
  • JDK-8300951: State return value for Types.asElement(NoType) explicitly (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12159/head:pull/12159
$ git checkout pull/12159

Update a local copy of the PR:
$ git checkout pull/12159
$ git pull https://git.openjdk.org/jdk pull/12159/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12159

View PR using the GUI difftool:
$ git pr show -t 12159

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12159.diff

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jan 24, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 24, 2023

👋 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 Pull request is ready for review label Jan 24, 2023
@openjdk
Copy link

openjdk bot commented Jan 24, 2023

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

  • compiler

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 compiler compiler-dev@openjdk.org label Jan 24, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 24, 2023

Webrevs

Copy link
Member

@pavelrappo pavelrappo left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. It looks good. However, I'll leave it to compiler experts to formally approve the PR and review the CSR.

* <li>{@linkplain TypeKind#EXECUTABLE executable types}
* <li>{@linkplain TypeKind#MODULE module pseudo-types}
* <li>{@linkplain TypeKind#NONE "none" pseudo-types}
* <li>{@linkplain TypeKind#NULL null types}
Copy link
Member

Choose a reason for hiding this comment

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

Was that extra whitespace between NULL and null intended?

@jddarcy
Copy link
Member Author

jddarcy commented Jan 24, 2023

PS I purposely did not provide an explicit specification on how a TypeMirror with a kind of OTHER or ERROR might be handled here to preserve implementation flexibility.

As an aside, if we had more time for the original JSR 269 effort, we would likely have worked so that there was a PrimitiveElement enum to host the element form of the built-in primitive types, but we ran out of time do to that work. That would have allowed a fuller round-trip relation of

element.asType().asElement()

returning something equal to the initial value.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Jan 25, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 25, 2023
@jddarcy
Copy link
Member Author

jddarcy commented Jan 25, 2023

Quick discussion of the revised version of the patch:

  • After looking at the javac implementation, I added spec and implementation support for the type mirrors of packages and modules returning the element for the package or module. This was a very small addendum to add support and allows round-tripping in more cases.

  • Neither union types nor intersection types are in the explicitly mapped or explicitly not mapped lists. This types are generally returned from trees and elements modeling the inside of method bodies rather than the declaration-level structures in the standardized API.

The remaining explicitly listed types-without-elements are straightforward to generate via the standard APIs.

Comment on lines 48 to 50
* The type may be a {@link DeclaredType} or {@link TypeVariable},
* or a pseudo-type for a {@linkplain TypeKind#PACKAGE package} or
* {@linkplain TypeKind#MODULE module}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Commas look erratic.

The type may be A or B, or C

Comment on lines 77 to 78


Copy link
Contributor

Choose a reason for hiding this comment

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

excess blank lines?

}

private void testRoundTripCases() {
expectRoundTrip(eltUtils.getPackageElement("java.lang"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a type element as well as the package element and module element

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.

approved with quibbles for optional update

@jonathan-gibbons
Copy link
Contributor

I like the presence of the new test ;-)

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Jan 26, 2023
@openjdk
Copy link

openjdk bot commented Jan 26, 2023

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

8300857: State return value for Types.asElement(NoType) explicitly

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

  • 7e951f4: 8301092: Add benchmark for CRC32
  • adcfd25: 8301098: Remove dead code FileMapInfo::stop_sharing_and_unmap()
  • 9f0887e: 8296661: Typo Found In CSSParser.java
  • ccf2f58: 8300806: Update googletest to v1.13.0
  • edf1e1a: 8300592: ASan build does not correctly propagate options to some test launchers
  • e80b5ea: 8299635: Hotspot update for deprecated sprintf in Xcode 14
  • f279c75: 8300805: Update autoconf build-aux files with latest from 2022-09-17
  • a23ff63: 8301086: jdk/internal/util/ByteArray/ReadWriteValues.java fails with CompilationError
  • 61775c8: 8300997: Add curl support to createJMHBundle.sh
  • 8a47429: 8295944: Move the Http2TestServer and related classes into a package of its own
  • ... and 36 more: https://git.openjdk.org/jdk/compare/1a3cb8c5018bc016c2ad6b078e4abe13b39d151c...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 Pull request is ready to be integrated label Jan 26, 2023
@jddarcy
Copy link
Member Author

jddarcy commented Jan 26, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jan 26, 2023

Going to push as commit b5a4744.
Since your change was applied there have been 46 commits pushed to the master branch:

  • 7e951f4: 8301092: Add benchmark for CRC32
  • adcfd25: 8301098: Remove dead code FileMapInfo::stop_sharing_and_unmap()
  • 9f0887e: 8296661: Typo Found In CSSParser.java
  • ccf2f58: 8300806: Update googletest to v1.13.0
  • edf1e1a: 8300592: ASan build does not correctly propagate options to some test launchers
  • e80b5ea: 8299635: Hotspot update for deprecated sprintf in Xcode 14
  • f279c75: 8300805: Update autoconf build-aux files with latest from 2022-09-17
  • a23ff63: 8301086: jdk/internal/util/ByteArray/ReadWriteValues.java fails with CompilationError
  • 61775c8: 8300997: Add curl support to createJMHBundle.sh
  • 8a47429: 8295944: Move the Http2TestServer and related classes into a package of its own
  • ... and 36 more: https://git.openjdk.org/jdk/compare/1a3cb8c5018bc016c2ad6b078e4abe13b39d151c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 26, 2023
@openjdk openjdk bot closed this Jan 26, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 26, 2023
@openjdk
Copy link

openjdk bot commented Jan 26, 2023

@jddarcy Pushed as commit b5a4744.

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

@jddarcy jddarcy deleted the JDK-8300857 branch October 26, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants