diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/Method.java b/src/main/java/de/dhbwstuttgart/syntaxtree/Method.java index 99cd3f91..33722c09 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/Method.java @@ -63,7 +63,7 @@ public class Method extends SyntaxTreeNode implements IItemWithOffset, TypeScope @Override public Token getOffset() { - return null; + return super.getOffset(); } public String getName() { diff --git a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java index d1a42342..71add44e 100644 --- a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java +++ b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java @@ -60,12 +60,12 @@ public class TypeInsertFactory { private static synchronized Set createGenericInsert(GenericsGeneratorResultForClass genericResult, ClassOrInterface cl, Method m, ResultSet resultSet, Token mOffset){ Set result = createGenericClassInserts(genericResult, cl); - + Resolver resolver = new Resolver(resultSet); if (m != null) { List methodConstraints = genericResult.getMethodConstraintsByID(MethodUtility.createID(resolver, m)); - result.addAll(createMethodConstraints(methodConstraints, mOffset)); + result.addAll(createMethodConstraints(methodConstraints, m.getOffset() != null ? m.getOffset() : mOffset)); } return result; diff --git a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java index a4803cf3..ce80d53d 100644 --- a/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java +++ b/src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java @@ -73,6 +73,14 @@ public class TypeInsertPoint { @Override public int compare(TypeInsertPoint o1, TypeInsertPoint o2) { + if (o1.point == null && o2.point == null) { + return 0; + } else if (o2.point == null) { + return 1; + } else if (o1.point == null) { + return -1; + } + if (o1.getPositionInCode() > o2.getPositionInCode()) { return 1; } else if (o1.getPositionInCode() < o2.getPositionInCode()) {