org.checkerframework.checker.initialization.qual.UnknownInitialization Java Examples

The following examples show how to use org.checkerframework.checker.initialization.qual.UnknownInitialization. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: State.java    From zetasketch with Apache License 2.0 6 votes vote down vote up
/** Resets all fields to their default value. */
// Using UnknownInitialization as this method is called both from the constructor (when it would
// be UnderInitialization(State.class)) as well as by users manually when wishing to reset the
// state (when it is Initialized(State.class)).
// https://checkerframework.org/manual/#initialization-checker
@EnsuresNonNull({"type", "valueType"})
public void clear(@UnknownInitialization State this) {
  type = DEFAULT_TYPE;
  numValues = DEFAULT_NUM_VALUES;
  encodingVersion = DEFAULT_ENCODING_VERSION;
  valueType = DEFAULT_VALUE_TYPE;
  sparseSize = DEFAULT_SPARSE_SIZE;
  precision = DEFAULT_PRECISION_OR_NUM_BUCKETS;
  sparsePrecision = DEFAULT_SPARSE_PRECISION_OR_NUM_BUCKETS;
  data = null;
  sparseData = null;
}
 
Example #2
Source File: SwitchAccessPreferenceUtils.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Registers a listener to the cache to be notified whenever a preference changes.
 *
 * @param context The context associated with the cache
 * @param listener The listener to notify whenever a preference changes
 */
public static void registerSwitchAccessPreferenceChangedListener(
    Context context, @UnknownInitialization SwitchAccessPreferenceChangedListener listener) {
  SwitchAccessPreferenceCache cache = SwitchAccessPreferenceCache.getOrCreateInstance(context);
  if (cache != null) {
    cache.registerSwitchAccessCachedPreferenceChangeListener(listener);
  }
}
 
Example #3
Source File: SwitchAccessPreferenceCache.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Registers a listener to be notified whenever a preference changes.
 *
 * <p>Listeners don't persist after {@link SwitchAccessPreferenceCache#shutdownIfInitialized} is
 * called.
 *
 * @param listener The listener to notify whenever a preference changes
 */
// List#add expects a fully initialized object but we need to register the listeners during their
// construction so they can begin listening immediately.
@SuppressWarnings("initialization:argument.type.incompatible")
public void registerSwitchAccessCachedPreferenceChangeListener(
    @UnknownInitialization SwitchAccessPreferenceChangedListener listener) {
  listeners.add(listener);
  // Call #onPreferenceChanged with null values to ensure that the listeners
  // update their information.
  listener.onPreferenceChanged(null /* sharedPrefs */, null /* key */);
}
 
Example #4
Source File: SpeechControllerImpl.java    From talkback with Apache License 2.0 4 votes vote down vote up
@Override
public void addObserver(@UnknownInitialization(Observer.class) Observer observer) {
  mObservers.add(observer);
}
 
Example #5
Source File: OverlayController.java    From talkback with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("initialization:argument.type.incompatible")
public void addMenuListener(@UnknownInitialization MenuListener listener) {
  menuListeners.add(listener);
}
 
Example #6
Source File: Util.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the current {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * <p>If the current thread doesn't have a {@link Looper}, the application's main thread {@link
 * Looper} is used.
 *
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
public static Handler createHandler(Handler.@UnknownInitialization Callback callback) {
  return createHandler(getLooper(), callback);
}
 
Example #7
Source File: Util.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the specified {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * @param looper A {@link Looper} to run the callback on.
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:return.type.incompatible"})
public static Handler createHandler(
    Looper looper, Handler.@UnknownInitialization Callback callback) {
  return new Handler(looper, callback);
}
 
Example #8
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the current {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * <p>If the current thread doesn't have a {@link Looper}, the application's main thread {@link
 * Looper} is used.
 *
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
public static Handler createHandler(Handler.@UnknownInitialization Callback callback) {
  return createHandler(getLooper(), callback);
}
 
Example #9
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the specified {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * @param looper A {@link Looper} to run the callback on.
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:return.type.incompatible"})
public static Handler createHandler(
    Looper looper, Handler.@UnknownInitialization Callback callback) {
  return new Handler(looper, callback);
}
 
Example #10
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the current {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * <p>If the current thread doesn't have a {@link Looper}, the application's main thread {@link
 * Looper} is used.
 *
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
public static Handler createHandler(Handler.@UnknownInitialization Callback callback) {
  return createHandler(getLooper(), callback);
}
 
Example #11
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the specified {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * @param looper A {@link Looper} to run the callback on.
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:return.type.incompatible"})
public static Handler createHandler(
    Looper looper, Handler.@UnknownInitialization Callback callback) {
  return new Handler(looper, callback);
}
 
Example #12
Source File: Util.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the current {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * <p>If the current thread doesn't have a {@link Looper}, the application's main thread {@link
 * Looper} is used.
 *
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
public static Handler createHandler(Handler.@UnknownInitialization Callback callback) {
  return createHandler(getLooper(), callback);
}
 
Example #13
Source File: Util.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the specified {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * @param looper A {@link Looper} to run the callback on.
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:return.type.incompatible"})
public static Handler createHandler(
    Looper looper, Handler.@UnknownInitialization Callback callback) {
  return new Handler(looper, callback);
}
 
Example #14
Source File: Util.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the current {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * <p>If the current thread doesn't have a {@link Looper}, the application's main thread {@link
 * Looper} is used.
 *
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
public static Handler createHandler(Handler.@UnknownInitialization Callback callback) {
  return createHandler(getLooper(), callback);
}
 
Example #15
Source File: Util.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a {@link Handler} with the specified {@link Handler.Callback} on the specified {@link
 * Looper} thread. The method accepts partially initialized objects as callback under the
 * assumption that the Handler won't be used to send messages until the callback is fully
 * initialized.
 *
 * @param looper A {@link Looper} to run the callback on.
 * @param callback A {@link Handler.Callback}. May be a partially initialized class.
 * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
 */
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:return.type.incompatible"})
public static Handler createHandler(
    Looper looper, Handler.@UnknownInitialization Callback callback) {
  return new Handler(looper, callback);
}