You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/12/01 11:52:26 UTC
[groovy] 02/03: Trivial refactoring: replace `isInstance` with
`instanceof` for simplicity
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 2c94d0641723fec4ec5cfbb2c856bda8f10abd87
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Dec 1 19:22:45 2019 +0800
Trivial refactoring: replace `isInstance` with `instanceof` for simplicity
(cherry picked from commit 4dc2c68757bd344eaedff1d45e071fb3c9191c99)
---
.../java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 1b2b18b..747570a 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -13460,14 +13460,14 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
if (nlgnSort && (head instanceof Comparable)) {
//n*LOG(n) version
Set<T> answer;
- if (Number.class.isInstance(head)) {
+ if (head instanceof Number) {
answer = new TreeSet<T>(numberComparator);
answer.addAll(self);
for (T t : self) {
- if (Number.class.isInstance(t)) {
+ if (t instanceof Number) {
for (Object t2 : removeMe) {
- if (Number.class.isInstance(t2)) {
- if (numberComparator.compare(t, (T)t2) == 0)
+ if (t2 instanceof Number) {
+ if (numberComparator.compare(t, (T) t2) == 0)
answer.remove(t);
}
}