@Override protected List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor) { if (internalIsResolved()) return resolvedTo.getSuperTypes(substitutor); return Collections.emptyList(); }
/** * Returns the named type if this is an anonymous type. */ public LightweightTypeReference getNamedType() { if (isAnonymous()) { return getSuperTypes().get(0); } return this; }
/** * Returns the list of immediate super types which includes the super class and the * implemented interfaces. The type parameters of the provided super types are resolved. * That means, the super type of <code>List<String></code> is <code>Collection<String></code> * rather than <code>Collection<E></code>. * * @return the list of super types, can be empty. */ public List<LightweightTypeReference> getSuperTypes() { TypeParameterSubstitutor<?> substitutor = createSubstitutor(); return getSuperTypes(substitutor); }
@Override protected List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor) { List<LightweightTypeReference> componentSuperTypes = component.getSuperTypes(substitutor); ITypeReferenceOwner owner = getOwner(); if (!componentSuperTypes.isEmpty()) { List<LightweightTypeReference> result = Lists.newArrayListWithCapacity(componentSuperTypes.size()); for(LightweightTypeReference componentSuperType: componentSuperTypes) { result.add(owner.newArrayTypeReference(componentSuperType)); } return result; } List<LightweightTypeReference> result = Lists.newArrayListWithCapacity(2); result.add(owner.newParameterizedTypeReference(findNonNullType(Cloneable.class))); result.add(owner.newParameterizedTypeReference(findNonNullType(Serializable.class))); return result; }
public void collectSuperTypes(SuperTypeAcceptor acceptor) { TypeParameterSubstitutor<?> substitutor = createSubstitutor(); List<LightweightTypeReference> superTypes = getSuperTypes(substitutor); collectSuperTypes(1, superTypes, substitutor, acceptor, Sets.<JvmType>newHashSet(getType())); }
protected void collectSuperTypes(int level, List<LightweightTypeReference> references, TypeParameterSubstitutor<?> substitutor, SuperTypeAcceptor acceptor, Set<JvmType> seenTypes) { for(LightweightTypeReference reference: references) { if (acceptor.accept(reference, level)) { if (seenTypes.add(reference.getType())) collectSuperTypes(level + 1, reference.getSuperTypes(substitutor), substitutor, acceptor, seenTypes); } } }
@Override public Iterable<? extends TypeReference> getDeclaredSuperTypes() { final Function1<LightweightTypeReference, TypeReference> _function = (LightweightTypeReference it) -> { return this.getCompilationUnit().toTypeReference(it); }; return ListExtensions.<LightweightTypeReference, TypeReference>map(this.getDelegate().getSuperTypes(), _function); }
private ArrayTypeReference doTryConvertToArray(ParameterizedTypeReference typeReference) { LightweightTypeReference parameterizedIterable = typeReference.getSuperType(Iterable.class); if (parameterizedIterable != null) { ITypeReferenceOwner owner = typeReference.getOwner(); if (parameterizedIterable.isRawType()) { // return Object[] List<LightweightTypeReference> superTypes = parameterizedIterable.getSuperTypes(); if (superTypes.isEmpty()) { return null; } LightweightTypeReference objectType = superTypes.get(0); ArrayTypeReference array = owner.newArrayTypeReference(objectType); return array; } else { LightweightTypeReference componentType = parameterizedIterable.getTypeArguments().get(0).getUpperBoundSubstitute(); ArrayTypeReference array = owner.newArrayTypeReference(componentType); return array; } } return null; }
protected JvmOperation findOverriddenOperation(JvmOperation operation, LightweightTypeReference declaringType, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper) { int parameterSize = operation.getParameters().size(); List<LightweightTypeReference> superTypes = declaringType.getSuperTypes(); for(LightweightTypeReference superType: superTypes) { if (superType.getType() instanceof JvmDeclaredType) {
protected void addConstructorCandidates(final ResolvedFeatures resolvedFeatures, final IVisibilityHelper visibilityHelper, final List<IResolvedExecutable> result) { LightweightTypeReference typeReference = resolvedFeatures.getType(); List<LightweightTypeReference> superTypes = typeReference.getSuperTypes(); for (final LightweightTypeReference superType : superTypes) { boolean _isInterfaceType = superType.isInterfaceType();
if (argument.getType() != declaration) { LightweightTypeReference reference = argument.getOwner().newParameterizedTypeReference(declaration); for(LightweightTypeReference superType: reference.getSuperTypes()) { LightweightTypeReference substitutedSuperType = substitutor.substitute(superType); if ((conformanceComputer.isConformant(substitutedSuperType, argument,