private static Stream<MethodSymbol> findSuperMethods( MethodSymbol methodSymbol, Types types, boolean skipInterfaces) { TypeSymbol owner = (TypeSymbol) methodSymbol.owner; return types.closure(owner.type).stream() .filter(closureTypes -> skipInterfaces ? !closureTypes.isInterface() : true) .map(type -> findSuperMethodInType(methodSymbol, type, types)) .filter(Objects::nonNull); }
/** * Tells if the given type is a Java interface. */ public boolean isInterface(TypeSymbol typeSymbol) { return (typeSymbol.type.isInterface() || hasAnnotationType(typeSymbol, JSweetConfig.ANNOTATION_INTERFACE)); }
@Override public boolean isInterface() { return underlyingType.isInterface(); } @Override
@Override public boolean isInterface() { return underlyingType.isInterface(); } @Override
private static Stream<MethodSymbol> findSuperMethods( MethodSymbol methodSymbol, Types types, boolean skipInterfaces) { TypeSymbol owner = (TypeSymbol) methodSymbol.owner; return types.closure(owner.type).stream() .filter(closureTypes -> skipInterfaces ? !closureTypes.isInterface() : true) .map(type -> findSuperMethodInType(methodSymbol, type, types)) .filter(Objects::nonNull); }
/** * The supertype is always a class type. If the type * variable's bounds start with a class type, this is also * the supertype. Otherwise, the supertype is * java.lang.Object. */ @Override public Type visitTypeVar(TypeVar t, Void ignored) { if (t.bound.tag == TYPEVAR || (!t.bound.isCompound() && !t.bound.isInterface())) { return t.bound; } else { return supertype(t.bound); } }
/** * The supertype is always a class type. If the type * variable's bounds start with a class type, this is also * the supertype. Otherwise, the supertype is * java.lang.Object. */ @Override public Type visitTypeVar(TypeVar t, Void ignored) { if (t.bound.hasTag(TYPEVAR) || (!t.bound.isCompound() && !t.bound.isInterface())) { return t.bound; } else { return supertype(t.bound); } }
@Override public List<Type> visitTypeVar(TypeVar t, Void ignored) { if (t.bound.isCompound()) return interfaces(t.bound); if (t.bound.isInterface()) return List.of(t.bound); return List.nil(); } };
return false; if (assignedType.isInterface() && expression.type.tsym.isEnum()) { String relTarget = getRootRelativeName((Symbol) expression.type.tsym); print(relTarget).print("[\"" + Java2TypeScriptTranslator.ENUM_WRAPPER_CLASS_WRAPPERS + "\"][")
@Override public List<Type> visitTypeVar(TypeVar t, Void ignored) { if (t.bound.isCompound()) return interfaces(t.bound); if (t.bound.isInterface()) return List.of(t.bound); return List.nil(); } };
@Override public List<Type> visitTypeVar(TypeVar t, Void ignored) { if (t.bound.isCompound()) return interfaces(t.bound); if (t.bound.isInterface()) return List.of(t.bound); return List.nil(); } };
public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) { super(Type.noType, List.<Type>nil(), csym); this.allInterfaces = allInterfaces; Assert.check((csym.flags() & COMPOUND) != 0); supertype_field = bounds.head; interfaces_field = bounds.tail; Assert.check(supertype_field.tsym.completer != null || !supertype_field.isInterface(), supertype_field); }
@Override public List<Type> visitTypeVar(TypeVar t, Void ignored) { if (t.bound.isCompound()) return interfaces(t.bound); if (t.bound.isInterface()) return List.of(t.bound); return List.nil(); } };
public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) { super(Type.noType, List.<Type>nil(), csym); this.allInterfaces = allInterfaces; Assert.check((csym.flags() & COMPOUND) != 0); supertype_field = bounds.head; interfaces_field = bounds.tail; Assert.check(supertype_field.tsym.completer != null || !supertype_field.isInterface(), supertype_field); }
public List<Type> getBounds() { TypeVar t = (TypeVar)type; Type bound = t.getUpperBound(); if (!bound.isCompound()) return List.of(bound); ClassType ct = (ClassType)bound; if (!ct.tsym.erasure_field.isInterface()) { return ct.interfaces_field.prepend(ct.supertype_field); } else { // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return ct.interfaces_field; } }
public List<Type> getBounds() { TypeVar t = (TypeVar)type; Type bound = t.getUpperBound(); if (!bound.isCompound()) return List.of(bound); ClassType ct = (ClassType)bound; if (!ct.tsym.erasure_field.isInterface()) { return ct.interfaces_field.prepend(ct.supertype_field); } else { // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return ct.interfaces_field; } }
public List<Type> getBounds() { TypeVar t = (TypeVar)type; Type bound = t.getUpperBound(); if (!bound.isCompound()) return List.of(bound); ClassType ct = (ClassType)bound; if (!ct.tsym.erasure_field.isInterface()) { return ct.interfaces_field.prepend(ct.supertype_field); } else { // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return ct.interfaces_field; } } }
public List<Type> getBounds() { TypeVar t = (TypeVar)type; Type bound = t.getUpperBound(); if (!bound.isCompound()) return List.of(bound); ClassType ct = (ClassType)bound; if (!ct.tsym.erasure_field.isInterface()) { return ct.interfaces_field.prepend(ct.supertype_field); } else { // No superclass was given in bounds. // In this case, supertype is Object, erasure is first interface. return ct.interfaces_field; } } }
class LookupFilter implements Filter<Symbol> { boolean abstractOk; LookupFilter(boolean abstractOk) { this.abstractOk = abstractOk; } public boolean accepts(Symbol s) { long flags = s.flags(); return s.kind == MTH && (flags & SYNTHETIC) == 0 && (abstractOk || (flags & DEFAULT) != 0 || (flags & ABSTRACT) == 0); } };
class LookupFilter implements Filter<Symbol> { boolean abstractOk; LookupFilter(boolean abstractOk) { this.abstractOk = abstractOk; } public boolean accepts(Symbol s) { long flags = s.flags(); return s.kind == MTH && (flags & SYNTHETIC) == 0 && (abstractOk || (flags & DEFAULT) != 0 || (flags & ABSTRACT) == 0); } };