From 3f1031fe90b5d940b5a63832d0aab2fe6446cbc5 Mon Sep 17 00:00:00 2001 From: Antoine Veuiller Date: Thu, 3 Nov 2016 11:12:24 +0100 Subject: [PATCH] fix: filter out some JDT errors on noclasspath Errors of type UndefinedType, UndefinedName and ImportNotFound doesn't make sense while using noclasspath mode, they are not logged anymore. Closes #788 --- .../spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java b/src/main/java/spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java index 71dac31af2e..fe4d243d633 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java @@ -621,7 +621,12 @@ protected void report(Environment environment, CategorizedProblem problem) { throw new ModelBuildingException(message); } else { // in noclasspath mode, errors are only reported - environment.report(null, problem.isError() ? Level.ERROR : Level.WARN, message); + // but undefined import, type, and name errors are irrelevant + int problemId = problem.getID(); + if (problemId != IProblem.UndefinedType && problemId != IProblem.UndefinedName + && problemId != IProblem.ImportNotFound) { + environment.report(null, Level.WARN, message); + } } }