Skip to content

Fix coverage-modified classes being included in published artifacts#4341

Closed
dondonz wants to merge 3 commits intomasterfrom
claude/fix-coverage-publishing-vuFc6
Closed

Fix coverage-modified classes being included in published artifacts#4341
dondonz wants to merge 3 commits intomasterfrom
claude/fix-coverage-publishing-vuFc6

Conversation

@dondonz
Copy link
Member

@dondonz dondonz commented Mar 17, 2026

The markGeneratedEqualsHashCode task was modifying .class files in-place
in build/classes/java/main and the jar task depended on it, causing
bytecode with injected @generated annotations to end up in the published
JAR. Fix by copying classes to a separate build/classes-jacoco directory
for modification, and only wiring jacocoTestReport (not jar) to depend
on the task.

https://claude.ai/code/session_01XDZqTUKLBoSJpGPGx9Amxg

The markGeneratedEqualsHashCode task was modifying .class files in-place
in build/classes/java/main and the jar task depended on it, causing
bytecode with injected @generated annotations to end up in the published
JAR. Fix by copying classes to a separate build/classes-jacoco directory
for modification, and only wiring jacocoTestReport (not jar) to depend
on the task.

https://claude.ai/code/session_01XDZqTUKLBoSJpGPGx9Amxg
@dondonz dondonz marked this pull request as draft March 17, 2026 23:42
@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5708 (±0) 5652 (±0) 0 (±0) 0 (±0) 56 (±0)
Java 17 5708 (±0) 5651 (±0) 0 (±0) 0 (±0) 57 (±0)
Java 21 5708 (±0) 5651 (±0) 0 (±0) 0 (±0) 57 (±0)
Java 25 5708 (±0) 5651 (±0) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22864 (±0) 22637 (±0) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 29024 3250 89.9% -0.3% 🔴
Branches 8535 1685 83.5% -1.2% 🔴
Methods 7784 1260 86.1% -0.2% 🔴

Changed Class Coverage (59 classes)

