[
https://issues.apache.org/jira/browse/LANG-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved LANG-1762.
-----------------------------------
Fix Version/s: 3.18.0
Resolution: Fixed
Hello [~a.gonzalez]
This is now fixed in git master and snapshot builds for {{3.18.0-SNAPSHOT}}.
You are credited in {{{}changes.xml{}}}.
Thank you!
> StopWatch methods should not delegate to deprecated methods
> -----------------------------------------------------------
>
> Key: LANG-1762
> URL: https://issues.apache.org/jira/browse/LANG-1762
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.time.*
> Affects Versions: 3.16.0, 3.17.0
> Reporter: Alonso Gonzalez
> Assignee: Gary D. Gregory
> Priority: Major
> Fix For: 3.18.0
>
>
> {{getStartTime()}} and {{getStopTime()}} were deprecated in 3.16.0 but the
> new methods don't use the new fields startInstant and stopInstant directly.
> Instead the new methods delegate to the deprecated methods.
> Thus calling the new {{getStartTime()}} method means:
> * call deprecated method {{getStartTime()}}
> * extract millis from available Instant startInstant
> * create a new Instant with the extracted millis
> The new methods should use the existing instants directly and the deprecated
> methods should delegate to the new methods:
> {code:java}
> public Instant getStartInstant() {
> if (runningState == State.UNSTARTED) {
> throw new IllegalStateException("Stopwatch has not been started");
> }
> return startInstant;
> }
> @Deprecated
> public long getStartTime() {
> return getStartInstant().toEpochMilli();
> }
> {code}
> This would avoid unnecessary object creation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)