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

Thanks Manoj,

Yes i also figured itÂout thanks to AST viewer plugin.

Thanks,
Gayan

On Thu, Jul 11, 2019, 15:39 Manoj Palat <manoj.palat@xxxxxxxxxx> wrote:

Hi Gayan,

There is no ConstructorInvocation node here in the first place â what you are referring to is actually a ClassInstanceCreation and hence you donât see the visit(ConstructorInvocation) never called. So please create a visit(ClassInstanceCreation c) override instead.

Any easy way to do this is to first put the example source code in Eclipse and check AST View for the corresponding statement.


Regards,

Manoj


jdt-dev-bounces@xxxxxxxxxxx wrote on 07/11/2019 10:33:10 AM:

> From: "Jayaprakash Arthanareeswaran" <jarthana@xxxxxxxxxx>

> To: "Eclipse JDT general developers list." <jdt-dev@xxxxxxxxxxx>
> Date: 07/11/2019 10:34 AM
> Subject: [EXTERNAL] Re: [jdt-dev] ConstructorInvocation visit
> Sent by: jdt-dev-bounces@xxxxxxxxxxx
>
> 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
>
>
> [image removed] Gayan 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
>
>
>
> _______________________________________________
> 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

_______________________________________________
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