// visitSelect that qualifier expression is a type.
Type t = syms.classType;
List<Type> typeargs = allowGenerics
? List.of(types.erasure(site))
: List.<Type>nil();
t = new ClassType(t.getEnclosingType(), typeargs, t.tsym);
return new VarSymbol(
STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
} else {
// We are seeing a plain identifier as selector.
Symbol sym = rs.findIdentInType(env, site, name, pkind);
if ((pkind & ERRONEOUS) == 0)
sym = rs.access(sym, pos, location, site, name, true);
return sym;
}
case WILDCARD:
throw new AssertionError(tree);
case TYPEVAR:
// Normally, site.getUpperBound() shouldn't be null.
// It should only happen during memberEnter/attribBase
// when determining the super type which *must* beac
// done before attributing the type variables. In
// other words, we are seeing this illegal program:
// class B<T> extends A<T.foo> {}
Symbol sym = (site.getUpperBound() != null)
? selectSym(tree, location, capture(site.getUpperBound()), env, pt, pkind)
: null;
if (sym == null) {
log.error(pos, "type.var.cant.be.deref");
return syms.errSymbol;
} else {
// Ceylon: relax the rules for private methods in wildcards, damnit, we want the private
// method to be called, not any subtype's method we can't possibly know about, this is really
// a lame Java decision.
Symbol sym2 = (!sourceLanguage.isCeylon() && (sym.flags() & Flags.PRIVATE) != 0) ?
rs.new AccessError(env, site, sym) :
sym;
rs.access(sym2, pos, location, site, name, true);
return sym;
}
case ERROR:
// preserve identifier names through errors
return types.createErrorType(name, site.tsym, site).tsym;
default:
// The qualifier expression is of a primitive type -- only
// .class is allowed for these.
if (name == names._class) {
// In this case, we have already made sure in Select that
// qualifier expression is a type.
Type t = syms.classType;
Type arg = types.boxedClass(site).type;
t = new ClassType(t.getEnclosingType(), List.of(arg), t.tsym);
return new VarSymbol(
STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
} else {
log.error(pos, "cant.deref", site);
return syms.errSymbol;