Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Preconditions.java

Issue 1999583002: Add Event and EventTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chromoting;
6
7 /**
8 * A set of helper functions to write assertions. These functions are always bei ng executed, and
9 * will not ignored in release build.
10 */
11
12 public final class Preconditions {
13 // This class contains only static functions, so it should not be instantiat ed.
14 private Preconditions() {}
15
16 /**
17 * Checks whether input |value| is true, and returns its value. Throws
18 * {@link IllegalStateException} if |value| is false.
19 */
20 public static final boolean isTrue(boolean value) {
21 if (!value) {
22 throw new IllegalStateException();
23 }
24 return value;
25 }
26
27 /**
28 * Checks whether input |ref| is not a null reference, and return its value. Throws
29 * {@link NullPointerException} if |ref| is null.
30 */
31 public static final <T> T notNull(T ref) {
32 if (ref == null) {
33 throw new NullPointerException();
34 }
35 return ref;
36 }
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698