mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpiunits] Restore and deprecate measure negate (#7345)
Delegate to unaryMinus. This ensures there's a deprecation message to help users with migration, vs just a compile error.
This commit is contained in:
@@ -43,6 +43,13 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
|
||||
return ({{ helpers['type_usage'](name) }}) unit().ofBaseUnits(0 - baseUnitMagnitude());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
default {{ helpers['type_usage'](name) }} negate() {
|
||||
return ({{ helpers['type_usage'](name) }}) unaryMinus();
|
||||
}
|
||||
|
||||
@Override
|
||||
default {{ helpers['type_usage'](name) }} plus(Measure<? extends {{ helpers['mtou'](name) }}> other) {
|
||||
return ({{ helpers['type_usage'](name) }}) unit().ofBaseUnits(baseUnitMagnitude() + other.baseUnitMagnitude());
|
||||
|
||||
Reference in New Issue
Block a user