Skip to content

Commit 738c3e4

Browse files
authored
feat: compile with JDK17 LTS, build with JDK21 (#273)
* chore: compile with JDK17 LTS, build with JDK21, update spotless, sonarcloud etc * format: google-java-format 1.22.0
1 parent 31f42ff commit 738c3e4

File tree

499 files changed

+2205
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

499 files changed

+2205
-24
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ jobs:
88
build:
99
strategy:
1010
matrix:
11-
java-version: [ 8, 11, 17 ]
11+
java-version: [ 11, 17, 21 ]
1212
os: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Set up JDK
17-
uses: actions/setup-java@v3
17+
uses: actions/setup-java@v4
1818
with:
1919
java-version: ${{ matrix.java-version }}
2020
distribution: 'temurin'
2121
cache: 'gradle'
2222
- name: Validate Gradle wrapper
23-
uses: gradle/wrapper-validation-action@v1
23+
uses: gradle/actions/wrapper-validation@v3
2424
- name: Build with Gradle
25-
run: ./gradlew build
25+
run: ./gradlew build

.github/workflows/deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
check-tag:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: Regex Match
1414
id: regex-match
1515
run: |
@@ -26,19 +26,19 @@ jobs:
2626
needs: [check-tag]
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030
- name: Set up Java
31-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@v4
3232
with:
33-
java-version: '8'
33+
java-version: '17'
3434
distribution: 'temurin'
3535
- name: Validate Gradle wrapper
36-
uses: gradle/wrapper-validation[email protected]
36+
uses: gradle/actions/wrapper-validation@v3
3737
# 发布项目
3838
- name: Publish
3939
run: ./gradlew publish
4040
env:
4141
SONATYPE_NEXUS_USERNAME: ${{secrets.SONATYPE_NEXUS_USERNAME}}
4242
SONATYPE_NEXUS_PASSWORD: ${{secrets.SONATYPE_NEXUS_PASSWORD}}
4343
SIGNING_KEY: ${{secrets.SIGNING_KEY}}
44-
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}
44+
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}

.github/workflows/sonarcloud-scan.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,28 @@ on:
99
- 'feat_*'
1010
- 'fix_*'
1111
- 'refactor_*'
12-
12+
1313
jobs:
1414
build:
1515
name: Build
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2121
- name: Set up JDK 17
22-
uses: actions/setup-java@v1
22+
uses: actions/setup-java@v4
2323
with:
2424
java-version: 17
25+
distribution: 'temurin'
2526
- name: Cache SonarCloud packages
26-
uses: actions/cache@v1
27+
uses: actions/cache@v4
2728
with:
2829
path: ~/.sonar/cache
2930
key: ${{ runner.os }}-sonar
3031
restore-keys: ${{ runner.os }}-sonar
3132
- name: Cache Gradle packages
32-
uses: actions/cache@v1
33+
uses: actions/cache@v4
3334
with:
3435
path: ~/.gradle/caches
3536
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}

buildSrc/src/main/groovy/common.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ plugins {
77
id "jacoco"
88
}
99

