aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authorantoinebouchie <antoinebouchie@google.com>2018-10-27 17:23:45 -0700
committerRon Shapiro <shapiro.rd@gmail.com>2018-10-29 12:43:38 -0400
commit47114df48e8a0b910e6cd1759b64c77dd8fdaee5 (patch)
treed6221a1911baea57bf57e84cc0522aa956b45b12 /value/src/test/java/com/google
parent46718eb7a68abfe824b5c19f7905e1d78e50c560 (diff)
downloadauto-47114df48e8a0b910e6cd1759b64c77dd8fdaee5.tar.gz
Check for null in autooneof.vm instead of calling foo.getClass() (in the case where one of the types is of type "Class", it triggers an "Error Prone" error: http://errorprone.info/bugpattern/GetClassOnClass
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219005298
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java
index d7dbe740..9de53ce9 100644
--- a/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java
@@ -70,12 +70,16 @@ public class AutoOneOfCompilationTest {
" private AutoOneOf_TaskResult() {} // There are no instances of this type.",
"",
" static <V, T extends Throwable> TaskResult<V, T> value(V value) {",
- " value.getClass();",
+ " if (value == null) {",
+ " throw new NullPointerException();",
+ " }",
" return new Impl_value<V, T>(value);",
" }",
"",
" static <V, T extends Throwable> TaskResult<V, T> exception(Throwable exception) {",
- " exception.getClass();",
+ " if (exception == null) {",
+ " throw new NullPointerException();",
+ " }",
" return new Impl_exception<V, T>(exception);",
" }",
"",