Fetching complete qualified names of variables

64 views
Skip to first unread message

camcoder

unread,
Dec 22, 2011, 8:03:59 AM12/22/11
to JavaParser
I am evaluating Java Parser as a way to capture dependency between
classes across multiple java projects/packages. Can you let me know
whether JavaParser can report complete qualified names of classes that
depend on one another.

package org.google.abc;
import org.google.xyz.Foo;

class Bar{
public void someMethod {
Foo foo;
}
}

In the sample above, can the parser report the complete name
org.google.xyz.Foo being referenced in Bar?
Appreciate any insight and pointers on this.

jgesser

unread,
Dec 22, 2011, 10:54:41 AM12/22/11
to JavaParser
No. JavaParser currently does not resolve names.
You have to implement a name resolver to get fully qualified names.

Matías Costa

unread,
Dec 22, 2011, 11:01:03 AM12/22/11
to javap...@googlegroups.com
That should not be too dificult, right? An object declaration has a FQN or a simple name. The simple name must have the correspondent import. Some time ago I found a snippet of code capable of expanding a "import x.y.z.*", so a simple map can work. Even a manual classpath directory / jar scanning is not too hard.

Am I missing something?

2011/12/22 jgesser <jge...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "JavaParser" group.
To post to this group, send email to javap...@googlegroups.com.
To unsubscribe from this group, send email to javaparser+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaparser?hl=en.


Julio Gesser

unread,
Dec 23, 2011, 11:00:40 AM12/23/11
to javap...@googlegroups.com
Yes, you can try something like that. It will work in most cases.

--
Júlio Vilmar Gesser


2011/12/22 Matías Costa <m.cos...@gmail.com>
Reply all
Reply to author
Forward
0 new messages