10+
sourceCompatibility = JavaVersion.VERSION_1_8
11+
targetCompatibility = JavaVersion.VERSION_1_8
12+
1013
version projectPropVersion
1114
group projectPropGroup
1215
compileJava.options.encoding = "UTF-8"
@@ -19,7 +22,7 @@ repositories {
1922
spotless {
2023
java {
2124
removeUnusedImports()
22-
googleJavaFormat('1.7')
25+
googleJavaFormat('1.22.0')
2326
}
2427
}
2528

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies {
2121
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
2222

2323
testImplementation "junit:junit:${junitVersion}"
24-
testImplementation "org.mockito:mockito-inline:${mockitoInlineVersion}"
24+
testImplementation "org.mockito:mockito-core:${mockitoCoreVersion}"
2525
testImplementation "com.squareup.okhttp3:mockwebserver:${okhttpVersion}"
2626
testImplementation "org.awaitility:awaitility:${awaitilityVersion}"
2727

core/src/main/java/com/wechat/pay/java/core/AbstractRSAConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ protected AbstractRSAConfig(
3232

3333
/** 商户号 */
3434
private final String merchantId;
35+
3536
/** 商户私钥 */
3637
private final PrivateKey privateKey;
38+
3739
/** 商户证书序列号 */
3840
private final String merchantSerialNumber;
41+
3942
/** 微信支付平台证书Provider */
4043
private final CertificateProvider certificateProvider;
4144

core/src/main/java/com/wechat/pay/java/core/notification/Constant.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.wechat.pay.java.core.notification;
2+
23
/** Notification 常量 */
34
public final class Constant {
45
public static final String RSA_SIGN_TYPE = "WECHATPAY2-SHA256-RSA2048";

core/src/test/java/com/wechat/pay/java/core/cipher/RSAVerifierTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class RSAVerifierTest {
1515

1616
private static Verifier rsaVerifier;
1717
private static final String MESSAGE = "message";
18+
1819
/** signature为使用RSASigner和测试商户证书私钥对MESSAGE签名得到的结果 */
1920
private static final SignatureResult SIGNATURE_RESULT =
2021
new SignatureResult(

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ junitVersion=4.13.2
66
junit5Version=5.9.1
77
okhttpVersion=4.10.0
88
gsonVersion=2.9.1
9-
mockitoInlineVersion=4.8.1
9+
mockitoCoreVersion=5.12.0
1010
awaitilityVersion=4.2.0
11-
spotlessVersion=6.11.0
11+
spotlessVersion=6.25.0
1212
shadowVersion=7.1.2
13-
sonarqubeVersion=4.0.0.2929
13+
sonarqubeVersion=5.0.0.4638
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

service/src/example/java/com/wechat/pay/java/service/QuickStart.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ public class QuickStart {
1313

1414
/** 商户号 */
1515
public static String merchantId = "";
16+
1617
/** 商户API私钥路径 */
1718
public static String privateKeyPath = "";
19+
1820
/** 商户证书序列号 */
1921
public static String merchantSerialNumber = "";
22+
2023
/** 商户APIV3密钥 */
2124
public static String apiV3Key = "";
2225

service/src/example/java/com/wechat/pay/java/service/billdownload/BillDownloadServiceExample.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ public class BillDownloadServiceExample {
1414

1515
/** 商户号 */
1616
public static String merchantId = "190000****";
17+
1718
/** 商户API私钥路径 */
1819
public static String privateKeyPath = "/Users/yourname/your/path/apiclient_key.pem";
20+
1921
/** 商户证书序列号 */
2022
public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********";
23+
2124
/** 商户APIV3密钥 */
2225
public static String apiV3Key = "...";
2326

@@ -38,24 +41,28 @@ public static void main(String[] args) {
3841
service = new BillDownloadService.Builder().config(config).build();
3942
// ... 调用接口
4043
}
44+
4145
/** 申请资金账单API */
4246
public static QueryBillEntity getFundFlowBill() {
4347

4448
GetFundFlowBillRequest request = new GetFundFlowBillRequest();
4549
return service.getFundFlowBill(request);
4650
}
51+
4752
/** 申请单个子商户资金账单API */
4853
public static QueryEncryptBillEntity getSingleSubMchFundFlowBill() {
4954

5055
GetSingleSubMchFundFlowBillRequest request = new GetSingleSubMchFundFlowBillRequest();
5156
return service.getSingleSubMchFundFlowBill(request);
5257
}
58+
5359
/** 申请二级商户资金账单API */
5460
public static QueryEncryptBillEntity getAllSubMchFundFlowBill() {
5561

5662
GetAllSubMchFundFlowBillRequest request = new GetAllSubMchFundFlowBillRequest();
5763
return service.getAllSubMchFundFlowBill(request);
5864
}
65+
5966
/** 申请交易账单API */
6067
public static QueryBillEntity getTradeBill() {
6168

service/src/example/java/com/wechat/pay/java/service/brandprofitsharing/BrandProfitSharingServiceExample.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ public class BrandProfitSharingServiceExample {
2626

2727
/** 商户号 */
2828
public static String merchantId = "190000****";
29+
2930
/** 商户API私钥路径 */
3031
public static String privateKeyPath = "/Users/yourname/your/path/apiclient_key.pem";
32+
3133
/** 商户证书序列号 */
3234
public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********";
35+
3336
/** 商户APIV3密钥 */
3437
public static String apiV3Key = "...";
3538

@@ -51,49 +54,58 @@ public static void main(String[] args) {
5154
service = new BrandProfitSharingService.Builder().config(config).build();
5255
// ... 调用接口
5356
}
57+
5458
/** 查询最大分账比例 */
5559
public static QueryBrandMerchantRatioResponse queryBrandMerchantRatio() {
5660

5761
QueryBrandMerchantRatioRequest request = new QueryBrandMerchantRatioRequest();
5862
return service.queryBrandMerchantRatio(request);
5963
}
64+
6065
/** 请求分账 */
6166
public static CreateOrderResponse createOrder() {
6267
CreateOrderRequest request = new CreateOrderRequest();
6368
return service.createOrder(request);
6469
}
70+
6571
/** 完结分账 */
6672
public static FinishOrderResponse finishOrder() {
6773
FinishOrderRequest request = new FinishOrderRequest();
6874
return service.finishOrder(request);
6975
}
76+
7077
/** 查询分账结果 */
7178
public static QueryOrderResponse queryOrder() {
7279

7380
QueryOrderRequest request = new QueryOrderRequest();
7481
return service.queryOrder(request);
7582
}
83+
7684
/** 查询订单剩余待分金额 */
7785
public static QueryOrderAmountResponse queryOrderAmount() {
7886

7987
QueryOrderAmountRequest request = new QueryOrderAmountRequest();
8088
return service.queryOrderAmount(request);
8189
}
90+
8291
/** 添加分账接收方 */
8392
public static AddReceiverResponse addReceiver() {
8493
AddReceiverRequest request = new AddReceiverRequest();
8594
return service.addReceiver(request);
8695
}
96+
8797
/** 删除分账接收方 */
8898
public static DeleteReceiverResponse deleteReceiver() {
8999
DeleteReceiverRequest request = new DeleteReceiverRequest();
90100
return service.deleteReceiver(request);
91101
}
102+
92103
/** 请求分账回退 */
93104
public static CreateReturnOrderResponse createReturnOrder() {
94105
CreateReturnOrderRequest request = new CreateReturnOrderRequest();
95106
return service.createReturnOrder(request);
96107
}
108+
97109
/** 查询分账回退结果 */
98110
public static QueryReturnOrderResponse queryReturnOrder() {
99111

0 commit comments

Comments
 (0)