1 /* 2 * Copyright 2020 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.io.IOException; 19 import javax.annotation.processing.Generated; 20 import javax.inject.Inject; 21 import javax.inject.Provider; 22 23 @Generated( 24 value = "com.google.auto.factory.processor.AutoFactoryProcessor", 25 comments = "https://github.com/google/auto/tree/main/factory" 26 ) 27 final class ConstructorAnnotatedThrowsFactory { 28 private final Provider<Object> objProvider; 29 30 @Inject ConstructorAnnotatedThrowsFactory(Provider<Object> objProvider)31 ConstructorAnnotatedThrowsFactory(Provider<Object> objProvider) { 32 this.objProvider = checkNotNull(objProvider, 1, 1); 33 } 34 create()35 ConstructorAnnotatedThrows create() throws IOException, InterruptedException { 36 return new ConstructorAnnotatedThrows(); 37 } 38 create(String s)39 ConstructorAnnotatedThrows create(String s) { 40 return new ConstructorAnnotatedThrows(checkNotNull(s, 1, 1)); 41 } 42 create(int i)43 ConstructorAnnotatedThrows create(int i) throws IOException { 44 return new ConstructorAnnotatedThrows(checkNotNull(objProvider.get(), 1, 2), i); 45 } 46 create(char c)47 ConstructorAnnotatedThrows create(char c) throws InterruptedException { 48 return new ConstructorAnnotatedThrows(checkNotNull(objProvider.get(), 1, 2), c); 49 } 50 checkNotNull(T reference, int argumentNumber, int argumentCount)51 private static <T> T checkNotNull(T reference, int argumentNumber, int argumentCount) { 52 if (reference == null) { 53 throw new NullPointerException( 54 "@AutoFactory method argument is null but is not marked @Nullable. Argument " 55 + argumentNumber 56 + " of " 57 + argumentCount); 58 } 59 return reference; 60 } 61 } 62