diff options
author | Bulgakov Alexander <buls@yandex.ru> | 2019-05-24 10:05:38 +0300 |
---|---|---|
committer | Bulgakov Alexander <buls@yandex.ru> | 2019-05-24 10:05:38 +0300 |
commit | 089f2ec5f45567c8c12e9d13bf9be8fa5c107c18 (patch) | |
tree | 6adfb90aa3143468d6a2071c520c700aa9898216 /src/eclipseAgent/lombok/eclipse/agent/PatchVal.java | |
parent | cd49188aff9ffece51ce8831c961e0faab33fbc8 (diff) | |
download | lombok-089f2ec5f45567c8c12e9d13bf9be8fa5c107c18.tar.gz lombok-089f2ec5f45567c8c12e9d13bf9be8fa5c107c18.tar.bz2 lombok-089f2ec5f45567c8c12e9d13bf9be8fa5c107c18.zip |
#1976. override error handling policy for problemReporter to guarantee AbortCompilation is throwing.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/PatchVal.java')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchVal.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java index 832a25e3..3aa5d386 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java @@ -21,10 +21,13 @@ */ package lombok.eclipse.agent; +import lombok.permit.Permit; import org.eclipse.jdt.core.compiler.CategorizedProblem; import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression; import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; @@ -45,9 +48,8 @@ import org.eclipse.jdt.internal.compiler.lookup.Scope; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; - -import lombok.permit.Permit; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import java.lang.reflect.Field; @@ -358,6 +360,10 @@ public class PatchVal { } private static TypeBinding resolveForExpression(Expression collection, BlockScope scope) { + CompilationUnitDeclaration referenceContext = scope.compilationUnitScope().referenceContext; + ProblemReporter oldProblemReporter = referenceContext.problemReporter; + referenceContext.problemReporter = new ProblemReporter(DefaultErrorHandlingPolicies.exitOnFirstError(), + oldProblemReporter.options, oldProblemReporter.problemFactory); try { return collection.resolveType(scope); } catch (ArrayIndexOutOfBoundsException e) { @@ -389,6 +395,8 @@ public class PatchVal { } } throw e; + } finally { + referenceContext.problemReporter = oldProblemReporter; } } } |