From 56e4192df46d814cce56d4b7dfdce526fe8302bb Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 22 Mar 2017 17:10:51 +0100 Subject: [PATCH] Fehler in JavaClassRegistry.contains fixen --- .../SyntaxTreeGenerator.java | 17 +---------------- .../typecheck/JavaClassRegistry.java | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java index 6ce63b82..725c8e7e 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java @@ -199,7 +199,7 @@ public class SyntaxTreeGenerator{ modifiers += newModifier; } } - JavaClassName name = convert(ctx.Identifier()); + JavaClassName name = reg.getName(ctx.Identifier().getText()); GenericDeclarationList genericClassParameters = TypeGenerator.convert(ctx.typeParameters(), reg, generics); Block class_block = null; List fielddecl = convertFields(ctx.classBody()); @@ -324,21 +324,6 @@ public class SyntaxTreeGenerator{ return convertModifier(ctx.getText()); } - - /** - Converts a TerminalNode to JavaClassName. If pkgName is set, it will be included like expected. - **/ - private JavaClassName convert(TerminalNode t){ - String name = ""; - if(this.pkgName != null){ - name = this.pkgName + "." + t.toString(); - } - else{ - name = t.toString(); - } - return this.reg.getName(name); - } - private ClassOrInterface convertEnum(Java8Parser.EnumDeclarationContext ctx){ return null; } diff --git a/src/de/dhbwstuttgart/typecheck/JavaClassRegistry.java b/src/de/dhbwstuttgart/typecheck/JavaClassRegistry.java index afb8d4d9..0c70f98f 100644 --- a/src/de/dhbwstuttgart/typecheck/JavaClassRegistry.java +++ b/src/de/dhbwstuttgart/typecheck/JavaClassRegistry.java @@ -32,6 +32,6 @@ public class JavaClassRegistry { } public boolean contains(String whole) { - return existingClasses.contains(whole); + return existingClasses.contains(new JavaClassName(whole)); } }