@@ -153,8 +153,8 @@ public void recordMethodMetric(String className, String methodSignature, String
153153
154154 /**
155155 * Returns {@code true} iff at least one collected {@link ClassMetrics}
156- * carries a Kotlin-specific signal — i.e. {@link ClassMetrics#isDataClass()},
157- * {@link ClassMetrics#isSealed()}, {@link ClassMetrics#getNumberOfExtensionFunctions()}
156+ * carries a Kotlin-specific signal — i.e. {@code ClassMetrics#isDataClass()},
157+ * {@code ClassMetrics#isSealed()}, {@code ClassMetrics#getNumberOfExtensionFunctions()}
158158 * > 0, a non-empty {@link ClassMetrics#getExtensionReceiverTypes()}, or a
159159 * non-empty {@link ClassMetrics#getSealedHierarchyAncestors()}.
160160 *
@@ -174,7 +174,7 @@ public void recordMethodMetric(String className, String methodSignature, String
174174 * only after {@link #finalizeMetrics()} has run (detection always runs
175175 * post-finalization); before finalization the cached value is still
176176 * computed on demand but may not reflect {@link #computeKotlinDerivedMetrics()}
177- * derived flags such as {@link ClassMetrics#isHasExplicitLogic()}.
177+ * derived flags such as {@code ClassMetrics#isHasExplicitLogic()}.
178178 *
179179 * @return {@code true} if any class carries a Kotlin-specific metric signal,
180180 * {@code false} for an empty or Java-only collector
@@ -199,11 +199,9 @@ public boolean hasKotlinMetrics() {
199199 }
200200
201201 /**
202- * Read-only lookup of a class's metrics. Returns {@code null} when the
203- * class has never been registered with this collector. Prefer
204- * {@link #getOrCreateClassMetrics(String)} from visitor logic that
205- * intends to mutate the returned instance and have the mutation
206- * reflected by {@link #getAllClassMetrics()}.
202+ * Looks up the metrics recorded for a class.
203+ *
204+ * @return the class metrics, or {@code null} if no metrics are recorded
207205 */
208206 public ClassMetrics getClassMetrics (String className ) {
209207 return classMetrics .get (className );
@@ -315,20 +313,10 @@ private int computeSealedDepth(ClassMetrics metrics) {
315313 }
316314
317315 /**
318- * Canonical get-or-create entry point used by {@link MetricsVisitorLogic}
319- * and the metrics-collecting visitors. Returns the existing
320- * {@link ClassMetrics} for {@code className} if present, otherwise
321- * creates one, stores it in {@link #getAllClassMetrics()}, and returns
322- * it.
323- * <p>The returned instance is the <em>same object</em> later returned by
324- * {@link #getAllClassMetrics()}. This is the invariant the historical
325- * {@code instanceof GraphMetricsCollector} branch in
326- * {@link MetricsVisitorLogic#enterClass} emulated: the
327- * {@link ClassMetrics} the visitor mutates during the walk is the
328- * instance the downstream disharmony detectors read from
329- * {@link #getAllClassMetrics()}. Any get-or-create path that builds an
330- * instance without storing it would silently discard every class's
331- * metrics.
316+ * Retrieves or creates metrics for a class.
317+ *
318+ * @param className the class name
319+ * @return the existing or newly created class metrics
332320 */
333321 public ClassMetrics getOrCreateClassMetrics (String className ) {
334322 return classMetrics .computeIfAbsent (className , ClassMetrics ::new );
0 commit comments