You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/05/10 14:47:16 UTC
[maven-surefire] 01/02: made TypeEncodedValue immutable,
use Objects.equals() of Java 1.7, implemented toString()
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch SUREFIRE-1617
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit e72603f196a5f3c69f9ea10a35ba74be1e36c44d
Author: tibordigana <ti...@apache.org>
AuthorDate: Fri May 10 16:41:34 2019 +0200
made TypeEncodedValue immutable, use Objects.equals() of Java 1.7, implemented toString()
---
.../apache/maven/surefire/booter/TypeEncodedValue.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
index 95365d8..06e93be 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.booter;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
+import java.util.Objects;
import java.util.Properties;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
@@ -30,7 +31,7 @@ import static org.apache.maven.surefire.util.ReflectionUtils.loadClass;
/**
* @author Kristian Rosenvold
*/
-public class TypeEncodedValue
+public final class TypeEncodedValue
{
private final String type;
private final String value;
@@ -41,7 +42,7 @@ public class TypeEncodedValue
this.value = value;
}
- public boolean isTypeClass()
+ private boolean isTypeClass()
{
return Class.class.getName().equals( type );
}
@@ -111,7 +112,6 @@ public class TypeEncodedValue
TypeEncodedValue that = (TypeEncodedValue) o;
return equalsType( that ) && equalsValue( that );
-
}
@Override
@@ -122,13 +122,19 @@ public class TypeEncodedValue
return result;
}
+ @Override
+ public String toString()
+ {
+ return "TypeEncodedValue{" + "type='" + type + '\'' + ", value='" + value + '\'' + '}';
+ }
+
private boolean equalsType( TypeEncodedValue that )
{
- return type == null ? that.type == null : type.equals( that.type );
+ return Objects.equals( type, that.type );
}
private boolean equalsValue( TypeEncodedValue that )
{
- return value == null ? that.value == null : value.equals( that.value );
+ return Objects.equals( value, that.value );
}
}