Skip to content

Conversation

@cushon
Copy link
Contributor

@cushon cushon commented Mar 7, 2025

Hello,

Please consider this fix for JDK-8351431, which allows type annotations on the class type of a new class creation expression to be retrieved by the Compiler Tree API.

Currently Attr is skipping annotateTypeSecondStage for all new class types, but the special case only needs to be applied to anonymous new class creation expressions to be consistent with logic in Annotate:

if (tree.def == null) {
scan(tree.clazz);
}
scan(tree.args);
// the anonymous class instantiation if any will be visited separately.

This also removes a check of isNewClass (now isNewAnonymousClass) in InvalidCanonicalConstructorInRecord, because the field was only set before descending into a JCNewClass.clazz, which can't contain return statements.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8351431: Type annotations on new class creation expressions can't be retrieved (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23946

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 7, 2025

👋 Welcome back cushon! 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
Copy link

openjdk bot commented Mar 7, 2025

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

8351431: Type annotations on new class creation expressions can't be retrieved

Reviewed-by: vromero

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

  • cc870d4: 8352088: Call of com.sun.jdi.ThreadReference.threadGroups() can lock up target VM
  • d979bd8: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15
  • 49cb7aa: 8339114: DaCapo xalan performance with -XX:+UseObjectMonitorTable
  • d32ff13: 8353117: Crash: assert(id >= ThreadIdentifier::initial() && id < ThreadIdentifier::current()) failed: must be reasonable)
  • a0677d9: 8353263: Parallel: Remove locking in PSOldGen::resize
  • 8608b16: 8348887: Create IR framework test for JDK-8347997
  • 23eb648: 8353545: Improve debug info for StartOptionTest
  • 4f97c4c: 8349211: Add support for intrusive trees to the utilities red-black tree
  • c9baa8a: 8352418: Add verification code to check that the associated loop nodes of useless Template Assertion Predicates are dead
  • b80b04d: 8353329: Small memory leak when create GrowableArray with initial size 0
  • ... and 34 more: https://git.openjdk.org/jdk/compare/4d1de46cb882bade5781255b646f623b55d7180f...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 rfr Pull request is ready for review label Mar 7, 2025
@openjdk
Copy link

openjdk bot commented Mar 7, 2025

@cushon 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 Mar 7, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 7, 2025

Webrevs

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

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

lgtm

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 2, 2025
@cushon
Copy link
Contributor Author

cushon commented Apr 3, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Apr 3, 2025

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

  • 64b691a: 8271870: G1: Add objArray splitting when scanning object with evacuation failure
  • b428cda: 8349686: [s390x] C1: Improve Class.isInstance intrinsic
  • 70e3250: 8352419: Test tools/jpackage/share/ErrorTest.java#id0 and #id1 fail
  • 296d9d6: 8353345: C2 asserts because maskShiftAmount modifies node without deleting the hash
  • 3ceabf0: 8353359: C2: Or(I|L)Node::Ideal is missing AddNode::Ideal call
  • b263292: 8353484: JFR: Simplify EventConfiguration
  • ffca4f2: 8353264: ZGC: Windows heap unreserving is broken
  • f7a94fe: 8352585: Add special case handling for Float16.max/min x86 backend
  • 9c5ed23: 8349988: Change cgroup version detection logic to not depend on /proc/cgroups
  • 00a038e: 8353341: C2: removal of a Mod[DF]Node crashes when the node is already dead
  • ... and 52 more: https://git.openjdk.org/jdk/compare/4d1de46cb882bade5781255b646f623b55d7180f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 3, 2025

@cushon Pushed as commit 6b7b324.

💡 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

compiler compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants