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