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

Fixing pattern matching for binding patterns #5121

Merged
merged 2 commits into from
Dec 20, 2022

Conversation

matthiasblaesing
Copy link
Contributor


^Add meaningful description above

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

…ng pattern.

Originally provided as:
apache#3342

Manually ported to current state of (nb)javac.

Closes: apache#3342
@matthiasblaesing matthiasblaesing added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) tests labels Dec 18, 2022
@matthiasblaesing matthiasblaesing added this to the NB17 milestone Dec 18, 2022
- JavaHintsAnnotationProcessorTest makes assumptions about the error
  messages. On non-english locales this fails, so ensure an english
  locale is configured.

- Elements#getPackageElement in modular projects is to specific as it
  suppresses results where an empty package is found. To work around
  this fallback to Elements#getAllPackageElements, which misses this
  check.

- The golden analyser pattern in UtilitiesTest needs to be adjusted to
  reality: The $expr is reported twice: once as JCConstantLabel and
  once as JCIdent
@matthiasblaesing
Copy link
Contributor Author

@jlahoda this is an updated version of your PR #3342. The fix was pending and began to bitrot. As I think I triggered it and it was already reviewed by @jtulach I had a look and checked if I could fix the problems. I think I succeeded. Could you please double check?

@mbien you touched the tests so would be nice if you could also have a look.

Copy link
Contributor

@jlahoda jlahoda 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!

Comment on lines -383 to -385
assertPositions(result, positions[0], code, "$expr", "$stmts$", "$stmts$;", "case $expr: foo bar $stmts$;", "foo", "foo bar ");
assertPositions(result, positions[0], code, "$expr", "$expr", "$stmts$", "$stmts$;", "case $expr: foo bar $stmts$;", "foo", "foo bar ");
}
*/
Copy link
Member

Choose a reason for hiding this comment

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

awesome. Good to see this test case enabled.
I wanted to do that in:
#5107 (comment)
when we enabled tests for this module (and many others) which was completely turned off till now.

but I wasn't sure if the result was actually correct. So I commented it out instead of running the risk to commit a wrong test assumption.

@matthiasblaesing
Copy link
Contributor Author

Thank you for the review. Lets get this in.

@matthiasblaesing matthiasblaesing merged commit f49a242 into apache:master Dec 20, 2022
@matthiasblaesing matthiasblaesing deleted the hints_instanceof branch December 23, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants