SCRIPT: Spotless Apply

This commit is contained in:
PJ Reiniger
2025-11-07 19:57:21 -05:00
committed by Peter Johnson
parent c89910b7c6
commit c48b722dac
650 changed files with 1529 additions and 1545 deletions

View File

@@ -6,10 +6,10 @@ package org.wpilib.vision.apriltag;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
import java.util.Objects;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.util.RawFrame;
import java.util.Objects;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/** Represents an AprilTag's metadata. */
@SuppressWarnings("MemberName")

View File

@@ -4,11 +4,11 @@
package org.wpilib.vision.apriltag;
import java.util.Arrays;
import org.wpilib.math.linalg.MatBuilder;
import org.wpilib.math.linalg.Matrix;
import org.wpilib.math.util.Nat;
import org.wpilib.math.numbers.N3;
import java.util.Arrays;
import org.wpilib.math.util.Nat;
/** A detection of an AprilTag tag. */
public class AprilTagDetection {

View File

@@ -4,8 +4,8 @@
package org.wpilib.vision.apriltag;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
import org.opencv.core.Mat;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/**
* An AprilTag detector engine. This is expensive to set up and tear down, so most use cases should

View File

@@ -10,9 +10,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Translation3d;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -25,6 +22,9 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Translation3d;
/**
* Class for representing a layout of AprilTags on a field and reading them from a JSON format.

View File

@@ -4,8 +4,8 @@
package org.wpilib.vision.apriltag;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/** Pose estimators for AprilTag tags. */
public class AprilTagPoseEstimator {

View File

@@ -4,14 +4,14 @@
package org.wpilib.vision.apriltag.jni;
import org.wpilib.vision.apriltag.AprilTagDetection;
import org.wpilib.vision.apriltag.AprilTagDetector;
import org.wpilib.vision.apriltag.AprilTagPoseEstimate;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.util.RawFrame;
import org.wpilib.util.runtime.RuntimeLoader;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.wpilib.vision.apriltag.AprilTagDetection;
import org.wpilib.vision.apriltag.AprilTagDetector;
import org.wpilib.vision.apriltag.AprilTagPoseEstimate;
/** AprilTag JNI. */
public class AprilTagJNI {

View File

@@ -8,9 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.math.util.Units;
import org.wpilib.util.runtime.RuntimeLoader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -23,6 +20,9 @@ import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.math.util.Units;
import org.wpilib.util.runtime.RuntimeLoader;
class AprilTagDetectorTest {
@SuppressWarnings("MemberName")

View File

@@ -6,8 +6,8 @@ package org.wpilib.vision.apriltag;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.wpilib.util.PixelFormat;
import org.junit.jupiter.api.Test;
import org.wpilib.util.PixelFormat;
class AprilTagGenerationTest {
@Test

View File

@@ -6,12 +6,12 @@ package org.wpilib.vision.apriltag;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Translation3d;
import org.wpilib.math.util.Units;
import java.util.List;
import org.junit.jupiter.api.Test;
class AprilTagPoseSetOriginTest {
@Test

View File

@@ -8,11 +8,11 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.util.Units;
import java.util.List;
import org.junit.jupiter.api.Test;
class AprilTagSerializationTest {
@Test

View File

@@ -9,14 +9,14 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.util.Units;
import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.util.Units;
class LoadConfigTest {
@ParameterizedTest

View File

@@ -4,9 +4,6 @@
package frc.robot;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.path.TravelingSalesman;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -18,6 +15,9 @@ import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.path.TravelingSalesman;
public class Main {
private static final Pose2d[] poses = {

View File

@@ -10,14 +10,14 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.wpilib.vision.stream.CameraServer;
import org.wpilib.vision.camera.VideoSource;
import org.wpilib.networktables.NetworkTableInstance;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.vision.camera.VideoSource;
import org.wpilib.vision.stream.CameraServer;
/*
JSON format:

View File

@@ -4,10 +4,10 @@
package org.wpilib.vision.process;
import org.wpilib.vision.stream.CameraServerSharedStore;
import org.opencv.core.Mat;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.VideoSource;
import org.opencv.core.Mat;
import org.wpilib.vision.stream.CameraServerSharedStore;
/**
* A vision runner is a convenient wrapper object to make it easy to run vision pipelines from robot

View File

@@ -3,8 +3,8 @@
// the WPILib BSD license file in the root directory of this project.
/**
* Classes in the {@code org.wpilib.vision.process} package are designed to simplify using OpenCV vision
* processing code from a robot program.
* Classes in the {@code org.wpilib.vision.process} package are designed to simplify using OpenCV
* vision processing code from a robot program.
*
* <p>An example use case for grabbing a yellow tote from 2015 in autonomous: <br>
*

View File

@@ -4,17 +4,13 @@
package org.wpilib.vision.stream;
import org.wpilib.vision.camera.CameraServerJNI;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.MjpegServer;
import org.wpilib.vision.camera.UsbCamera;
import org.wpilib.vision.camera.VideoEvent;
import org.wpilib.vision.camera.VideoException;
import org.wpilib.vision.camera.VideoListener;
import org.wpilib.vision.camera.VideoMode;
import org.wpilib.vision.camera.VideoSink;
import org.wpilib.vision.camera.VideoSource;
import java.lang.ref.Reference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import org.wpilib.networktables.BooleanEntry;
import org.wpilib.networktables.BooleanPublisher;
import org.wpilib.networktables.IntegerEntry;
@@ -26,13 +22,17 @@ import org.wpilib.networktables.StringArrayTopic;
import org.wpilib.networktables.StringEntry;
import org.wpilib.networktables.StringPublisher;
import org.wpilib.util.PixelFormat;
import java.lang.ref.Reference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import org.wpilib.vision.camera.CameraServerJNI;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.MjpegServer;
import org.wpilib.vision.camera.UsbCamera;
import org.wpilib.vision.camera.VideoEvent;
import org.wpilib.vision.camera.VideoException;
import org.wpilib.vision.camera.VideoListener;
import org.wpilib.vision.camera.VideoMode;
import org.wpilib.vision.camera.VideoSink;
import org.wpilib.vision.camera.VideoSource;
/**
* Singleton class for creating and keeping camera servers. Also publishes camera information to

View File

@@ -7,16 +7,16 @@ package org.wpilib.command2;
import static org.wpilib.units.Units.Seconds;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.units.measure.Time;
import org.wpilib.util.function.BooleanConsumer;
import org.wpilib.util.sendable.Sendable;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.function.BooleanSupplier;
import org.wpilib.annotation.NoDiscard;
import org.wpilib.units.measure.Time;
import org.wpilib.util.function.BooleanConsumer;
import org.wpilib.util.sendable.Sendable;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
/**
* A state machine representing a complete action to be performed by the robot. Commands are run by

View File

@@ -6,17 +6,6 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.util.sendable.Sendable;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.RobotBase;
import org.wpilib.opmode.RobotState;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.Watchdog;
import org.wpilib.event.EventLoop;
import org.wpilib.command2.Command.InterruptionBehavior;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -33,6 +22,17 @@ import java.util.Set;
import java.util.WeakHashMap;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import org.wpilib.command2.Command.InterruptionBehavior;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.event.EventLoop;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.opmode.RobotBase;
import org.wpilib.opmode.RobotState;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.Watchdog;
import org.wpilib.util.sendable.Sendable;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
/**
* The scheduler responsible for running {@link Command}s. A Command-based robot should call {@link

View File

@@ -6,11 +6,11 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.units.measure.Time;
import java.util.Map;
import java.util.Set;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import org.wpilib.units.measure.Time;
/**
* Namespace for command factory methods.

View File

@@ -6,8 +6,8 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.function.BooleanSupplier;
import org.wpilib.util.sendable.SendableBuilder;
/**
* A command composition that runs one of two commands, depending on the value of the given

View File

@@ -6,9 +6,9 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.Set;
import java.util.function.Supplier;
import org.wpilib.util.sendable.SendableBuilder;
/**
* Defers Command construction to runtime. Runs the command returned by a supplier when this command

View File

@@ -4,10 +4,10 @@
package org.wpilib.command2;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.wpilib.util.sendable.SendableBuilder;
/**
* A command composition that runs a set of commands in parallel, ending only when a specific

View File

@@ -6,8 +6,8 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.function.Supplier;
import org.wpilib.util.sendable.SendableBuilder;
/**
* Schedules a given command when this command is initialized and ends when it ends, but does not

View File

@@ -6,9 +6,9 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.Map;
import java.util.function.Supplier;
import org.wpilib.util.sendable.SendableBuilder;
/**
* A command composition that runs one of a selection of commands using a selector and a key to

View File

@@ -4,9 +4,9 @@
package org.wpilib.command2;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.ArrayList;
import java.util.List;
import org.wpilib.util.sendable.SendableBuilder;
/**
* A command composition that runs a list of commands in sequence.

View File

@@ -6,10 +6,10 @@ package org.wpilib.command2;
import static org.wpilib.units.Units.Seconds;
import org.wpilib.system.Timer;
import org.wpilib.units.measure.Time;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.system.Timer;
/**
* A command that does nothing but takes a specified amount of time to finish.

View File

@@ -6,8 +6,8 @@ package org.wpilib.command2;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.system.Timer;
import java.util.function.BooleanSupplier;
import org.wpilib.system.Timer;
/**
* A command that does nothing but ends after a specified match time or condition. Useful for

View File

@@ -4,9 +4,9 @@
package org.wpilib.command2.button;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.Gamepad;
import org.wpilib.event.EventLoop;
import org.wpilib.command2.CommandScheduler;
/**
* A version of {@link Gamepad} with {@link Trigger} factories for command-based.

View File

@@ -4,13 +4,13 @@
package org.wpilib.command2.button;
import org.wpilib.math.util.Pair;
import java.util.HashMap;
import java.util.Map;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.event.EventLoop;
import org.wpilib.command2.CommandScheduler;
import java.util.HashMap;
import java.util.Map;
import org.wpilib.math.util.Pair;
/**
* A version of {@link GenericHID} with {@link Trigger} factories for command-based.

View File

@@ -4,9 +4,9 @@
package org.wpilib.command2.button;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.Joystick;
import org.wpilib.event.EventLoop;
import org.wpilib.command2.CommandScheduler;
/**
* A version of {@link Joystick} with {@link Trigger} factories for command-based.

View File

@@ -6,11 +6,11 @@ package org.wpilib.command2.button;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.math.filter.Debouncer;
import org.wpilib.event.EventLoop;
import java.util.function.BooleanSupplier;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import java.util.function.BooleanSupplier;
import org.wpilib.event.EventLoop;
import org.wpilib.math.filter.Debouncer;
/**
* This class provides an easy way to link commands to conditions.

View File

@@ -4,21 +4,21 @@
package org.wpilib.command2.sysid;
import static java.util.Map.entry;
import static org.wpilib.units.Units.Second;
import static org.wpilib.units.Units.Seconds;
import static org.wpilib.units.Units.Volts;
import static java.util.Map.entry;
import java.util.Map;
import java.util.function.Consumer;
import org.wpilib.command2.Command;
import org.wpilib.command2.Subsystem;
import org.wpilib.sysid.SysIdRoutineLog;
import org.wpilib.system.Timer;
import org.wpilib.units.VoltageUnit;
import org.wpilib.units.measure.Time;
import org.wpilib.units.measure.Velocity;
import org.wpilib.units.measure.Voltage;
import org.wpilib.system.Timer;
import org.wpilib.sysid.SysIdRoutineLog;
import org.wpilib.command2.Command;
import org.wpilib.command2.Subsystem;
import java.util.Map;
import java.util.function.Consumer;
/**
* A SysId characterization routine for a single mechanism. Mechanisms may have multiple motors.

View File

@@ -4,11 +4,11 @@
package org.wpilib;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.DriverStationSim;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.DriverStationSim;
public final class MockHardwareExtension implements BeforeAllCallback {
private static ExtensionContext getRoot(ExtensionContext context) {

View File

@@ -9,12 +9,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
class CommandDecoratorTest extends CommandTestBase {
@Test

View File

@@ -11,9 +11,9 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.jupiter.api.Test;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.smartdashboard.SmartDashboard;
import org.junit.jupiter.api.Test;
class CommandScheduleTest extends CommandTestBase {
@Test

View File

@@ -8,13 +8,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.networktables.BooleanPublisher;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.smartdashboard.SmartDashboard;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.wpilib.networktables.BooleanPublisher;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.smartdashboard.SmartDashboard;
class CommandSendableButtonTest extends CommandTestBase {
private NetworkTableInstance m_inst;

View File

@@ -7,11 +7,11 @@ package org.wpilib.command2;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.simulation.DriverStationSim;
import org.wpilib.command2.Command.InterruptionBehavior;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach;
import org.wpilib.command2.Command.InterruptionBehavior;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.simulation.DriverStationSim;
/** Basic setup for all {@link Command tests}. */
public class CommandTestBase {

View File

@@ -10,13 +10,13 @@ import static org.junit.jupiter.params.provider.Arguments.arguments;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import org.wpilib.command2.Command.InterruptionBehavior;
import java.util.function.BooleanSupplier;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.wpilib.command2.Command.InterruptionBehavior;
class ConditionalCommandTest extends CommandTestBase {
@Test

View File

@@ -8,11 +8,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import org.wpilib.command2.Command.InterruptionBehavior;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.wpilib.command2.Command.InterruptionBehavior;
abstract class MultiCompositionTestBase<T extends Command> extends SingleCompositionTestBase<T> {
abstract T compose(Command... members);

View File

@@ -6,13 +6,13 @@ package org.wpilib.command2;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
class NotifierCommandTest extends CommandTestBase {
@BeforeEach

View File

@@ -4,9 +4,9 @@
package org.wpilib.command2;
import static org.wpilib.command2.Commands.parallel;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.wpilib.command2.Commands.parallel;
import java.util.Map;
import org.junit.jupiter.api.Test;

View File

@@ -9,12 +9,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.command2.Command.InterruptionBehavior;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.wpilib.command2.Command.InterruptionBehavior;
class SchedulingRecursionTest extends CommandTestBase {
/**

View File

@@ -12,12 +12,12 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
class WaitCommandTest extends CommandTestBase {
@BeforeEach

View File

@@ -7,12 +7,12 @@ package org.wpilib.command2.button;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.CommandTestBase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.CommandTestBase;
import org.wpilib.networktables.NetworkTableInstance;
class NetworkButtonTest extends CommandTestBase {
NetworkTableInstance m_inst;

View File

@@ -6,9 +6,9 @@ package org.wpilib.command2.button;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.simulation.DriverStationSim;
import org.wpilib.command2.CommandTestBase;
import org.junit.jupiter.api.Test;
import org.wpilib.command2.CommandTestBase;
import org.wpilib.simulation.DriverStationSim;
class RobotModeTriggersTest extends CommandTestBase {
@Test

View File

@@ -10,7 +10,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import org.wpilib.simulation.SimHooks;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BooleanSupplier;
import org.junit.jupiter.api.Test;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.CommandTestBase;
@@ -18,10 +21,7 @@ import org.wpilib.command2.FunctionalCommand;
import org.wpilib.command2.RunCommand;
import org.wpilib.command2.StartEndCommand;
import org.wpilib.command2.WaitUntilCommand;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BooleanSupplier;
import org.junit.jupiter.api.Test;
import org.wpilib.simulation.SimHooks;
class TriggerTest extends CommandTestBase {
@Test

View File

@@ -4,7 +4,6 @@
package org.wpilib.command2.sysid;
import static org.wpilib.units.Units.Volts;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.clearInvocations;
@@ -12,16 +11,17 @@ import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.wpilib.units.Units.Volts;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.units.measure.Voltage;
import org.wpilib.simulation.SimHooks;
import org.wpilib.sysid.SysIdRoutineLog;
import org.wpilib.command2.Command;
import org.wpilib.command2.Subsystem;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.wpilib.command2.Command;
import org.wpilib.command2.Subsystem;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.simulation.SimHooks;
import org.wpilib.sysid.SysIdRoutineLog;
import org.wpilib.units.measure.Voltage;
class SysIdRoutineTest {
interface Mechanism extends Subsystem {

View File

@@ -6,13 +6,13 @@ package org.wpilib.command3;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.units.measure.Time;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import org.wpilib.annotation.NoDiscard;
import org.wpilib.units.measure.Time;
/**
* Performs some task using one or more {@link Mechanism mechanisms}. Commands are fundamentally

View File

@@ -7,13 +7,13 @@ package org.wpilib.command3;
import static org.wpilib.units.Units.Seconds;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.units.measure.Time;
import org.wpilib.system.Timer;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import org.wpilib.system.Timer;
import org.wpilib.units.measure.Time;
/**
* A coroutine object is injected into command's {@link Command#run(Coroutine)} method to allow

View File

@@ -4,10 +4,10 @@
package org.wpilib.command3;
import org.wpilib.units.measure.Time;
import java.util.List;
import java.util.function.Consumer;
import org.wpilib.annotation.NoDiscard;
import org.wpilib.units.measure.Time;
/**
* Generic base class to represent mechanisms on a robot. Commands can require sole ownership of a

View File

@@ -7,11 +7,6 @@ package org.wpilib.command3;
import static org.wpilib.units.Units.Microseconds;
import static org.wpilib.units.Units.Milliseconds;
import org.wpilib.util.ErrorMessages;
import org.wpilib.util.protobuf.ProtobufSerializable;
import org.wpilib.system.RobotController;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.event.EventLoop;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -29,6 +24,11 @@ import java.util.stream.Collectors;
import org.wpilib.annotation.NoDiscard;
import org.wpilib.command3.button.CommandGenericHID;
import org.wpilib.command3.proto.SchedulerProto;
import org.wpilib.event.EventLoop;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.RobotController;
import org.wpilib.util.ErrorMessages;
import org.wpilib.util.protobuf.ProtobufSerializable;
/**
* Manages the lifecycles of {@link Coroutine}-based {@link Command Commands}. Commands may be

View File

@@ -4,8 +4,8 @@
package org.wpilib.command3;
import org.wpilib.system.RobotController;
import java.util.function.Consumer;
import org.wpilib.system.RobotController;
/**
* An event that occurs during scheduler processing. This can range from {@link Scheduled a command

View File

@@ -7,14 +7,14 @@ package org.wpilib.command3;
import static org.wpilib.units.Units.Seconds;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.math.filter.Debouncer;
import org.wpilib.units.measure.Time;
import org.wpilib.event.EventLoop;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.function.BooleanSupplier;
import org.wpilib.event.EventLoop;
import org.wpilib.math.filter.Debouncer;
import org.wpilib.units.measure.Time;
/**
* Triggers allow users to specify conditions for when commands should run. Triggers can be set up

View File

@@ -4,10 +4,10 @@
package org.wpilib.command3.button;
import org.wpilib.driverstation.Gamepad;
import org.wpilib.event.EventLoop;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.Gamepad;
import org.wpilib.event.EventLoop;
/**
* A version of {@link Gamepad} with {@link Trigger} factories for command-based.

View File

@@ -4,14 +4,14 @@
package org.wpilib.command3.button;
import org.wpilib.math.util.Pair;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.event.EventLoop;
import java.util.HashMap;
import java.util.Map;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.event.EventLoop;
import org.wpilib.math.util.Pair;
/**
* A version of {@link GenericHID} with {@link Trigger} factories for command-based.

View File

@@ -4,10 +4,10 @@
package org.wpilib.command3.button;
import org.wpilib.driverstation.Joystick;
import org.wpilib.event.EventLoop;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.Joystick;
import org.wpilib.event.EventLoop;
/**
* A version of {@link Joystick} with {@link Trigger} factories for command-based.

View File

@@ -6,8 +6,8 @@ package org.wpilib.command3.button;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.GenericHID;
/** A {@link Trigger} that gets its state from a {@link GenericHID}. */
public class JoystickButton extends Trigger {

View File

@@ -6,11 +6,11 @@ package org.wpilib.command3.button;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.command3.Trigger;
import org.wpilib.networktables.BooleanSubscriber;
import org.wpilib.networktables.BooleanTopic;
import org.wpilib.networktables.NetworkTable;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.command3.Trigger;
/** A {@link Trigger} that uses a {@link NetworkTable} boolean field. */
public class NetworkButton extends Trigger {

View File

@@ -6,9 +6,9 @@ package org.wpilib.command3.button;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.command3.Trigger;
/** A {@link Trigger} that gets its state from a POV on a {@link GenericHID}. */
public class POVButton extends Trigger {

View File

@@ -4,8 +4,8 @@
package org.wpilib.command3.button;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation;
/**
* A class containing static {@link Trigger} factories for running callbacks when the robot mode

View File

@@ -4,11 +4,11 @@
package org.wpilib.command3.proto;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.command3.Command;
import org.wpilib.command3.Mechanism;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.proto.ProtobufCommands.ProtobufCommand;
import org.wpilib.util.protobuf.Protobuf;
import us.hebi.quickbuf.Descriptors;
/** Protobuf serde for running commands. */

View File

@@ -4,9 +4,9 @@
package org.wpilib.command3.proto;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.command3.Mechanism;
import org.wpilib.command3.proto.ProtobufCommands.ProtobufMechanism;
import org.wpilib.util.protobuf.Protobuf;
import us.hebi.quickbuf.Descriptors;
public class MechanismProto implements Protobuf<Mechanism, ProtobufMechanism> {

View File

@@ -4,10 +4,10 @@
package org.wpilib.command3.proto;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.command3.Command;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.proto.ProtobufCommands.ProtobufScheduler;
import org.wpilib.util.protobuf.Protobuf;
import us.hebi.quickbuf.Descriptors;
/**

View File

@@ -4,10 +4,10 @@
package org.wpilib.command3;
import org.wpilib.system.RobotController;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.wpilib.system.RobotController;
class CommandTestBase {
protected Scheduler m_scheduler;

View File

@@ -4,19 +4,19 @@
package org.wpilib.command3;
import static org.wpilib.units.Units.Microseconds;
import static org.wpilib.units.Units.Milliseconds;
import static org.wpilib.units.Units.Seconds;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.wpilib.units.Units.Microseconds;
import static org.wpilib.units.Units.Milliseconds;
import static org.wpilib.units.Units.Seconds;
import org.wpilib.system.RobotController;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.jupiter.api.Test;
import org.wpilib.system.RobotController;
class SchedulerTimingTests extends CommandTestBase {
@Test

View File

@@ -4,12 +4,12 @@
package org.wpilib.vision.camera;
import org.wpilib.util.RawFrame;
import org.wpilib.util.runtime.RuntimeLoader;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.wpilib.util.RawFrame;
import org.wpilib.util.runtime.RuntimeLoader;
/** CameraServer JNI. */
public class CameraServerJNI {

View File

@@ -4,12 +4,12 @@
package org.wpilib.vision.camera;
import org.wpilib.util.PixelFormat;
import org.wpilib.util.RawFrame;
import org.wpilib.util.TimestampSource;
import java.nio.ByteBuffer;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.wpilib.util.PixelFormat;
import org.wpilib.util.RawFrame;
import org.wpilib.util.TimestampSource;
/**
* A sink for user code to accept video frames as OpenCV images. These sinks require the WPILib

View File

@@ -4,8 +4,8 @@
package org.wpilib.vision.camera;
import org.wpilib.util.PixelFormat;
import org.opencv.core.Mat;
import org.wpilib.util.PixelFormat;
/**
* A source that represents a video camera. These sources require the WPILib OpenCV builds. For an

View File

@@ -4,10 +4,10 @@
package org.wpilib.vision.camera;
import org.wpilib.util.runtime.RuntimeLoader;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.opencv.core.Core;
import org.wpilib.util.runtime.RuntimeLoader;
/** OpenCV Native Loader. */
public final class OpenCvLoader {

View File

@@ -4,8 +4,8 @@
package org.wpilib.vision.camera;
import org.wpilib.util.PixelFormat;
import java.util.Objects;
import org.wpilib.util.PixelFormat;
/** Video mode. */
@SuppressWarnings("MemberName")

View File

@@ -4,9 +4,9 @@
package org.wpilib.vision.camera.raw;
import org.wpilib.util.RawFrame;
import org.wpilib.vision.camera.CameraServerJNI;
import org.wpilib.vision.camera.ImageSink;
import org.wpilib.util.RawFrame;
/**
* A sink for user code to accept video frames as raw bytes.

View File

@@ -4,12 +4,12 @@
package org.wpilib.vision.camera.raw;
import java.nio.ByteBuffer;
import org.wpilib.util.PixelFormat;
import org.wpilib.util.RawFrame;
import org.wpilib.vision.camera.CameraServerJNI;
import org.wpilib.vision.camera.ImageSource;
import org.wpilib.vision.camera.VideoMode;
import org.wpilib.util.PixelFormat;
import org.wpilib.util.RawFrame;
import java.nio.ByteBuffer;
/**
* A source for user code to provide video frames as raw bytes.

View File

@@ -7,8 +7,8 @@ package org.wpilib.vision.camera;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.wpilib.util.PixelFormat;
import org.junit.jupiter.api.Test;
import org.wpilib.util.PixelFormat;
class VideoModeTest {
@Test

View File

@@ -4,14 +4,14 @@
package org.wpilib.datalog;
import org.wpilib.util.WPIUtilJNI;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.wpilib.util.WPIUtilJNI;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
/**
* A data log for high-speed writing of data values.

View File

@@ -4,10 +4,10 @@
package org.wpilib.datalog;
import org.wpilib.util.runtime.RuntimeLoader;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
import org.wpilib.util.runtime.RuntimeLoader;
/**
* DataLog JNI Functions.

View File

@@ -4,10 +4,10 @@
package org.wpilib.datalog;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.protobuf.ProtobufBuffer;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.protobuf.ProtobufBuffer;
import us.hebi.quickbuf.ProtoMessage;
/**

View File

@@ -4,12 +4,12 @@
package org.wpilib.datalog;
import org.wpilib.util.struct.Struct;
import org.wpilib.util.struct.StructBuffer;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collection;
import org.wpilib.util.struct.Struct;
import org.wpilib.util.struct.StructBuffer;
/**
* Log struct-encoded array values.

View File

@@ -4,9 +4,9 @@
package org.wpilib.datalog;
import java.nio.ByteBuffer;
import org.wpilib.util.struct.Struct;
import org.wpilib.util.struct.StructBuffer;
import java.nio.ByteBuffer;
/**
* Log struct-encoded values.

View File

@@ -4,8 +4,6 @@
package printlog;
import org.wpilib.datalog.DataLogReader;
import org.wpilib.datalog.DataLogRecord;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
@@ -14,6 +12,8 @@ import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
import org.wpilib.datalog.DataLogReader;
import org.wpilib.datalog.DataLogRecord;
public final class PrintLog {
private static final DateTimeFormatter m_timeFormatter =

View File

@@ -9,14 +9,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.wpilib.util.struct.Struct;
import org.wpilib.util.struct.StructSerializable;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.Objects;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.wpilib.util.struct.Struct;
import org.wpilib.util.struct.StructSerializable;
@SuppressWarnings("AvoidEscapedUnicodeCharacters")
class DataLogTest {

View File

@@ -4,9 +4,6 @@
package org.wpilib.epilogue.processor;
import org.wpilib.epilogue.CustomLoggerFor;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
@@ -35,11 +32,11 @@ import javax.lang.model.type.NoType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic;
import org.wpilib.epilogue.CustomLoggerFor;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
@SupportedAnnotationTypes({
"org.wpilib.epilogue.CustomLoggerFor",
"org.wpilib.epilogue.Logged"
})
@SupportedAnnotationTypes({"org.wpilib.epilogue.CustomLoggerFor", "org.wpilib.epilogue.Logged"})
@SupportedSourceVersion(SourceVersion.RELEASE_21)
public class AnnotationProcessor extends AbstractProcessor {
private static final String kCustomLoggerFqn = "org.wpilib.epilogue.CustomLoggerFor";

View File

@@ -4,9 +4,6 @@
package org.wpilib.epilogue.processor;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.logging.ClassSpecificLogger;
import org.wpilib.epilogue.logging.EpilogueBackend;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
@@ -16,6 +13,9 @@ import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.logging.ClassSpecificLogger;
import org.wpilib.epilogue.logging.EpilogueBackend;
/**
* Handles logging of fields or methods. An element that passes the {@link #isLoggable(Element)}

View File

@@ -4,7 +4,6 @@
package org.wpilib.epilogue.processor;
import org.wpilib.epilogue.EpilogueConfiguration;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
@@ -14,13 +13,14 @@ import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import org.wpilib.epilogue.EpilogueConfiguration;
/**
* Generates the {@code Epilogue} file used as the main entry point to logging with Epilogue in a
* robot program. {@code Epilogue} has instances of every generated logger class, a {@link
* EpilogueConfiguration config} object, and (if the main robot class inherits from {@link
* org.wpilib.opmode.TimedRobot TimedRobot}) a {@code bind()} method to automatically add a
* periodic logging call to the robot.
* org.wpilib.opmode.TimedRobot TimedRobot}) a {@code bind()} method to automatically add a periodic
* logging call to the robot.
*/
public class EpilogueGenerator {
private final ProcessingEnvironment m_processingEnv;

View File

@@ -4,7 +4,6 @@
package org.wpilib.epilogue.processor;
import org.wpilib.epilogue.Logged;
import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
@@ -17,6 +16,7 @@ import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import org.wpilib.epilogue.Logged;
/** Handles logging for types annotated with the {@link Logged @Logged} annotation. */
public class LoggableHandler extends ElementHandler {

View File

@@ -11,8 +11,6 @@ import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.ReturnTree;
import com.sun.source.util.SimpleTreeVisitor;
import com.sun.source.util.Trees;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.annotation.Annotation;
@@ -38,6 +36,8 @@ import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.tools.Diagnostic;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
/** Generates logger class files for {@link Logged @Logged}-annotated classes. */
public class LoggerGenerator {
@@ -104,9 +104,9 @@ public class LoggerGenerator {
/**
* Generates the logger class used to handle data objects of the given type. The generated logger
* class will subclass from {@link org.wpilib.epilogue.logging.ClassSpecificLogger} and
* implement the {@code update()} method to populate a data log with information from an instance
* of the data type.
* class will subclass from {@link org.wpilib.epilogue.logging.ClassSpecificLogger} and implement
* the {@code update()} method to populate a data log with information from an instance of the
* data type.
*
* @param clazz the data type that the logger should support.
* @throws IOException if the file could not be written

View File

@@ -19,16 +19,13 @@ public class SendableHandler extends ElementHandler {
super(processingEnv);
m_sendableType =
Optional.ofNullable(
lookupTypeElement(processingEnv, "org.wpilib.util.sendable.Sendable"))
Optional.ofNullable(lookupTypeElement(processingEnv, "org.wpilib.util.sendable.Sendable"))
.map(TypeElement::asType);
m_commandType =
Optional.ofNullable(
lookupTypeElement(processingEnv, "org.wpilib.command2.Command"))
Optional.ofNullable(lookupTypeElement(processingEnv, "org.wpilib.command2.Command"))
.map(TypeElement::asType);
m_subsystemType =
Optional.ofNullable(
lookupTypeElement(processingEnv, "org.wpilib.command2.SubsystemBase"))
Optional.ofNullable(lookupTypeElement(processingEnv, "org.wpilib.command2.SubsystemBase"))
.map(TypeElement::asType);
}

View File

@@ -4,7 +4,6 @@
package org.wpilib.epilogue.processor;
import org.wpilib.epilogue.Logged;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
@@ -13,6 +12,7 @@ import java.util.stream.Collectors;
import javax.lang.model.element.Element;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import org.wpilib.epilogue.Logged;
public final class StringUtils {
private StringUtils() {

View File

@@ -32,8 +32,7 @@ public class StructHandler extends ElementHandler {
.getElementUtils()
.getTypeElement("org.wpilib.util.struct.StructSerializable")
.asType();
m_structType =
processingEnv.getElementUtils().getTypeElement("org.wpilib.util.struct.Struct");
m_structType = processingEnv.getElementUtils().getTypeElement("org.wpilib.util.struct.Struct");
m_typeUtils = processingEnv.getTypeUtils();
m_elementUtils = processingEnv.getElementUtils();
}

View File

@@ -6,10 +6,10 @@ package org.wpilib.epilogue.processor;
import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;
import static org.wpilib.epilogue.processor.CompileTestOptions.kJavaVersionOptions;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.wpilib.epilogue.processor.CompileTestOptions.kJavaVersionOptions;
import com.google.testing.compile.Compilation;
import com.google.testing.compile.JavaFileObjects;
@@ -2335,8 +2335,7 @@ class AnnotationProcessorTest {
.withOptions(kJavaVersionOptions)
.withProcessors(new AnnotationProcessor())
.compile(
JavaFileObjects.forSourceString(
"org.wpilib.epilogue.Example", loggedClassContent));
JavaFileObjects.forSourceString("org.wpilib.epilogue.Example", loggedClassContent));
assertThat(compilation).succeeded();
var generatedFiles = compilation.generatedSourceFiles();

View File

@@ -6,8 +6,8 @@ package org.wpilib.epilogue.processor;
import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;
import static org.wpilib.epilogue.processor.CompileTestOptions.kJavaVersionOptions;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.wpilib.epilogue.processor.CompileTestOptions.kJavaVersionOptions;
import com.google.testing.compile.Compilation;
import com.google.testing.compile.JavaFileObjects;

View File

@@ -4,12 +4,12 @@
package org.wpilib.epilogue.logging;
import java.util.LinkedHashMap;
import java.util.Map;
import org.wpilib.epilogue.CustomLoggerFor;
import org.wpilib.epilogue.logging.errors.ErrorHandler;
import org.wpilib.util.sendable.Sendable;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Base class for class-specific generated loggers. Loggers are generated at compile time by the

View File

@@ -4,11 +4,11 @@
package org.wpilib.epilogue.logging;
import java.util.Collection;
import org.wpilib.units.Measure;
import org.wpilib.units.Unit;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.Collection;
import us.hebi.quickbuf.ProtoMessage;
/** A backend is a generic interface for Epilogue to log discrete data points. */

View File

@@ -6,6 +6,11 @@ package org.wpilib.epilogue.logging;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import org.wpilib.datalog.BooleanArrayLogEntry;
import org.wpilib.datalog.BooleanLogEntry;
import org.wpilib.datalog.DataLog;
@@ -24,11 +29,6 @@ import org.wpilib.datalog.StructArrayLogEntry;
import org.wpilib.datalog.StructLogEntry;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import us.hebi.quickbuf.ProtoMessage;
/** A backend implementation that saves information to a WPILib {@link DataLog} file on disk. */

View File

@@ -4,12 +4,12 @@
package org.wpilib.epilogue.logging;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import us.hebi.quickbuf.ProtoMessage;
/**

View File

@@ -4,10 +4,6 @@
package org.wpilib.epilogue.logging;
import org.wpilib.util.function.BooleanConsumer;
import org.wpilib.util.function.FloatConsumer;
import org.wpilib.util.function.FloatSupplier;
import org.wpilib.util.sendable.SendableBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.BooleanSupplier;
@@ -17,6 +13,10 @@ import java.util.function.DoubleSupplier;
import java.util.function.LongConsumer;
import java.util.function.LongSupplier;
import java.util.function.Supplier;
import org.wpilib.util.function.BooleanConsumer;
import org.wpilib.util.function.FloatConsumer;
import org.wpilib.util.function.FloatSupplier;
import org.wpilib.util.sendable.SendableBuilder;
/** A sendable builder implementation that sends data to a {@link EpilogueBackend}. */
public class LogBackedSendableBuilder implements SendableBuilder {

View File

@@ -4,11 +4,11 @@
package org.wpilib.epilogue.logging;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import us.hebi.quickbuf.ProtoMessage;
/**

View File

@@ -4,6 +4,11 @@
package org.wpilib.epilogue.logging;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import org.wpilib.networktables.BooleanArrayPublisher;
import org.wpilib.networktables.BooleanPublisher;
import org.wpilib.networktables.DoubleArrayPublisher;
@@ -22,11 +27,6 @@ import org.wpilib.networktables.StructArrayPublisher;
import org.wpilib.networktables.StructPublisher;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import us.hebi.quickbuf.ProtoMessage;
/**

View File

@@ -4,10 +4,10 @@
package org.wpilib.epilogue.logging;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import java.util.HashMap;
import java.util.Map;
import org.wpilib.util.protobuf.Protobuf;
import org.wpilib.util.struct.Struct;
import us.hebi.quickbuf.ProtoMessage;
/**

View File

@@ -4,9 +4,9 @@
package org.wpilib.epilogue.logging.errors;
import org.wpilib.epilogue.logging.ClassSpecificLogger;
import java.util.HashMap;
import java.util.Map;
import org.wpilib.epilogue.logging.ClassSpecificLogger;
/**
* An error handler that disables loggers after too many exceptions are raised. Useful when playing

View File

@@ -6,9 +6,9 @@ package org.wpilib.epilogue.logging;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.wpilib.epilogue.Logged;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.wpilib.epilogue.Logged;
class ClassSpecificLoggerTest {
@Logged

Some files were not shown because too many files have changed in this diff Show More