-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add support for enhanced instanceof #7290
Comments
This syntax usage might result in bunch of regressions in existing Checks that try to analyze scope of variables. |
Is this what you would expect?
I haven't ran regression on this yet, but if this is the expected tree, I can start on this. |
@nmancus1 thank you. |
That's correct, I've just modified the |
May be it will be better to make this part as VARIABLE_DEF token? |
@strkkk How would this be:
|
Here's the results of the normal regression tests, using ANTLR grammar regression test here: |
Note that the docs says this is a pattern rather than a variable def:
So the tree should be more complicated:
In the future, the pattern matching may grow to something like
in this case there still be the |
This is a good point. Regarding |
I'm not sure. Either replace it or wrap it. From a possible future point of view, the wrap is better. In this case, we have the ability to extend the patterns. And all existing checks like VariableName will handle such variables. Especially HiddenField - it is important to catch code like this:
On the other hand, the check VisibilityModifier (and, possible other) need to be updated to ignore matching variables as well. The bad news is that we can't do regression tests, because we're going to test code that doesn't exist yet. |
…ern matching" grammar
…ern matching" grammar
Fix is merged. |
Link to JEP
It is for java 14
https://docs.oracle.com/en/java/javase/14/docs/specs/patterns-instanceof-jls.html#jls-6.3.1
UPDATE: here is copy of discussion that explain why selected final variant of AST.
telegram-discussion.txt
The text was updated successfully, but these errors were encountered: