On Mon, Jan 29, 2018 at 7:39 AM, Remko Popma <remko.po...@gmail.com> wrote:

> I actually coded it this way deliberately.
> The local variables clarify the intention and make the code self
> documenting. Without the variable the reader needs to spend effort to
> understand the calculation on the right.
>
> I got this technique from Kent Beck’s Implementation Patterns and Robert
> Martin’s Clean Code and find it very useful.
>
> Would you mind putting them back?
>
Ping?

>
> (Shameless plug) Every java main() method deserves http://picocli.info
>
> > On Jan 29, 2018, at 0:45, ggreg...@apache.org wrote:
> >
> > Repository: logging-log4j2
> > Updated Branches:
> >  refs/heads/master 91f927f8c -> 0295bcb47
> >
> >
> > In-line mutable local vars.
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> commit/0295bcb4
> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> 0295bcb4
> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> 0295bcb4
> >
> > Branch: refs/heads/master
> > Commit: 0295bcb4776c0885f26aab6ae39c5cff498be5a2
> > Parents: 91f927f
> > Author: Gary Gregory <garydgreg...@gmail.com>
> > Authored: Sun Jan 28 08:45:14 2018 -0700
> > Committer: Gary Gregory <garydgreg...@gmail.com>
> > Committed: Sun Jan 28 08:45:14 2018 -0700
> >
> > ----------------------------------------------------------------------
> > .../org/apache/logging/log4j/core/time/MutableInstant.java    | 7
> +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 0295bcb4/log4j-core/src/main/java/org/apache/logging/log4j/
> core/time/MutableInstant.java
> > ----------------------------------------------------------------------
> > diff --git 
> > a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/MutableInstant.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> time/MutableInstant.java
> > index 4ec26ad..09b0d39 100644
> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/
> time/MutableInstant.java
> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/
> time/MutableInstant.java
> > @@ -55,15 +55,14 @@ public class MutableInstant implements Instant,
> Serializable {
> >     @Override
> >     public long getEpochMillisecond() {
> >         final int millis = nanoOfSecond / NANOS_PER_MILLI;
> > -        long epochMillisecond = epochSecond * MILLIS_PER_SECOND +
> millis;
> > -        return epochMillisecond;
> > +        return epochSecond * MILLIS_PER_SECOND + millis;
> >     }
> >
> >     @Override
> >     public int getNanoOfMillisecond() {
> >         final int millis = nanoOfSecond / NANOS_PER_MILLI;
> > -        int nanoOfMillisecond = nanoOfSecond - (millis *
> NANOS_PER_MILLI); // cheaper than nanoOfSecond % NANOS_PER_MILLI
> > -        return nanoOfMillisecond;
> > +         // cheaper than nanoOfSecond % NANOS_PER_MILLI
> > +        return nanoOfSecond - (millis * NANOS_PER_MILLI);
> >     }
> >
> >     public void initFrom(final Instant other) {
> >
>

Reply via email to