Ejemplo n.º 1
0
 public JvmWildcardTypeReference wildCardExtends(JvmTypeReference clone) {
   JvmWildcardTypeReference result = factory.createJvmWildcardTypeReference();
   JvmUpperBound upperBound = factory.createJvmUpperBound();
   upperBound.setTypeReference(clone);
   result.getConstraints().add(upperBound);
   return result;
 }
 protected JvmWildcardTypeReference wc_extends(JvmTypeReference typeRef) {
   JvmWildcardTypeReference result = TypesFactory.eINSTANCE.createJvmWildcardTypeReference();
   JvmUpperBound upperBound = TypesFactory.eINSTANCE.createJvmUpperBound();
   upperBound.setTypeReference(typeRef);
   result.getConstraints().add(upperBound);
   return result;
 }
Ejemplo n.º 3
0
 @Override
 public JvmTypeReference toTypeReference() {
   TypesFactory typesFactory = getTypesFactory();
   JvmWildcardTypeReference result = typesFactory.createJvmWildcardTypeReference();
   if (upperBounds != null && !upperBounds.isEmpty()) {
     for (LightweightTypeReference typeArgument : upperBounds) {
       JvmUpperBound constraint = typesFactory.createJvmUpperBound();
       constraint.setTypeReference(typeArgument.getWrapperTypeIfPrimitive().toTypeReference());
       result.getConstraints().add(constraint);
     }
   }
   if (lowerBound != null) {
     JvmLowerBound constraint = typesFactory.createJvmLowerBound();
     constraint.setTypeReference(lowerBound.getWrapperTypeIfPrimitive().toTypeReference());
     result.getConstraints().add(constraint);
   }
   return result;
 }
Ejemplo n.º 4
0
 @Override
 public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper helper) {
   TypesFactory typesFactory = getTypesFactory();
   JvmWildcardTypeReference result = typesFactory.createJvmWildcardTypeReference();
   if (upperBounds != null && !upperBounds.isEmpty()) {
     List<LightweightTypeReference> nonInterfaceTypes = getNonInterfaceTypes(upperBounds);
     JvmTypeReference upperBound =
         toJavaCompliantTypeReference(
             nonInterfaceTypes != null ? nonInterfaceTypes : upperBounds, helper);
     JvmUpperBound constraint = typesFactory.createJvmUpperBound();
     constraint.setTypeReference(upperBound);
     result.getConstraints().add(constraint);
   }
   if (lowerBound != null) {
     JvmLowerBound constraint = typesFactory.createJvmLowerBound();
     constraint.setTypeReference(lowerBound.toJavaCompliantTypeReference());
     result.getConstraints().add(constraint);
   }
   return result;
 }
Ejemplo n.º 5
0
 protected void copyAndFixTypeParameters(
     List<JvmTypeParameter> typeParameters, JvmTypeParameterDeclarator target) {
   for (JvmTypeParameter typeParameter : typeParameters) {
     final JvmTypeParameter clonedTypeParameter = cloneWithProxies(typeParameter);
     target.getTypeParameters().add(clonedTypeParameter);
     boolean upperBoundSeen = false;
     for (JvmTypeConstraint constraint : clonedTypeParameter.getConstraints()) {
       if (constraint instanceof JvmUpperBound) {
         upperBoundSeen = true;
         break;
       }
     }
     if (!upperBoundSeen) {
       JvmUpperBound upperBound = typesFactory.createJvmUpperBound();
       upperBound.setTypeReference(typeReferences.getTypeForName(Object.class, typeParameter));
       clonedTypeParameter.getConstraints().add(upperBound);
     }
     associator.associate(typeParameter, clonedTypeParameter);
   }
 }
 protected JvmUpperBound upper(JvmTypeReference type) {
   JvmUpperBound result = TypesFactory.eINSTANCE.createJvmUpperBound();
   result.setTypeReference(type);
   return result;
 }