Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Only map nodes of the exact same type #71 #73

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/se/kth/spork/spoon/SpoonMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public static SpoonMapping fromGumTreeMapping(MappingStore gumtreeMapping) {
throw new IllegalStateException("non-root node " + m.first.toShortString()
+ " had no mapped Spoon object");
}
} else {
} else if (spoonSrc.getClass() == spoonDst.getClass()) {
// It is important to only map nodes of the exact same type, as 3DM has no notion of "correct"
// parent-child relationships. Mapping e.g. an array type reference to a non-array type reference
// may cause the resulting merge to try to treat either as the other, which does not work out.
mapping.put(spoonSrc, spoonDst);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Cls {
private Integer[] arr;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Cls {
private Object arr;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Cls {
private Object arr;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Cls {
private Integer[] arr;
}