From 223f6facc767d1c500c00a2970d321899813d131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Wed, 4 May 2016 00:28:57 +0200 Subject: [PATCH] modified: ../../../src/de/dhbwstuttgart/bytecode/ClassGenerator.java in addMethod : String methodNameAndTypes = m.getName()+Arrays.toString(m.getArgumentTypes()); durch String methodNameAndTypes = m.getReturnType().getSignature()+m.getName()+Arrays.toString(m.getArgumentTypes()); ersetzt modified: OL.jav Main-Klasse hinzugefuegt --- .../bytecode/ClassGenerator.java | 6 +++++- test/bytecode/types/OL.jav | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/de/dhbwstuttgart/bytecode/ClassGenerator.java b/src/de/dhbwstuttgart/bytecode/ClassGenerator.java index e9ef10e3..85509b57 100644 --- a/src/de/dhbwstuttgart/bytecode/ClassGenerator.java +++ b/src/de/dhbwstuttgart/bytecode/ClassGenerator.java @@ -171,7 +171,11 @@ public class ClassGenerator extends ClassGen{ @Override public void addMethod(Method m) { - String methodNameAndTypes = m.getName()+Arrays.toString(m.getArgumentTypes()); + String methodNameAndTypes = m.getReturnType().getSignature()+m.getName()+Arrays.toString(m.getArgumentTypes()); + //PL 1016-05-03 ersetzt: + //m.getName()+Arrays.toString(m.getArgumentTypes()); + //Hier sollten alle Maxima der Funktionstypen (arg-typ möglichst gross, + //return-Typ moeglichst klein) ermittelt werden (s. pppl 2008) if(methodsNamesAndTypes.contains(methodNameAndTypes)){ return; diff --git a/test/bytecode/types/OL.jav b/test/bytecode/types/OL.jav index c6349bdc..30bf0906 100644 --- a/test/bytecode/types/OL.jav +++ b/test/bytecode/types/OL.jav @@ -1,6 +1,19 @@ class OL { - m(x) { return x + x; } + m(x) { return x + x; } - Boolean m(Boolean x) {return x; } -} \ No newline at end of file + m(Boolean x) { return x; } +} + + + +class Main { + + main(x) { + ol; + ol = new OL(); + return ol.m(x); + } + +} +