Skip to content

Commit 2c1714b

Browse files
committed
build: exclude the generated CCJSqlParser from JaCoCo
Instrumented by JaCoCo, the generated CCJSqlParser class is close to the 65,535 constant-pool limit (808 entries left on c84ad0e). Past the limit the agent loads it uninstrumented and the coverage verification fails. Exclude it from the agent, the report and the verification, like the TokenManager. The verification pattern "**CCJSqlParserTokenManager**" did not match the class file, so both classes are now excluded by their exact paths, which keeps the nested helper classes measured. See #2866. Signed-off-by: minleejae <mmj9808@gmail.com>
1 parent c84ad0e commit 2c1714b

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎build.gradle‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ test {
276276
jvmArgs = ['-Xss4m', '--add-opens=java.base/java.lang=ALL-UNNAMED']
277277

278278
jacoco {
279-
excludes = ['net/sf/jsqlparser/parser/CCJSqlParserTokenManager']
279+
// the generated parser exceeds the constant-pool limit once instrumented (#2866)
280+
excludes = ['net/sf/jsqlparser/parser/CCJSqlParserTokenManager',
281+
'net/sf/jsqlparser/parser/CCJSqlParser']
280282
}
281283
}
282284

@@ -291,13 +293,23 @@ jacocoTestReport {
291293
csv.required = false
292294
html.outputLocation = layout.buildDirectory.dir('reports/jacoco')
293295
}
296+
// the classes that are not instrumented, see test.jacoco
297+
afterEvaluate {
298+
classDirectories.setFrom(files(classDirectories.files.collect {
299+
fileTree(dir: it, exclude: [
300+
"**/parser/CCJSqlParserTokenManager.class",
301+
"**/parser/CCJSqlParser.class"
302+
])
303+
}))
304+
}
294305
}
295306
jacocoTestCoverageVerification {
296-
// Jacoco can't handle the TokenManager class
307+
// Jacoco can't handle the TokenManager and the generated parser classes
297308
afterEvaluate {
298309
classDirectories.setFrom(files(classDirectories.files.collect {
299310
fileTree(dir: it, exclude: [
300-
"**CCJSqlParserTokenManager**"
311+
"**/parser/CCJSqlParserTokenManager.class",
312+
"**/parser/CCJSqlParser.class"
301313
])
302314
}))
303315
}

0 commit comments

Comments
 (0)