Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] ConstructorInvocation visit

Gayan,

I can't find anything obviously missing from your code.

Can you check if the ast node you get from createAST contains that particular node in the first place? That should give us some idea what's going on. If you don't see it, please raise a bug to discuss further.

Regards,
Jay


Inactive hide details for Gayan Perera ---10/07/2019 09:32:35 PM---I'm trying to visit a compilation unit to find a certain ConGayan Perera ---10/07/2019 09:32:35 PM---I'm trying to visit a compilation unit to find a certain Constructor Invocation in that CU.

From: Gayan Perera <gayanper@xxxxxxxxx>
To: "Eclipse JDT general developers list." <jdt-dev@xxxxxxxxxxx>
Date: 10/07/2019 09:32 PM
Subject: [EXTERNAL] [jdt-dev] ConstructorInvocation visit
Sent by: jdt-dev-bounces@xxxxxxxxxxx





I'm trying to visit a compilation unit to find a certain Constructor
Invocation in that CU.
This is my parser setup

ASTParser parser = ASTParser.newParser(AST.JLS11);
parser.setSource(context.getCompilationUnit());
parser.setProject(context.getProject());
parser.setResolveBindings(true);
parser.setStatementsRecovery(true);
parser.setBindingsRecovery(true);
ASTNode ast = parser.createAST(monitor);
CompletionASTVistor visitor = new CompletionASTVistor(context);
ast.accept(visitor);

But my visit(ConstructorInvocation node) is never called.

My example code is as bellow

public class Foo {
 public static void main(String[] args) {
   Bar bar = new Bar(Arrays.asList("Hello"));
 }

 public static class Bar {
   public Bar(List<String> args) {}
 }
}

Any reason why the ConstructorInvocation for Bar(...) is not invoked ?

Thanks,
Gayan.
_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jdt-dev





Back to the top