Skip to content

Commit

Permalink
test: fix typo in MMType (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
surli authored and monperrus committed Nov 10, 2017
1 parent 01487d8 commit 796ed12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/test/java/spoon/test/metamodel/MMType.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class MMType {
/**
* The {@link CtInterface} linked to this {@link MMType}. Is null in case of interface without class
*/
private CtInterface<?> modelInteface;
private CtInterface<?> modelInterface;

/**
* {@link ClassTypingContext} of this type used to adapt methods from super type implementations to this {@link MMType}
Expand Down Expand Up @@ -149,20 +149,20 @@ void setModelClass(CtClass<?> modelClass) {
/**
* @return {@link CtInterface} which represents this {@link MMType}
*/
public CtInterface<?> getModelInteface() {
return modelInteface;
public CtInterface<?> getModelInterface() {
return modelInterface;
}

void setModelInteface(CtInterface<?> modelInteface) {
this.modelInteface = modelInteface;
void setModelInterface(CtInterface<?> modelInterface) {
this.modelInterface = modelInterface;
}

/**
* @return {@link ClassTypingContext}, which can be used to adapt super type methods to this {@link MMType}
*/
public ClassTypingContext getTypeContext() {
if (typeContext == null) {
typeContext = new ClassTypingContext(modelClass != null ? modelClass : modelInteface);
typeContext = new ClassTypingContext(modelClass != null ? modelClass : modelInterface);
}
return typeContext;
}
Expand Down
11 changes: 4 additions & 7 deletions src/test/java/spoon/test/metamodel/SpoonMetaModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Supplier;

import spoon.Launcher;
import spoon.SpoonException;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import spoon.reflect.code.CtStatement;
import spoon.reflect.declaration.CtAnnotation;
import spoon.reflect.declaration.CtClass;
import spoon.reflect.declaration.CtInterface;
Expand All @@ -41,7 +39,6 @@
import spoon.reflect.factory.Factory;
import spoon.reflect.path.CtRole;
import spoon.reflect.reference.CtTypeReference;
import spoon.reflect.visitor.PrinterHelper;
import spoon.reflect.visitor.filter.AllTypeMembersFunction;
import spoon.reflect.visitor.filter.TypeFilter;
import spoon.support.compiler.FileSystemFolder;
Expand Down Expand Up @@ -174,11 +171,11 @@ private void initializeMMType(CtType<?> type, MMType mmType) {
if (type instanceof CtInterface<?>) {
CtInterface<?> iface = (CtInterface<?>) type;
mmType.setModelClass(getImplementationOfInterface(iface));
mmType.setModelInteface(iface);
mmType.setModelInterface(iface);
} else if (type instanceof CtClass<?>) {
CtClass<?> clazz = (CtClass<?>) type;
mmType.setModelClass(clazz);
mmType.setModelInteface(getInterfaceOfImplementation(clazz));
mmType.setModelInterface(getInterfaceOfImplementation(clazz));
} else {
throw new SpoonException("Unexpected spoon model type: " + type.getQualifiedName());
}
Expand All @@ -188,9 +185,9 @@ private void initializeMMType(CtType<?> type, MMType mmType) {
addFieldsOfType(mmType, mmType.getModelClass());
}
//add fields of interface
if (mmType.getModelInteface() != null) {
if (mmType.getModelInterface() != null) {
//add fields of interface too. They are not added by above call of addFieldsOfType, because the MMType already exists in name2mmType
addFieldsOfType(mmType, mmType.getModelInteface());
addFieldsOfType(mmType, mmType.getModelInterface());
}
//initialize all fields
mmType.getRole2field().forEach((role, mmField) -> {
Expand Down

0 comments on commit 796ed12

Please sign in to comment.