Skip to content

Commit 5078c4e

Browse files
committed
fix: jsqlparser 降级至 4.9 以兼容 JDK 8 构建
- jsqlparser 5.0 为 Java 11+ 字节码(class 55),JDK 8 下无法编译,降级至最后支持 Java 8 的 4.9 版本 - 移除 Statement/PreparedStatement/CallableStatement 代理测试中依赖 JDK 9+ Statement.enquote* API 的断言,保留 unwrap/isWrapperFor 委托验证
1 parent 0595d15 commit 5078c4e

4 files changed

Lines changed: 7 additions & 28 deletions

File tree

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<snakeyaml.version>2.2</snakeyaml.version>
5050
<apache-groovy.version>4.0.24</apache-groovy.version>
5151
<h2.version>1.4.200</h2.version>
52-
<jsqlparser.version>5.0</jsqlparser.version>
52+
<jsqlparser.version>4.9</jsqlparser.version>
5353
</properties>
5454

5555
<dependencies>

‎springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/jdbc/proxy/CallableStatementProxyTest.java‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,18 +615,11 @@ void testAttributeDelegates() throws SQLException {
615615
}
616616

617617
@Test
618-
void testEnquoteAndWrapperDelegates() throws SQLException {
619-
when(callableStatement.enquoteLiteral("v")).thenReturn("'v'");
620-
when(callableStatement.enquoteIdentifier("id", true)).thenReturn("\"id\"");
621-
when(callableStatement.isSimpleIdentifier("id")).thenReturn(true);
622-
when(callableStatement.enquoteNCharLiteral("v")).thenReturn("N'v'");
618+
void testWrapperDelegates() throws SQLException {
619+
// enquoteLiteral/enquoteIdentifier/isSimpleIdentifier/enquoteNCharLiteral 为 JDK 9+ 的 Statement API,8.x 版本线不覆盖
623620
when(callableStatement.unwrap(String.class)).thenReturn("unwrapped");
624621
when(callableStatement.isWrapperFor(String.class)).thenReturn(true);
625622

626-
assertEquals("'v'", proxy.enquoteLiteral("v"));
627-
assertEquals("\"id\"", proxy.enquoteIdentifier("id", true));
628-
assertTrue(proxy.isSimpleIdentifier("id"));
629-
assertEquals("N'v'", proxy.enquoteNCharLiteral("v"));
630623
assertEquals("unwrapped", proxy.unwrap(String.class));
631624
assertTrue(proxy.isWrapperFor(String.class));
632625
}

‎springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/jdbc/proxy/PreparedStatementProxyTest.java‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,18 +363,11 @@ void testAttributeDelegates() throws SQLException {
363363
}
364364

365365
@Test
366-
void testEnquoteAndWrapperDelegates() throws SQLException {
367-
when(preparedStatement.enquoteLiteral("v")).thenReturn("'v'");
368-
when(preparedStatement.enquoteIdentifier("id", true)).thenReturn("\"id\"");
369-
when(preparedStatement.isSimpleIdentifier("id")).thenReturn(true);
370-
when(preparedStatement.enquoteNCharLiteral("v")).thenReturn("N'v'");
366+
void testWrapperDelegates() throws SQLException {
367+
// enquoteLiteral/enquoteIdentifier/isSimpleIdentifier/enquoteNCharLiteral 为 JDK 9+ 的 Statement API,8.x 版本线不覆盖
371368
when(preparedStatement.unwrap(String.class)).thenReturn("unwrapped");
372369
when(preparedStatement.isWrapperFor(String.class)).thenReturn(true);
373370

374-
assertEquals("'v'", proxy.enquoteLiteral("v"));
375-
assertEquals("\"id\"", proxy.enquoteIdentifier("id", true));
376-
assertTrue(proxy.isSimpleIdentifier("id"));
377-
assertEquals("N'v'", proxy.enquoteNCharLiteral("v"));
378371
assertEquals("unwrapped", proxy.unwrap(String.class));
379372
assertTrue(proxy.isWrapperFor(String.class));
380373
}

‎springboot-starter-data-authorization/src/test/java/com/codingapi/springboot/authorization/jdbc/proxy/StatementProxyTest.java‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,11 @@ void testAttributeDelegates() throws SQLException {
228228
}
229229

230230
@Test
231-
void testEnquoteAndWrapperDelegates() throws SQLException {
232-
when(statement.enquoteLiteral("v")).thenReturn("'v'");
233-
when(statement.enquoteIdentifier("id", true)).thenReturn("\"id\"");
234-
when(statement.isSimpleIdentifier("id")).thenReturn(true);
235-
when(statement.enquoteNCharLiteral("v")).thenReturn("N'v'");
231+
void testWrapperDelegates() throws SQLException {
232+
// enquoteLiteral/enquoteIdentifier/isSimpleIdentifier/enquoteNCharLiteral 为 JDK 9+ 的 Statement API,8.x 版本线不覆盖
236233
when(statement.unwrap(String.class)).thenReturn("unwrapped");
237234
when(statement.isWrapperFor(String.class)).thenReturn(true);
238235

239-
assertEquals("'v'", proxy.enquoteLiteral("v"));
240-
assertEquals("\"id\"", proxy.enquoteIdentifier("id", true));
241-
assertTrue(proxy.isSimpleIdentifier("id"));
242-
assertEquals("N'v'", proxy.enquoteNCharLiteral("v"));
243236
assertEquals("unwrapped", proxy.unwrap(String.class));
244237
assertTrue(proxy.isWrapperFor(String.class));
245238
}

0 commit comments

Comments
 (0)