3 Replies Latest reply: Dec 8, 2009 10:30 AM by 843793 RSS

    Type from MethodInvocationTree

      Class Example:
      public class Example {
           TestClass  testCLS = new TestClass();
           private void getTestClassStr() {
                String str = testCLS.getTestClassStr();
      Class TestClass:
      public class TestClass {
           private String privStr = "HelloWorld";
           public TestClass() {}
           public String getTestClassStr() {
                return this.privStr;
      I'm using an annotation processor with a TreeVisitor. The following code:
            public Void visitMethodInvocation(MethodInvocationTree r, Void p) {
                  System.out.println("MethodInvocation is " + r.toString());
                  return super.visitMethodInvocation(r,p);
      will yield this printed to standard out:
      +MethodInvocation from Example testCLS.getTestClassStr()+

      Is there a way I can get the TYPE of testCLS which is TestClass rather than the name of the instance?