forked from JavaTX/JavaCompilerCore
Aufräumen
This commit is contained in:
parent
9919ecd083
commit
3a444c0172
@ -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);
|
||||
|
@ -72,55 +72,6 @@ public class SyntaxTreeGenerator{
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
public void setImports(Java8Parser.CompilationUnitContext ctx) throws ClassNotFoundException {
|
||||
List<JavaClassName> 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<JavaClassName> convertTypeImportOnDemandDeclaration(Java8Parser.TypeImportOnDemandDeclarationContext ctx){
|
||||
return reg.getAllFromPackage(ctx.packageOrTypeName().getText());
|
||||
}
|
||||
|
||||
private JavaClassName convertSingleStaticImportDeclaration(Java8Parser.SingleStaticImportDeclarationContext ctx){
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private List<JavaClassName> 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<ClassOrInterface> classes = new ArrayList<>();
|
||||
Map<String, Integer> imports = GatherNames.getImports(ctx, packageCrawler);
|
||||
|
Loading…
Reference in New Issue
Block a user