Files
frameworks_base/errorprone/tests/res/android/util/Preconditions.java
Jeff Sharkey a52266b3e3 Recommend efficient String operations.
Android offers several efficient alternatives to some upstream
String operations, such as the newly added TextUtils.formatSimple().

This checker also detects and discourages transparent StringBuilder
operations related to Preconditions, where we always pay the cost of
building the failure message string, even in the successful case.

Bug: 170978902
Test: atest error_prone_android_framework_test
Change-Id: I8cef4c50d8b0da3f1e66727dfa724ad44b88963b
2020-10-16 13:44:22 -06:00

44 lines
1.4 KiB
Java

/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.util;
public class Preconditions {
public static void checkArgument(boolean expression) {
throw new UnsupportedOperationException();
}
public static void checkArgument(boolean expression, Object errorMessage) {
throw new UnsupportedOperationException();
}
public static <T> T checkNotNull(T reference) {
throw new UnsupportedOperationException();
}
public static <T> T checkNotNull(T reference, Object errorMessage) {
throw new UnsupportedOperationException();
}
public static void checkState(boolean expression) {
throw new UnsupportedOperationException();
}
public static void checkState(boolean expression, String message) {
throw new UnsupportedOperationException();
}
}