org.eclipse.xtext.common.types.TypesPackage Java Examples

The following examples show how to use org.eclipse.xtext.common.types.TypesPackage. 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: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void _setValue(final JvmAnnotationValue it, final Object value, final String componentType, final boolean mustBeArray) {
  if ((componentType == null)) {
    this.throwNotApplicable(it, value.getClass().getName());
  }
  boolean _or = false;
  if (mustBeArray) {
    _or = true;
  } else {
    JvmTypeReference _returnType = it.getOperation().getReturnType();
    JvmType _type = null;
    if (_returnType!=null) {
      _type=_returnType.getType();
    }
    EClass _eClass = null;
    if (_type!=null) {
      _eClass=_type.eClass();
    }
    boolean _equals = Objects.equal(_eClass, TypesPackage.Literals.JVM_ARRAY_TYPE);
    _or = _equals;
  }
  if (_or) {
    this.throwNotApplicable(it, (componentType + "[]"));
  }
  this.throwNotApplicable(it, componentType);
}
 
Example #2
Source File: A0NoIngerithanceTest.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Test
public void parseLocalFunctionCall01() throws Exception {
	SarlScript mas = file(getParseHelper(), LOCAL_FUNCTION_CALL_SARL_01);
	Validator val = validate(getValidationHelper(), getInjector(), mas);
	val
		.assertNoErrors(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST)
		.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
		.assertWarning(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION,
			"toA0");
}
 
Example #3
Source File: JvmExecutableImpl.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean eIsSet(int featureID)
{
	switch (featureID)
	{
		case TypesPackage.JVM_EXECUTABLE__TYPE_PARAMETERS:
			return typeParameters != null && !typeParameters.isEmpty();
		case TypesPackage.JVM_EXECUTABLE__PARAMETERS:
			return parameters != null && !parameters.isEmpty();
		case TypesPackage.JVM_EXECUTABLE__EXCEPTIONS:
			return exceptions != null && !exceptions.isEmpty();
		case TypesPackage.JVM_EXECUTABLE__VAR_ARGS:
			return varArgs != VAR_ARGS_EDEFAULT;
	}
	return super.eIsSet(featureID);
}
 
Example #4
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected JvmOperation findOperation(final String name, final boolean mustBeArray) {
  final JvmOperation result = this.findOperation(name);
  JvmTypeReference _returnType = result.getReturnType();
  JvmType _type = null;
  if (_returnType!=null) {
    _type=_returnType.getType();
  }
  final JvmType returnType = _type;
  boolean _and = false;
  if (!mustBeArray) {
    _and = false;
  } else {
    EClass _eClass = null;
    if (returnType!=null) {
      _eClass=returnType.eClass();
    }
    boolean _notEquals = (!Objects.equal(_eClass, TypesPackage.Literals.JVM_ARRAY_TYPE));
    _and = _notEquals;
  }
  if (_and) {
    throw new IllegalArgumentException("Cannot assign array value to simple annotation property");
  }
  return result;
}
 
Example #5
Source File: IndexedJvmTypeAccess.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
public EObject getIndexedJvmType(QualifiedName qualifiedName, String fragment, ResourceSet resourceSet, boolean throwShadowedException) throws UnknownNestedTypeException {
	if (resourceSet != null) {
		IResourceDescriptions descriptions = resourceDescriptionsProvider.getResourceDescriptions(resourceSet);
		Iterable<IEObjectDescription> candidates = descriptions.getExportedObjects(TypesPackage.Literals.JVM_TYPE, qualifiedName, false);
		Iterator<IEObjectDescription> iterator = candidates.iterator();
		if (iterator.hasNext()) {
			EObject result = findAccessibleType(fragment, resourceSet, iterator);
			if (result != null) {
				return result;
			}
		}
		if (throwShadowedException && descriptions instanceof IShadowedResourceDescriptions) {
			if (((IShadowedResourceDescriptions) descriptions).isShadowed(TypesPackage.Literals.JVM_TYPE, qualifiedName, false)) {
				throw new ShadowedTypeException("The type '"+qualifiedName+"' is locally shadowed.");
			}
		}
	}
	return null;
}
 
Example #6
Source File: XbaseValidator.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@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 #7
Source File: XtendUIValidationTests.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testDiscouragedTypeUsageInnernClass() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar(org.eclipse.xtend.core.tests.internal.InternalClass$InnerInternalClass x){}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    final XtendFile xtendFile = this.testHelper.xtendFile("Clazz.xtend", _builder.toString());
    XtendMember _head = IterableExtensions.<XtendMember>head(IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers());
    final XtendFunction function = ((XtendFunction) _head);
    this.helper.assertWarning(function.getParameters().get(0), TypesPackage.Literals.JVM_TYPE_REFERENCE, org.eclipse.xtext.xbase.validation.IssueCodes.DISCOURAGED_REFERENCE);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #8
