Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner#newParameterizedTypeReference()
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.references.ITypeReferenceOwner#newParameterizedTypeReference() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollectionLiteralsTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
/** * Creates a map type reference that comes as close as possible / necessary to its expected type. */ protected LightweightTypeReference createMapTypeReference(JvmGenericType mapType, LightweightTypeReference pairType, LightweightTypeReference expectation, ITypeReferenceOwner owner) { List<LightweightTypeReference> leftAndRight = pairType.getTypeArguments(); LightweightTypeReference left = leftAndRight.get(0).getInvariantBoundSubstitute(); LightweightTypeReference right = leftAndRight.get(1).getInvariantBoundSubstitute(); LightweightTypeReference mapExpectation = getMapExpectation(expectation); if (mapExpectation != null) { List<LightweightTypeReference> typeArguments = expectation.getTypeArguments(); left = doNormalizeElementType(left, typeArguments.get(0)); right = doNormalizeElementType(right, typeArguments.get(1)); } ParameterizedTypeReference result = owner.newParameterizedTypeReference(mapType); result.addTypeArgument(left.copyInto(owner)); result.addTypeArgument(right.copyInto(owner)); if (mapExpectation != null && !expectation.isAssignableFrom(result)) { // expectation does not match the computed type, but looks good according to the element types: // use expected type if (matchesExpectation(left, mapExpectation.getTypeArguments().get(0)) && matchesExpectation(right, mapExpectation.getTypeArguments().get(1))) { return expectation; } } return result; }
Example 2
Source File: DispatchHelper.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
/** * Computes all the dispatch methods that are declared in the given type or altered * by additional cases in this type. The associated operations are sorted by according their parameter types * from left to right where the most special types occur before more common types. Ambiguous * ordering is resolved alphabetically. * * An exemplary order would look like this * <pre> * method(String) * method(Serializable) * method(CharSequence) * method(Object) * </pre> * * @return a mapping from {@link DispatchSignature signature} to sorted operations. */ public ListMultimap<DispatchSignature, JvmOperation> getDeclaredOrEnhancedDispatchMethods(JvmDeclaredType type) { ListMultimap<DispatchSignature, JvmOperation> result = Multimaps2.newLinkedHashListMultimap(2,4); Iterable<JvmOperation> operations = type.getDeclaredOperations(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, owner.newParameterizedTypeReference(type)); for(JvmOperation operation: operations) { if (isDispatchFunction(operation)) { DispatchSignature signature = new DispatchSignature(operation.getSimpleName().substring(1), operation.getParameters().size()); if (!result.containsKey(signature)) { List<JvmOperation> allOperations = getAllDispatchMethods(signature, type, contextualVisibilityHelper); result.putAll(signature, allOperations); } } } return result; }
Example 3
Source File: CreateMemberQuickfixes.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
protected LightweightTypeReference getReceiverType(XAbstractFeatureCall featureCall) { XExpression actualReceiver = featureCall.getActualReceiver(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, featureCall); if (actualReceiver == null) { JvmDeclaredType callersType = getCallersType(featureCall); if (callersType != null) return owner.newParameterizedTypeReference(callersType); } else if (actualReceiver instanceof XAbstractFeatureCall && ((XAbstractFeatureCall) actualReceiver).isTypeLiteral()) { JvmType type = (JvmType) ((XAbstractFeatureCall) actualReceiver).getFeature(); ParameterizedTypeReference reference = owner.newParameterizedTypeReference(type); return reference; } else { LightweightTypeReference typeRef = typeResolver.resolveTypes(featureCall).getActualType(actualReceiver); if(typeRef != null && typeRef.getType() instanceof JvmDeclaredType) return typeRef; } return null; }
Example 4
Source File: StaticFeatureOnTypeLiteralScope.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override protected List<IEObjectDescription> getAllLocalElements() { List<IEObjectDescription> result = super.getAllLocalElements(); if (getSession().isInstanceContext() && !isExplicitStaticFeatureCall()) { ITypeReferenceOwner owner = getReceiverType().getOwner(); QualifiedThisOrSuperDescription thisDescription = new QualifiedThisOrSuperDescription(THIS, owner.newParameterizedTypeReference(getTypeLiteral()), getBucket().getId(), true, getReceiver()); addToList(thisDescription, result); JvmType receiverRawType = getTypeLiteral(); if (receiverRawType instanceof JvmDeclaredType) { JvmType referencedType = receiverRawType; // If the receiver type is an interface, 'super' always refers to that interface if (!(receiverRawType instanceof JvmGenericType && ((JvmGenericType) receiverRawType).isInterface())) { JvmTypeReference superType = ((JvmDeclaredType) receiverRawType).getExtendedClass(); if (superType != null) { referencedType = superType.getType(); } } QualifiedThisOrSuperDescription superDescription = new QualifiedThisOrSuperDescription(SUPER, owner.newParameterizedTypeReference(referencedType), getBucket().getId(), true, getReceiver()); addToList(superDescription, result); } } return result; }
Example 5
Source File: ResolvedOperationInHierarchy.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override protected TypeParameterSubstitutor<?> getSubstitutor() { if (isRawTypeInheritance()) { return new RawTypeSubstitutor(getContextType().getOwner()); } TypeParameterSubstitutor<?> result = super.getSubstitutor(); List<JvmTypeParameter> typeParameters = getTypeParameters(); if (!typeParameters.isEmpty()) { List<JvmTypeParameter> resolvedTypeParameters = getResolvedTypeParameters(); int max = Math.min(typeParameters.size(), resolvedTypeParameters.size()); ITypeReferenceOwner owner = getContextType().getOwner(); Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> additionalMapping = Maps.newHashMapWithExpectedSize(max); for(int i = 0; i < max; i++) { LightweightTypeReference localReference = owner.newParameterizedTypeReference(resolvedTypeParameters.get(i)); additionalMapping.put(typeParameters.get(i), new LightweightMergedBoundTypeArgument(localReference, VarianceInfo.INVARIANT)); } result.enhanceMapping(additionalMapping); } return result; }
Example 6
Source File: TypeConformanceComputer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected LightweightTypeReference doGetTypeParametersForSuperType( final Multimap<JvmType, LightweightTypeReference> all, JvmGenericType rawType, ITypeReferenceOwner owner, List<LightweightTypeReference> types) { // if we do not declare any parameters it is safe to return the first candidate if (!hasTypeParameters(rawType)) { return getFirstForRawType(all, rawType); } ParameterizedTypeReference result = owner.newParameterizedTypeReference(rawType); pushRequestedTypes(types); if (!enhanceSuperType(Lists.newArrayList(all.get(rawType)), result)) { return null; } FunctionTypeReference resultAsFunctionType = result.getAsFunctionTypeReference(); if (resultAsFunctionType != null) return resultAsFunctionType; return result; }
Example 7
Source File: XbaseTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected void _computeTypes(XTypeLiteral object, ITypeComputationState state) { JvmType type = object.getType(); if (type == null) { return; } checkTypeParameterNotAllowedAsLiteral(object, type, state); ITypeReferenceOwner owner = state.getReferenceOwner(); LightweightTypeReference clazz = owner.newParameterizedTypeReference(type); for (int i = 0; i < object.getArrayDimensions().size(); i++) { clazz = owner.newArrayTypeReference(clazz); } if (object.getArrayDimensions().isEmpty()) { if (clazz.isPrimitiveVoid()) { clazz = state.getReferenceOwner().newReferenceTo(Void.class); } else { clazz = clazz.getWrapperTypeIfPrimitive(); } } LightweightTypeReference result = owner.newReferenceTo(Class.class); if (result instanceof ParameterizedTypeReference) { ParameterizedTypeReference parameterizedTypeReference = (ParameterizedTypeReference) result; parameterizedTypeReference.addTypeArgument(clazz); } state.acceptActualType(result); }
Example 8
Source File: CollectionLiteralsTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
/** * Same as {@link LightweightTypeReference#isSubtypeOf(Class)} but does not accept synonym types as subtypes. */ protected boolean isSubtypeButNotSynonym(LightweightTypeReference expectation, Class<?> clazz) { if (expectation.isType(clazz)) { return true; } ITypeReferenceOwner owner = expectation.getOwner(); JvmType declaredType = owner.getServices().getTypeReferences().findDeclaredType(clazz, owner.getContextResourceSet()); if (declaredType == null) { return false; } LightweightTypeReference superType = owner.newParameterizedTypeReference(declaredType); // don't allow synonyms, e.g. Iterable is not considered to be a supertype of Functions.Function0 boolean result = superType.isAssignableFrom(expectation.getRawTypeReference(), new TypeConformanceComputationArgument(false, false, true, true, false, false)); return result; }
Example 9
Source File: FeatureLinkingCandidate.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected void initializeMapping(JvmTypeParameter typeParameter, Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> result) { ITypeReferenceOwner owner = getState().getReferenceOwner(); if (typeParameter.getDeclarator() instanceof JvmType && owner.getDeclaredTypeParameters().contains(typeParameter)) { LightweightTypeReference typeReference = owner.newParameterizedTypeReference(typeParameter); result.put(typeParameter, new LightweightMergedBoundTypeArgument(typeReference, VarianceInfo.INVARIANT)); } else { super.initializeMapping(typeParameter, result); } }
Example 10
Source File: FeatureLinkingCandidate.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected LightweightTypeReference getDeclaredType(JvmIdentifiableElement feature) { if (feature instanceof JvmConstructor) { return getState().getReferenceOwner().toLightweightTypeReference(getState().getTypeReferences().getTypeForName(Void.TYPE, feature)); } /* * The actual result type is Class<? extends |X|> where |X| is the erasure of * the static type of the expression on which getClass is called. For example, * no cast is required in this code fragment: * Number n = 0; * Class<? extends Number> c = n.getClass(); */ if (isGetClass(feature)) { LightweightTypeReference receiverType = getReceiverType(); if (receiverType == null) { throw new IllegalStateException("Cannot determine the receiver's type"); } List<JvmType> rawTypes = receiverType.getRawTypes(); if (rawTypes.isEmpty()) { return super.getDeclaredType(feature); } ITypeReferenceOwner owner = receiverType.getOwner(); ParameterizedTypeReference result = owner.newParameterizedTypeReference(((JvmOperation) feature).getReturnType().getType()); WildcardTypeReference wildcard = owner.newWildcardTypeReference(); wildcard.addUpperBound(owner.toPlainTypeReference(rawTypes.get(0))); result.addTypeArgument(wildcard); return result; } return super.getDeclaredType(feature); }
Example 11
Source File: WrapperTypeLookup.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
private static LightweightTypeReference findTopLevelType(LightweightTypeReference context, String typeName) { ITypeReferenceOwner owner = context.getOwner(); ResourceSet resourceSet = owner.getContextResourceSet(); Resource typeResource = resourceSet.getResource(URIHelperConstants.OBJECTS_URI.appendSegment(typeName), true); EList<EObject> contents = typeResource.getContents(); if (contents.isEmpty()) { return null; } JvmType type = (JvmType) contents.get(0); if (type == null) return null; return owner.newParameterizedTypeReference(type); }
Example 12
Source File: ResolvedFeature.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected LightweightTypeReference getDeclaredType(JvmIdentifiableElement feature) { if (feature instanceof JvmConstructor) { return getState().getReferenceOwner().newReferenceTo(Void.TYPE); } /* * The actual result type is Class<? extends |X|> where |X| is the erasure of * the static type of the expression on which getClass is called. For example, * no cast is required in this code fragment: * Number n = 0; * Class<? extends Number> c = n.getClass(); */ if (feature instanceof JvmOperation && feature.getSimpleName().equals("getClass")) { JvmOperation getClassOperation = (JvmOperation) feature; if (getClassOperation.getParameters().isEmpty() && "java.lang.Object".equals(getClassOperation.getDeclaringType().getIdentifier())) { LightweightTypeReference receiverType = getReceiverType(); if (receiverType == null) { throw new IllegalStateException("Cannot determine type of receiver "+ getReceiver()); } List<JvmType> rawTypes = receiverType.getRawTypes(); if (rawTypes.isEmpty()) { return super.getDeclaredType(feature); } ITypeReferenceOwner owner = receiverType.getOwner(); ParameterizedTypeReference result = owner.newParameterizedTypeReference(((JvmOperation) feature).getReturnType().getType()); WildcardTypeReference wildcard = owner.newWildcardTypeReference(); wildcard.addUpperBound(owner.toPlainTypeReference(rawTypes.get(0))); result.addTypeArgument(wildcard); return result; } } return super.getDeclaredType(feature); }
Example 13
Source File: TypeInsteadOfConstructorLinkingCandidate.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected void applyType() { JvmType type = (JvmType) getFeature(); if (type == null || type.eIsProxy()) { throw new IllegalStateException(); } ITypeReferenceOwner referenceOwner = getResolvedTypes().getReferenceOwner(); ParameterizedTypeReference result = referenceOwner.newParameterizedTypeReference(type); for(LightweightTypeReference typeArgument: getTypeArguments()) { result.addTypeArgument(typeArgument); } getState().acceptActualType(result); }
Example 14
Source File: InvokedResolvedOperation.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected LightweightTypeReference getReceiverType(XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes, ITypeReferenceOwner owner) { XExpression receiver = featureCall.getActualReceiver(); if (receiver == null) { // static feature call JvmOperation operation = (JvmOperation) featureCall.getFeature(); JvmDeclaredType declaringType = operation.getDeclaringType(); return owner.newParameterizedTypeReference(declaringType); } return resolvedTypes.getActualType(receiver); }
Example 15
Source File: SuperMemberImplementorTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected LightweightTypeReference getContextType() { JvmGenericType inferredType = associations.getInferredType(xtendClass); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, inferredType); ParameterizedTypeReference contextType = owner.newParameterizedTypeReference(inferredType); for(JvmTypeParameter typeParamter: inferredType.getTypeParameters()) { contextType.addTypeArgument(owner.newParameterizedTypeReference(typeParamter)); } return contextType; }
Example 16
Source File: DispatchHelper.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
/** * Return all the cases that are associated with the given dispatch operation. */ public List<JvmOperation> getAllDispatchCases(JvmOperation dispatcherOperation) { DispatchSignature dispatchSignature = new DispatchSignature(dispatcherOperation.getSimpleName(), dispatcherOperation.getParameters().size()); JvmDeclaredType type = dispatcherOperation.getDeclaringType(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, owner.newParameterizedTypeReference(type)); return getAllDispatchMethods(dispatchSignature, type, contextualVisibilityHelper); }
Example 17
Source File: CollectionLiteralsTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void computeType(XSetLiteral literal, JvmGenericType setType, JvmGenericType mapType, ITypeExpectation expectation, ITypeComputationState state) { LightweightTypeReference elementTypeExpectation = null; LightweightTypeReference expectedType = expectation.getExpectedType(); if(expectedType != null) { elementTypeExpectation = getElementOrComponentType(expectedType, state); } List<LightweightTypeReference> setTypeCandidates = computeCollectionTypeCandidates(literal, setType, elementTypeExpectation, state); LightweightTypeReference commonSetType = getCommonSuperType(setTypeCandidates, state); ITypeReferenceOwner owner = state.getReferenceOwner(); if(commonSetType != null) { LightweightTypeReference commonElementType = commonSetType.getTypeArguments().get(0).getInvariantBoundSubstitute(); if(isMapLiteral(expectedType, commonElementType)) { LightweightTypeReference mapTypeReference = createMapTypeReference(mapType, commonElementType, expectedType, owner); expectation.acceptActualType(mapTypeReference, ConformanceFlags.UNCHECKED); commonElementType = createNormalizedPairType(commonElementType, mapTypeReference, owner); refineElementTypeExpectation(literal, commonElementType, state); } else { commonElementType = normalizeElementType(commonElementType, expectedType, owner); if (expectedType != null) { commonSetType = createCollectionTypeReference(setType, commonElementType, expectedType, owner); } expectation.acceptActualType(commonSetType, ConformanceFlags.UNCHECKED); refineElementTypeExpectation(literal, commonElementType, state); } } else { if(isMapExpectation(expectedType)) { ParameterizedTypeReference unboundCollectionType = owner.newParameterizedTypeReference(mapType); unboundCollectionType.addTypeArgument(expectation.createUnboundTypeReference(literal, mapType.getTypeParameters().get(0))); unboundCollectionType.addTypeArgument(expectation.createUnboundTypeReference(literal, mapType.getTypeParameters().get(1))); expectation.acceptActualType(unboundCollectionType, ConformanceFlags.UNCHECKED); } else { setUnboundCollectionType(literal, setType, expectation, elementTypeExpectation, state); } } }
Example 18
Source File: OverrideTester.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
/** * Checks if the overriding method and the given overridden candidate have compatible subsignatures * according to JLS 8.4.2. Uses information about static-ness and visibility for early exits. * * The implemented algorithm pretty much mirrors the one from * class <code>org.eclipse.jdt.internal.corext.util.MethodOverrideTester</code>. * * @param checkInheritance <code>true</code> if it is unknown whether the given operations are declared in a valid type hierarchy. */ public IOverrideCheckResult isSubsignature(AbstractResolvedOperation overriding, JvmOperation overridden, boolean checkInheritance) { JvmOperation declaration = overriding.getDeclaration(); if (declaration == overridden) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.CURRENT); } if (overridden.getDeclaringType() == declaration.getDeclaringType()) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.SAME_DECLARATOR); } ITypeReferenceOwner owner = overriding.getContextType().getOwner(); LightweightTypeReference currentDeclarator = null; if (checkInheritance) { // here we use the raw types intentionally since there is no need to resolve // declarators to concrete bounds to determine the override relationship of types currentDeclarator = owner.newParameterizedTypeReference(declaration.getDeclaringType()); if (!currentDeclarator.isSubtypeOf(overridden.getDeclaringType())) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NO_INHERITANCE); } } if (!Strings.equal(overridden.getSimpleName(), declaration.getSimpleName())) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NAME_MISMATCH); } int parameterCount = overridden.getParameters().size(); if (parameterCount != declaration.getParameters().size()) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.ARITY_MISMATCH); } if (currentDeclarator == null) { currentDeclarator = owner.newParameterizedTypeReference(declaration.getDeclaringType()); } if (!(new ContextualVisibilityHelper(visibilityHelper, currentDeclarator).isVisible(overridden))) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NOT_VISIBLE); } if (declaration.isStatic() != overridden.isStatic()) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.STATIC_MISMATCH); } AbstractResolvedOperation overriddenInHierarchy = new ResolvedOperationInHierarchy(overridden, overriding.getBottom()); if (parameterCount != 0 && !isMatchingParameterList(overriding, overriddenInHierarchy)) { return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.PARAMETER_TYPE_MISMATCH); } if (!isMatchingTypeParameters(overriding, overriddenInHierarchy)) return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.TYPE_PARAMETER_MISMATCH); return new LazyOverrideCheckResult(overriding, overridden, getPrimaryValidDetail(overriding, overridden)); }
Example 19
Source File: XbaseTypeComputer.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected LightweightTypeReference getAndEnhanceIterableOrArrayFromComponent(LightweightTypeReference parameterType, JvmGenericType iterableType, final CompoundTypeReference compoundResult) { if (parameterType.isUnknown()) { compoundResult.addComponent(parameterType); return parameterType; } ITypeReferenceOwner owner = compoundResult.getOwner(); LightweightTypeReference iterableOrArray = null; LightweightTypeReference addAsArrayComponentAndIterable = null; if (parameterType.isPrimitive()) { iterableOrArray = owner.newArrayTypeReference(parameterType); compoundResult.addComponent(iterableOrArray); addAsArrayComponentAndIterable = parameterType.getWrapperTypeIfPrimitive(); } else if (parameterType.isAny()) { addAsArrayComponentAndIterable = parameterType.getOwner().newReferenceToObject(); } else { addAsArrayComponentAndIterable = parameterType; } if (iterableType != null) { ParameterizedTypeReference reference = owner.newParameterizedTypeReference(iterableType); WildcardTypeReference wildcard = owner.newWildcardTypeReference(); wildcard.addUpperBound(addAsArrayComponentAndIterable); reference.addTypeArgument(wildcard); compoundResult.addComponent(reference); if (iterableOrArray == null) { iterableOrArray = reference; LightweightTypeReference potentialPrimitive = addAsArrayComponentAndIterable.getPrimitiveIfWrapperType(); if (potentialPrimitive != addAsArrayComponentAndIterable) { compoundResult.addComponent(owner.newArrayTypeReference(potentialPrimitive)); } } compoundResult.addComponent(owner.newArrayTypeReference(addAsArrayComponentAndIterable)); } else if (iterableOrArray == null) { // no JRE on the CP if (addAsArrayComponentAndIterable != null) { iterableOrArray = owner.newArrayTypeReference(addAsArrayComponentAndIterable); compoundResult.addComponent(iterableOrArray); } else { compoundResult.addComponent(parameterType); return parameterType; } } return iterableOrArray; }
Example 20
Source File: OverrideHelper.java From xtext-extras with Eclipse Public License 2.0 | 3 votes |
/** * Returns <code>null</code> if the given operation declares it's own return type or if it does not override * another operation. * * TODO support this case: * * <pre> * interface I { * String m() * String m2() * } * class A { * CharSequence m() * int m2() * } * class B extends A implements I { * m() will expect String since this is the best choice * m2() will expect int since this is actually overridden and not compatible to String from I#m2 * } * </pre> */ /* @Nullable */ public LightweightTypeReference getReturnTypeOfOverriddenOperation(JvmOperation operation, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper) { if (operation.getVisibility() == JvmVisibility.PRIVATE || !InferredTypeIndicator.isInferred(operation.getReturnType())) { return null; } LightweightTypeReference declaringType = owner.newParameterizedTypeReference(operation.getDeclaringType()); TypeParameterSubstitutor<?> substitutor = createSubstitutor(owner, declaringType); JvmOperation overriddenOperation = findOverriddenOperation(operation, declaringType, substitutor, owner, visibilityHelper); if (overriddenOperation != null) { return substitutor.substitute(owner.toLightweightTypeReference(overriddenOperation.getReturnType())); } return null; }