From b7bb0fa1c454858b34e786b1651764a11b9177c2 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Mon, 19 Feb 2018 04:47:10 +0100 Subject: [PATCH] Vector Test Fehler beheben --- .../dhbwstuttgart/environment/CompilationEnvironment.java | 2 +- .../parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java | 7 ++++++- test/javFiles/Vector.jav | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java index 44754e7c..3d450183 100644 --- a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java +++ b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java @@ -62,7 +62,7 @@ public class CompilationEnvironment { } //URLClassLoader loader = new URLClassLoader(new URL[0], cl); //librarys = Arrays.asList(loader.getURLs()); - + this.sourceFiles = sourceFiles; this.packageCrawler = new PackageCrawler(librarys); } diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java index b681d9c3..ed96d2e6 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java @@ -164,7 +164,12 @@ public class SyntaxTreeGenerator{ modifiers += newModifier; } } - JavaClassName name = reg.getName(ctx.Identifier().getText()); + String className = this.pkgName + (this.pkgName.length()>0?".":"") + ctx.Identifier().getText(); + JavaClassName name = reg.getName(className); + if(! name.toString().equals(className)){ + throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString() + ,ctx.getStart()); + } GenericsRegistry generics = createGenerics(ctx.typeParameters(), name, "", reg, new GenericsRegistry(globalGenerics)); Token offset = ctx.getStart(); GenericDeclarationList genericClassParameters; diff --git a/test/javFiles/Vector.jav b/test/javFiles/Vector.jav index 1ea1ac41..ef3533a6 100644 --- a/test/javFiles/Vector.jav +++ b/test/javFiles/Vector.jav @@ -1,6 +1,6 @@ import java.util.Vector; -class Vector{ +class MyVector{ id(x){ return id2(x);