use of com.sun.tools.javac.code.Type in project ceylon-compiler by ceylon.
the class ExecutableMemberDocImpl method thrownExceptions.
/**
* Return exceptions this method or constructor throws.
*
* @return an array of ClassDoc[] representing the exceptions
* thrown by this method.
*/
public ClassDoc[] thrownExceptions() {
ListBuffer<ClassDocImpl> l = new ListBuffer<ClassDocImpl>();
for (Type ex : sym.type.getThrownTypes()) {
ex = env.types.erasure(ex);
//### Will these casts succeed in the face of static semantic
//### errors in the documented code?
ClassDocImpl cdi = env.getClassDoc((ClassSymbol) ex.tsym);
if (cdi != null)
l.append(cdi);
}
return l.toArray(new ClassDocImpl[l.length()]);
}
use of com.sun.tools.javac.code.Type in project ceylon-compiler by ceylon.
the class ExecutableMemberDocImpl method makeSignature.
private String makeSignature(boolean full) {
StringBuilder result = new StringBuilder();
result.append("(");
for (List<Type> types = sym.type.getParameterTypes(); types.nonEmpty(); ) {
Type t = types.head;
result.append(TypeMaker.getTypeString(env, t, full));
types = types.tail;
if (types.nonEmpty()) {
result.append(", ");
}
}
if (isVarArgs()) {
int len = result.length();
result.replace(len - 2, len, "...");
}
result.append(")");
return result.toString();
}
use of com.sun.tools.javac.code.Type in project ceylon-compiler by ceylon.
the class TypeVariableImpl method typeVarToString.
/**
* Return the string form of a type variable along with any
* "extends" clause. Class names are qualified if "full" is true.
*/
static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
StringBuilder s = new StringBuilder(v.toString());
List<Type> bounds = getBounds(v, env);
if (bounds.nonEmpty()) {
boolean first = true;
for (Type b : bounds) {
s.append(first ? " extends " : " & ");
s.append(TypeMaker.getTypeString(env, b, full));
first = false;
}
}
return s.toString();
}
use of com.sun.tools.javac.code.Type in project ceylon-compiler by ceylon.
the class WildcardTypeImpl method wildcardTypeToString.
/**
* Return the string form of a wildcard type ("?") along with any
* "extends" or "super" clause. Delimiting brackets are not
* included. Class names are qualified if "full" is true.
*/
static String wildcardTypeToString(DocEnv env, Type.WildcardType wildThing, boolean full) {
if (env.legacyDoclet) {
return TypeMaker.getTypeName(env.types.erasure(wildThing), full);
}
StringBuilder s = new StringBuilder("?");
List<Type> bounds = getExtendsBounds(wildThing);
if (bounds.nonEmpty()) {
s.append(" extends ");
} else {
bounds = getSuperBounds(wildThing);
if (bounds.nonEmpty()) {
s.append(" super ");
}
}
// currently only one bound is allowed
boolean first = true;
for (Type b : bounds) {
if (!first) {
s.append(" & ");
}
s.append(TypeMaker.getTypeString(env, b, full));
first = false;
}
return s.toString();
}
use of com.sun.tools.javac.code.Type in project ceylon-compiler by ceylon.
the class TypeMaker method typeParametersString.
/**
* Return the formal type parameters of a class or method as an
* angle-bracketed string. Each parameter is a type variable with
* optional bounds. Class names are qualified if "full" is true.
* Return "" if there are no type parameters or we're hiding generics.
*/
static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
return "";
}
StringBuilder s = new StringBuilder();
for (Type t : sym.type.getTypeArguments()) {
s.append(s.length() == 0 ? "<" : ", ");
s.append(TypeVariableImpl.typeVarToString(env, (TypeVar) t, full));
}
s.append(">");
return s.toString();
}
Aggregations