From c52da7951a35f43030ac12ce9ad6ff6dab1b9783 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 5 Dec 2019 21:51:53 +0100 Subject: [PATCH] =?UTF-8?q?Bug=20176=20-=20Argumente=20mit=20Typvariabelen?= =?UTF-8?q?=20werden=20die=20Generics=20einschlie=C3=9Flich=20Bounds=20imm?= =?UTF-8?q?er=20bei=20den=20Argumenten=20eingef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/de/dhbwstuttgart/syntaxtree/Method.java | 2 +- .../dhbwstuttgart/typedeployment/TypeInsertFactory.java | 4 ++-- .../de/dhbwstuttgart/typedeployment/TypeInsertPoint.java | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) 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()) {