Source File: JvmMemberImpl.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setDeclaringType(JvmDeclaredType newDeclaringType)
{
	if (newDeclaringType != eInternalContainer() || (eContainerFeatureID() != TypesPackage.JVM_MEMBER__DECLARING_TYPE && newDeclaringType != null))
	{
		if (EcoreUtil.isAncestor(this, newDeclaringType))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newDeclaringType != null)
			msgs = ((InternalEObject)newDeclaringType).eInverseAdd(this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, JvmDeclaredType.class, msgs);
		msgs = basicSetDeclaringType(newDeclaringType, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_MEMBER__DECLARING_TYPE, newDeclaringType, newDeclaringType));
}
 
Example #9
Source File: JvmCustomAnnotationValueItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Values feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void addValuesPropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmCustomAnnotationValue_values_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmCustomAnnotationValue_values_feature", "_UI_JvmCustomAnnotationValue_type"),
			 TypesPackage.Literals.JVM_CUSTOM_ANNOTATION_VALUE__VALUES,
			 true,
			 false,
			 false,
			 null,
			 null,
			 null));
}
 
Example #10
Source File: JvmGenericTypeItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Strict Floating Point feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void addStrictFloatingPointPropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmGenericType_strictFloatingPoint_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmGenericType_strictFloatingPoint_feature", "_UI_JvmGenericType_type"),
			 TypesPackage.Literals.JVM_GENERIC_TYPE__STRICT_FLOATING_POINT,
			 true,
			 false,
			 false,
			 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
			 null,
			 null));
}
 
Example #11
Source File: JvmOperationItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Final feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void addFinalPropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmOperation_final_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmOperation_final_feature", "_UI_JvmOperation_type"),
			 TypesPackage.Literals.JVM_OPERATION__FINAL,
			 true,
			 false,
			 false,
			 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
			 null,
			 null));
}
 
Example #12
Source File: JvmDeclaredTypeItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Static feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void addStaticPropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmDeclaredType_static_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmDeclaredType_static_feature", "_UI_JvmDeclaredType_type"),
			 TypesPackage.Literals.JVM_DECLARED_TYPE__STATIC,
			 true,
			 false,
			 false,
			 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
			 null,
			 null));
}
 
Example #13
Source File: JvmDelegateTypeReferenceItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Delegate feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void addDelegatePropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmDelegateTypeReference_delegate_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmDelegateTypeReference_delegate_feature", "_UI_JvmDelegateTypeReference_type"),
			 TypesPackage.Literals.JVM_DELEGATE_TYPE_REFERENCE__DELEGATE,
			 true,
			 false,
			 true,
			 null,
			 null,
			 null));
}
 
Example #14
Source File: VarDeclarationParsingTest.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Test
@Tag("sarlValidation")
public void multicatch_xtend() throws Exception {
	SarlScript mas = file(getParseHelper(), multilineString(
		"agent A1 {",
			"def myaction {",
				"try {",
					"System.out.println(\"G\")",
				"}",
				"catch(Exception e) {",
					"System.out.println(e)",
				"}",
				"catch(Throwable e) {",
					"System.out.println(e)",
				"}",
			"}",
		"}"
	));
	validate(getValidationHelper(), getInjector(), mas).assertError(
		TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
		Diagnostic.SYNTAX_DIAGNOSTIC,
		"missing ':' at 'e'");
}
 
Example #15
Source File: JvmOperationItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * This adds a property descriptor for the Strict Floating Point feature.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 * @since 2.4
 */
protected void addStrictFloatingPointPropertyDescriptor(Object object)
{
	itemPropertyDescriptors.add
		(createItemPropertyDescriptor
			(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
			 getResourceLocator(),
			 getString("_UI_JvmOperation_strictFloatingPoint_feature"),
			 getString("_UI_PropertyDescriptor_description", "_UI_JvmOperation_strictFloatingPoint_feature", "_UI_JvmOperation_type"),
			 TypesPackage.Literals.JVM_OPERATION__STRICT_FLOATING_POINT,
			 true,
			 false,
			 false,
			 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
			 null,
			 null));
}
 
Example #16
Source File: A0NoIngerithanceTest.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Test
public void parseSuperStatic() throws Exception {
	SarlScript mas = file(getParseHelper(), SUPER_STATIC_SARL);
	Validator val = validate(getValidationHelper(), getInjector(), mas);
	val
		.assertNoErrors(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST)
		.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
		.assertWarning(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION,
			"toA0");
}
 
Example #17
Source File: JvmIntAnnotationValueImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public EList<Integer> getValues()
{
	if (values == null)
	{
		values = new EDataTypeEList<Integer>(Integer.class, this, TypesPackage.JVM_INT_ANNOTATION_VALUE__VALUES);
	}
	return values;
}
 
Example #18
Source File: JvmComponentTypeImplCustom.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
	switch (featureID)
	{
		case TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE:
			// don't demand-create the array if queried reflectively
			return arrayType;
	}
	return super.eGet(featureID, resolve, coreType);
}
 
Example #19
Source File: JvmAnnotationTargetImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID)
{
	switch (featureID)
	{
		case TypesPackage.JVM_ANNOTATION_TARGET__ANNOTATIONS:
			getAnnotations().clear();
			return;
	}
	super.eUnset(featureID);
}
 
Example #20
Source File: CompilerTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
@Tag("sarlValidation")
public void string_as_biginteger_issues() throws Exception {
	validate(getValidationHelper(), getInjector(), file(getParseHelper(), STRING_AS_BIGINTEGER_SARL))
	.assertNoErrors(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST)
	.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
	.assertWarning(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION,
			"'toBigInteger'");
}
 
Example #21
Source File: XtendValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testWildcardSuperType_4() throws Exception {
	XtendFile file = file(
			"class Foo {"
			+ " val bar = new Bar<?>() {" 
			+ " }"
			+ "}"
			+ "class Bar<T> {"
			+ "}");
	helper.assertError(file.getXtendTypes().get(0), TypesPackage.Literals.JVM_WILDCARD_TYPE_REFERENCE, INVALID_USE_OF_WILDCARD);
}
 
Example #22
Source File: JvmFieldImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setVolatile(boolean newVolatile)
{
	boolean oldVolatile = volatile_;
	volatile_ = newVolatile;
	if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_FIELD__VOLATILE, oldVolatile, volatile_));
}
 
Example #23
Source File: CompilerTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void as_float_issues() throws Exception {
	validate(getValidationHelper(), getInjector(), file(getParseHelper(), AS_FLOAT_SARL))
	.assertNoErrors(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST)
	.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
	.assertWarning(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION,
			"'floatValue'");
}
 
Example #24
Source File: CompilerTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void as_UUID_issues() throws Exception {
	validate(getValidationHelper(), getInjector(), file(getParseHelper(), AS_UUID_OBJECT_SARL))
	.assertError(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST,
			"BigInteger to UUID")
	.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
	.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION);
}
 
Example #25
Source File: CompilerTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void as_int_issues() throws Exception {
	validate(getValidationHelper(), getInjector(), file(getParseHelper(), AS_INT_SARL))
	.assertNoErrors(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST)
	.assertNoWarnings(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.OBSOLETE_CAST)
	.assertWarning(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			IssueCodes.POTENTIAL_INEFFICIENT_VALUE_CONVERSION,
			"'intValue'");
}
 
Example #26
Source File: JvmWildcardTypeReferenceItemProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
{
	if (childrenFeatures == null)
	{
		super.getChildrenFeatures(object);
		childrenFeatures.add(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS);
	}
	return childrenFeatures;
}
 
Example #27
Source File: JvmAnnotationAnnotationValueImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
	switch (featureID)
	{
		case TypesPackage.JVM_ANNOTATION_ANNOTATION_VALUE__VALUES:
			return getValues();
	}
	return super.eGet(featureID, resolve, coreType);
}
 
Example #28
Source File: JvmComponentTypeImpl.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetArrayType(JvmArrayType newArrayType, NotificationChain msgs)
{
	JvmArrayType oldArrayType = arrayType;
	arrayType = newArrayType;
	if (eNotificationRequired())
	{
		ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE, oldArrayType, newArrayType);
		if (msgs == null) msgs = notification; else msgs.add(notification);
	}
	return msgs;
}
 
Example #29
Source File: ToPrimitiveTypeTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void parseNoOperator() throws Exception {
	SarlScript mas = file(getParseHelper(), NO_OPERATOR_SARL);
	Validator val = validate(getValidationHelper(), getInjector(), mas);
	val.assertError(
			TypesPackage.eINSTANCE.getJvmParameterizedTypeReference(),
			org.eclipse.xtext.xbase.validation.IssueCodes.INVALID_CAST,
			"Cannot cast from A1 to double");
}
 
Example #30
Source File: JdtBasedSimpleTypeScopeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testGetScope_04() {
	resourceSet.getResources().clear();
	try {
		scopeProvider.getScope(field.eResource(), TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
		fail("Expected IllegalStateException");
	} catch( IllegalStateException ex) {
		// ok
	}
}