Skip to content

Commit 27f3745

Browse files
committed
Merge remote-tracking branch 'origin/master' into create_function
2 parents 8ce9eda + bfcb8b7 commit 27f3745

File tree

24 files changed

+1452
-452
lines changed

24 files changed

+1452
-452
lines changed

build.gradle

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,18 @@ javadoc {
222222
jar {
223223
manifest {
224224
attributes (
225-
"Automatic-Module-Name": "net.sf.jsqlparser"
225+
"Automatic-Module-Name": "net.sf.jsqlparser"
226226
)
227227
}
228228

229229
bundle {
230230
properties.empty()
231231
bnd(
232-
"Created-By": System.properties.get('user.name'),
233-
"Bundle-SymbolicName": "net.sf.jsqlparser",
234-
"Import-Package": "*",
235-
"Export-Package": "net.sf.jsqlparser.*",
236-
"Automatic-Module-Name": "net.sf.jsqlparser"
232+
"Created-By": System.properties.get('user.name'),
233+
"Bundle-SymbolicName": "net.sf.jsqlparser",
234+
"Import-Package": "*",
235+
"Export-Package": "net.sf.jsqlparser.*",
236+
"Automatic-Module-Name": "net.sf.jsqlparser"
237237
)
238238
}
239239

@@ -344,7 +344,7 @@ jacocoTestCoverageVerification {
344344

345345
//@todo: temporarily increased to 7000, we need to bring that down to 5500 after accepting the Keywords PR
346346
maximum = 20000
347-
}
347+
}
348348
excludes = [
349349
'net.sf.jsqlparser.util.validation.*',
350350
'net.sf.jsqlparser.**.*Adapter',
@@ -379,27 +379,31 @@ spotbugsMain {
379379
spotbugs {
380380
// fail only on P1 and without the net.sf.jsqlparser.parser.*
381381
excludeFilter = file("config/spotbugs/spotBugsExcludeFilter.xml")
382+
}
382383

383-
// do not run over the test, although we should do that eventually
384-
spotbugsTest.enabled = false
384+
// do not run over the test, although we should do that eventually
385+
tasks.named('spotbugsTest').configure {
386+
enabled = false
385387
}
386388

387389
pmd {
390+
// later versions throw NPE
391+
toolVersion = '7.17.0'
392+
388393
consoleOutput = true
389394
sourceSets = [sourceSets.main]
390395

391396
// clear the ruleset in order to use configured rules only
392397
ruleSets = []
393-
394-
//rulesMinimumPriority = 1
398+
rulesMinimumPriority = 2
395399
ruleSetFiles = files("config/pmd/ruleset.xml")
400+
}
396401

397-
pmdMain {
398-
excludes = [
399-
"build/generated/*"
400-
, "**/net/sf/jsqlparser/parser/SimpleCharStream.java"
401-
]
402-
}
402+
tasks.named('pmdMain').configure {
403+
excludes = [
404+
"build/generated/*"
405+
, "**/net/sf/jsqlparser/parser/SimpleCharStream.java"
406+
]
403407
}
404408

405409
checkstyle {
@@ -462,28 +466,34 @@ tasks.register('renderRR') {
462466
}
463467

464468
// Convert JJ file to EBNF
465-
tasks.register("convertJJ", JavaExec) {
466-
standardOutput = new FileOutputStream(new File(rrDir, "JSqlParserCC.ebnf"))
467-
mainClass = "-jar"
468-
args = [
469-
new File(rrDir, "convert.war").absolutePath,
470-
layout.buildDirectory.dir("generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj").get().asFile.absolutePath
471-
]
472-
}.get().exec()
469+
def ebnfFile = new File(rrDir, "JSqlParserCC.ebnf")
470+
def jjFile = layout.buildDirectory.dir("generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj").get().asFile.absolutePath
471+
472+
def convertProc = new ProcessBuilder('java', '-jar',
473+
new File(rrDir, "convert.war").absolutePath,
474+
jjFile)
475+
.redirectOutput(ebnfFile)
476+
.redirectErrorStream(true)
477+
.start()
478+
if (convertProc.waitFor() != 0) {
479+
throw new GradleException("Failed to convert JJ to EBNF")
480+
}
473481

474482
// Generate RR diagrams
475-
tasks.register("generateRR", JavaExec) {
476-
mainClass = "-jar"
477-
args = [
478-
new File(rrDir, "rr.war").absolutePath,
479-
"-noepsilon",
480-
"-color:#4D88FF",
481-
"-offset:0",
482-
"-width:800",
483-
"-out:${new File(rrDir, "JSqlParserCC.xhtml")}",
484-
new File(rrDir, "JSqlParserCC.ebnf").absolutePath
485-
]
486-
}.get().exec()
483+
def rrProc = new ProcessBuilder('java', '-jar',
484+
new File(rrDir, "rr.war").absolutePath,
485+
"-noepsilon",
486+
"-color:#4D88FF",
487+
"-offset:0",
488+
"-width:800",
489+
"-out:${new File(rrDir, "JSqlParserCC.xhtml")}",
490+
new File(rrDir, "JSqlParserCC.ebnf").absolutePath)
491+
.redirectErrorStream(true)
492+
.start()
493+
rrProc.inputStream.eachLine { logger.info(it) }
494+
if (rrProc.waitFor() != 0) {
495+
throw new GradleException("Failed to generate RR diagrams")
496+
}
487497
}
488498
}
489499

@@ -535,7 +545,7 @@ tasks.register('updateKeywords', JavaExec) {
535545
file('src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt').absolutePath
536546
, file('src/site/sphinx/keywords.rst').absolutePath
537547
]
538-
main("net.sf.jsqlparser.parser.ParserKeywordsUtils")
548+
mainClass.set("net.sf.jsqlparser.parser.ParserKeywordsUtils")
539549

540550
dependsOn(compileJava)
541551
}
@@ -733,4 +743,4 @@ jmh {
733743
fork = 3
734744
iterations = 5
735745
timeOnIteration = '1s'
736-
}
746+
}

