switch (_kind) { case TypeDeclaration.CLASS_DECL: _switchResult = TypesFactory.eINSTANCE.createJvmGenericType(); break; case TypeDeclaration.INTERFACE_DECL: JvmGenericType _createJvmGenericType = TypesFactory.eINSTANCE.createJvmGenericType(); final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { it.setInterface(true); break; case TypeDeclaration.ENUM_DECL: _switchResult = TypesFactory.eINSTANCE.createJvmEnumerationType(); break; case TypeDeclaration.ANNOTATION_TYPE_DECL: _switchResult = TypesFactory.eINSTANCE.createJvmAnnotationType(); break; default: for (final TypeParameter typeParam : type.typeParameters) { final JvmTypeParameter jvmTypeParam = TypesFactory.eINSTANCE.createJvmTypeParameter(); jvmTypeParam.setName(String.valueOf(typeParam.name)); EList<JvmTypeParameter> _typeParameters = ((JvmGenericType)jvmType).getTypeParameters();
protected JvmAnnotationReference createJvmAnnotationReference(final JvmType type) { JvmAnnotationReference _switchResult = null; boolean _matched = false; if (type instanceof JvmAnnotationType) { _matched=true; JvmAnnotationReference _createJvmAnnotationReference = TypesFactory.eINSTANCE.createJvmAnnotationReference(); final Procedure1<JvmAnnotationReference> _function = (JvmAnnotationReference it) -> { it.setAnnotation(((JvmAnnotationType)type)); }; _switchResult = ObjectExtensions.<JvmAnnotationReference>operator_doubleArrow(_createJvmAnnotationReference, _function); } if (!_matched) { _switchResult = null; } return _switchResult; } }
protected JvmTypeParameter createTypeParameter(TypeVariable<?> variable, JvmMember container) { JvmTypeParameter result = TypesFactory.eINSTANCE.createJvmTypeParameter(); result.setName(variable.getName()); Type[] bounds = variable.getBounds(); if (bounds.length != 0) { InternalEList<JvmTypeConstraint> constraints = (InternalEList<JvmTypeConstraint>)result.getConstraints(); for (Type bound : variable.getBounds()) { JvmUpperBound upperBound = TypesFactory.eINSTANCE.createJvmUpperBound(); ((JvmTypeConstraintImplCustom) upperBound).internalSetTypeReference(createTypeReference(bound)); constraints.addUnique(upperBound); } } return result; }
public JvmWildcardTypeReference wildCardExtends(JvmTypeReference clone) { JvmWildcardTypeReference result = factory.createJvmWildcardTypeReference(); JvmUpperBound upperBound = factory.createJvmUpperBound(); upperBound.setTypeReference(clone); result.getConstraints().add(upperBound); return result; }
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; }
private JvmTypeReference newObjectReference() { JvmType objectType = typesFactory.createJvmGenericType(); String objectClassName = Object.class.getName(); ((InternalEObject) objectType).eSetProxyURI(URIHelperConstants.OBJECTS_URI.appendSegment(objectClassName).appendFragment(objectClassName)); JvmParameterizedTypeReference result = typesFactory.createJvmParameterizedTypeReference(); result.setType(objectType); return result; }
final JvmGenericType innerType = this.typesFactory.createJvmGenericType(); innerType.setInterface(false); innerType.setAbstract(false); final JvmTypeParameter typeParameter = this.typesFactory.createJvmTypeParameter(); typeParameter.setName("C"); //$NON-NLS-1$ final JvmUpperBound constraint = this.typesFactory.createJvmUpperBound(); constraint.setTypeReference(this._typeReferenceBuilder.typeRef(inferredJvmType)); typeParameter.getConstraints().add(constraint); final JvmConstructor constructor = this.typesFactory.createJvmConstructor(); constructor.setVisibility(JvmVisibility.PUBLIC); innerType.getMembers().add(constructor); final JvmFormalParameter parameter1 = this.typesFactory.createJvmFormalParameter(); parameter1.setName("capacity"); //$NON-NLS-1$ parameter1.setParameterType(this._typeReferenceBuilder.typeRef(typeParameter)); constructor.getParameters().add(parameter1); final JvmFormalParameter parameter2 = this.typesFactory.createJvmFormalParameter(); parameter2.setName("caller"); //$NON-NLS-1$ parameter2.setParameterType(this._typeReferenceBuilder.typeRef(AgentTrait.class));
final JvmAnnotationType annotation = typesFactory.createJvmAnnotationType(); if (!preIndexingPhase) { doLater.add(new Runnable() { } else if (declaration instanceof XtendClass) { XtendClass xtendClass = (XtendClass) declaration; final JvmGenericType javaType = typesFactory.createJvmGenericType(); copyTypeParameters(xtendClass.getTypeParameters(), javaType); if (!preIndexingPhase) { } else if (declaration instanceof XtendInterface) { XtendInterface xtendInterface = (XtendInterface) declaration; final JvmGenericType javaType = typesFactory.createJvmGenericType(); javaType.setInterface(true); copyTypeParameters(xtendInterface.getTypeParameters(), javaType); final JvmEnumerationType javaType = typesFactory.createJvmEnumerationType(); if (!preIndexingPhase) { doLater.add(new Runnable() {
protected List<JvmType> createObjectReference(Resource resource) { if (resource != null) { // no upper bound found - seems to be an invalid - assume object as upper bound JvmType objectType = factory.createJvmGenericType(); String objectClassName = Object.class.getName(); ((InternalEObject) objectType).eSetProxyURI(URIHelperConstants.OBJECTS_URI.appendSegment( objectClassName).appendFragment(objectClassName)); objectType = (JvmType) EcoreUtil.resolve(objectType, resource); return Collections.singletonList(objectType); } return Collections.emptyList(); } }
return null; JvmOperation first = iterator.next(); JvmOperation result = typesFactory.createJvmOperation(); target.getMembers().add(result); for (int i = 0; i < first.getParameters().size(); i++) { JvmFormalParameter parameter = typesFactory.createJvmFormalParameter(); result.getParameters().add(parameter); parameter.setParameterType(jvmTypesBuilder.inferredType());
protected JvmOperation createMethodProxy(Method method) { JvmOperation proxy = operationProxies.get(method); if (proxy == null) { proxy = TypesFactory.eINSTANCE.createJvmOperation(); URI uri = uriHelper.getFullURI(method); ((InternalEObject)proxy).eSetProxyURI(uri); operationProxies.put(method, proxy); } return proxy; }
protected JvmField createField(Field field) { JvmField result; int modifiers = field.getModifiers(); if (!field.isEnumConstant()) { result = TypesFactory.eINSTANCE.createJvmField(); } else result = TypesFactory.eINSTANCE.createJvmEnumerationLiteral(); String fieldName = field.getName(); result.internalSetIdentifier(field.getDeclaringClass().getName() + "." + fieldName); result.setSimpleName(fieldName); result.setFinal(Modifier.isFinal(modifiers)); result.setStatic(Modifier.isStatic(modifiers)); result.setTransient(Modifier.isTransient(modifiers)); result.setVolatile(Modifier.isVolatile(modifiers)); setVisibility(result, modifiers); Type fieldType = null; try { fieldType = field.getGenericType(); } catch (GenericSignatureFormatError error) { logSignatureFormatError(field.getDeclaringClass()); fieldType = field.getType(); } catch (MalformedParameterizedTypeException error) { logSignatureFormatError(field.getDeclaringClass()); fieldType = field.getType(); } result.setType(createTypeReference(fieldType)); createAnnotationValues(field, result); return result; }
JvmAnnotationReference result = typesFactory.createJvmAnnotationReference(); JvmType jvmType = references.findDeclaredType(annotationTypeName, sourceElement); if (jvmType == null) { if (value != null) { if (value instanceof String) { JvmStringAnnotationValue annotationValue = typesFactory.createJvmStringAnnotationValue(); annotationValue.getValues().add((String) value); result.getExplicitValues().add(annotationValue);
protected JvmConstructor inferAnonymousClassConstructor(AnonymousClass anonymousClass, JvmGenericType inferredLocalClass) { XConstructorCall constructorCall = anonymousClass.getConstructorCall(); JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); inferredLocalClass.getMembers().add(constructor); associator.associatePrimary(constructorCall, constructor); constructor.setVisibility(JvmVisibility.DEFAULT); constructor.setSimpleName(inferredLocalClass.getSimpleName()); return constructor; }
protected JvmFormalParameter createFormalParameter(BinaryTypeSignature parameterType, String paramName, JvmMember container, Map<String, JvmTypeParameter> typeParameters) { JvmFormalParameter result = TypesFactory.eINSTANCE.createJvmFormalParameter(); result.setName(paramName); result.setParameterType(proxies.createTypeReference(parameterType, typeParameters)); return result; }
protected JvmAnnotationType createAnnotationProxy(Class<? extends Annotation> type) { JvmAnnotationType proxy = annotationProxies.get(type); if (proxy == null) { proxy = TypesFactory.eINSTANCE.createJvmAnnotationType(); URI uri = uriHelper.getFullURI(type); ((InternalEObject)proxy).eSetProxyURI(uri); annotationProxies.put(type, proxy); } return proxy; }
assert annotationType != null; try { final JvmAnnotationReference result = this.typesFactory.createJvmAnnotationReference(); final JvmType jvmType = this.typeReferences.findDeclaredType(annotationType, target); if (jvmType == null) { final JvmIntAnnotationValue annotationValue = this.typesFactory.createJvmIntAnnotationValue(); annotationValue.getValues().add(value); result.getExplicitValues().add(annotationValue);
if(anno == null) return null; JvmAnnotationReference reference = typesFactory.createJvmAnnotationReference(); final JvmType annotation = (JvmType) anno.eGet( XAnnotationsPackage.Literals.XANNOTATION__ANNOTATION_TYPE, false); if (annotation.eIsProxy()) { JvmAnnotationType copiedProxy = TypesFactory.eINSTANCE.createJvmAnnotationType(); ((InternalEObject)copiedProxy).eSetProxyURI(EcoreUtil.getURI(annotation)); reference.setAnnotation(copiedProxy);
protected JvmTypeReference createLocalTypeReference(Type type, JvmTypeParameterDeclarator container, GenericDeclaration member) { if (type instanceof GenericArrayType) { GenericArrayType arrayType = (GenericArrayType) type; Type componentType = arrayType.getGenericComponentType(); return createLocalArrayTypeReference(componentType, container, member); } else if (type instanceof TypeVariable<?>) { TypeVariable<?> typeVariable = (TypeVariable<?>) type; JvmParameterizedTypeReference result = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); int idx = Arrays.asList(member.getTypeParameters()).indexOf(typeVariable); result.setType(container.getTypeParameters().get(idx)); return result; } throw new IllegalArgumentException(type.toString()); }
final StringBuilder fqName; if (isConstructor(name)) { result = TypesFactory.eINSTANCE.createJvmConstructor(); String declaratorIdentifier = declarator.getIdentifier(); String simpleName = declarator.getSimpleName(); this.offset = initialOffset; } else { JvmOperation operation = TypesFactory.eINSTANCE.createJvmOperation(); result = operation; String declaratorIdentifier = declarator.getIdentifier();