From 3a444c0172ef5e53aa0a74ce69c07e6d1f9a2cf3 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 15 Dec 2017 13:12:18 +0100 Subject: [PATCH] =?UTF-8?q?Aufr=C3=A4umen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/core/JavaTXCompiler.java | 3 +- .../SyntaxTreeGenerator.java | 49 ------------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index 80afb800a..51974ce80 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -52,6 +52,7 @@ public class JavaTXCompiler { //Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC for(File forSourceFile : sourceFiles.keySet()) for(JavaClassName name : sourceFiles.get(forSourceFile).getImports()){ + //TODO: Hier werden imports von eigenen (.jav) Klassen nicht beachtet ClassOrInterface importedClass = ASTFactory.createClass( ClassLoader.getSystemClassLoader().loadClass(name.toString())); importedClasses.add(importedClass); @@ -96,7 +97,7 @@ public class JavaTXCompiler { private SourceFile parse(File sourceFile) throws IOException, java.lang.ClassNotFoundException { CompilationUnitContext tree = JavaTXParser.parse(sourceFile); SyntaxTreeGenerator generator = new SyntaxTreeGenerator(environment.getRegistry(sourceFile), new GenericsRegistry(null)); - SourceFile ret = generator.convert(tree,environment.packageCrawler); + SourceFile ret = generator.convert(tree, environment.packageCrawler); return ret; } diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java index bae6e9b92..b5ade8115 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java @@ -71,55 +71,6 @@ public class SyntaxTreeGenerator{ } return ret; } - - /* - public void setImports(Java8Parser.CompilationUnitContext ctx) throws ClassNotFoundException { - List newImports = new ArrayList(); - for(Java8Parser.ImportDeclarationContext importDeclCtx : ctx.importDeclaration()){ - if(importDeclCtx.singleTypeImportDeclaration() != null){ - newImports.add(convertSingleTypeImportDeclaration(importDeclCtx.singleTypeImportDeclaration())); - } - else if(importDeclCtx.typeImportOnDemandDeclaration() != null){ - newImports.addAll(convertTypeImportOnDemandDeclaration(importDeclCtx.typeImportOnDemandDeclaration())); - } - else if(importDeclCtx.singleStaticImportDeclaration() != null){ - newImports.add(convertSingleStaticImportDeclaration(importDeclCtx.singleStaticImportDeclaration())); - } - else{ - newImports.addAll(convertStaticImportOnDemandDeclaration(importDeclCtx.staticImportOnDemandDeclaration())); - } - } - this.imports.addAll(newImports); - } - - private JavaClassName convertSingleTypeImportDeclaration(Java8Parser.SingleTypeImportDeclarationContext ctx) throws ClassNotFoundException{ - String typeName = convertTypeName(ctx.typeName()); - JavaClassName ret = reg.getName(typeName); - return ret; - } - - private List convertTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx){ - return reg.getAllFromPackage(ctx.packageOrTypeName().getText()); - } - - private JavaClassName convertSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx){ - throw new NotImplementedException(); - } - - private List convertStaticImportOnDemandDeclaration(Java8Parser.StaticImportOnDemandDeclarationContext ctx){ - return reg.getAllFromPackage(ctx.typeName().getText()); - } - - */ - private String getPackageFromClass(String cls){ - String ret = ""; - String[] parts = cls.split("\\."); - for(int i = 0; i < parts.length - 1; i++){ - ret = ret + "." + parts[i]; - } - ret = ret.substring(1); - return ret; - } public SourceFile convert(Java8Parser.CompilationUnitContext ctx, PackageCrawler packageCrawler) throws ClassNotFoundException{ List classes = new ArrayList<>();