代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/openjdk-1.8.0 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Date: Fri, 9 Jun 2023 11:15:09 +0800
Subject: 8276904: Optional.toString() is unnecessarily expensive
Bug url: https://bugs.openjdk.org/browse/JDK-8276904
---
jdk/src/share/classes/java/util/Optional.java | 2 +-
jdk/src/share/classes/java/util/OptionalDouble.java | 2 +-
jdk/src/share/classes/java/util/OptionalInt.java | 2 +-
jdk/src/share/classes/java/util/OptionalLong.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/jdk/src/share/classes/java/util/Optional.java b/jdk/src/share/classes/java/util/Optional.java
index d471058ec..ff2b4db7f 100644
--- a/jdk/src/share/classes/java/util/Optional.java
+++ b/jdk/src/share/classes/java/util/Optional.java
@@ -343,7 +343,7 @@ public final class Optional<T> {
@Override
public String toString() {
return value != null
- ? String.format("Optional[%s]", value)
+ ? ("Optional[" + value + "]")
: "Optional.empty";
}
}
diff --git a/jdk/src/share/classes/java/util/OptionalDouble.java b/jdk/src/share/classes/java/util/OptionalDouble.java
index 0efc770fa..9aff9be8d 100644
--- a/jdk/src/share/classes/java/util/OptionalDouble.java
+++ b/jdk/src/share/classes/java/util/OptionalDouble.java
@@ -246,7 +246,7 @@ public final class OptionalDouble {
@Override
public String toString() {
return isPresent
- ? String.format("OptionalDouble[%s]", value)
+ ? ("OptionalDouble[" + value + "]")
: "OptionalDouble.empty";
}
}
diff --git a/jdk/src/share/classes/java/util/OptionalInt.java b/jdk/src/share/classes/java/util/OptionalInt.java
index 5cb927524..584f6e2ba 100644
--- a/jdk/src/share/classes/java/util/OptionalInt.java
+++ b/jdk/src/share/classes/java/util/OptionalInt.java
@@ -246,7 +246,7 @@ public final class OptionalInt {
@Override
public String toString() {
return isPresent
- ? String.format("OptionalInt[%s]", value)
+ ? ("OptionalInt[" + value + "]")
: "OptionalInt.empty";
}
}
diff --git a/jdk/src/share/classes/java/util/OptionalLong.java b/jdk/src/share/classes/java/util/OptionalLong.java
index 589a59fd3..089f54adf 100644
--- a/jdk/src/share/classes/java/util/OptionalLong.java
+++ b/jdk/src/share/classes/java/util/OptionalLong.java
@@ -246,7 +246,7 @@ public final class OptionalLong {
@Override
public String toString() {
return isPresent
- ? String.format("OptionalLong[%s]", value)
+ ? ("OptionalLong[" + value + "]")
: "OptionalLong.empty";
}
}
--
2.22.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。