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

8253385: annotation processors remove varargs information from record components #709

Closed

Conversation

vicente-romero-oracle
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle commented Oct 16, 2020

Please review this fix for a corner case bug. Essentially for code like:

import java.lang.annotation.*;

@Target({ElementType.TYPE_USE})
@interface Simple {}

record R(@Simple int ...val) {
    static void test() {
        R rec = new R(10, 20);
    }
}

assuming that there is an AP present, after the first annotation processing round, the record component's symbol is set to null and thus the flags info is lost. So once the symbols and their types are determined again after every annotation processing round, there is no recollection that the record component was a varargs. Remember that the AST for the record component declaration is not kept but it is used to extract information from it and to derive compiler generated code like fields, canonical constructor, etc. The proposed solution is to keep the information about the vararg-ness of the record component in a dedicated field in the record component so that this information can be recovered later on as needed.

TIA,
Vicente


Progress

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

Testing

Linux x64 Linux x86 Windows x64 macOS x64
Build ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed) (2/9 failed) (1/9 failed)

Failed test tasks

Issue

  • JDK-8253385: annotation processors remove varargs information from record components

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 16, 2020

👋 Welcome back vromero! 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 Oct 16, 2020
@openjdk
Copy link

openjdk bot commented Oct 16, 2020

@vicente-romero-oracle 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 label Oct 16, 2020
@mlbridge
Copy link

mlbridge bot commented Oct 16, 2020

Webrevs

Copy link
Contributor

@jonathan-gibbons jonathan-gibbons left a comment

minor suggestions in comments

@@ -1785,19 +1785,27 @@ public void setData(Object data) {
*/
private final int pos;

private boolean isVarargs;
Copy link
Contributor

@jonathan-gibbons jonathan-gibbons Nov 4, 2020

Choose a reason for hiding this comment

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

field can be final?

Copy link
Contributor Author

@vicente-romero-oracle vicente-romero-oracle Nov 4, 2020

Choose a reason for hiding this comment

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

sure will do

@Target({ElementType.TYPE_USE})
@interface Simple {}

record R(@Simple int ...val) {
Copy link
Contributor

@jonathan-gibbons jonathan-gibbons Nov 4, 2020

Choose a reason for hiding this comment

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

(minor) unusual typography for "int ...val". Suggest "int... val"

@Target({ElementType.TYPE_USE})
@interface Simple {}

record R(@Simple int ...val) {
Copy link
Contributor

@jonathan-gibbons jonathan-gibbons Nov 4, 2020

Choose a reason for hiding this comment

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

(minor) unusual typography for "int ...val". Suggest "int... val"

@openjdk
Copy link

openjdk bot commented Nov 4, 2020

@vicente-romero-oracle 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:

8253385: annotation processors remove varargs information from record components

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

  • 26e7ef7: 8252870: Finalize (remove "incubator" from) jpackage
  • 804bd72: 8255128: linux x86 build failure with libJNIPoint.c
  • 160759c: 8255838: Use 32-bit immediate movslq in macro assembler if 64-bit value fits in 32 bits on x86_64

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Nov 4, 2020
@vicente-romero-oracle
Copy link
Contributor Author

vicente-romero-oracle commented Nov 4, 2020

/integrate

@openjdk openjdk bot closed this Nov 4, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 4, 2020
@openjdk
Copy link

openjdk bot commented Nov 4, 2020

@vicente-romero-oracle Since your change was applied there have been 6 commits pushed to the master branch:

  • 166c728: 8255858: Add debug agent support for storing thread names
  • a0ade22: 8255900: x86: Reduce impact when VerifyOops is disabled
  • 29db1dc: 8255886: Shenandoah: Resolve cset address truncation and register clash in interpreter LRB
  • 26e7ef7: 8252870: Finalize (remove "incubator" from) jpackage
  • 804bd72: 8255128: linux x86 build failure with libJNIPoint.c
  • 160759c: 8255838: Use 32-bit immediate movslq in macro assembler if 64-bit value fits in 32 bits on x86_64

Your commit was automatically rebased without conflicts.

Pushed as commit 97a81ce.

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

@vicente-romero-oracle
Copy link
Contributor Author

vicente-romero-oracle commented Nov 5, 2020

thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler integrated
2 participants