Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.ArrayTypeReference#getComponentType()

The following examples show how to use org.eclipse.xtext.xbase.typesystem.references.ArrayTypeReference#getComponentType() . 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: DeferredTypeParameterHintCollector.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void doVisitArrayTypeReference(ArrayTypeReference reference, ParameterizedTypeReference declaration) {
	JvmType type = declaration.getType();
	if (type instanceof JvmTypeParameter) {
		if (shouldProcess((JvmTypeParameter) type)) {
			JvmTypeParameter typeParameter = (JvmTypeParameter) type;
			processTypeParameter(typeParameter, reference);
		}
	} else {
		if (!declaration.isRawType() && (declaration.isType(List.class) || declaration.isType(Collection.class) || declaration.isType(Iterable.class))) {
			LightweightTypeReference elementType = declaration.getTypeArguments().get(0);
			LightweightTypeReference componentType = reference.getComponentType();
			outerVisit(componentType.getInvariantBoundSubstitute(), elementType);
		}
	}
}
 
Example 2
Source File: RawTypeConformanceComputer.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected int doIsConformant(ArrayTypeReference left, ParameterizedTypeReference right, int flags) {
	if ((flags & AS_TYPE_ARGUMENT) == 0 && (flags & ALLOW_SYNONYMS) != 0) {
		ArrayTypeReference rightAsArray = right.tryConvertToArray();
		if (rightAsArray != null) {
			LightweightTypeReference leftComponent = left.getComponentType().getWrapperTypeIfPrimitive();
			LightweightTypeReference rightComponent = rightAsArray.getComponentType();
			int result = doIsConformant(leftComponent, rightComponent, flags & ~(ALLOW_BOXING_UNBOXING | ALLOW_PRIMITIVE_WIDENING | ALLOW_SYNONYMS | ALLOW_FUNCTION_CONVERSION));
			if ((result & SUCCESS) != 0) {
				return result | DEMAND_CONVERSION | SYNONYM;
			}
		}
	}
	return flags;
}
 
Example 3
Source File: ElementOrComponentTypeComputer.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public LightweightTypeReference doVisitArrayTypeReference(ArrayTypeReference reference) {
	return reference.getComponentType();
}
 
Example 4
Source File: RawTypeConformanceComputer.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected int doIsConformant(ArrayTypeReference left, ArrayTypeReference right, int flags) {
	LightweightTypeReference leftComponent = left.getComponentType();
	LightweightTypeReference rightComponent = right.getComponentType();
	return doIsConformant(leftComponent, rightComponent, flags & ~(ALLOW_BOXING_UNBOXING | ALLOW_PRIMITIVE_WIDENING | ALLOW_SYNONYMS | ALLOW_FUNCTION_CONVERSION));
}