[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:
sciencewhiz
2024-11-06 15:07:31 -08:00
committed by GitHub
parent 83fa422338
commit 71c050389a
27 changed files with 197 additions and 0 deletions

View File

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