• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package tests;
17 
18 import java.util.Map;
19 import javax.annotation.processing.Generated;
20 import javax.inject.Inject;
21 import javax.inject.Provider;
22 import org.checkerframework.checker.nullness.compatqual.NullableDecl;
23 import org.checkerframework.checker.nullness.compatqual.NullableType;
24 
25 @Generated(
26     value = "com.google.auto.factory.processor.AutoFactoryProcessor",
27     comments = "https://github.com/google/auto/tree/master/factory"
28     )
29 final class CheckerFrameworkNullableFactory {
30 
31   private final Provider<String> java_lang_StringProvider;
32 
33   private final Provider<Map.@NullableType Entry<?, ?>> providedNestedNullableTypeProvider;
34 
35   @Inject
CheckerFrameworkNullableFactory( Provider<String> java_lang_StringProvider, Provider<Map.@NullableType Entry<?, ?>> providedNestedNullableTypeProvider)36   CheckerFrameworkNullableFactory(
37       Provider<String> java_lang_StringProvider,
38       Provider<Map.@NullableType Entry<?, ?>> providedNestedNullableTypeProvider) {
39     this.java_lang_StringProvider = checkNotNull(java_lang_StringProvider, 1);
40     this.providedNestedNullableTypeProvider = checkNotNull(providedNestedNullableTypeProvider, 2);
41   }
42 
create( @ullableDecl String nullableDecl, @NullableType String nullableType, Map.@NullableType Entry<?, ?> nestedNullableType)43   CheckerFrameworkNullable create(
44       @NullableDecl String nullableDecl,
45       @NullableType String nullableType,
46       Map.@NullableType Entry<?, ?> nestedNullableType) {
47     return new CheckerFrameworkNullable(
48         nullableDecl,
49         java_lang_StringProvider.get(),
50         nullableType,
51         java_lang_StringProvider.get(),
52         nestedNullableType,
53         providedNestedNullableTypeProvider.get());
54   }
55 
checkNotNull(T reference, int argumentIndex)56   private static <T> T checkNotNull(T reference, int argumentIndex) {
57     if (reference == null) {
58       throw new NullPointerException(
59           "@AutoFactory method argument is null but is not marked @Nullable. Argument index: "
60               + argumentIndex);
61     }
62     return reference;
63   }
64 }
65