RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
ErrorMessages.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.util;
6
8public final class ErrorMessages {
10 private ErrorMessages() {
11 throw new UnsupportedOperationException("This is a utility class!");
12 }
13
24 @SuppressWarnings("PMD.AvoidThrowingNullPointerException")
25 public static <T> T requireNonNullParam(T obj, String paramName, String methodName) {
26 if (obj == null) {
27 throw new NullPointerException(
28 "Parameter "
29 + paramName
30 + " in method "
31 + methodName
32 + " was null when it should not have been! Check the stacktrace to find the"
33 + " responsible line of code - usually, it is the first line of user-written code"
34 + " indicated in the stacktrace. Make sure all objects passed to the method in"
35 + " question were properly initialized - note that this may not be obvious if it"
36 + " is being called under dynamically-changing conditions! Please do not seek"
37 + " additional technical assistance without doing this first!");
38 }
39 return obj;
40 }
41}
static< T > T requireNonNullParam(T obj, String paramName, String methodName)