protected List<JvmTypeReference> replacePrimitivesAndRemoveAnyReferences(List<JvmTypeReference> types) { List<JvmTypeReference> result = Lists.newArrayList(); for(JvmTypeReference type: types) { if (!(type instanceof JvmAnyTypeReference)) result.add(primitives.asWrapperTypeIfPrimitive(type)); } return result; }
public JvmTypeReference asWrapperTypeIfPrimitive(JvmTypeReference primitive) { if (primitive == null || !isPrimitive(primitive)) { return primitive; } final JvmType wrapperType = getWrapperType((JvmPrimitiveType) primitive.getType()); if (wrapperType == null) return primitive; return typeReferences.createTypeRef(wrapperType); }
public JvmType getWrapperType(JvmPrimitiveType primitive) { switch (primitiveKind(primitive)) { case Byte : return getType(Byte.class, primitive); case Short : return getType(Short.class, primitive); case Char : return getType(Character.class, primitive); case Int : return getType(Integer.class, primitive); case Long : return getType(Long.class, primitive); case Float : return getType(Float.class, primitive); case Double : return getType(Double.class, primitive); case Boolean : return getType(Boolean.class, primitive); case Void : return getType(Void.class, primitive); default : throw new IllegalArgumentException("Not a primitive : "+primitive); } }
argumentTypes.subList(paramCount, argumentTypes.size()), Predicates.notNull())); if (!actualVarArgTypes.isEmpty()) { if (!primitives.isPrimitive(varArgComponentType)) { List<JvmTypeReference> wrappedVarArgTypes = Lists.newArrayListWithCapacity(actualVarArgTypes.size()); for(JvmTypeReference varArgType: actualVarArgTypes) { wrappedVarArgTypes.add(primitives.asWrapperTypeIfPrimitive(varArgType));
initialValue = internalEvaluate(variableDecl.getRight(), context, indicator); } else { if (services.getPrimitives().isPrimitive(variableDecl.getType())) { Primitive primitiveKind = services.getPrimitives().primitiveKind((JvmPrimitiveType) variableDecl.getType().getType()); switch(primitiveKind) { case Boolean:
JvmTypeReference potentialPrimitive = conformanceComputer.getPrimitives().asPrimitiveIfWrapperType(rightReference); if (potentialPrimitive != rightReference) { if (leftType == potentialPrimitive.getType() || isWideningConversion((JvmPrimitiveType)leftType, (JvmPrimitiveType) potentialPrimitive.getType())) { JvmTypeReference potentialWrapper = conformanceComputer.getPrimitives().asWrapperTypeIfPrimitive(rightReference); if (potentialWrapper != rightReference) { TypeConformanceResult result = conformanceComputer.isConformant(leftReference, potentialWrapper, param);
protected void checkNotPrimitive(JvmTypeReference jvmTypeReference) { if (primitives.isPrimitive(jvmTypeReference)) { error("The primitive '"+jvmTypeReference.getQualifiedName('.')+"' cannot be a type argument", jvmTypeReference, null, IssueCodes.INVALID_USE_OF_TYPE); } }
protected Primitive primitiveKind(JvmPrimitiveType primitiveType) { return conformanceComputer.getPrimitives().primitiveKind(primitiveType); }
JvmType wrapper = primitives.getWrapperType((JvmPrimitiveType) right); boolean result = isAssignableFrom(left, wrapper); return result; JvmType primitive = primitives.getPrimitiveTypeIfWrapper((JvmDeclaredType) right); if (primitive != null) { boolean result = isAssignableFrom(left, primitive);
public boolean isWrapperType(JvmTypeReference type) { JvmTypeReference result = asPrimitiveIfWrapperType(type); return result != type && result != null; }
for(JvmUpperBound upperBound: filter(constraints, JvmUpperBound.class)) { JvmTypeReference upperBoundType = upperBound.getTypeReference(); if (isWrapperType(upperBoundType)) return true;
protected boolean _isConstant(final XCastedExpression expression) { return (this._primitives.isPrimitive(expression.getType()) || this._typeReferences.is(expression.getType(), String.class)); }
String getDefaultValue(LightweightTypeReference type) { if (type != null && type.isPrimitive()) { Primitive primitiveKind = primitives.primitiveKind((JvmPrimitiveType) type.getType()); if (primitiveKind == Primitive.Boolean) return "false"; else return "0"; } return "null"; }
public boolean isWrapperType(JvmTypeReference type) { JvmTypeReference result = asPrimitiveIfWrapperType(type); return result != type && result != null; }
for(JvmUpperBound upperBound: filter(constraints, JvmUpperBound.class)) { JvmTypeReference upperBoundType = upperBound.getTypeReference(); if (isWrapperType(upperBoundType)) return true;
@Override public JvmTypeReference put(JvmTypeParameter key, JvmTypeReference value) { return super.put(key, primitives.asWrapperTypeIfPrimitive(value)); }
public JvmTypeReference asWrapperTypeIfPrimitive(JvmTypeReference primitive) { if (primitive == null || !isPrimitive(primitive)) { return primitive; } final JvmType wrapperType = getWrapperType((JvmPrimitiveType) primitive.getType()); if (wrapperType == null) return primitive; return typeReferences.createTypeRef(wrapperType); }
return this._typeReferenceBuilder.typeRef(Void.TYPE); if (this.services.getPrimitives().isPrimitive(type)) { return this._typeReferenceBuilder.typeRef(id);
public JvmType getWrapperType(JvmPrimitiveType primitive) { switch (primitiveKind(primitive)) { case Byte : return getType(Byte.class, primitive); case Short : return getType(Short.class, primitive); case Char : return getType(Character.class, primitive); case Int : return getType(Integer.class, primitive); case Long : return getType(Long.class, primitive); case Float : return getType(Float.class, primitive); case Double : return getType(Double.class, primitive); case Boolean : return getType(Boolean.class, primitive); case Void : return getType(Void.class, primitive); default : throw new IllegalArgumentException("Not a primitive : "+primitive); } }
protected Object getDefaultObjectValue(LightweightTypeReference type) { if(!type.isPrimitive()) return null; else { JvmPrimitiveType primitive = (JvmPrimitiveType) type.getType(); switch (services.getPrimitives().primitiveKind(primitive)) { case Byte : return Byte.valueOf((byte)0); case Short : return Short.valueOf((short)0); case Char : return Character.valueOf((char)0); case Int : return Integer.valueOf(0); case Long : return Long.valueOf(0l); case Float : return Float.valueOf(0f); case Double : return Double.valueOf("0."); case Boolean : return Boolean.FALSE; case Void : return null; default : throw new IllegalArgumentException("Not a primitive : "+primitive); } } }