1 /* 2 * Copyright 2024 The Android Open Source Project 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 17 package replacewith; 18 19 import android.view.View; 20 21 import androidx.annotation.ReplaceWith; 22 23 @SuppressWarnings({"unused", "UnknownNullness", "InnerClassMayBeStatic", 24 "InstantiationOfUtilityClass", "ClassCanBeStatic", "PrivateConstructorForUtilityClass"}) 25 public class ReplaceWithUsageJava { 26 /** 27 * Calls the method on the object. 28 * 29 * @param obj The object on which to call the method. 30 * @deprecated Use {@link Object#toString()} directly. 31 */ 32 @Deprecated 33 @ReplaceWith(expression = "obj.toString()") toString(Object obj)34 public static void toString(Object obj) { 35 // Stub. 36 } 37 38 /** 39 * Calls the method on the object. 40 * 41 * @param obj The object on which to call the method. 42 * @deprecated Use {@link Object#toString()} directly. 43 */ 44 @Deprecated 45 @ReplaceWith(expression = "obj.toString()", imports = "androidx.annotation.Deprecated") toStringWithImport(Object obj)46 public static void toStringWithImport(Object obj) { 47 // Stub. 48 } 49 50 /** 51 * Calls the method on the object. 52 * 53 * @param obj The object on which to call the method. 54 * @deprecated Use {@link Object#toString()} directly. 55 */ 56 @Deprecated 57 @ReplaceWith(expression = "obj.toString()", 58 imports = {"androidx.annotation.Deprecated", "androidx.annotation.NonNull"}) toStringWithImports(Object obj)59 public static void toStringWithImports(Object obj) { 60 // Stub. 61 } 62 63 /** 64 * Returns a new object. 65 */ obtain(int param)66 public static ReplaceWithUsageJava obtain(int param) { 67 return new ReplaceWithUsageJava(); 68 } 69 70 /** 71 * String constant. 72 * 73 * @deprecated Use {@link View#AUTOFILL_HINT_NAME} directly. 74 */ 75 @Deprecated 76 @ReplaceWith(expression = "View.AUTOFILL_HINT_NAME") 77 public static final String AUTOFILL_HINT_NAME = View.AUTOFILL_HINT_NAME; 78 79 /** 80 * Constructor. 81 * 82 * @deprecated Use {@link StringBuffer#StringBuffer(String)} instead. 83 */ 84 @Deprecated 85 @ReplaceWith(expression = "StringBuffer(param)") ReplaceWithUsageJava(String param)86 public ReplaceWithUsageJava(String param) { 87 // Stub. 88 } 89 90 /** 91 * Constructor. 92 * 93 * @deprecated Use {@link ReplaceWithUsageJava#obtain(int)} instead. 94 */ 95 @Deprecated 96 @ReplaceWith(expression = "ReplaceWithUsageJava.newInstance(param)") ReplaceWithUsageJava(int param)97 public ReplaceWithUsageJava(int param) { 98 // Stub. 99 } 100 101 /** 102 * Constructor. 103 */ ReplaceWithUsageJava()104 public ReplaceWithUsageJava() { 105 // Stub. 106 } 107 108 class InnerClass { 109 /** 110 * Constructor. 111 * 112 * @deprecated Use {@link InnerClass#InnerClass()} instead. 113 */ 114 @Deprecated 115 @ReplaceWith(expression = "InnerClass()") InnerClass(String param)116 InnerClass(String param) { 117 // Stub. 118 } 119 120 /** 121 * Constructor. 122 */ InnerClass()123 InnerClass() { 124 // Stub. 125 } 126 } 127 } 128