public boolean isParameterized() { return elemtype.isParameterized(); }
public DeclaredType getDeclaredType(DeclaredType enclosing, TypeElement typeElem, TypeMirror... typeArgs) { if (enclosing == null) return getDeclaredType(typeElem, typeArgs); ClassSymbol sym = (ClassSymbol) typeElem; Type outer = (Type) enclosing; if (outer.tsym != sym.owner.enclClass()) throw new IllegalArgumentException(enclosing.toString()); if (!outer.isParameterized()) return getDeclaredType(typeElem, typeArgs); return getDeclaredType0(outer, sym, typeArgs); } // where
private boolean giveWarning(Type from, Type to) { // To and from are (possibly different) parameterizations // of the same class or interface return to.isParameterized() && !containsType(to.getTypeArguments(), from.getTypeArguments()); }
private boolean giveWarning(Type from, Type to) { // To and from are (possibly different) parameterizations // of the same class or interface return to.isParameterized() && !containsType(to.getTypeArguments(), from.getTypeArguments()); }
public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) { ClassSymbol sym = (ClassSymbol) typeElem; if (typeArgs.length == 0) return (DeclaredType) sym.erasure(types); if (sym.type.getEnclosingType().isParameterized()) throw new IllegalArgumentException(sym.toString()); return getDeclaredType0(sym.type.getEnclosingType(), sym, typeArgs); }
public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) { ClassSymbol sym = (ClassSymbol) typeElem; if (typeArgs.length == 0) return (DeclaredType) sym.erasure(types); if (sym.type.getEnclosingType().isParameterized()) throw new IllegalArgumentException(sym.toString()); return getDeclaredType0(sym.type.getEnclosingType(), sym, typeArgs); }
public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) { ClassSymbol sym = (ClassSymbol) typeElem; if (typeArgs.length == 0) return (DeclaredType) sym.erasure(types); if (sym.type.getEnclosingType().isParameterized()) throw new IllegalArgumentException(sym.toString()); return getDeclaredType0(sym.type.getEnclosingType(), sym, typeArgs); }
public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) { ClassSymbol sym = (ClassSymbol) typeElem; if (typeArgs.length == 0) return (DeclaredType) sym.erasure(types); if (sym.type.getEnclosingType().isParameterized()) throw new IllegalArgumentException(sym.toString()); return getDeclaredType0(sym.type.getEnclosingType(), sym, typeArgs); }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.tsym.isStatic() && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression tree.selected.accept(this); } }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.getEnclosingType().tag != CLASS && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression validate(tree.selected); } }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.getEnclosingType().tag != CLASS && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression validate(tree.selected); } }
private Pair<Type, Type> getParameterizedSupers(Type t, Type s) { Type lubResult = types.lub(t, s); if (lubResult == syms.errType || lubResult == syms.botType || !lubResult.isParameterized()) { return null; } Type asSuperOfT = types.asSuper(t, lubResult.tsym); Type asSuperOfS = types.asSuper(s, lubResult.tsym); return new Pair<>(asSuperOfT, asSuperOfS); }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.tsym.isStatic() && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression tree.selected.accept(this); } }
public void visitSelect(JCFieldAccess tree) { if (tree.type.tag == CLASS) { visitSelectInternal(tree); // Check that this type is either fully parameterized, or // not parameterized at all. if (tree.selected.type.isParameterized() && tree.type.tsym.type.getTypeArguments().nonEmpty()) log.error(tree.pos(), "improperly.formed.type.param.missing"); } } public void visitSelectInternal(JCFieldAccess tree) {
public void visitSelect(JCFieldAccess tree) { if (tree.type.tag == CLASS) { visitSelectInternal(tree); // Check that this type is either fully parameterized, or // not parameterized at all. if (tree.selected.type.isParameterized() && tree.type.tsym.type.getTypeArguments().nonEmpty()) log.error(tree.pos(), "improperly.formed.type.param.missing"); } } public void visitSelectInternal(JCFieldAccess tree) {
@Override public void visitSelect(JCFieldAccess tree) { if (tree.type.hasTag(CLASS)) { visitSelectInternal(tree); // Check that this type is either fully parameterized, or // not parameterized at all. if (tree.selected.type.isParameterized() && tree.type.tsym.type.getTypeArguments().nonEmpty()) log.error(tree.pos(), "improperly.formed.type.param.missing"); } }
@Override public void visitSelect(JCFieldAccess tree) { if (tree.type.hasTag(CLASS)) { visitSelectInternal(tree); // Check that this type is either fully parameterized, or // not parameterized at all. if (tree.selected.type.isParameterized() && tree.type.tsym.type.getTypeArguments().nonEmpty()) log.error(tree.pos(), "improperly.formed.type.param.missing"); } }
@Override public Boolean visitClassType(ClassType t, Type s) { Type sup = asSuper(t, s.tsym); if (sup == null) return false; // If t is an intersection, sup might not be a class type if (!sup.hasTag(CLASS)) return isSubtypeNoCapture(sup, s); return sup.tsym == s.tsym // Check type variable containment && (!s.isParameterized() || containsTypeRecursive(s, sup)) && isSubtypeNoCapture(sup.getEnclosingType(), s.getEnclosingType()); }
private boolean giveWarning(Type from, Type to) { List<Type> bounds = to.isCompound() ? ((IntersectionClassType)to.unannotatedType()).getComponents() : List.of(to); for (Type b : bounds) { Type subFrom = asSub(from, b.tsym); if (b.isParameterized() && (!(isUnbounded(b) || isSubtype(from, b) || ((subFrom != null) && containsType(b.allparams(), subFrom.allparams()))))) { return true; } } return false; }
private boolean giveWarning(Type from, Type to) { List<Type> bounds = to.isCompound() ? ((IntersectionClassType)to.unannotatedType()).getComponents() : List.of(to); for (Type b : bounds) { Type subFrom = asSub(from, b.tsym); if (b.isParameterized() && (!(isUnbounded(b) || isSubtype(from, b) || ((subFrom != null) && containsType(b.allparams(), subFrom.allparams()))))) { return true; } } return false; }