You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kotlin ABC counts a secondary-constructor superclass delegation
(constructor_delegation_call, : super(x)) as a branch but not the primary-constructor form (constructor_invocation, class Sub : Base(1, 2)). Both invoke the superclass constructor at run time. #1279 added the first and did not name the second.
kotlin_count_token_branch / the branch arm in src/metrics/abc/kotlin.rs lists CallExpression, ConstructorDelegationCall and the object-construction kinds, but not ConstructorInvocation.
Java and Groovy: class Sub extends Base carries no argument list, so
there is no analogous production to miss; their super(1) inside a
constructor body is a CallExpression and already counts.
Kotlin's primary-constructor form is the only spelling of "call the
superclass constructor" that scores zero.
Notes
Found while fixing #1297 (kotlin_super_type_argument_is_not_a_condition
uses class B : A() as scaffolding and its branches_sum() anchor
measured 1, not 2). Not fixed there — it is a branches question, not a conditions one, and unrelated to the < / > token class that issue
covers.
ConstructorInvocation also appears in an enum-entry initialiser
(enum class E { A(1) }) and a delegation specifier with no arguments
is a plain user_type, not a constructor_invocation, so the arm can
be added without a parent gate — but confirm that with a bca dump
sweep before landing it, and check the nom / wmc / cyclomatic
siblings for the same omission.
Summary
Kotlin ABC counts a secondary-constructor superclass delegation
(
constructor_delegation_call,: super(x)) as a branch but not theprimary-constructor form (
constructor_invocation,class Sub : Base(1, 2)). Both invoke the superclass constructor at run time.#1279 added the first and did not name the second.
Measured
bca metrics --no-config -O json,abc.branches:abc.branchesSub1Sub2bca dumpshows the two productions:Where
kotlin_count_token_branch/ the branch arm insrc/metrics/abc/kotlin.rslistsCallExpression,ConstructorDelegationCalland the object-construction kinds, but notConstructorInvocation.Sibling comparison
constructor_initializer(: base(…)/: this(…)) counts —added by fix(abc): constructor delegation calls score zero branches in Java and C# #1279 and pinned by
csharp_constructor_initializer_is_a_branch.class Sub extends Basecarries no argument list, sothere is no analogous production to miss; their
super(1)inside aconstructor body is a
CallExpressionand already counts.Kotlin's primary-constructor form is the only spelling of "call the
superclass constructor" that scores zero.
Notes
Found while fixing #1297 (
kotlin_super_type_argument_is_not_a_conditionuses
class B : A()as scaffolding and itsbranches_sum()anchormeasured 1, not 2). Not fixed there — it is a
branchesquestion, not aconditionsone, and unrelated to the</>token class that issuecovers.
ConstructorInvocationalso appears in an enum-entry initialiser(
enum class E { A(1) }) and a delegation specifier with no argumentsis a plain
user_type, not aconstructor_invocation, so the arm canbe added without a parent gate — but confirm that with a
bca dumpsweep before landing it, and check the
nom/wmc/ cyclomaticsiblings for the same omission.