Example #1
0
 public JvmWildcardTypeReference wildCardExtends(JvmTypeReference clone) {
   JvmWildcardTypeReference result = factory.createJvmWildcardTypeReference();
   JvmUpperBound upperBound = factory.createJvmUpperBound();
   upperBound.setTypeReference(clone);
   result.getConstraints().add(upperBound);
   return result;
 }
 @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;
 }
 @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;
 }
Example #4
0
 public JvmWildcardTypeReference wildCard() {
   JvmWildcardTypeReference result = factory.createJvmWildcardTypeReference();
   return result;
 }