Class Line Branch Method
g.a.FieldComplexityEnvironment -33.0% 🔴 ±0.0% -6.3% 🔴
g.a.QueryVisitorFieldEnvironmentImpl +3.7% 🟢 -45.8% 🔴 +2.4% 🟢
g.a.QueryVisitorFragmentDefinitionEnvironmentImpl -34.0% 🔴 ±0.0% -17.1% 🔴
g.a.QueryVisitorFragmentSpreadEnvironmentImpl -30.0% 🔴 ±0.0% -22.9% 🔴
g.a.QueryVisitorInlineFragmentEnvironmentImpl -27.8% 🔴 ±0.0% -17.1% 🔴
g.Assert +0.9% 🟢 +1.1% 🟢 ±0.0%
g.c.ImmutableMapWithNullValues -2.8% 🔴 ±0.0% -2.9% 🔴
g.e.DataFetcherResult -2.1% 🔴 -14.3% 🔴 +1.4% 🟢
g.e.ExecutionId -8.3% 🔴 +50.0% 🟢 -16.7% 🔴
g.e.MergedField +0.3% 🟢 -3.6% 🔴 +1.4% 🟢
g.e.MergedField
$MultiMergedField
-13.2% 🔴 -25.0% 🔴 +2.5% 🟢
g.e.NonNullableFieldWasNullError -18.2% 🔴 ±0.0% -25.0% 🔴
g.e.r.SingleSubscriberPublisher +1.5% 🟢 +4.5% 🟢 ±0.0%
g.e.r.SingleSubscriberPublisher
$SimpleSubscription
+5.6% 🟢 +25.0% 🟢 ±0.0%
g.e.ResultPath +0.8% 🟢 -0.8% 🔴 +1.7% 🟢
g.GraphQLContext -14.3% 🔴 -75.0% 🔴 -7.7% 🔴
g.GraphqlErrorBuilder
$GraphqlErrorImpl
±0.0% +85.7% 🟢 ±0.0%
g.i.DeferPayload ±0.0% +62.5% 🟢 ±0.0%
g.i.IncrementalPayload -1.0% 🔴 -15.0% 🔴 +12.7% 🟢
g.i.StreamPayload +5.4% 🟢 +62.5% 🟢 +8.3% 🟢
g.InvalidSyntaxError +1.1% 🟢 ±0.0% +4.0% 🟢
g.l.IgnoredChar -7.9% 🔴 +50.0% 🟢 +8.6% 🟢
g.l.SourceLocation -6.5% 🔴 -1.4% 🔴 ±0.0%
g.n.ExecutableNormalizedOperationToAstCompiler
$ExecutionFragmentDetails
-18.2% 🔴 +50.0% 🟢 ±0.0%
g.n.NormalizedInputValue -6.9% 🔴 -18.7% 🔴 -6.7% 🔴
g.r.DefaultConnection ±0.0% +70.0% 🟢 +16.7% 🟢
g.r.DefaultConnectionCursor +1.3% 🟢 +12.5% 🟢 +13.3% 🟢
g.r.DefaultEdge -7.1% 🔴 +70.0% 🟢 +8.3% 🟢
g.r.DefaultPageInfo +12.1% 🟢 +78.6% 🟢 +20.8% 🟢
g.r.InvalidCursorException -16.7% 🔴 ±0.0% -16.7% 🔴
g.s.DataFetchingFieldSelectionSetImpl
$SelectedFieldImpl
+1.1% 🟢 +10.0% 🟢 +2.5% 🟢
g.s.d.EditOperation -25.9% 🔴 ±0.0% -13.3% 🔴
g.s.FieldCoordinates -6.5% 🔴 -18.8% 🔴 ±0.0%
g.s.GraphQLAppliedDirective +1.3% 🟢 ±0.0% +2.1% 🟢
g.s.GraphQLAppliedDirectiveArgument +0.9% 🟢 ±0.0% +2.0% 🟢
g.s.GraphQLArgument +0.2% 🟢 ±0.0% +0.4% 🟢
g.s.GraphQLDirective +0.2% 🟢 ±0.0% +0.9% 🟢
g.s.GraphQLEnumType +0.3% 🟢 ±0.0% +1.0% 🟢
g.s.GraphQLEnumValueDefinition +0.2% 🟢 ±0.0% +0.6% 🟢
g.s.GraphQLFieldDefinition +0.1% 🟢 ±0.0% +0.2% 🟢
g.s.GraphQLInputObjectField +0.1% 🟢 ±0.0% +0.2% 🟢
g.s.GraphQLInputObjectType +0.2% 🟢 ±0.0% +0.6% 🟢
g.s.GraphQLInterfaceType +0.3% 🟢 ±0.0% +0.9% 🟢
g.s.GraphQLList +0.8% 🟢 ±0.0% +1.2% 🟢
g.s.GraphQLNonNull -2.4% 🔴 ±0.0% -5.4% 🔴
g.s.GraphQLObjectType +0.3% 🟢 ±0.0% +0.7% 🟢
g.s.GraphQLScalarType +0.4% 🟢 ±0.0% +1.0% 🟢
g.s.GraphqlTypeComparatorEnvironment -9.5% 🔴 +60.0% 🟢 ±0.0%
g.s.GraphQLUnionType +0.1% 🟢 ±0.0% +0.5% 🟢
g.s.i.e.BaseError -14.1% 🔴 ±0.0% -16.7% 🔴
g.s.i.TypeInfo +1.2% 🟢 -2.6% 🔴 +1.4% 🟢
g.s.PropertyFetchingImpl
$CacheKey
-11.8% 🔴 +50.0% 🟢 ±0.0%
g.s.v.SchemaValidationError +6.1% 🟢 +50.0% 🟢 +8.3% 🟢
g.SerializationError -11.3% 🔴 ±0.0% -14.1% 🔴
g.TypeMismatchError -14.3% 🔴 ±0.0% -22.2% 🔴
g.UnresolvedTypeError -9.7% 🔴 ±0.0% -15.0% 🔴
g.u.Breadcrumb -31.4% 🔴 ±0.0% -25.0% 🔴
g.u.NodeLocation -24.6% 🔴 +50.0% 🟢 -8.3% 🔴
g.v.OperationValidator
$FieldAndType
-6.4% 🔴 +50.0% 🟢 +25.0% 🟢
FieldComplexityEnvironment — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
QueryVisitorFieldEnvironmentImpl — method details
Method Line Branch
equals new 100.0% 50.0%
hashCode new 100.0%
QueryVisitorFragmentDefinitionEnvironmentImpl — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
QueryVisitorFragmentSpreadEnvironmentImpl — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
QueryVisitorInlineFragmentEnvironmentImpl — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
ImmutableMapWithNullValues — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
DataFetcherResult — method details
Method Line Branch
equals new 85.7% 83.3%
hashCode new 100.0%
ExecutionId — method details
Method Line Branch
equals new 100.0% 50.0%
hashCode new 0.0%
MergedField — method details
Method Line Branch
equals new 83.3% 66.7%
hashCode new 100.0%
MergedField.MultiMergedField — method details
Method Line Branch
equals new 33.3% 16.7%
hashCode new 100.0%
NonNullableFieldWasNullError — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
ResultPath — method details
Method Line Branch
equals new 83.3% 68.8%
hashCode new 100.0% 100.0%
GraphQLContext — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
IncrementalPayload — method details
Method Line Branch
hashCode new 100.0%
equals new 77.8% 64.3%
IgnoredChar — method details
Method Line Branch
equals new 71.4% 50.0%
hashCode new 0.0%
SourceLocation — method details
Method Line Branch
equals new 70.0% 60.0%
hashCode new 100.0%
ExecutableNormalizedOperationToAstCompiler.ExecutionFragmentDetails — method details
Method Line Branch
equals new 66.7% 50.0%
hashCode new 100.0%
NormalizedInputValue — method details
Method Line Branch
equals new 75.0% 55.6%
hashCode new 0.0%
DefaultEdge — method details
Method Line Branch
equals new 66.7% 70.0%
hashCode new 100.0%
InvalidCursorException — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
EditOperation — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
FieldCoordinates — method details
Method Line Branch
equals new 71.4% 70.0%
hashCode new 100.0%
GraphQLNonNull — method details
Method Line Branch
equals new 0.0%
hashCode new 100.0%
GraphqlTypeComparatorEnvironment — method details
Method Line Branch
equals new 66.7% 60.0%
hashCode new 100.0%
BaseError — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
TypeInfo — method details
Method Line Branch
equals new 100.0% 75.0%
hashCode new 100.0%
PropertyFetchingImpl.CacheKey — method details
Method Line Branch
equals new 66.7% 50.0%
hashCode new 100.0%
SerializationError — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
TypeMismatchError — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
UnresolvedTypeError — method details
Method Line Branch
equals new 0.0%
hashCode new 0.0%
Breadcrumb — method details
Method Line Branch
equals new 0.0% 0.0%
hashCode new 0.0%
NodeLocation — method details
Method Line Branch
equals new 71.4% 50.0%
hashCode new 0.0%
OperationValidator.FieldAndType — method details
Method Line Branch
equals new 66.7% 50.0%
hashCode new 100.0%