config/pmd/ruleset.xml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ under the License.
2020
<ruleset name="Default Maven PMD Plugin Ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
2121

2222
<description>
23-
The default ruleset used by the Maven PMD Plugin, when no other ruleset is specified.
24-
It contains the rules of the old (pre PMD 6.0.0) rulesets java-basic, java-empty, java-imports,
25-
java-unnecessary, java-unusedcode.
23+
Custom PMD ruleset, compatible with PMD 7.x.
2624

27-
This ruleset might be used as a starting point for an own customized ruleset [0].
25+
Based on the old (pre PMD 6.0.0) rulesets java-basic, java-empty, java-imports,
26+
java-unnecessary, java-unusedcode, migrated for PMD 7.
2827

29-
[0] https://pmd.github.io/latest/pmd_userdocs_making_rulesets.html
30-
</description>
28+
This ruleset might be used as a starting point for an own customized ruleset [0].
29+
30+
[0] https://pmd.github.io/latest/pmd_userdocs_making_rulesets.html
31+
</description>
3132

3233
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
3334
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
@@ -46,6 +47,14 @@ under the License.
4647
<rule ref="category/java/codestyle.xml/UselessParentheses" />
4748
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
4849

50+
<!-- PMD 7: replaces EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer,
51+
EmptyStatementBlock, EmptySwitchStatements, EmptySynchronizedBlock,
52+
EmptyTryBlock, EmptyWhileStmt (all removed in PMD 7) -->
53+
<rule ref="category/java/codestyle.xml/EmptyControlStatement" />
54+
55+
<!-- PMD 7: replaces EmptyStatementNotInLoop (removed in PMD 7) -->
56+
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
57+
4958
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
5059
<properties>
5160
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*" />
@@ -63,14 +72,15 @@ under the License.
6372
<rule ref="category/java/design.xml/UselessOverridingMethod" />
6473
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException" />
6574

66-
6775
<rule ref="category/java/design.xml/CyclomaticComplexity">
6876
<properties>
6977
<property name="classReportLevel" value="200" />
7078
<property name="methodReportLevel" value="120" />
7179
</properties>
7280
</rule>
73-
<rule ref="category/java/design.xml/ExcessiveMethodLength" />
81+
82+
<!-- PMD 7: ExcessiveMethodLength was removed, use NcssCount instead -->
83+
<rule ref="category/java/design.xml/NcssCount" />
7484

7585
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
7686
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
@@ -80,32 +90,25 @@ under the License.
8090
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
8191
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
8292
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
93+
94+
<!-- EmptyCatchBlock is explicitly kept as a separate rule in PMD 7 -->
8395
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
84-
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
85-
<rule ref="category/java/errorprone.xml/EmptyIfStmt" />
86-
<rule ref="category/java/errorprone.xml/EmptyInitializer" />
87-
<rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
88-
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
89-
<rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
90-
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
91-
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
92-
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
96+
9397
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
9498
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
9599
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
96100
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
97101
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
98102
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
99103
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
100-
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" />
101-
102-
<!-- for Codazy -->
104+
105+
<!-- for Codazy -->
103106
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
104107
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
105108
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
106109

107110
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
108111

109-
<!-- for Codazy -->
112+
<!-- for Codazy -->
110113
<!-- <rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody" /> -->
111-
</ruleset>
114+
</ruleset>

gradle/wrapper/gradle-wrapper.jar

5.26 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)