Skip to content

Commit

Permalink
application to XtendJvmModelInferrer (only interfaces)
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Dec 22, 2023
1 parent ae531bf commit 1aad86f
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import org.eclipse.xtext.common.types.JvmField;
import org.eclipse.xtext.common.types.JvmFormalParameter;
import org.eclipse.xtext.common.types.JvmGenericArrayTypeReference;
import org.eclipse.xtext.common.types.JvmGenericClass;
import org.eclipse.xtext.common.types.JvmGenericInterface;
import org.eclipse.xtext.common.types.JvmGenericType;
import org.eclipse.xtext.common.types.JvmOperation;
import org.eclipse.xtext.common.types.JvmParameterizedTypeReference;
Expand Down Expand Up @@ -270,7 +272,7 @@ public void run() {
return annotation;
} else if (declaration instanceof XtendClass) {
XtendClass xtendClass = (XtendClass) declaration;
final JvmGenericType javaType = typesFactory.createJvmGenericType();
final JvmGenericClass javaType = typesFactory.createJvmGenericClass();
copyTypeParameters(xtendClass.getTypeParameters(), javaType);
if (!preIndexingPhase) {
doLater.add(new Runnable() {
Expand All @@ -283,7 +285,7 @@ public void run() {
return javaType;
} else if (declaration instanceof XtendInterface) {
XtendInterface xtendInterface = (XtendInterface) declaration;
final JvmGenericType javaType = typesFactory.createJvmGenericType();
final JvmGenericInterface javaType = typesFactory.createJvmGenericInterface();
javaType.setInterface(true);
copyTypeParameters(xtendInterface.getTypeParameters(), javaType);
if (!preIndexingPhase) {
Expand Down Expand Up @@ -366,7 +368,7 @@ protected void translateAnnotationsTo(List<XAnnotation> annotations, JvmAnnotati
jvmTypesBuilder.addAnnotations(target, Iterables.filter(annotations, annotationTranslationFilter));
}

protected void initialize(XtendClass source, JvmGenericType inferredJvmType) {
protected void initialize(XtendClass source, JvmGenericClass inferredJvmType) {
inferredJvmType.setVisibility(source.getVisibility());
boolean isStatic = source.isStatic() && !isTopLevel(source);
if (!isStatic) {
Expand Down Expand Up @@ -394,7 +396,7 @@ protected void initialize(XtendClass source, JvmGenericType inferredJvmType) {
inferredJvmType.getSuperTypes().add(jvmTypesBuilder.cloneWithProxies(extendsClause));
}
for (JvmTypeReference intf : source.getImplements()) {
inferredJvmType.getSuperTypes().add(jvmTypesBuilder.cloneWithProxies(intf));
inferredJvmType.getInterfacesToImplement().add(jvmTypesBuilder.cloneWithProxies(intf));
}
fixTypeParameters(inferredJvmType);
addDefaultConstructor(source, inferredJvmType);
Expand All @@ -412,14 +414,14 @@ protected void initialize(XtendClass source, JvmGenericType inferredJvmType) {

}

protected void initialize(XtendInterface source, JvmGenericType inferredJvmType) {
protected void initialize(XtendInterface source, JvmGenericInterface inferredJvmType) {
inferredJvmType.setVisibility(source.getVisibility());
inferredJvmType.setStatic(source.isStatic() && !isTopLevel(source));
inferredJvmType.setAbstract(true);
inferredJvmType.setStrictFloatingPoint(source.isStrictFloatingPoint());
translateAnnotationsTo(source.getAnnotations(), inferredJvmType);
for (JvmTypeReference intf : source.getExtends()) {
inferredJvmType.getSuperTypes().add(jvmTypesBuilder.cloneWithProxies(intf));
inferredJvmType.getInterfacesToExtend().add(jvmTypesBuilder.cloneWithProxies(intf));
}
fixTypeParameters(inferredJvmType);
for (XtendMember member : source.getMembers()) {
Expand Down

0 comments on commit 1aad86f

Please sign in to comment.