diff --git a/.gitignore b/.gitignore index 56aa7bb2a9b..2a80c44bfeb 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ maven-eclipse.xml !.idea/codeStyleSettings.xml *.iml +# VSCode +.vscode + # Spoon spooned-classes/ spooned/ @@ -31,3 +34,6 @@ doc/_jekyll/_site/ # Nodejs node_modules/ + +# Gradle +.gradle \ No newline at end of file diff --git a/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java b/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java index d80bff647cf..a00df752722 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java @@ -91,7 +91,14 @@ public CompilationUnit[] getCompilationUnits() { } else { lastSlash += 1; } - compilationUnit.module = this.module.name(); + + if (this.module == null) { + compilationUnit.module = CharOperation.subarray(modulePath, lastSlash, modulePath.length); + } else { + //TODO the module name parsed by JDK compiler is in `this.modNames`, consider using that instead? + compilationUnit.module = this.module.name(); + } + pathToModName.put(String.valueOf(modulePath), compilationUnit.module); } } else {