Skip to content

Commit 40bbcd6

Browse files
author
Max Stachon
committed
extract method checkSuperTypes from BasicTypeConfStrategy
1 parent d383320 commit 40bbcd6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cddiff/src/main/java/de/monticore/cdconformance/conf/type/BasicTypeConfStrategy.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ public boolean checkConformance(ASTCDType concrete, ASTCDType ref) {
9393
boolean associations = checkAssocIncarnation(concrete, ref);
9494

9595
// check if all reference super-types are incarnated
96-
boolean superTypes = CDDiffUtil.getAllSuperTypes(ref, refCD.getCDDefinition()).stream()
97-
.allMatch(refSuper -> CDDiffUtil.getAllSuperTypes(concrete, conCD.getCDDefinition())
98-
.stream().anyMatch(conSuper -> incMapping.getReferenceElements(conSuper).contains(
99-
refSuper)));
96+
boolean superTypes = checkSuperTypes(concrete, ref);
10097
if (attributes && methods && associations && superTypes) {
10198
return true;
10299
}
@@ -117,6 +114,12 @@ public boolean checkConformance(ASTCDType concrete, ASTCDType ref) {
117114
return false;
118115
}
119116

117+
protected boolean checkSuperTypes(ASTCDType concrete, ASTCDType ref) {
118+
return CDDiffUtil.getAllSuperTypes(ref).stream().allMatch(refSuper -> CDDiffUtil
119+
.getAllSuperTypes(concrete).stream().anyMatch(conSuper -> incMapping.getReferenceElements(
120+
conSuper).contains(refSuper)));
121+
}
122+
120123
/** We check that all reference enum constants are preserved in relative order. */
121124
public boolean checkConformance(ASTCDEnum concrete, ASTCDEnum ref) {
122125

0 commit comments

Comments
 (0)