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)); } }