-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix for visit(PatternInstanceofExpression node) in NaiveASTFlattener #2285
Fix for visit(PatternInstanceofExpression node) in NaiveASTFlattener #2285
Conversation
8f17328
to
195299d
Compare
@twasik81 do you have issue describing where we can observe this behavior ? |
Here is the result of debugging: on code snippet: static boolean checkCollisionIfs(Object p1, Object p2) { |
@twasik81 : please sign ECA, see this https://api.eclipse.org/git/eca/status/gh/eclipse-jdt/eclipse.jdt.core/2285 |
@iloveeclipse : The ECA is already signed, but I'm not a committer to run the ECA validation tool again. |
I did it and it still failing. Please make sure the mail used in the commit matches the mail used for your Eclipse account. |
@iloveeclipse here is eclipse account view: |
@iloveeclipse: So if there is a problem with ECA validation of my account can someone else create the pull request with the same content? From my point of view is irrelevant who will be a contributor to this fix. |
But not from IP point of view, as long as commit is not identified to be from a person that signed ECA we cannot accept patches. I've created https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/4542 ticket, let see what IT guys say. |
@twasik81 : see https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/4542#note_2086634. |
@iloveeclipse : I've added this: |
@twasik81 : while the ECA check seem to be fixed now (see ticket), could you please add a test case or at least provide a simple snippet that shows the issue? |
Here is the code of test: import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.PatternInstanceofExpression;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
public class PatternInstanceOfExpressionTest {
@Test
public void testPatternInstanceOfExpression() {
String content = "public class Foo {" +
"static boolean checkCollisionIfs(Object p1, Object p2) {" +
"if (p1 instanceof Point(int x1, int y1)) {" +
"return x1 == x2 && y1 == y2;" +
"}}" +
"record Point(int x, int y) {}" +
"record ColoredPoint(Point T, String color) {}" +
"record Decorator(Object obj) {}" +
"}";
ASTParser parser = ASTParser.newParser(AST.JLS21);
parser.setSource(content.toCharArray());
CompilationUnit cunit = (CompilationUnit) parser.createAST(null);
NodeFinder astVisitor = new NodeFinder();
cunit.accept(astVisitor);
assertFalse(astVisitor.patternInstanceofExpression.toString().contains("MISSING"));
}
class NodeFinder extends ASTVisitor {
PatternInstanceofExpression patternInstanceofExpression;
public boolean visit(PatternInstanceofExpression node) {
patternInstanceofExpression = node;
return super.visit(node);
}
}
} |
Could you please add it in While doing so, please amend existing commit, rebase it on latest master state & force push to github. |
I've tried but I've failed to run a test under the specified package. |
Also-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
195299d
to
c4e27a8
Compare
…ipse-jdt#2285) eclipse-jdt#2285 Author: twasik <twasik@parasoft.com> Also-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
…ipse-jdt#2285) eclipse-jdt#2285 Author: twasik <twasik@parasoft.com> Also-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
What it does
The change resolves an issue with the "MISSING" string printed that is a result of parsing PatternInstanceofExpression.
How to test
Author checklist