String methodClassType;
boolean getStartPosFromMethodLength = false;
if (kind.equals(Tree.Kind.NEW_CLASS)) {
identifier = ((NewClassTree) node).getIdentifier();
methodName = "<init>";
TreePath iPath = TreePath.getPath(cu, identifier);
TypeMirror type = trees.getTypeMirror(iPath);
if (type.getKind() == TypeKind.ERROR) {
// There are errors, give it up.
return null;
}
assert type.getKind() == TypeKind.DECLARED;
TypeElement te = (TypeElement) types.asElement(type);
methodClassType = ElementUtilities.getBinaryName(te);
} else {
//identifier = ((MemberSelectTree) ((MethodInvocationTree) node).getMethodSelect()).getIdentifier();
identifier = ((MethodInvocationTree) node).getMethodSelect();
if (identifier.getKind() == Tree.Kind.IDENTIFIER) {
methodName = ((IdentifierTree) identifier).getName().toString();
TreePath iPath = TreePath.getPath(cu, identifier);
TypeElement te = trees.getScope(iPath).getEnclosingClass();
if (te == null) {
// No enclosing class? Some error, give it up.
return null;
}
methodClassType = ElementUtilities.getBinaryName(te);
} else {
methodName = ((MemberSelectTree) identifier).getIdentifier().toString();
getStartPosFromMethodLength = true;
ExpressionTree exp = ((MemberSelectTree) identifier).getExpression();
TreePath expPath = TreePath.getPath(cu, exp);
TypeMirror type = trees.getTypeMirror(expPath);
if (type.getKind() == TypeKind.ERROR) {
// There are errors, give it up.
return null;
}