static IType getGenericType( IType ownersType ) { if( ownersType.isParameterizedType() ) { return ownersType.getGenericType(); } return ownersType; } }
private void addImplicitTypeVariableParamTypes( IType owningType, List<IRType> paramTypes ) { if ( owningType instanceof IGosuClassInternal && !IGosuClassInternal.ProxyUtil.isProxy( owningType ) ) { if (owningType.isParameterizedType()) { owningType = owningType.getGenericType(); } addTypeVariableParameters( paramTypes, owningType.getGenericTypeVariables().length); addTypeVarsFromEnclosingFunctions( (IGosuClassInternal) owningType, paramTypes ); } }
private static IType makeRawType( IType type ) { IType ret; if( type instanceof ICompoundType ) { ret = makeRawType( ((ICompoundType)type).getTypes().iterator().next() ); } else { ret = type.getGenericType() == null ? type : type.getGenericType(); } return ret; }
private void addImplicitTypeVariableParamTypes( IType owningType, List<IRType> paramTypes ) { if ( owningType instanceof IGosuClassInternal && !IGosuClassInternal.ProxyUtil.isProxy( owningType ) ) { if (owningType.isParameterizedType()) { owningType = owningType.getGenericType(); } addTypeVariableParameters( paramTypes, owningType.getGenericTypeVariables().length); addTypeVarsFromEnclosingFunctions( (IGosuClassInternal) owningType, paramTypes ); } }
public static IType getPureGenericType(IType type) { while( type.isParameterizedType() ) { type = type.getGenericType(); } return type; }
public static <E extends IType> E getPureGenericType( E type ) { while( type.isParameterizedType() ) { //noinspection unchecked type = (E)type.getGenericType(); } return type; }
public IGosuClassInternal createImmediately( IType type ) { if( type.isParameterizedType() ) { type = type.getGenericType(); } if( type instanceof IJavaType ) { IJavaTypeInternal javaType = (IJavaTypeInternal)type; return (IGosuClassInternal)createJavaProxyImmediately( javaType ); } throw new IllegalArgumentException( "No handler for type: " + type.getClass().getName() ); }
private IType maybeUnwrapProxy( IType type ) { if( type != null && type.isParameterizedType() ) { type = type.getGenericType(); } return type == null ? null : IGosuClass.ProxyUtil.getProxiedType( type ); }
private static String getProxyName( IType type ) { if( type.isParameterizedType() ) { type = type.getGenericType(); } return IGosuClass.PROXY_PREFIX + '.' + type.getName(); }
private static IType maybeUnwrapProxy( IType type ) { if( type != null && type.isParameterizedType() ) { type = type.getGenericType(); } return type == null ? null : IGosuClass.ProxyUtil.getProxiedType( type ); }
private static IType maybeUnwrapProxy( IType type ) { if( type != null && type.isParameterizedType() ) { type = type.getGenericType(); } return type == null ? null : IGosuClass.ProxyUtil.getProxiedType( type ); }
private IType maybeUnwrapProxy( IType type ) { if( type != null && type.isParameterizedType() ) { type = type.getGenericType(); } return type == null ? null : IGosuClass.ProxyUtil.getProxiedType( type ); }
public IModifierInfo getModifierInfo(GosuBaseAttributedFeatureInfo featureInfo) { if( getOwnersType().isParameterizedType() ) { return ((GosuClassTypeInfo)getOwnersType().getGenericType().getTypeInfo()).getModifierInfo( featureInfo ); } return _modifierInfoByFeature.get(featureInfo); }
private boolean supportsInitializer( IType type ) { return type.isArray() || JavaTypes.MAP().isAssignableFrom( type ) || JavaTypes.SET().isAssignableFrom( type ) || JavaTypes.LIST().isAssignableFrom( type ) || JavaTypes.COLLECTION().equals( type.getGenericType() ) || JavaTypes.ITERABLE().equals( type.getGenericType() ) || isDynamic( type ); }
public IModifierInfo getModifierInfo(GosuBaseAttributedFeatureInfo featureInfo) { if( getOwnersType().isParameterizedType() ) { return ((GosuClassTypeInfo)getOwnersType().getGenericType().getTypeInfo()).getModifierInfo( featureInfo ); } return _modifierInfoByFeature.get(featureInfo); }
public static IType getProxiedType( IType type ) { while (type.isParameterizedType()) { type = type.getGenericType(); } if (isProxy(type)) { return TypeSystem.getByFullName( getNameSansProxy( type ) ); } else { return type; } }
public IType resolveType( IType target, IType source ) { if( target.getGenericType() == JavaTypes.CLASS() ) { return JavaTypes.CLASS().getParameterizedType(source.getTypeParameters()[0]); } else { return source; } }
public static boolean isStructurallyAssignable( IType toType, IType fromType ) { if( !(toType instanceof IGosuClass && ((IGosuClass)toType).isStructure()) && !(isStrictGenerics( toType ) && toType.getGenericType().isAssignableFrom( TypeSystem.getPureGenericType( fromType ) )) ) { return false; } return isStructurallyAssignable_Laxed( toType, fromType ); } public static boolean isStructurallyAssignable_Laxed( IType toType, IType fromType )
private boolean _genericInterfacesClash( IType rhsType, IType lhsType ) { if( !rhsType.isParameterizedType() || !lhsType.isParameterizedType() ) { return false; } IType lhsTypeInRhs = TypeLord.findParameterizedType( lhsType, rhsType.getGenericType() ); if( lhsTypeInRhs != null ) { lhsTypeInRhs = TypeLord.replaceTypeVariableTypeParametersWithBoundingTypes( lhsTypeInRhs, lhsTypeInRhs.getEnclosingType() ); return !rhsType.isAssignableFrom( lhsTypeInRhs ) && !lhsTypeInRhs.isAssignableFrom( rhsType ); } return false; }
private boolean isValidAnnotationMethodReturnType( IType returnType ) { return (returnType.isPrimitive() && returnType != JavaTypes.pVOID()) || returnType == JavaTypes.STRING() || returnType.getGenericType() == JavaTypes.CLASS() || JavaTypes.ANNOTATION().isAssignableFrom( returnType ) || returnType.isEnum() || (returnType.isArray() && isValidAnnotationMethodReturnType( returnType.getComponentType())); }