Java Code Examples for org.eclipse.xtext.common.types.JvmTypeParameter#getDeclarator()
The following examples show how to use
org.eclipse.xtext.common.types.JvmTypeParameter#getDeclarator() .
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: XbaseValidator.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Check public void checkTypeParameterNotUsedInStaticContext(JvmTypeReference ref) { if(ref.getType() instanceof JvmTypeParameter) { JvmTypeParameter typeParameter = (JvmTypeParameter) ref.getType(); if (!(typeParameter.getDeclarator() instanceof JvmOperation) || !isTypeParameterOfClosureImpl(ref)) { EObject currentParent = logicalContainerProvider.getNearestLogicalContainer(ref); while(currentParent != null) { if(currentParent == typeParameter.eContainer()) return; else if(isStaticContext(currentParent)) error("Cannot make a static reference to the non-static type " + typeParameter.getName(), ref, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, -1, STATIC_ACCESS_TO_INSTANCE_MEMBER); currentParent = currentParent.eContainer(); } } } }
Example 2
Source File: TypeReferenceSerializer.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public boolean isLocalTypeParameter(EObject context, JvmTypeParameter parameter) { if (context == parameter.getDeclarator()) return true; if (context instanceof JvmOperation && ((JvmOperation) context).isStatic()) return false; if (context instanceof JvmDeclaredType && ((JvmDeclaredType) context).isStatic()) return false; JvmIdentifiableElement jvmElement = contextProvider.getNearestLogicalContainer(context); if (jvmElement != null) { return isLocalTypeParameter(jvmElement, parameter); } EObject container = context.eContainer(); if (container == null) { return false; } return isLocalTypeParameter(container, parameter); }
Example 3
Source File: ConstructorLinkingCandidate.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected boolean isBoundTypeArgumentSkipped(JvmTypeParameter type, Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping, ITypeReferenceOwner owner) { if (super.isBoundTypeArgumentSkipped(type, mapping, owner)) { if (getConstructor().getDeclaringType() != type.getDeclarator()) { return true; } } return false; }
Example 4
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 5
Source File: AbstractLinkingCandidate.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected boolean isBoundTypeArgumentSkipped(JvmTypeParameter type, Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping, ITypeReferenceOwner owner) { return (type.getDeclarator() instanceof JvmType) && owner.getDeclaredTypeParameters().contains(type) && !mapping.containsKey(type); }