public IJavaClassType getGenericReturnType() {
   if (_genericReturnType == null) {
     int indexOfName = _methodNode.getChildOfTypeIndex(JavaParser.IDENTIFIER);
     _genericReturnType = JavaSourceType.createType(this, _methodNode.getChild(indexOfName - 1));
     if (_genericReturnType == null) {
       throw new RuntimeException("Cannot compute return type.");
     }
   }
   return _genericReturnType;
 }
 public static JavaSourceMethod create(IJavaASTNode methodNode, JavaSourceType containingClass) {
   IJavaASTNode nameNode = methodNode.getChildOfType(JavaParser.IDENTIFIER);
   if (nameNode == null) {
     return null;
   }
   String methodName = nameNode.getText();
   if (methodName.equals(containingClass.getSimpleName())) {
     return new JavaSourceConstructor(methodNode, containingClass);
   } else if (containingClass.isAnnotation()) {
     return new JavaSourceAnnotationMethod(methodNode, containingClass);
   } else {
     return new JavaSourceMethod(methodNode, containingClass);
   }
 }
 public IJavaClassTypeVariable[] getTypeParameters() {
   if (_typeParameters == null) {
     IJavaASTNode typeParamsNode = _methodNode.getChildOfType(JavaASTConstants.typeParameters);
     if (typeParamsNode != null) {
       List<IJavaASTNode> typeParamNodes =
           typeParamsNode.getChildrenOfTypes(JavaASTConstants.typeParameter);
       _typeParameters = new IJavaClassTypeVariable[typeParamNodes.size()];
       for (int i = 0; i < _typeParameters.length; i++) {
         _typeParameters[i] = JavaSourceTypeVariable.create(this, typeParamNodes.get(i));
       }
     } else {
       _typeParameters = JavaSourceTypeVariable.EMPTY;
     }
   }
   return _typeParameters;
 }
 public IModifierList getModifierList() {
   if (_modifierList == null) {
     _modifierList =
         new JavaSourceModifierList(this, _methodNode.getChildOfType(JavaASTConstants.modifiers));
   }
   return _modifierList;
 }
 public JavaSourceParameter[] getParameters() {
   if (_parameters == null) {
     IJavaASTNode parametersNode = _methodNode.getChildOfTypes(JavaASTConstants.formalParameters);
     if (parametersNode == null) {
       _parameters = new JavaSourceParameter[0];
     } else {
       List<IJavaASTNode> parameterNodes =
           parametersNode.getChildrenOfTypes(
               JavaASTConstants.normalParameterDecl, JavaASTConstants.ellipsisParameterDecl);
       _parameters = new JavaSourceParameter[parameterNodes.size()];
       for (int i = 0; i < _parameters.length; i++) {
         _parameters[i] = new JavaSourceParameter(this, parameterNodes.get(i));
       }
     }
   }
   return _parameters;
 }
 @Override
 public IJavaClassInfo getReturnClassInfo() {
   if (_returnType == null) {
     int indexOfName = _methodNode.getChildOfTypeIndex(JavaParser.IDENTIFIER);
     IJavaASTNode typeNode = _methodNode.getChild(indexOfName - 1);
     String typeName;
     if (typeNode instanceof TypeASTNode) {
       typeName = ((TypeASTNode) typeNode).getTypeName();
     } else {
       typeName = typeNode.getText();
     }
     _returnType =
         (IJavaClassInfo)
             JavaSourceType.createType(this, typeName, JavaSourceType.IGNORE_NONE)
                 .getConcreteType();
     if (_returnType == null) {
       throw new RuntimeException("Cannot compute return type.");
     }
   }
   return _returnType;
 }
 public String getName() {
   return _methodNode.getChildOfType(JavaParser.IDENTIFIER).getText();
 }