You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2022/01/12 13:50:13 UTC
[logging-log4j2] branch master updated (fe562a1 -> 857eca7)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.
from fe562a1 Add Source constructors for Path and URL; add unit test case class.
new 0a4adfa Format tweak.
new 857eca7 Use final and simpler hashcode generation through Objects.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/logging/log4j/core/util/Source.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
[logging-log4j2] 01/02: Format tweak.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 0a4adfaec9eec09bc683d8b613b5cc4035c74f7e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 12 07:06:21 2022 -0500
Format tweak.
---
log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
index 7d095ff..9674618 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
@@ -65,6 +65,7 @@ public class Source {
throw new IllegalArgumentException(e);
}
}
+
private final File file;
private final URI uri;
private final String location;
Re: [logging-log4j2] 02/02: Use final and simpler hashcode generation through Objects.
Posted by Carter Kozak <ck...@ckozak.net>.
I'd prefer if we didn't incur implicit array allocation cost generating a hash code. My preference is to keep the original implementation.
-ck
On Wed, Jan 12, 2022, at 08:50, ggregory@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> ggregory pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
>
> commit 857eca786c2027469763e2fea93ed2b4a3c2b6c0
> Author: Gary Gregory <ga...@gmail.com>
> AuthorDate: Wed Jan 12 07:09:06 2022 -0500
>
> Use final and simpler hashcode generation through Objects.
> ---
> .../main/java/org/apache/logging/log4j/core/util/Source.java | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
> index 9674618..f28c8f8 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
> @@ -143,15 +143,15 @@ public class Source {
> }
>
> @Override
> - public boolean equals(final Object o) {
> - if (this == o) {
> + public boolean equals(Object obj) {
> + if (this == obj) {
> return true;
> }
> - if (!(o instanceof Source)) {
> + if (!(obj instanceof Source)) {
> return false;
> }
> - final Source source = (Source) o;
> - return Objects.equals(location, source.location);
> + Source other = (Source) obj;
> + return Objects.equals(location, other.location);
> }
>
> /**
> @@ -208,7 +208,7 @@ public class Source {
>
> @Override
> public int hashCode() {
> - return 31 + Objects.hashCode(location);
> + return Objects.hash(location);
> }
>
> @Override
>
[logging-log4j2] 02/02: Use final and simpler hashcode generation through Objects.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 857eca786c2027469763e2fea93ed2b4a3c2b6c0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 12 07:09:06 2022 -0500
Use final and simpler hashcode generation through Objects.
---
.../main/java/org/apache/logging/log4j/core/util/Source.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
index 9674618..f28c8f8 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Source.java
@@ -143,15 +143,15 @@ public class Source {
}
@Override
- public boolean equals(final Object o) {
- if (this == o) {
+ public boolean equals(Object obj) {
+ if (this == obj) {
return true;
}
- if (!(o instanceof Source)) {
+ if (!(obj instanceof Source)) {
return false;
}
- final Source source = (Source) o;
- return Objects.equals(location, source.location);
+ Source other = (Source) obj;
+ return Objects.equals(location, other.location);
}
/**
@@ -208,7 +208,7 @@ public class Source {
@Override
public int hashCode() {
- return 31 + Objects.hashCode(location);
+ return Objects.hash(location);
}
@Override