/** * Static helper method that is used from within the super call in the constructor of * {@link RawResolvedFeatures}. */ private static LightweightTypeReference createTypeReference(JvmDeclaredType type, CommonTypeComputationServices services) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); return owner.newParameterizedTypeReference(type); }
@Override public FunctionTypeReference newFunctionTypeReference(JvmType type) { FunctionTypeReference result; if (factory.isInner(type)) { ParameterizedTypeReference outer = newParameterizedTypeReference((JvmDeclaredType)type.eContainer()); result = new InnerFunctionTypeReference(this, outer, type); } else { result = new FunctionTypeReference(this, type); } return result; }
@Override public ParameterizedTypeReference newParameterizedTypeReference(JvmType type) { ParameterizedTypeReference result; if (factory.isInner(type)) { ParameterizedTypeReference outer = newParameterizedTypeReference((JvmDeclaredType)type.eContainer()); result = new InnerTypeReference(this, outer, type); } else { result = new ParameterizedTypeReference(this, type); } return result; }
/** * Creates a references to the given class or returns an {@link UnknownTypeReference} if no * JRE is available. If the type is available, the given acceptor is used to initialize it further. */ @Override public LightweightTypeReference newReferenceTo(Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init) { if (init == null) { throw new NullPointerException("initializer"); } JvmType rawType = getServices().getTypeReferences().findDeclaredType(type, getContextResourceSet()); if (rawType == null) { return newUnknownTypeReference(type.getName()); } if (rawType.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { throw new IllegalArgumentException("given type is an array type: " + type); } ParameterizedTypeReference result = newParameterizedTypeReference(rawType); return init.enhance(result); }