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; }
@Override public JvmTypeReference put(JvmTypeParameter key, JvmTypeReference value) { return super.put(key, primitives.asWrapperTypeIfPrimitive(value)); }
private JvmTypeReference getTypeReferenceForTypeName(final String typeName, final EObject context) { final JvmTypeReference typeRef = this.typeReferences.getTypeForName(typeName, context); final JvmTypeReference typeReference = this.primitives.asWrapperTypeIfPrimitive(typeRef); if ((typeReference == null)) { EObject errorContext = context; String contextName = context.toString(); if (((context instanceof Variable) && (((Variable) context).eContainer() instanceof PatternBody))) { final Variable variable = ((Variable) context); final Optional<VariableReference> reference = PatternLanguageHelper.getReferences(variable).findAny(); boolean _isPresent = reference.isPresent(); if (_isPresent) { contextName = variable.getName(); errorContext = reference.get(); } } this.errorFeedback.reportError(errorContext, String.format( "Cannot resolve corresponding Java type for variable %s. Are the required bundle dependencies set?", contextName), EMFPatternLanguageJvmModelInferrer.INVALID_TYPEREF_CODE, Severity.WARNING, IErrorFeedback.JVMINFERENCE_ERROR_TYPE); } return typeReference; }
private JvmTypeReference getTypeReferenceForTypeName(String typeName, EObject context) { JvmTypeReference typeRef = typeReferences.getTypeForName(typeName, context); JvmTypeReference typeReference = primitives.asWrapperTypeIfPrimitive(typeRef); if (typeReference == null) { EObject errorContext = context; String contextName = context.toString(); if (context instanceof Variable && ((Variable)context).eContainer() instanceof PatternBody && ((Variable)context).getReferences().size() > 0) { contextName = ((Variable)context).getName(); errorContext = ((Variable)context).getReferences().get(0); } errorFeedback.reportError( errorContext, String.format( "Cannot resolve corresponding Java type for variable %s. Are the required bundle dependencies set?", contextName), EMFPatternLanguageJvmModelInferrer.INVALID_TYPEREF_CODE, Severity.WARNING, IErrorFeedback.JVMINFERENCE_ERROR_TYPE); } return typeReference; }
protected int getMaxDistanceToObject(JvmTypeReference type) { type = primitives.asWrapperTypeIfPrimitive(type); if (typeRefs.is(type, Object.class)) return 0; JvmType jvmType = type.getType(); int maxDistance = 1; if (jvmType instanceof JvmDeclaredType) { EList<JvmTypeReference> list = ((JvmDeclaredType) jvmType).getSuperTypes(); for (JvmTypeReference jvmTypeReference : list) { int result = 1 + getMaxDistanceToObject(jvmTypeReference); if (result > maxDistance) maxDistance = result; } } return maxDistance; } }
}.visit(primitives.asWrapperTypeIfPrimitive(receiverType)); if (rawType) return new TypeArgumentContext(null, typeReferences, typesFactory, rawTypeHelper, primitives);
List<JvmTypeReference> wrappedVarArgTypes = Lists.newArrayListWithCapacity(actualVarArgTypes.size()); for(JvmTypeReference varArgType: actualVarArgTypes) { wrappedVarArgTypes.add(primitives.asWrapperTypeIfPrimitive(varArgType));
@Override public JvmTypeReference doVisitWildcardTypeReference(JvmWildcardTypeReference reference, Boolean replaceWildcards) { JvmWildcardTypeReference result = typesFactory.createJvmWildcardTypeReference(); for(JvmTypeConstraint constraint: reference.getConstraints()) { JvmTypeReference bound = visit(constraint.getTypeReference(), replaceWildcards); if (bound instanceof JvmWildcardTypeReference) { result.getConstraints().addAll(Lists.transform(((JvmWildcardTypeReference) bound).getConstraints(), new Function<JvmTypeConstraint, JvmTypeConstraint>() { public JvmTypeConstraint apply(JvmTypeConstraint input) { return EcoreUtil2.cloneIfContained(input); } })); } else { JvmTypeConstraint copiedConstraint = (JvmTypeConstraint) EcoreUtil.create(constraint.eClass()); copiedConstraint.setTypeReference(primitives.asWrapperTypeIfPrimitive(bound)); result.getConstraints().add(copiedConstraint); } } return result; }
if (!(bound.getType() instanceof JvmVoid && !bound.getType().eIsProxy())) { JvmLowerBound copiedLowerBound = typesFactory.createJvmLowerBound(); copiedLowerBound.setTypeReference(primitives.asWrapperTypeIfPrimitive(bound)); newConstraints.add(copiedLowerBound);
JvmTypeReference potentialWrapper = conformanceComputer.getPrimitives().asWrapperTypeIfPrimitive(rightReference); if (potentialWrapper != rightReference) { TypeConformanceResult result = conformanceComputer.isConformant(leftReference, potentialWrapper, param);
JvmType jvmType = allowPrimitives ? type.getType() : primitives.asWrapperTypeIfPrimitive(type).getType(); if (tracing) { ITextRegion region = locationProvider.getFullTextRegion(type, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, 0);