• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JvmTypeReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.xtext.common.types.JvmTypeReference的典型用法代码示例。如果您正苦于以下问题:Java JvmTypeReference类的具体用法?Java JvmTypeReference怎么用?Java JvmTypeReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JvmTypeReference类属于org.eclipse.xtext.common.types包,在下文中一共展示了JvmTypeReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test_twoListWildcardsListResult_03

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_twoListWildcardsListResult_03() {
	JvmOperation twoListWildcardsListResult = getMethodFromParameterizedMethods(
			"twoListWildcardsListResult(java.util.List,java.util.List)");
	JvmTypeReference returnType = twoListWildcardsListResult.getReturnType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) returnType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	assertTrue(typeParameter instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcard = (JvmWildcardTypeReference) typeParameter;
	assertEquals(1, wildcard.getConstraints().size());
	assertTrue(wildcard.getConstraints().get(0) instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) wildcard.getConstraints().get(0);
	assertNotNull(upperBound.getTypeReference());
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertFalse(upperBoundType.eIsProxy());
	assertEquals("java.lang.Object", upperBoundType.getIdentifier());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractTypeProviderTest.java


示例2: test_ParameterizedTypes_05

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodZ = getMethodFromType(type, ParameterizedTypes.class, "methodZ(java.util.List)");
	assertEquals(1, methodZ.getParameters().size());
	assertEquals(1, methodZ.getTypeParameters().size());
	assertEquals("Z", methodZ.getTypeParameters().get(0).getIdentifier());
	JvmTypeReference listZ = methodZ.getReturnType();
	assertFalse(listZ.toString(), listZ.getType().eIsProxy());
	assertEquals("java.util.List<? extends java.lang.Object & super Z>", listZ.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listZ;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends java.lang.Object & super Z", wildcardTypeArgument.getIdentifier());
	assertEquals(2, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	assertEquals("java.lang.Object", upperBound.getTypeReference().getIdentifier());
	JvmLowerBound lowerBound = (JvmLowerBound) wildcardTypeArgument.getConstraints().get(1);
	assertEquals("Z", lowerBound.getTypeReference().getIdentifier());
	JvmTypeParameter z = methodZ.getTypeParameters().get(0);
	assertSame(z, lowerBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:AbstractTypeProviderTest.java


示例3: test_ParameterizedTypes_W_01

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_W_01() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmTypeParameter typeParameterW = type.getTypeParameters().get(4);
	assertEquals("W", typeParameterW.getIdentifier());
	assertSame(type, typeParameterW.getDeclarator());
	assertEquals(2, typeParameterW.getConstraints().size());
	JvmTypeConstraint firstTypeConstraint = typeParameterW.getConstraints().get(0);
	assertTrue(firstTypeConstraint instanceof JvmUpperBound);
	JvmUpperBound firstUpperBound = (JvmUpperBound) firstTypeConstraint;
	assertNotNull(firstUpperBound.getTypeReference());
	assertFalse(firstUpperBound.getTypeReference().toString(), firstUpperBound.getTypeReference().eIsProxy());
	assertEquals("java.lang.Comparable<S>", firstUpperBound.getTypeReference().getIdentifier());
	JvmParameterizedTypeReference comparableType = (JvmParameterizedTypeReference) firstUpperBound
			.getTypeReference();
	assertEquals(1, comparableType.getArguments().size());
	JvmTypeReference typeArgument = comparableType.getArguments().get(0);
	assertEquals("S", typeArgument.getIdentifier());
	JvmTypeParameter s = type.getTypeParameters().get(0);
	assertSame(s, typeArgument.getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:AbstractTypeProviderTest.java


示例4: setSuperTypes

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
private void setSuperTypes(String name, BinarySuperTypeSignature signature, String superName, String[] interfaces) {
   	InternalEList<JvmTypeReference> superTypes = (InternalEList<JvmTypeReference>) result.getSuperTypes();
	if (signature != null) {
		List<BinaryGenericTypeSignature> superTypeSignatures = signature.getSuperTypes();
		if (result.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE && ((JvmGenericType) result).isInterface()) {
			if (superTypeSignatures.size() > 1) {
				superTypeSignatures = superTypeSignatures.subList(1, superTypeSignatures.size());
			}
		}
		for (int i = 0; i < superTypeSignatures.size(); i++) {
			superTypes.addUnique(proxies.createTypeReference(superTypeSignatures.get(i), typeParameters));
		}
	} else {
		if (superName != null && result.eClass() != TypesPackage.Literals.JVM_ANNOTATION_TYPE) {
			superTypes.addUnique(proxies.createTypeReference(BinarySignatures.createObjectTypeSignature(superName), typeParameters));
		}
		setInterfaces(interfaces, typeParameters, superTypes);
		if (superTypes.isEmpty() && !Proxies.JAVA_LANG_OBJECT.equals(name)) {
			superTypes.addUnique(proxies.createObjectTypeReference());
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:JvmDeclaredTypeBuilder.java


示例5: setTypeReference

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setTypeReference(JvmTypeReference newTypeReference)
{
	if (newTypeReference != typeReference)
	{
		NotificationChain msgs = null;
		if (typeReference != null)
			msgs = ((InternalEObject)typeReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TypesPackage.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE, null, msgs);
		if (newTypeReference != null)
			msgs = ((InternalEObject)newTypeReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TypesPackage.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE, null, msgs);
		msgs = basicSetTypeReference(newTypeReference, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE, newTypeReference, newTypeReference));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:JvmTypeConstraintImpl.java


示例6: test_ParameterizedTypes_Inner_05

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_Inner_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_01()");
	JvmTypeReference listT = methodV.getReturnType();
	assertEquals("java.util.List<? extends V>[]", listT.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listT)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, upperBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractTypeProviderTest.java


示例7: test_ParameterizedTypes_Inner_06

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_Inner_06() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_02()");
	JvmTypeReference listV = methodV.getReturnType();
	assertEquals("java.util.List<? extends V[]>", listV.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listV;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V[]", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertTrue(upperBoundType instanceof JvmArrayType);
	assertTrue(((JvmArrayType) upperBoundType).getComponentType() instanceof JvmTypeParameter);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, ((JvmArrayType) upperBoundType).getComponentType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:AbstractTypeProviderTest.java


示例8: getJavaLangObjectTypeRef

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
protected JvmTypeReference getJavaLangObjectTypeRef(JvmType rawType, TypesFactory typesFactory) {
	ResourceSet rs = EcoreUtil2.getResourceSet(rawType);
	JvmParameterizedTypeReference refToObject = typesFactory.createJvmParameterizedTypeReference();
	if (rs != null) {
		EObject javaLangObject = rs.getEObject(javaLangObjectURI, true);
		if (javaLangObject instanceof JvmType) {
			JvmType objectDeclaration = (JvmType) javaLangObject;
			refToObject.setType(objectDeclaration);
			return refToObject;
		}
	}
	JvmGenericType proxy = typesFactory.createJvmGenericType();
	((InternalEObject)proxy).eSetProxyURI(javaLangObjectURI);
	refToObject.setType(proxy);
	return refToObject;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:XFunctionTypeRefImplCustom.java


示例9: getFragment

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Override
public String getFragment(EObject obj, IFragmentProvider.Fallback fallback) {
	if (obj instanceof JvmTypeParameter)
		return getFragment(obj.eContainer(), fallback) + "/" + ((JvmTypeParameter) obj).getName();
	if (obj instanceof JvmTypeReference || obj instanceof JvmFormalParameter)
		return fallback.getFragment(obj);
	if (obj instanceof JvmIdentifiableElement) {
		if (obj instanceof JvmArrayType) {
			if (obj.eContainer() instanceof JvmGenericArrayTypeReference)
				return fallback.getFragment(obj);
			if (obj.eContainer() instanceof JvmIdentifiableElement) {
				return getFragment(obj.eContainer(), fallback) + "[]";
			}
		}
		return ((JvmIdentifiableElement) obj).getIdentifier();
	}
	return fallback.getFragment(obj);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractClassMirror.java


示例10: setType

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setType(JvmTypeReference newType)
{
	if (newType != type)
	{
		NotificationChain msgs = null;
		if (type != null)
			msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CheckPackage.FORMAL_PARAMETER__TYPE, null, msgs);
		if (newType != null)
			msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CheckPackage.FORMAL_PARAMETER__TYPE, null, msgs);
		msgs = basicSetType(newType, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, CheckPackage.FORMAL_PARAMETER__TYPE, newType, newType));
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:21,代码来源:FormalParameterImpl.java


示例11: test_ParameterizedTypes_03

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_03() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodT = getMethodFromType(type, ParameterizedTypes.class, "methodT(T)");
	JvmTypeReference listS = methodT.getReturnType();
	assertFalse(listS.toString(), listS.eIsProxy());
	assertEquals("java.util.List<? extends java.lang.Object & super T>", listS.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listS;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends java.lang.Object & super T", wildcardTypeArgument.getIdentifier());
	assertEquals(2, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound uperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	assertEquals("java.lang.Object", uperBound.getTypeReference().getIdentifier());
	JvmLowerBound lowerBound = (JvmLowerBound) wildcardTypeArgument.getConstraints().get(1);
	JvmTypeParameter t = type.getTypeParameters().get(1);
	assertSame(t, lowerBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:AbstractTypeProviderTest.java


示例12: doVisitCompoundTypeReference

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Override
public JvmTypeReference doVisitCompoundTypeReference(JvmCompoundTypeReference reference, Resource resource) {
	JvmCompoundTypeReference result = null;
	List<JvmTypeReference> components = reference.getReferences();
	int recent = -1;
	for (int i = 0; i < components.size(); i++) {
		JvmTypeReference component = components.get(i);
		JvmTypeReference rawType = visit(component, resource);
		if (rawType != null && component != rawType) {
			if (result == null) {
				result = (JvmCompoundTypeReference) EcoreUtil.create(reference.eClass());
			}
			for (int j = recent + 1; j < i; j++) {
				result.getReferences().add(components.get(j));
			}
			result.getReferences().add(rawType);
			recent = i;
		}
	}
	if (result != null)
		return result;
	return reference;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:24,代码来源:RawTypeHelper.java


示例13: checkTypeParameterNotUsedInStaticContext

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@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();
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:XbaseValidator.java


示例14: toSetter

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
/**
 * Creates a setter method for the given properties name with the standard implementation assigning the passed
 * parameter to a similarly named field.
 * 
 * Example: <code>
 * public void setFoo(String foo) {
 *   this.foo = foo;
 * }
 * </code>
 *
 * @return a setter method for a JavaBeans property with the given name, <code>null</code> if sourceElement or name are <code>null</code>.
 */
/* @Nullable */ 
public JvmOperation toSetter(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final String propertyName, /* @Nullable */ final String fieldName, /* @Nullable */ JvmTypeReference typeRef) {
	if(sourceElement == null || propertyName == null || fieldName == null) 
		return null;
	JvmOperation result = typesFactory.createJvmOperation();
	result.setVisibility(JvmVisibility.PUBLIC);
	result.setReturnType(references.getTypeForName(Void.TYPE,sourceElement));
	result.setSimpleName("set" + Strings.toFirstUpper(propertyName));
	result.getParameters().add(toParameter(sourceElement, propertyName, typeRef));
	setBody(result, new Procedures.Procedure1<ITreeAppendable>() {
		@Override
		public void apply(/* @Nullable */ ITreeAppendable p) {
			if(p != null) {
				p = p.trace(sourceElement);
				p.append("this.");
				p.append(javaKeywords.isJavaKeyword(fieldName) ? fieldName+"_" : fieldName);
				p.append(" = ");
				p.append(javaKeywords.isJavaKeyword(propertyName) ? propertyName+"_" : propertyName);
				p.append(";");
			}
		}
	});
	return associate(sourceElement, result);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:37,代码来源:JvmTypesBuilder.java


示例15: test_ParameterizedTypes_Inner_Z_01

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_Inner_Z_01() {
	String typeName = ParameterizedTypes.Inner.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmTypeParameter typeParameterZ = type.getTypeParameters().get(2);
	assertEquals("Z", typeParameterZ.getIdentifier());
	assertSame(type, typeParameterZ.getDeclarator());
	assertEquals(1, typeParameterZ.getConstraints().size());
	JvmTypeConstraint typeConstraint = typeParameterZ.getConstraints().get(0);
	assertTrue(typeConstraint instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) typeConstraint;
	assertNotNull(upperBound.getTypeReference());
	assertEquals("java.util.List<W>", upperBound.getTypeReference().getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) upperBound.getTypeReference();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertEquals("W", typeArgument.getIdentifier());
	JvmTypeParameter w = ((JvmTypeParameterDeclarator) type.getDeclaringType()).getTypeParameters().get(4);
	assertSame(w, typeArgument.getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:AbstractTypeProviderTest.java


示例16: createComputedTypeReference

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
protected JvmTypeReference createComputedTypeReference(
			Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext,
			ResolvedTypes resolvedTypes,
			IFeatureScopeSession featureScopeSession,
			JvmMember member,
			/* @Nullable */ InferredTypeIndicator indicator,
			boolean returnType) {
		XComputedTypeReference result = getServices().getXtypeFactory().createXComputedTypeReference();
		if (indicator == null || indicator.getExpression() == null)
			result.setTypeProvider(createTypeProvider(resolvedTypesByContext, resolvedTypes, featureScopeSession, member, returnType));
		else
			result.setTypeProvider(createTypeProvider(resolvedTypesByContext, resolvedTypes, featureScopeSession, member, indicator.getExpression(), returnType));
		// TODO do we need a lightweight computed type reference?
//		resolvedTypes.setType(member, result);
		return result;
	}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:LogicalContainerAwareReentrantTypeResolver.java


示例17: getAllLocalElements

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@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;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:StaticFeatureOnTypeLiteralScope.java


示例18: setType

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setType(JvmTypeReference newType)
{
	if (newType != type)
	{
		NotificationChain msgs = null;
		if (type != null)
			msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TypesPackage.JVM_FIELD__TYPE, null, msgs);
		if (newType != null)
			msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TypesPackage.JVM_FIELD__TYPE, null, msgs);
		msgs = basicSetType(newType, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_FIELD__TYPE, newType, newType));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:JvmFieldImpl.java


示例19: test_twoListParamsNoResult_03

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Test
public void test_twoListParamsNoResult_03() {
	JvmOperation twoListParamsNoResult = getMethodFromParameterizedMethods(
			"twoListParamsNoResult(java.util.List,java.util.List)");
	JvmFormalParameter firstParam = twoListParamsNoResult.getParameters().get(0);
	JvmTypeReference paramType = firstParam.getParameterType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) paramType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	JvmType referencedType = typeParameter.getType();
	assertFalse(referencedType.eIsProxy());
	assertTrue(referencedType instanceof JvmTypeParameter);
	JvmTypeParameter typeVar = (JvmTypeParameter) referencedType;
	assertEquals("T", typeVar.getName());
	assertSame(twoListParamsNoResult, typeVar.getDeclarator());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:AbstractTypeProviderTest.java


示例20: doGetTypeReference

import org.eclipse.xtext.common.types.JvmTypeReference; //导入依赖的package包/类
@Override
/* @Nullable */
protected JvmTypeReference doGetTypeReference(XComputedTypeReferenceImplCustom context) {
	try {
		resolvedTypes.addDiagnostic(new EObjectDiagnosticImpl(
				Severity.ERROR, 
				IssueCodes.TOO_LITTLE_TYPE_INFORMATION, 
				"Cannot infer type",
				typeResolver.getSourceElement(member), 
				null, 
				-1, 
				null));
		return TypesFactory.eINSTANCE.createJvmAnyTypeReference();
	} finally {
		context.unsetTypeProviderWithoutNotification();
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:LogicalContainerAwareReentrantTypeResolver.java



注:本文中的org.eclipse.xtext.common.types.JvmTypeReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TaskAttemptState类代码示例发布时间:2022-05-22
下一篇:
Java ServiceCreds类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap