JMethodSymbol extends JSymbol implements Symbol.MethodSymbol { @Override public String signature() { return signature; } JMethodSymbol(JSema sema, IMethodBinding methodBinding); @Override List<Type> parameterTypes(); @Override TypeSymbol returnType(); @Override List<Type> thrownTypes(); @Nullable @Override MethodSymbol overriddenSymbol(); @Override String signature(); @Nullable @Override MethodTree declaration();  }
@Test void signature() { JavaTree.CompilationUnitTreeImpl cu = test("package org.example; class C { C() {} <T> Object m(Object p1, Object[] p2, T p3) { return m(null, null, 42); } }"); ClassTreeImpl c = (ClassTreeImpl) cu.types().get(0); MethodTreeImpl constructor = (MethodTreeImpl) c.members().get(0); MethodTreeImpl method = (MethodTreeImpl) c.members().get(1); ReturnStatementTreeImpl s = (ReturnStatementTreeImpl) Objects.requireNonNull(method.block()).body().get(0); MethodInvocationTreeImpl methodInvocation = Objects.requireNonNull((MethodInvocationTreeImpl) s.expression()); assertThat(cu.sema.methodSymbol(Objects.requireNonNull(constructor.methodBinding)).signature()) .isEqualTo(constructor.symbol().signature()) .isEqualTo("org.example.C#<init>()V"); assertThat(cu.sema.methodSymbol(Objects.requireNonNull(method.methodBinding)).signature()) .isEqualTo(method.symbol().signature()) .isEqualTo("org.example.C#m(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); assertThat(cu.sema.methodSymbol(Objects.requireNonNull(methodInvocation.methodBinding)).signature()) .isEqualTo(method.symbol().signature()) .isEqualTo("org.example.C#m(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); }