Java Code Examples for com.sun.tools.javac.code.Type.ClassType#getTypeArguments()

The following examples show how to use com.sun.tools.javac.code.Type.ClassType#getTypeArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeMaker.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 2
Source File: TypeMaker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 3
Source File: TypeMaker.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 4
Source File: InferenceContext.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Void visitClassType(ClassType t, Void _unused) {
    visit(t.getEnclosingType());
    for (Type targ : t.getTypeArguments()) {
        visit(targ);
    }
    return null;
}
 
Example 5
Source File: TypeMaker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 6
Source File: InferenceContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Void visitClassType(ClassType t, Void _unused) {
    visit(t.getEnclosingType());
    for (Type targ : t.getTypeArguments()) {
        visit(targ);
    }
    return null;
}
 
Example 7
Source File: VarTypePrinter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Type visitClassType(ClassType t, Boolean upward) {
    if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
        //lift anonymous class type to first supertype (class or interface)
        return types.directSupertypes(t).last();
    } else if (t.isCompound()) {
        List<Type> components = types.directSupertypes(t);
        List<Type> components1 = components.map(c -> c.map(this, upward));
        if (components == components1) return t;
        else return types.makeIntersectionType(components1);
    } else {
        Type outer = t.getEnclosingType();
        Type outer1 = visit(outer, upward);
        List<Type> typarams = t.getTypeArguments();
        List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
        if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
            //not defined
            return syms.botType;
        }
        if (outer1 == outer && typarams1 == typarams) return t;
        else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
            @Override
            protected boolean needsStripping() {
                return true;
            }
        };
    }
}
 
Example 8
Source File: TypeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 9
Source File: TypeMaker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 10
Source File: TypeMaker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 11
Source File: TypeMaker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example 12
Source File: Inliner.java    From Refaster with Apache License 2.0 5 votes vote down vote up
@Override
public JCExpression visitClassType(ClassType type, Inliner inliner) {
  ClassSymbol classSym = (ClassSymbol) type.tsym;
  JCExpression classExpr = inliner.importPolicy().classReference(
      inliner, classSym.outermostClass().getQualifiedName().toString(),
      classSym.getQualifiedName().toString());
  List<JCExpression> argExprs = List.nil();
  for (Type argType : type.getTypeArguments()) {
    argExprs = argExprs.append(visit(argType, inliner));
  }
  return argExprs.isEmpty()
      ? classExpr
      : inliner.maker().TypeApply(classExpr, argExprs);
}