Skip to content

Conversation

@lgxbslgx
Copy link
Member

@lgxbslgx lgxbslgx commented Jan 29, 2021

Hi all,

The order of the arguments is wrong when using method Errors.InstanceofPatternNoSubtype.

This patch fixes it and revises the corresponding tests.
Thank you for taking the time to review.
And it may be good to fix JDK16 as well.

Best Regards.
-- xiong


Progress

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

Issue

  • JDK-8260566: Pattern type X is a subtype of expression type Y message is incorrect

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 29, 2021

👋 Welcome back lgxbslgx! 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 29, 2021
@openjdk
Copy link

openjdk bot commented Jan 29, 2021

@lgxbslgx 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 29, 2021
@mlbridge
Copy link

mlbridge bot commented Jan 29, 2021

Webrevs

@amaembo
Copy link
Contributor

amaembo commented Jan 29, 2021

The fix doesn't seem correct to me. Consider the code in the ticket:

public class Test {
  void test(String s) {
    if(s instanceof Object obj) {}
  }
}

The previous message was:

Test.java:3: error: pattern type Object is a subtype of expression type String
    if(s instanceof Object obj) {}

It was incorrect because Object is not a subtype of String

After applying this fix, the message will be

Test.java:3: error: pattern type String is a subtype of expression type Object
    if(s instanceof Object obj) {}

It's also incorrect because String is not a pattern type, and Object is not an expression type. A correct message would be
Test.java:3: error: expression type String is a subtype of pattern type Object
or
Test.java:3: error: pattern type Object is a supertype of expression type String

@lgxbslgx
Copy link
Member Author

@amaembo You are right. I will fix it later.

Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Thanks for Tagir for pointing out the mistake in the error message.

@openjdk
Copy link

openjdk bot commented Jan 29, 2021

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

8260566: Pattern type X is a subtype of expression type Y message is incorrect

Reviewed-by: jlahoda, tvaleev

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 1 new commit pushed to the master branch:

  • a5fb517: 8259404: Shenandoah: Fix time tracking in parallel_cleaning

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@lahodaj, @amaembo) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

Copy link
Contributor

@amaembo amaembo left a comment

Choose a reason for hiding this comment

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

Looks good to me! (I'm not an official reviewer though)

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 29, 2021
@lgxbslgx
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 29, 2021
@openjdk
Copy link

openjdk bot commented Jan 29, 2021

@lgxbslgx
Your change (at version 6bcda73) is now ready to be sponsored by a Committer.

@lgxbslgx
Copy link
Member Author

@amaembo @lahodaj Thanks for your review. Could I get your help to sponsor this patch?

@vicente-romero-oracle
Copy link
Contributor

/sponsor

@openjdk openjdk bot closed this Jan 29, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 29, 2021
@openjdk
Copy link

openjdk bot commented Jan 29, 2021

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

  • b2e582a: 8259905: Compiler treats 'sealed' keyword as 'var' keyword
  • 6415d3b: 8259584: SuperWord::fix_commutative_inputs checks in_bb(fin1) instead of in_bb(fin2)
  • b7b391b: 8260625: Rename MetaspaceExpand_lock
  • 22bfa5b: 8255837: Shenandoah: Remove ShenandoahConcurrentRoots class
  • 53f1b93: 8260518: Change default -mmacosx-version-min to 10.12
  • 24a2621: 8260592: jpackage tests fail when Desktop is not supported
  • d2b0ea1: 8260282: Add option to compress heap dumps created by -XX:+HeapDumpOnOutOfMemoryError
  • a5fb517: 8259404: Shenandoah: Fix time tracking in parallel_cleaning

Your commit was automatically rebased without conflicts.

Pushed as commit 739bbd0.

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

@lgxbslgx lgxbslgx deleted the JDK-8260566 branch January 30, 2021 08:19
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.

4 participants