Java 类org.eclipse.xtext.common.types.JvmLowerBound 实例源码

项目:xtext-extras    文件:AbstractTypeProviderTest.java   
@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());
}
项目:xtext-extras    文件:AbstractTypeProviderTest.java   
@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());
}
项目:xtext-extras    文件:AbstractTypeProviderTest.java   
@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());
}
项目:xtext-extras    文件:AbstractTypeProviderTest.java   
@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());
}
项目:xtext-extras    文件:PureXbaseSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBoundAnded returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBoundAnded(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:PureXbaseSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBound returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBound(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:AbstractXtypeSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBoundAnded returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBoundAnded(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:AbstractXtypeSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBound returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBound(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:JvmTypeReferences.java   
public JvmParameterizedTypeReferenceConstructor wildCardSuper(String qualifiedName) {
    JvmWildcardTypeReference argument = typesFactory.createJvmWildcardTypeReference();
    JvmLowerBound upperBound = typesFactory.createJvmLowerBound();
    argument.getConstraints().add(upperBound);
    JvmParameterizedTypeReferenceConstructor constructor = new JvmParameterizedTypeReferenceConstructor(qualifiedName, typesFactory, typesProvider, this);
    upperBound.setTypeReference(constructor.getReference());
    reference.getArguments().add(argument);
    return constructor;
}
项目:xtext-extras    文件:JvmTypeReferenceBuilderTest.java   
@Test
public void testWildcard_03() {
  JvmTypeReference _wildcardSuper = this.typeReferenceBuilder.wildcardSuper(this.typeReferenceBuilder.typeRef(CharSequence.class));
  final EList<JvmTypeConstraint> constraints = ((JvmWildcardTypeReference) _wildcardSuper).getConstraints();
  Assert.assertEquals(2, constraints.size());
  Assert.assertEquals("java.lang.CharSequence", IterableExtensions.<JvmLowerBound>head(Iterables.<JvmLowerBound>filter(constraints, JvmLowerBound.class)).getTypeReference().getIdentifier());
}
项目:xtext-extras    文件:TypeReferences.java   
public JvmWildcardTypeReference wildCardSuper(JvmTypeReference clone) {
    JvmWildcardTypeReference result = factory.createJvmWildcardTypeReference();
    JvmLowerBound lowerBound = factory.createJvmLowerBound();
    lowerBound.setTypeReference(clone);
    JvmUpperBound upperBound = factory.createJvmUpperBound();
    upperBound.setTypeReference(getTypeForName(Object.class, clone.getType()));
    result.getConstraints().add(lowerBound);
    result.getConstraints().add(upperBound);
    return result;
}
项目:xtext-extras    文件:Bug462047LangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBoundAnded returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBoundAnded(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:Bug462047LangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBound returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBound(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:ContentAssistFragmentTestLangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBoundAnded returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBoundAnded(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:ContentAssistFragmentTestLangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBound returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBound(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:XImportSectionTestLangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBoundAnded returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBoundAnded(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAndedAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:XImportSectionTestLangSemanticSequencer.java   
/**
 * Contexts:
 *     JvmLowerBound returns JvmLowerBound
 *
 * Constraint:
 *     typeReference=JvmTypeReference
 */
protected void sequence_JvmLowerBound(ISerializationContext context, JvmLowerBound 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.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0(), semanticObject.getTypeReference());
    feeder.finish();
}
项目:xtext-extras    文件:AbstractXtypeSemanticSequencer.java   
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == TypesPackage.eINSTANCE)
        switch (semanticObject.eClass().getClassifierID()) {
        case TypesPackage.JVM_GENERIC_ARRAY_TYPE_REFERENCE:
            sequence_JvmTypeReference(context, (JvmGenericArrayTypeReference) semanticObject); 
            return; 
        case TypesPackage.JVM_INNER_TYPE_REFERENCE:
            sequence_JvmParameterizedTypeReference(context, (JvmInnerTypeReference) semanticObject); 
            return; 
        case TypesPackage.JVM_LOWER_BOUND:
            if (rule == grammarAccess.getJvmLowerBoundAndedRule()) {
                sequence_JvmLowerBoundAnded(context, (JvmLowerBound) semanticObject); 
                return; 
            }
            else if (rule == grammarAccess.getJvmLowerBoundRule()) {
                sequence_JvmLowerBound(context, (JvmLowerBound) semanticObject); 
                return; 
            }
            else break;
        case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE:
            if (action == grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0()) {
                sequence_JvmParameterizedTypeReference_JvmInnerTypeReference_1_4_0_0_0(context, (JvmParameterizedTypeReference) semanticObject); 
                return; 
            }
            else if (rule == grammarAccess.getJvmTypeReferenceRule()
                    || action == grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0()
                    || rule == grammarAccess.getJvmParameterizedTypeReferenceRule()
                    || rule == grammarAccess.getJvmArgumentTypeReferenceRule()) {
                sequence_JvmParameterizedTypeReference(context, (JvmParameterizedTypeReference) semanticObject); 
                return; 
            }
            else break;
        case TypesPackage.JVM_TYPE_PARAMETER:
            sequence_JvmTypeParameter(context, (JvmTypeParameter) semanticObject); 
            return; 
        case TypesPackage.JVM_UPPER_BOUND:
            if (rule == grammarAccess.getJvmUpperBoundAndedRule()) {
                sequence_JvmUpperBoundAnded(context, (JvmUpperBound) semanticObject); 
                return; 
            }
            else if (rule == grammarAccess.getJvmUpperBoundRule()) {
                sequence_JvmUpperBound(context, (JvmUpperBound) semanticObject); 
                return; 
            }
            else break;
        case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE:
            sequence_JvmWildcardTypeReference(context, (JvmWildcardTypeReference) semanticObject); 
            return; 
        }
    else if (epackage == XtypePackage.eINSTANCE)
        switch (semanticObject.eClass().getClassifierID()) {
        case XtypePackage.XFUNCTION_TYPE_REF:
            sequence_XFunctionTypeRef(context, (XFunctionTypeRef) semanticObject); 
            return; 
        case XtypePackage.XIMPORT_DECLARATION:
            sequence_XImportDeclaration(context, (XImportDeclaration) semanticObject); 
            return; 
        case XtypePackage.XIMPORT_SECTION:
            sequence_XImportSection(context, (XImportSection) semanticObject); 
            return; 
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
项目:xtext-extras    文件:AbstractXtypeSemanticSequencer.java   
@Deprecated
protected void sequence_JvmLowerBoundAnded(EObject context, JvmLowerBound semanticObject) {
    sequence_JvmLowerBoundAnded(createContext(context, semanticObject), semanticObject);
}
项目:xtext-extras    文件:AbstractXtypeSemanticSequencer.java   
@Deprecated
protected void sequence_JvmLowerBound(EObject context, JvmLowerBound semanticObject) {
    sequence_JvmLowerBound(createContext(context, semanticObject), semanticObject);
}