aboutsummaryrefslogtreecommitdiff
path: root/java/com/google/turbine/processing/TurbineAnnotationProxy.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/turbine/processing/TurbineAnnotationProxy.java')
-rw-r--r--java/com/google/turbine/processing/TurbineAnnotationProxy.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/java/com/google/turbine/processing/TurbineAnnotationProxy.java b/java/com/google/turbine/processing/TurbineAnnotationProxy.java
index c39f310..967ead9 100644
--- a/java/com/google/turbine/processing/TurbineAnnotationProxy.java
+++ b/java/com/google/turbine/processing/TurbineAnnotationProxy.java
@@ -17,6 +17,7 @@
package com.google.turbine.processing;
import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
import com.google.turbine.binder.bound.EnumConstantValue;
import com.google.turbine.binder.bound.TurbineAnnotationValue;
@@ -131,14 +132,15 @@ class TurbineAnnotationProxy implements InvocationHandler {
private static Object constArrayValue(
Class<?> returnType, ModelFactory factory, ClassLoader loader, ArrayInitValue value) {
- if (returnType.getComponentType().equals(Class.class)) {
+ Class<?> componentType = requireNonNull(returnType.getComponentType());
+ if (componentType.equals(Class.class)) {
List<TypeMirror> result = new ArrayList<>();
for (Const element : value.elements()) {
result.add(factory.asTypeMirror(((TurbineClassValue) element).type()));
}
throw new MirroredTypesException(result);
}
- Object result = Array.newInstance(returnType.getComponentType(), value.elements().size());
+ Object result = Array.newInstance(componentType, value.elements().size());
int idx = 0;
for (Const element : value.elements()) {
Object v = constValue(returnType, factory, loader, element);