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

@@ -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;