use of com.sun.tools.javac.code.Type.ArrayType in project ceylon-compiler by ceylon.
the class Attr method visitNewArray.
public void visitNewArray(JCNewArray tree) {
Type owntype = types.createErrorType(tree.type);
Type elemtype;
if (tree.elemtype != null) {
elemtype = attribType(tree.elemtype, env);
chk.validate(tree.elemtype, env);
owntype = elemtype;
for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
attribExpr(l.head, env, syms.intType);
owntype = new ArrayType(owntype, syms.arrayClass);
}
} else {
// this is allowed only if the prototype is an array
if (pt.tag == ARRAY) {
elemtype = types.elemtype(pt);
} else {
if (pt.tag != ERROR) {
log.error(tree.pos(), "illegal.initializer.for.type", pt);
}
elemtype = types.createErrorType(pt);
}
}
if (tree.elems != null) {
attribExprs(tree.elems, env, elemtype);
owntype = new ArrayType(elemtype, syms.arrayClass);
}
if (!types.isReifiable(elemtype))
log.error(tree.pos(), "generic.array.creation");
result = check(tree, owntype, VAL, pkind, pt);
}
use of com.sun.tools.javac.code.Type.ArrayType in project ceylon-compiler by ceylon.
the class JavacType method getComponentType.
@Override
public TypeMirror getComponentType() {
if (!componentTypeSet && type instanceof ArrayType) {
Type compType = ((ArrayType) type).getComponentType();
if (compType != null) {
componentType = new JavacType(compType);
}
componentTypeSet = true;
}
return componentType;
}
Aggregations