MonotonicClock.withZone() ignores zone parameter, violating Clock contract
Found in: maven-4.0.x branch
File: api/maven-api-core/src/main/java/org/apache/maven/api/MonotonicClock.java (lines 147-150)
Severity: Low
Description
withZone() ignores the zone parameter and returns this, violating the java.time.Clock.withZone() contract:
@Override
public Clock withZone(ZoneId zone) {
return this; // ignores the zone parameter
}
The Clock.withZone() contract states: "Returns a copy of this clock with a different time-zone. The returned clock is functionally equivalent to this clock but with the specified time-zone." Ignoring the parameter and returning this means callers that pass a specific timezone expecting a clock in that zone will silently get UTC instead, leading to subtle timezone bugs.
MonotonicClock.withZone() ignores zone parameter, violating Clock contract
Found in: maven-4.0.x branch
File:
api/maven-api-core/src/main/java/org/apache/maven/api/MonotonicClock.java(lines 147-150)Severity: Low
Description
withZone()ignores the zone parameter and returnsthis, violating thejava.time.Clock.withZone()contract:The
Clock.withZone()contract states: "Returns a copy of this clock with a different time-zone. The returned clock is functionally equivalent to this clock but with the specified time-zone." Ignoring the parameter and returningthismeans callers that pass a specific timezone expecting a clock in that zone will silently get UTC instead, leading to subtle timezone bugs.