diff options
author | emcmanus <emcmanus@google.com> | 2020-02-11 16:54:52 -0800 |
---|---|---|
committer | Chris Povirk <beigetangerine@gmail.com> | 2020-02-11 17:15:07 -0800 |
commit | ecb6032d6398317da0539ce0ac7287989ea7b0e3 (patch) | |
tree | 7e99151ceeb8af317580eb990fac49bc154993be /value/src/main/java/com/google/auto | |
parent | 4ab1b53b0ae9a6dbaae3cbc54c270e90fc7daa84 (diff) | |
download | auto-ecb6032d6398317da0539ce0ac7287989ea7b0e3.tar.gz |
If AutoValue detects an error, don't invoke extensions or generate code.
For example if there's a type mismatch between a property getter and the
corresponding setter in a Builder, we may otherwise end up invoking an extension
with an inconsistent state. Also the generated code is likely to have compile
errors of its own, which distract from the real source of the problem.
Fixes https://github.com/google/auto/issues/809.
RELNOTES=Don't generate code or invoke extensions if AutoValue detects a problem, for example a mismatch between getters and setters.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=294552938
Diffstat (limited to 'value/src/main/java/com/google/auto')
-rw-r--r-- | value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java index a60eef69..6342d802 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java @@ -247,6 +247,11 @@ public class AutoValueProcessor extends AutoValueOrOneOfProcessor { defineSharedVarsForType(type, methods, vars); defineVarsForType(type, vars, toBuilderMethods, propertyMethodsAndTypes, builder); + // If we've encountered problems then we might end up invoking extensions with inconsistent + // state. Anyway we probably don't want to generate code which is likely to provoke further + // compile errors to add to the ones we've already seen. + errorReporter().abortIfAnyError(); + GwtCompatibility gwtCompatibility = new GwtCompatibility(type); vars.gwtCompatibleAnnotation = gwtCompatibility.gwtCompatibleAnnotationString(); |