Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Binding not resolved => ClassPath Problem ?(Can't resolve MethodInvocation despite resolveBindings placed to true)
Binding not resolved => ClassPath Problem ? [message #696302] Wed, 13 July 2011 16:40 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 8
Registered: June 2011
Junior Member
Hi People,

I'm willing to parse some Java files contained in a "normal" directory, that is i'm not working with a java project in a workspace.
Let's asumme in my directory DIR
DIR/src/main/a.java
DIR/src/main/aTest.java

I use AST visitor to get content of files, assume first aTest.java.
This file contains code which calls methods from a.java.
That's why i place it in my sourceClassPath.
Here is roughly my code to parse this file :

		ASTParser parser = ASTParser.newParser(AST.JLS3);
		parser.setEnvironment(new String[]{},
				new String[]{"DIR/src/main},
				null,true);
		parser.setResolveBindings(true);
		parser.setBindingsRecovery(true);
		parser.setStatementsRecovery(true);
		parser.setKind(ASTParser.K_COMPILATION_UNIT);
		
		JavaASTRequestor req = new JavaASTRequestor();
		String source = "DIR/src/main/aTest.java";
		parser.createASTs(new String[] {source},null,new String[] {},req,null);


Problem : in my AstVisitor :
public boolean visit(MethodInvocation mi) {
	IMethodBinding mb = mi.resolveMethodBinding();
        Syso(mb==null);
        [...]
}


always display true. So it does not resolve bindings.
Therefore i can't detect methods from a.java called from aTest.java.

Anybody does see something wrong with this code ?

Thank you very much.
Regards,

Cédric

[Updated on: Wed, 13 July 2011 16:43]

Report message to a moderator

Re: Binding not resolved => ClassPath Problem ? [message #696576 is a reply to message #696302] Thu, 14 July 2011 10:26 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Is main a package? If so, use DIR/src in the call to setEnvironment.
Re: Binding not resolved => ClassPath Problem ? [message #696816 is a reply to message #696576] Thu, 14 July 2011 21:35 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 8
Registered: June 2011
Junior Member
Things get better now.
Thank you, i think i've been handling directories and packages wrongly.

[Updated on: Thu, 14 July 2011 22:04]

Report message to a moderator

Previous Topic:Where do I put my image files in Eclipse?
Next Topic:'Updating Software' has encountered a problem.
Goto Forum:
  


Current Time: Tue Mar 19 04:03:48 GMT 2024

Powered by FUDForum. Page generated in 0.02622 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top