From 1f9876d2cc914861340b974d8931e65b4c857c4c Mon Sep 17 00:00:00 2001 From: Noah Santschi-Cooney Date: Wed, 26 Aug 2020 00:37:33 +0100 Subject: [PATCH] Fallback to resolving compilation unit from filename as previously --- .../spoon/support/compiler/jdt/JDTBatchCompiler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 {