private void setBoundingType( IType type ) { if( type != null && type.isPrimitive() ) { // Never ever let a type var be bounded by a primitive. // Instead we autobox the type. type = TypeSystem.getBoxType( type ); } _boundingType = type; }
private void setBoundingType( IType type ) { if( type != null && type.isPrimitive() ) { // Never ever let a type var be bounded by a primitive. // Instead we autobox the type. type = TypeSystem.getBoxType( type ); } _boundingType = type; }
public static IType[] boxPrimitiveTypeParams( IType[] typeParams ) { IType[] newTypes = new IType[typeParams.length]; for( int i = 0; i < typeParams.length; i++ ) { if( typeParams[i].isPrimitive() ) { newTypes[i] = TypeSystem.getBoxType( typeParams[i] ); } else { newTypes[i] = typeParams[i]; } } return newTypes; }
public static IType[] boxPrimitiveTypeParams( IType[] typeParams ) { IType[] newTypes = new IType[typeParams.length]; for( int i = 0; i < typeParams.length; i++ ) { if( typeParams[i].isPrimitive() ) { newTypes[i] = TypeSystem.getBoxType( typeParams[i] ); } else { newTypes[i] = typeParams[i]; } } return newTypes; }
@Override public void setExpectedReturnType( IType expectedReturnType ) { if( expectedReturnType != null && expectedReturnType.isPrimitive() && expectedReturnType != JavaTypes.pVOID() ) { expectedReturnType = TypeSystem.getBoxType( expectedReturnType ); } _expectedReturnType = expectedReturnType; }
@Override public void setExpectedReturnType( IType expectedReturnType ) { if( expectedReturnType != null && expectedReturnType.isPrimitive() && expectedReturnType != JavaTypes.pVOID() ) { expectedReturnType = TypeSystem.getBoxType( expectedReturnType ); } _expectedReturnType = expectedReturnType; }
private void boxTypeLiteralsType( TypeLiteral tl ) { IType tlType = tl.getType().getType(); if( !warn( tl, !tlType.isPrimitive(), Res.MSG_PRIMITIVE_TYPE_PARAM, tlType.getName(), TypeSystem.getBoxType( tlType ) ) ) { tl.setType( TypeSystem.getBoxType( tlType ) ); } }
private IType getNumberTypeFromContextType( IType ctxType ) { if( ctxType == null ) { return null; } // Return ctxType if it's a primitive number, assignable to Number, or is Object, otherwise null. IType compType = ctxType.isPrimitive() ? TypeSystem.getBoxType( ctxType ) : ctxType; return JavaTypes.NUMBER().isAssignableFrom( compType ) || JavaTypes.OBJECT().equals( compType ) ? ctxType : null; }
private void boxTypeLiteralsType( TypeLiteral tl ) { IType tlType = tl.getType().getType(); if( !warn( tl, !tlType.isPrimitive(), Res.MSG_PRIMITIVE_TYPE_PARAM, tlType.getName(), TypeSystem.getBoxType( tlType ) ) ) { tl.setType(TypeSystem.getBoxType(tlType)); } }
public static Pair<QName, XmlSimpleValueFactory> gosuToSchemaIfValid( IType gosuType ) { if (gosuType == null) { return null; } maybeInit(); if ( gosuType.isPrimitive() ) { gosuType = TypeSystem.getBoxType( gosuType ); } else if ( gosuType.isEnum() ) { return new Pair<QName, XmlSimpleValueFactory>( new QName( XMLConstants.W3C_XML_SCHEMA_NS_URI, "string" ), new GosuEnumSimpleValueFactory( (IEnumType) gosuType ) ); } return _gosuToSchema.get( gosuType ); }
IType makeParamType(Class clazz) { switch (_typeCategory) { case PRIMITIVE: return TypeSystem.getBoxType(TypeSystem.get(clazz)); case ENUM: String enumName = TypeSystem.get(_type).getRelativeName().replace('.', '_'); try { return TypeSystem.getByFullName("gw.vark.enums." + enumName); } catch (Exception e) { AntlibTypeLoader.log("could not find generated enum type for " + enumName + " - must use EnumeratedAttribute instance instead", Project.MSG_VERBOSE); } _typeCategory = TypeCategory.PLAIN; // fall through case PLAIN: default: return TypeSystem.get(clazz); } } }
private Expression wrapExpressionIfNeeded( Expression first, Expression second ) { if( first.getType() == JavaTypes.pVOID() && second.getType().isPrimitive() ) { return possiblyWrapWithImplicitCoercion( first, TypeSystem.getBoxType( second.getType() ) ); } else if( second.getType() == JavaTypes.pVOID() && first.getType().isPrimitive() ) { return possiblyWrapWithImplicitCoercion( first, TypeSystem.getBoxType( first.getType() ) ); } return first; }
private Expression wrapExpressionIfNeeded( Expression first, Expression second ) { if( first.getType() == JavaTypes.pVOID() && second.getType().isPrimitive() ) { return possiblyWrapWithImplicitCoercion( first, TypeSystem.getBoxType( second.getType() ) ); } else if( second.getType() == JavaTypes.pVOID() && first.getType().isPrimitive() ) { return possiblyWrapWithImplicitCoercion( first, TypeSystem.getBoxType( first.getType() ) ); } return first; }
private Expression box( Expression expr ) { ImplicitTypeAsExpression cast = new ImplicitTypeAsExpression(); cast.setLHS( expr ); cast.setCoercer( CommonServices.getCoercionManager().resolveCoercerStatically( JavaTypes.OBJECT(), expr.getType() ) ); cast.setType( TypeSystem.getBoxType( expr.getType() ) ); return cast; }
private Expression box( Expression expr ) { ImplicitTypeAsExpression cast = new ImplicitTypeAsExpression(); cast.setLHS( expr ); cast.setCoercer( CommonServices.getCoercionManager().resolveCoercerStatically( JavaTypes.OBJECT(), expr.getType() ) ); cast.setType( TypeSystem.getBoxType( expr.getType() ) ); return cast; }
private static Expression box( Expression value ) { ImplicitTypeAsExpression cast = initLocation( new ImplicitTypeAsExpression() ); cast.setLHS( value ); cast.setCoercer( CommonServices.getCoercionManager().resolveCoercerStatically( JavaTypes.OBJECT(), value.getType() ) ); cast.setType( TypeSystem.getBoxType( value.getType() ) ); value = cast; return value; }
returnType = TypeSystem.getBoxType( returnType ); if( paramType.isPrimitive() ) paramType = TypeSystem.getBoxType( paramType );
boundingTypes[j] = TypeSystem.getBoxType( boundingTypes[j] );
boundingTypes[j] = TypeSystem.getBoxType( boundingTypes[j] );
if( asType.isAssignableFrom( TypeSystem.getBoxType( lhsType ) ) )