mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This shouldn't result in any logical changes. I've done a quick smoke test by building a local Android engine and running Flutter gallery, no compile errors or other obvious issues. Applied by running `/ci/format.sh | patch -p0` with the altered script added in flutter/engine#16500. I did locally modify the script slightly further so it would run against all Java files in the repo instead of just modified ones.
28 lines
849 B
Java
28 lines
849 B
Java
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
package io.flutter.util;
|
|
|
|
/**
|
|
* Static convenience methods that help a method or constructor check whether it was invoked
|
|
* correctly (that is, whether its <i>preconditions</i> were met).
|
|
*/
|
|
public final class Preconditions {
|
|
private Preconditions() {}
|
|
|
|
/**
|
|
* Ensures that an object reference passed as a parameter to the calling method is not null.
|
|
*
|
|
* @param reference an object reference
|
|
* @return the non-null reference that was validated
|
|
* @throws NullPointerException if {@code reference} is null
|
|
*/
|
|
public static <T> T checkNotNull(T reference) {
|
|
if (reference == null) {
|
|
throw new NullPointerException();
|
|
}
|
|
return reference;
|
|
}
|
|
}
|