From 082fdabb8ea8a03869a1f871f097f509cb7fd460 Mon Sep 17 00:00:00 2001 From: xiafang Date: Fri, 24 Nov 2023 13:50:47 +0800 Subject: [PATCH] maven --- .../main/java/cn/felord/retrofit/WecomUserAgent.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java b/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java index 1ab12e13..568904f7 100644 --- a/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java +++ b/wecom-common/src/main/java/cn/felord/retrofit/WecomUserAgent.java @@ -31,9 +31,13 @@ public final class WecomUserAgent { /** * UserAgent */ - public static final String WECOM_USER_AGENT = "Wecom/" + VERSION + Optional.ofNullable(System.getProperty("java.version")) - .map(javaVersion -> " Java/" + javaVersion) - .orElse(""); + public static final String WECOM_USER_AGENT; + + static { + WECOM_USER_AGENT = "Wecom/" + VERSION + Optional.ofNullable(System.getProperty("java.version")) + .map(javaVersion -> " Java/" + javaVersion) + .orElse(""); + } private WecomUserAgent() { }