diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 8683cc60..640111d4 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -55,7 +55,7 @@ public class FamilyOfGeneratedGenerics { if(posOfTphs.containsKey(allCons.getLeft()) && allCons.getRight()!=null && allCons.getRel()==Relation.EXTENDS) { for(String tph: posOfTphs.keySet()) { if(tph == allCons.getLeft() && posOfTphs.get(tph) == PositionFinder.Position.FIELD) { - ClassConstraint consToAdd = new ClassConstraint(allCons.getLeft(), allCons.getRight(), allCons.getRel()); + ClassConstraint consToAdd = new ClassConstraint(tph, allCons.getRight(), allCons.getRel()); if (!checkForDuplicates(consToAdd, tempCC)) { tempCC.add(consToAdd); } diff --git a/src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java b/src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java index d0a2712f..d8c4fb8e 100644 --- a/src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java +++ b/src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java @@ -54,8 +54,8 @@ public class FamilyOfGeneratedGenericsTest extends TestCase { inputConstraints.add(new TPHConstraint("A", "B", TPHConstraint.Relation.EXTENDS)); HashMap tphPositions = new HashMap<>(); - tphPositions.put("A", PositionFinder.Position.METHOD); - tphPositions.put("B", PositionFinder.Position.FIELD); + tphPositions.put("A", PositionFinder.Position.FIELD); + tphPositions.put("B", PositionFinder.Position.METHOD); /* ClassConstraints should be the same as the input constraint