The JDefinedClass.getMethod() method works by searching a method with matching name and parameter types. As JDirectClass does not implement the equals method, if getMethod() is provided with a JDirectClass freshly obtained from JCodeModel.ref(), it will not return the required method.
The
JDefinedClass.getMethod()
method works by searching a method with matching name and parameter types. AsJDirectClass
does not implement theequals
method, ifgetMethod()
is provided with aJDirectClass
freshly obtained fromJCodeModel.ref()
, it will not return the required method.