Full HTML report: build artifact jacoco-html-report

Updated: 2026-03-18 00:18:20 UTC

claude added 2 commits March 17, 2026 23:54
jacocoTestReport was only including execution data from the JUnit `test`
task. The `testng` task also produces a JaCoCo .exec file but it was
never merged into the report, causing code exercised only by TestNG
tests to show zero coverage.

Add `testng` to dependsOn and set executionData to include all .exec
files from the jacoco output directory.

https://claude.ai/code/session_01XDZqTUKLBoSJpGPGx9Amxg
The markGeneratedEqualsHashCode task copied class files and then modified
them with ASM to add @generated annotations on equals/hashCode methods.
This changed the bytecode CRC64 checksums, so JaCoCo could not correlate
its execution data (recorded against the original classes) with the
modified copies.  Result: 61 classes with equals/hashCode showed ZERO
coverage across all metrics — not just on equals/hashCode, but on every
line, branch, and method in the class.

Fix by pointing classDirectories back at the original classes/java/main
directory and removing the markGeneratedEqualsHashCode task entirely.
The small trade-off is that equals/hashCode methods now appear in
coverage metrics, but all 61 affected classes regain their full coverage.

https://claude.ai/code/session_01XDZqTUKLBoSJpGPGx9Amxg
@dondonz
Copy link
Member Author

dondonz commented Mar 18, 2026

I have to look more closely at this - so far only a quick Claude attempt

@dondonz
Copy link
Member Author

dondonz commented Mar 18, 2026

Fixed by #4343

@dondonz dondonz closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants