/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_GENERIC_TYPE__TYPE_PARAMETERS: return getTypeParameters(); case TypesPackage.JVM_GENERIC_TYPE__INTERFACE: return isInterface(); case TypesPackage.JVM_GENERIC_TYPE__STRICT_FLOATING_POINT: return isStrictFloatingPoint(); case TypesPackage.JVM_GENERIC_TYPE__ANONYMOUS: return isAnonymous(); } return super.eGet(featureID, resolve, coreType); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TypesPackage.JVM_MEMBER__DECLARING_TYPE: setDeclaringType((JvmDeclaredType)newValue); return; case TypesPackage.JVM_MEMBER__VISIBILITY: setVisibility((JvmVisibility)newValue); return; case TypesPackage.JVM_MEMBER__SIMPLE_NAME: setSimpleName((String)newValue); return; case TypesPackage.JVM_MEMBER__DEPRECATED: setDeprecated((Boolean)newValue); return; } super.eSet(featureID, newValue); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TypesPackage.JVM_MEMBER__DECLARING_TYPE: return getDeclaringType() != null; case TypesPackage.JVM_MEMBER__VISIBILITY: return visibility != VISIBILITY_EDEFAULT; case TypesPackage.JVM_MEMBER__SIMPLE_NAME: return SIMPLE_NAME_EDEFAULT == null ? simpleName != null : !SIMPLE_NAME_EDEFAULT.equals(simpleName); case TypesPackage.JVM_MEMBER__IDENTIFIER: return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier); case TypesPackage.JVM_MEMBER__DEPRECATED: return isSetDeprecated(); } return super.eIsSet(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDeclarator(JvmTypeParameterDeclarator newDeclarator) { if (newDeclarator != eInternalContainer() || (eContainerFeatureID() != TypesPackage.JVM_TYPE_PARAMETER__DECLARATOR && newDeclarator != null)) { if (EcoreUtil.isAncestor(this, newDeclarator)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newDeclarator != null) msgs = ((InternalEObject)newDeclarator).eInverseAdd(this, TypesPackage.JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS, JvmTypeParameterDeclarator.class, msgs); msgs = basicSetDeclarator(newDeclarator, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_TYPE_PARAMETER__DECLARATOR, newDeclarator, newDeclarator)); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_DECLARED_TYPE__ARRAY_TYPE: return getArrayType(); case TypesPackage.JVM_DECLARED_TYPE__SUPER_TYPES: return getSuperTypes(); case TypesPackage.JVM_DECLARED_TYPE__MEMBERS: return getMembers(); case TypesPackage.JVM_DECLARED_TYPE__ABSTRACT: return isAbstract(); case TypesPackage.JVM_DECLARED_TYPE__STATIC: return isStatic(); case TypesPackage.JVM_DECLARED_TYPE__FINAL: return isFinal(); case TypesPackage.JVM_DECLARED_TYPE__PACKAGE_NAME: return getPackageName(); } return super.eGet(featureID, resolve, coreType); }
@Override public LightweightTypeReference doVisitFunctionTypeReference(XFunctionTypeRef reference) { JvmTypeReference equivalent = reference.getEquivalent(); if (equivalent == null) { return super.doVisitFunctionTypeReference(reference); } FunctionTypeReference result; // constructors used below to avoid subsequent checks for isInner which was supposed to be done by // the computation of the equivalent if (equivalent.eClass() == TypesPackage.Literals.JVM_INNER_TYPE_REFERENCE) { JvmParameterizedTypeReference outer = ((JvmInnerTypeReference) equivalent).getOuter(); LightweightTypeReference outerEquivalent = outer.accept(this); result = new InnerFunctionTypeReference(owner, outerEquivalent, reference.getType()); } else { result = new FunctionTypeReference(owner, reference.getType()); } if (equivalent instanceof JvmParameterizedTypeReference) { for(JvmTypeReference argument: ((JvmParameterizedTypeReference)equivalent).getArguments()) { result.addTypeArgument(visit(argument)); } } for(JvmTypeReference parameter: reference.getParamTypes()) { result.addParameterType(visit(parameter)); } if (reference.getReturnType() != null) { result.setReturnType(visit(reference.getReturnType())); } return result; }
@Override /* @Nullable */ public LightweightTypeReference getSuperType(JvmType rawType) { if (rawType.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { JvmComponentType rawComponentType = ((JvmArrayType) rawType).getComponentType(); LightweightTypeReference result = component.getSuperType(rawComponentType); if (result == null) { return null; } if (result == component) return this; return getOwner().newArrayTypeReference(result); } else if (rawType.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { String identifier = rawType.getIdentifier(); if (Object.class.getName().equals(identifier) || Cloneable.class.getName().equals(identifier) || Serializable.class.getName().equals(identifier)) { return getOwner().newParameterizedTypeReference(rawType); } } return null; }
static String computeFor(JvmWildcardTypeReference typeReference, char innerClassDelimiter, NameType nameType) { if (typeReference.eIsSet(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS)) { if (typeReference.getConstraints().size() == 1) { JvmTypeConstraint onlyConstraint = typeReference.getConstraints().get(0); if (nameType != NameType.ID && nameType != NameType.TO_STRING) { JvmTypeReference reference = onlyConstraint.getTypeReference(); if (reference == null || (onlyConstraint instanceof JvmUpperBound && Object.class.getCanonicalName().equals(onlyConstraint.getTypeReference().getIdentifier()))) { return "?"; } } else if (nameType == NameType.ID && onlyConstraint.getTypeReference() == null) { return "?"; } } StringBuilder mutableResult = new StringBuilder(64); mutableResult.append("? "); appendConstraintsName(mutableResult, typeReference.getConstraints(), innerClassDelimiter, nameType); return mutableResult.toString(); } return "?"; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == JvmType.class) { switch (derivedFeatureID) { default: return -1; } } if (baseClass == JvmComponentType.class) { switch (derivedFeatureID) { case TypesPackage.JVM_DECLARED_TYPE__ARRAY_TYPE: return TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); }
@Test public void testUnreachableCase_6() { try { StringConcatenation _builder = new StringConcatenation(); _builder.append("switch new java.util.ArrayList<String> {"); _builder.newLine(); _builder.append("\t"); _builder.append("java.util.List<Integer>: \"list of integers\""); _builder.newLine(); _builder.append("\t"); _builder.append("java.util.List<String>: \"list of strings\""); _builder.newLine(); _builder.append("\t"); _builder.append("default: \"something else\""); _builder.newLine(); _builder.append("}"); _builder.newLine(); this._validationTestHelper.assertError(this.expression(_builder), TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, IssueCodes.UNREACHABLE_CASE); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TypesPackage.JVM_SHORT_ANNOTATION_VALUE__VALUES: return values != null && !values.isEmpty(); } return super.eIsSet(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == JvmTypeParameterDeclarator.class) { switch (derivedFeatureID) { case TypesPackage.JVM_EXECUTABLE__TYPE_PARAMETERS: return TypesPackage.JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TypesPackage.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE: return basicSetTypeReference(null, msgs); case TypesPackage.JVM_TYPE_CONSTRAINT__OWNER: return basicSetOwner(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_DECLARED_TYPE__ARRAY_TYPE: setArrayType((JvmArrayType)null); return; case TypesPackage.JVM_DECLARED_TYPE__SUPER_TYPES: getSuperTypes().clear(); return; case TypesPackage.JVM_DECLARED_TYPE__MEMBERS: getMembers().clear(); return; case TypesPackage.JVM_DECLARED_TYPE__ABSTRACT: setAbstract(ABSTRACT_EDEFAULT); return; case TypesPackage.JVM_DECLARED_TYPE__STATIC: setStatic(STATIC_EDEFAULT); return; case TypesPackage.JVM_DECLARED_TYPE__FINAL: setFinal(FINAL_EDEFAULT); return; case TypesPackage.JVM_DECLARED_TYPE__PACKAGE_NAME: setPackageName(PACKAGE_NAME_EDEFAULT); return; } super.eUnset(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TypesPackage.JVM_BYTE_ANNOTATION_VALUE__VALUES: getValues().clear(); getValues().addAll((Collection<? extends Byte>)newValue); return; } super.eSet(featureID, newValue); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_UNKNOWN_TYPE_REFERENCE__QUALIFIED_NAME: setQualifiedName(QUALIFIED_NAME_EDEFAULT); return; } super.eUnset(featureID); }
/** * Contexts: * JvmUpperBound returns JvmUpperBound * * Constraint: * typeReference=JvmTypeReference */ protected void sequence_JvmUpperBound(ISerializationContext context, JvmUpperBound semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, TypesPackage.Literals.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TypesPackage.Literals.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getJvmUpperBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference()); feeder.finish(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_FORMAL_PARAMETER__NAME: return getName(); case TypesPackage.JVM_FORMAL_PARAMETER__PARAMETER_TYPE: return getParameterType(); } return super.eGet(featureID, resolve, coreType); }
/** * Contexts: * JvmUpperBoundAnded returns JvmUpperBound * * Constraint: * typeReference=JvmTypeReference */ protected void sequence_JvmUpperBoundAnded(ISerializationContext context, JvmUpperBound semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, TypesPackage.Literals.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, TypesPackage.Literals.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getJvmUpperBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference()); feeder.finish(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TypesPackage.JVM_FIELD__STATIC: setStatic((Boolean)newValue); return; case TypesPackage.JVM_FIELD__FINAL: setFinal((Boolean)newValue); return; case TypesPackage.JVM_FIELD__TYPE: setType((JvmTypeReference)newValue); return; case TypesPackage.JVM_FIELD__VOLATILE: setVolatile((Boolean)newValue); return; case TypesPackage.JVM_FIELD__TRANSIENT: setTransient((Boolean)newValue); return; case TypesPackage.JVM_FIELD__CONSTANT: setConstant((Boolean)newValue); return; case TypesPackage.JVM_FIELD__CONSTANT_VALUE: setConstantValue(newValue); return; } super.eSet(featureID, newValue); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_PRIMITIVE_TYPE__SIMPLE_NAME: setSimpleName(SIMPLE_NAME_EDEFAULT); return; } super.eUnset(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE__ARGUMENTS: getArguments().clear(); return; case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE: setType((JvmType)null); return; } super.eUnset(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_INNER_TYPE_REFERENCE__OUTER: return getOuter(); } return super.eGet(featureID, resolve, coreType); }
/** * Constraint bounds are definitely invalid if they are <code>not null</code> and point to a primitive type. * {@link JvmSpecializedTypeReference} will not be resolved by this check thus they may lead to finally * invalid constraint bounds. * * @param constraintBound the reference that shall be come the new constraint. * @return <code>false</code> if the given constraint is definitely invalid. */ protected boolean isLikelyAValidConstraintBound(JvmTypeReference constraintBound) { if (constraintBound == null) return true; if (constraintBound instanceof JvmSpecializedTypeReference) { JvmTypeReference equivalent = (JvmTypeReference) constraintBound.eGet(TypesPackage.Literals.JVM_SPECIALIZED_TYPE_REFERENCE__EQUIVALENT, false); if (equivalent != null) { return isLikelyAValidConstraintBound(equivalent); } return true; } boolean invalid = (constraintBound.getType() instanceof JvmPrimitiveType || (constraintBound.getType() instanceof JvmVoid && !constraintBound.getType().eIsProxy())); return !invalid; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TypesPackage.JVM_GENERIC_TYPE__TYPE_PARAMETERS: return ((InternalEList<?>)getTypeParameters()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TypesPackage.JVM_DOUBLE_ANNOTATION_VALUE__VALUES: getValues().clear(); getValues().addAll((Collection<? extends Double>)newValue); return; } super.eSet(featureID, newValue); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_FEATURE__LOCAL_CLASSES: return getLocalClasses(); } return super.eGet(featureID, resolve, coreType); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<JvmEnumerationLiteral> getValues() { if (values == null) { values = new EObjectResolvingEList<JvmEnumerationLiteral>(JvmEnumerationLiteral.class, this, TypesPackage.JVM_ENUM_ANNOTATION_VALUE__VALUES); } return values; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_STRING_ANNOTATION_VALUE__VALUES: return getValues(); } return super.eGet(featureID, resolve, coreType); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_CHAR_ANNOTATION_VALUE__VALUES: getValues().clear(); return; } super.eUnset(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_TYPE_ANNOTATION_VALUE__VALUES: getValues().clear(); return; } super.eUnset(featureID); }
private int internalGetPrimitiveKindFromWrapper(ParameterizedTypeReference typeReference) { JvmType type = typeReference.getType(); if (type == null || type.eIsProxy()) { return PRIMITIVE_NONE; } EClass eClass = type.eClass(); if (eClass != TypesPackage.Literals.JVM_GENERIC_TYPE) { if (eClass == TypesPackage.Literals.JVM_TYPE_PARAMETER) { return internalGetPrimitiveKindFromWrapper((JvmTypeParameter)type, null); } return PRIMITIVE_NONE; } return internalGetPrimitiveKindFromWrapper((JvmGenericType)type); }
@Override public LightweightTypeReference getRawTypeReference() { if (isRawType()) { return this; } LightweightTypeReference rawOuter = outer.getRawTypeReference(); JvmType type = getType(); if (type.eClass() != TypesPackage.Literals.JVM_TYPE_PARAMETER) { return getOwner().newParameterizedTypeReference(rawOuter, type); } return getServices().getRawTypeHelper().getRawTypeReference(this, getOwner().getContextResourceSet()); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAnnotation(JvmAnnotationType newAnnotation) { JvmAnnotationType oldAnnotation = annotation; annotation = newAnnotation; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_ANNOTATION_REFERENCE__ANNOTATION, oldAnnotation, annotation)); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TypesPackage.JVM_PRIMITIVE_TYPE__SIMPLE_NAME: return SIMPLE_NAME_EDEFAULT == null ? simpleName != null : !SIMPLE_NAME_EDEFAULT.equals(simpleName); } return super.eIsSet(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TypesPackage.JVM_OPERATION__STATIC: return isStatic(); case TypesPackage.JVM_OPERATION__FINAL: return isFinal(); case TypesPackage.JVM_OPERATION__ABSTRACT: return isAbstract(); case TypesPackage.JVM_OPERATION__RETURN_TYPE: return getReturnType(); case TypesPackage.JVM_OPERATION__DEFAULT_VALUE: return getDefaultValue(); case TypesPackage.JVM_OPERATION__SYNCHRONIZED: return isSynchronized(); case TypesPackage.JVM_OPERATION__DEFAULT: return isDefault(); case TypesPackage.JVM_OPERATION__NATIVE: return isNative(); case TypesPackage.JVM_OPERATION__STRICT_FLOATING_POINT: return isStrictFloatingPoint(); } return super.eGet(featureID, resolve, coreType); }
@Override public boolean isRawType() { EClass typeClass = type.eClass(); if (typeClass == TypesPackage.Literals.JVM_GENERIC_TYPE && typeArguments == null) { return ((InternalEObject)type).eIsSet(TypesPackage.JVM_GENERIC_TYPE__TYPE_PARAMETERS); } else if (typeClass == TypesPackage.Literals.JVM_TYPE_PARAMETER) { JvmTypeParameter typeParameter = (JvmTypeParameter) type; return isRawType(typeParameter, new RecursionGuard<JvmTypeParameter>()); } return false; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE: setArrayType((JvmArrayType)null); return; } super.eUnset(featureID); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TypesPackage.JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS: getTypeParameters().clear(); getTypeParameters().addAll((Collection<? extends JvmTypeParameter>)newValue); return; } super.eSet(featureID, newValue); }