1 /* 2 * Copyright (C) 2017. Uber Technologies 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 com.uber.modelexample; 17 18 import static com.uber.nullaway.LibraryModels.MethodRef.methodRef; 19 20 import com.google.auto.service.AutoService; 21 import com.google.common.collect.ImmutableSet; 22 import com.google.common.collect.ImmutableSetMultimap; 23 import com.uber.nullaway.LibraryModels; 24 25 @AutoService(LibraryModels.class) 26 public class ExampleLibraryModels implements LibraryModels { 27 28 @Override failIfNullParameters()29 public ImmutableSetMultimap<MethodRef, Integer> failIfNullParameters() { 30 return ImmutableSetMultimap.of(); 31 } 32 33 @Override explicitlyNullableParameters()34 public ImmutableSetMultimap<MethodRef, Integer> explicitlyNullableParameters() { 35 return ImmutableSetMultimap.of(); 36 } 37 38 @Override nonNullParameters()39 public ImmutableSetMultimap<MethodRef, Integer> nonNullParameters() { 40 return ImmutableSetMultimap.of(); 41 } 42 43 @Override nullImpliesTrueParameters()44 public ImmutableSetMultimap<MethodRef, Integer> nullImpliesTrueParameters() { 45 return ImmutableSetMultimap.<MethodRef, Integer>builder() 46 .put(methodRef("org.utilities.StringUtils", "isEmptyOrNull(java.lang.CharSequence)"), 0) 47 .build(); 48 } 49 50 @Override nullImpliesFalseParameters()51 public ImmutableSetMultimap<MethodRef, Integer> nullImpliesFalseParameters() { 52 return ImmutableSetMultimap.of(); 53 } 54 55 @Override nullImpliesNullParameters()56 public ImmutableSetMultimap<MethodRef, Integer> nullImpliesNullParameters() { 57 return ImmutableSetMultimap.of(); 58 } 59 60 @Override nullableReturns()61 public ImmutableSet<MethodRef> nullableReturns() { 62 return ImmutableSet.of(); 63 } 64 65 @Override nonNullReturns()66 public ImmutableSet<MethodRef> nonNullReturns() { 67 return ImmutableSet.of(); 68 } 69 70 @Override castToNonNullMethods()71 public ImmutableSetMultimap<MethodRef, Integer> castToNonNullMethods() { 72 return ImmutableSetMultimap.of(); 73 } 74 75 @Override nullableFields()76 public ImmutableSet<FieldRef> nullableFields() { 77 return ImmutableSet.of(); 78 } 79 } 80