@Override public IType[] getInterfaces() { return _superType.getInterfaces(); }
@Override public IType[] getInterfaces() { ArrayList<IType> interfaces = new ArrayList<IType>(); for (IType type : _types) { if (type.isInterface()) { interfaces.add(type); } for (IType anInterface : type.getInterfaces()) { if (!interfaces.contains(anInterface)) { interfaces.add(type); } } } return interfaces.toArray(new IType[interfaces.size()]); }
@Override public IType[] getInterfaces() { ArrayList<IType> interfaces = new ArrayList<IType>(); for (IType type : _types) { if (type.isInterface()) { interfaces.add(type); } for (IType anInterface : type.getInterfaces()) { if (!interfaces.contains(anInterface)) { interfaces.add(type); } } } return interfaces.toArray(new IType[interfaces.size()]); }
private Set<IType> getTypeInterfaces( IType type, Set<IType> set ) { if( getType().equals( DEFAULT_TYPE.get() ) ) { set.add( JavaTypes.ITYPE() ); return set; } for( IType iface : type.getInterfaces() ) { iface = TypeLord.getDefaultParameterizedType( iface ); if( !iface.getNamespace().startsWith( "gw.internal" ) ) { set.add( iface ); } getTypeInterfaces( iface, set ); } return set; }
private Set<IType> getTypeInterfaces( IType type, Set<IType> set ) { if( getType() == DEFAULT_TYPE.get() ) { return Collections.singleton( (IType)JavaTypes.ITYPE() ); } for( IType iface : type.getInterfaces() ) { iface = TypeLord.getDefaultParameterizedType( iface ); if( !iface.getNamespace().startsWith( "gw.internal" ) ) { set.add( iface ); } getTypeInterfaces( iface, set ); } return set; }
private Set<IType> getTypeInterfaces( IType type, Set<IType> set ) { if( getOwnersType().getType() == MetaType.DEFAULT_TYPE.get() ) { return Collections.singleton( (IType)JavaTypes.ITYPE() ); } for( IType iface : type.getInterfaces() ) { if( !iface.getNamespace().startsWith( "gw.internal" ) ) { set.add( iface ); } else { getTypeInterfaces(iface, set); } } return set; }
private Set<IType> getTypeInterfaces( IType type, Set<IType> set ) { if( getOwnersType().getType() == MetaType.DEFAULT_TYPE.get() ) { return Collections.singleton( (IType)JavaTypes.ITYPE() ); } for( IType iface : type.getInterfaces() ) { if( !iface.getNamespace().startsWith( "gw.internal" ) ) { set.add( iface ); } else { getTypeInterfaces(iface, set); } } return set; }
public static IType findParameterizedTypeInHierarchy( IType sourceType, IType rawGenericType ) { if( sourceType == null ) { return null; } if( sourceType.isParameterizedType() && sourceType.getGenericType().equals( rawGenericType ) ) { return sourceType; } IType[] list = sourceType.getInterfaces(); for( int i = 0; i < list.length; i++ ) { IType returnType = findParameterizedTypeInHierarchy( list[i], rawGenericType ); if( returnType != null ) { return returnType; } } return findParameterizedTypeInHierarchy( sourceType.getSupertype(), rawGenericType ); }
public static IType findParameterizedTypeInHierarchy( IType sourceType, IType rawGenericType ) { if( sourceType == null ) { return null; } if( sourceType.isParameterizedType() && sourceType.getGenericType().equals( rawGenericType ) ) { return sourceType; } IType[] list = sourceType.getInterfaces(); for( int i = 0; i < list.length; i++ ) { IType returnType = findParameterizedTypeInHierarchy( list[i], rawGenericType ); if( returnType != null ) { return returnType; } } return findParameterizedTypeInHierarchy( sourceType.getSupertype(), rawGenericType ); }
public static boolean isDelegatableInterface( IType declaringType, IType iface ) { if( iface.isAssignableFrom( declaringType ) ) { return true; } IType superClass = declaringType.getSupertype(); if( superClass != null && isDelegatableInterface( superClass, iface ) ) { return true; } IType[] interfaces = declaringType.getInterfaces(); if( interfaces != null ) { for( IType t : interfaces ) { if( isDelegatableInterface( t, iface ) ) { return true; } } } return false; }
public void addAllEnhancementMethodsForType( IType typeToGetEnhancementsFor ) { List<IGosuEnhancementInternal> enhancements = getEnhancementsForType( typeToGetEnhancementsFor ); for( IGosuEnhancementInternal type : enhancements ) { GosuClassTypeInfo typeInfo = getTypeInfoForType( typeToGetEnhancementsFor, type ); List extensionMethods = typeInfo.getDeclaredMethods(); for( Object extensionMethod : extensionMethods ) { GosuMethodInfo extensionMethodInfo = (GosuMethodInfo)extensionMethod; if( shouldAddMethod( extensionMethodInfo, type, typeToGetEnhancementsFor ) ) { _methodsToAddTo.add( extensionMethodInfo ); } } } IType[] interfaces = typeToGetEnhancementsFor.getInterfaces(); for( IType interfaceType : interfaces ) { addAllEnhancementMethodsForType( interfaceType ); } }
protected Collection<BaseFeatureInfo> getSuperAnnotatedElements() { List<BaseFeatureInfo> infos = new ArrayList<BaseFeatureInfo>(); addAnnotationSuperElement( infos, getOwnersType().getSupertype() ); if( !(this instanceof IConstructorInfo) ) { IType[] interfaces = getOwnersType().getInterfaces(); if( interfaces != null ) { for( IType anInterface : interfaces ) { if (!TypeSystem.isDeleted(anInterface)) { addAnnotationSuperElement( infos, anInterface ); } } } } return infos; }
protected Collection<BaseFeatureInfo> getSuperAnnotatedElements() { List<BaseFeatureInfo> infos = new ArrayList<BaseFeatureInfo>(); addAnnotationSuperElement( infos, getOwnersType().getSupertype() ); if( !(this instanceof IConstructorInfo) ) { IType[] interfaces = getOwnersType().getInterfaces(); if( interfaces != null ) { for( IType anInterface : interfaces ) { if (!TypeSystem.isDeleted(anInterface)) { addAnnotationSuperElement( infos, anInterface ); } } } } return infos; }
public static void addAllClassesInClassHierarchy( IType type, Set<IType> set, boolean bForce ) { if( !set.add( type ) && !bForce ) { return; } boolean bFromStructure = type instanceof IGosuClass && ((IGosuClass)type).isStructure(); for( IType iface : type.getInterfaces() ) { if( !bFromStructure || !(iface instanceof IGosuClass) || ((IGosuClass)iface).isStructure() ) { addAllClassesInClassHierarchy( iface, set ); } } if( type.getSupertype() != null ) { addAllClassesInClassHierarchy( type.getSupertype(), set ); } if( type.isParameterizedType() ) { set.add( type.getGenericType() ); } }
private void addGenericTypes( IType type, Set<IType> includeGenericTypes) { if( type == null ) { return; } if( type.isGenericType() || type.isParameterizedType() ) { TypeLord.addAllClassesInClassHierarchy( type, includeGenericTypes, true ); } else { addGenericTypes(type.getSupertype(), includeGenericTypes); IType[] interfaces = type.getInterfaces(); if( interfaces != null ) { for( IType iface: interfaces ) { addGenericTypes( iface, includeGenericTypes ); } } } }
private ICoercer findCoercerImpl( IType lhsType, IType rhsType, boolean runtime ) { ICoercer coercer = getCoercerInternal( lhsType, rhsType, runtime ); if( coercer != null ) { return coercer; } //Look at interfaces on rhsType for coercions IType[] interfaces = rhsType.getInterfaces(); for ( IType anInterface1 : interfaces ) { coercer = findCoercer(lhsType, anInterface1, runtime); if (coercer != null) { return coercer; } } //Recurse to the superclass of rhsType for coercions if( rhsType.getSupertype() == null || isPrimitiveOrBoxed( lhsType ) ) { return null; } else { return findCoercer( lhsType, rhsType.getSupertype(), runtime ); } }
private static void addAllClassesInClassHierarchy(IType type, Set<IType> set) { if (!set.add(type)) { return; } for (IType iface : type.getInterfaces()) { addAllClassesInClassHierarchy(iface, set); } if (type.getSupertype() != null) { addAllClassesInClassHierarchy(type.getSupertype(), set); } if (type.isParameterizedType()) { addAllClassesInClassHierarchy(type.getGenericType(), set); } if (type.isGenericType() || !type.isParameterizedType()) { addAllClassesInClassHierarchy(TypeSystem.getDefaultParameterizedType( type ), set); } }
private static void addAllClassesInClassHierarchy(IType type, Set<IType> set) { if (!set.add(type)) { return; } for (IType iface : type.getInterfaces()) { addAllClassesInClassHierarchy(iface, set); } if (type.getSupertype() != null) { addAllClassesInClassHierarchy(type.getSupertype(), set); } if (type.isParameterizedType()) { addAllClassesInClassHierarchy(type.getGenericType(), set); } if (type.isGenericType() || !type.isParameterizedType()) { addAllClassesInClassHierarchy(TypeSystem.getDefaultParameterizedType( type ), set); } }
private Expression verifyWithComparableDimension( Expression rhs, IType lhsType ) { if( JavaTypes.IDIMENSION().isAssignableFrom( lhsType ) && JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) ) { for( IType iface : lhsType.getInterfaces() ) { if( JavaTypes.COMPARABLE().isAssignableFrom( iface.getGenericType() ) ) { IType type = iface.getTypeParameters()[0]; verifyComparable( type, rhs, true, true ); if( !rhs.hasParseExceptions() ) { rhs = possiblyWrapWithImplicitCoercion( rhs, type ); } return rhs; } } } return null; }
private Expression verifyWithComparableDimension( Expression rhs, IType lhsType ) { if( JavaTypes.IDIMENSION().isAssignableFrom( lhsType ) && JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) ) { for( IType iface : lhsType.getInterfaces() ) { if( JavaTypes.COMPARABLE().isAssignableFrom( iface.getGenericType() ) ) { IType type = iface.getTypeParameters()[0]; verifyComparable( type, rhs, true, true ); if( !rhs.hasParseExceptions() ) { rhs = possiblyWrapWithImplicitCoercion( rhs, type ); } return rhs; } } } return null; }