Skip to content

Commit 8e91227

Browse files
committed
Annotate SwerveModuleVelocity with NoDiscard
1 parent ab0d4e6 commit 8e91227

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ set(WPIUNITS_DEP_REPLACE_IMPL "find_dependency(wpiunits)")
287287
set(WPIANNOTATIONS_DEP_REPLACE_IMPL "find_dependency(wpiannotations)")
288288
set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
289289
set(DATALOG_DEP_REPLACE "find_dependency(datalog)")
290+
if(WITH_JAVA)
291+
add_subdirectory(wpiannotations)
292+
endif()
293+
290294
add_subdirectory(wpiutil)
291295

292296
add_subdirectory(datalog)
@@ -307,10 +311,6 @@ if(WITH_WPIMATH)
307311
add_subdirectory(wpimath)
308312
endif()
309313

310-
if(WITH_JAVA)
311-
add_subdirectory(wpiannotations)
312-
endif()
313-
314314
if(WITH_WPIUNITS AND NOT WITH_WPIMATH)
315315
# In case of building wpiunits standalone
316316
set(WPIUNITS_DEP_REPLACE ${WPIUNITS_DEP_REPLACE_IMPL})

wpimath/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,15 @@ wpilib_cc_shared_library(
236236
wpilib_jni_java_library(
237237
name = "wpimath-java",
238238
srcs = [":generated_java"] + glob(["src/main/java/**/*.java"]),
239+
exported_plugins = ["//javacPlugin:plugin"],
239240
maven_artifact_name = "wpimath-java",
240241
maven_group_id = "org.wpilib.wpimath",
241242
native_libs = [":wpimathjni"],
242243
resource_strip_prefix = "wpimath/src/main/proto",
243244
resources = glob(["src/main/proto/**"]),
244245
visibility = ["//visibility:public"],
245246
deps = [
247+
"//wpiannotations",
246248
"//wpiunits:wpiunits-java",
247249
"//wpiutil:wpiutil-java",
248250
"@maven//:com_fasterxml_jackson_core_jackson_annotations",

wpimath/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ if(WITH_JAVA)
7070
add_jar(
7171
wpimath_jar
7272
${JAVA_SOURCES}
73-
INCLUDE_JARS wpiutil_jar wpiunits_jar ${EJML_JARS} ${JACKSON_JARS} ${QUICKBUF_JAR}
73+
INCLUDE_JARS
74+
wpiutil_jar
75+
wpiunits_jar
76+
wpiannotations_jar
77+
${EJML_JARS}
78+
${JACKSON_JARS}
79+
${QUICKBUF_JAR}
7480
OUTPUT_NAME wpimath
7581
OUTPUT_DIR ${WPILIB_BINARY_DIR}/${java_lib_dest}
7682
GENERATE_NATIVE_HEADERS wpimath_jni_headers

wpimath/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ dependencies {
9292
api libs.bundles.ejml
9393
api libs.bundles.jackson
9494
api libs.quickbuf.runtime
95+
implementation project(":wpiannotations")
96+
annotationProcessor project(':javacPlugin')
97+
testAnnotationProcessor project(':javacPlugin')
9598
}
9699

97100
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"

wpimath/src/main/java/org/wpilib/math/kinematics/SwerveModuleVelocity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import static org.wpilib.units.Units.MetersPerSecond;
88

99
import java.util.Objects;
10+
import org.wpilib.annotation.NoDiscard;
1011
import org.wpilib.math.geometry.Rotation2d;
1112
import org.wpilib.math.interpolation.Interpolatable;
1213
import org.wpilib.math.kinematics.proto.SwerveModuleVelocityProto;
@@ -16,6 +17,7 @@
1617
import org.wpilib.util.struct.StructSerializable;
1718

1819
/** Represents the velocity of one swerve module. */
20+
@NoDiscard
1921
public class SwerveModuleVelocity
2022
implements Interpolatable<SwerveModuleVelocity>,
2123
Comparable<SwerveModuleVelocity>,

0 commit comments

Comments
 (0)