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; }
@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; }