diff --git a/pom.xml b/pom.xml index cda172b2..4902ed65 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,19 @@ http://maven.apache.org/maven-v4_0_0.xsd"> true + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + true + /home/michael/programs/jdk/jdk8u232-b09/bin/javac + 1.8 + 1.8 + 1.8 + + org.antlr antlr4-maven-plugin 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()) {