@@ -54,7 +54,7 @@ public final class Level extends Doc {
5454 /**
5555 * The depth of nested levels in the current level tree from which we explore both breaking vs not breaking the current level.
5656 */
57- private static final int LAST_LEVELS_TO_EXPLORE = 7 ;
57+ private static final int LAST_LEVELS_TO_EXPLORE = 12 ;
5858
5959 private static final Collector <Level , ?, Optional <Level >> GET_LAST_COLLECTOR = Collectors .reducing ((u , v ) -> v );
6060
@@ -758,9 +758,7 @@ private int getMaxDepth() {
758758 }
759759
760760 /**
761- * Calculate an approximation of the maximum depth of nested levels in this level tree, counting method call nesting.
762- * This counts levels that represent method invocations (including lambdas and other callable constructs),
763- * which provides a better measure of structural complexity than counting all levels.
761+ * Calculates the maximum depth of nested levels in this level tree.
764762 * This computation is expensive, so it's memoized via {@link #getMaxDepth()}.
765763 */
766764 private int computeMaxDepth (Iterable <Doc > docs ) {
@@ -772,10 +770,7 @@ private int computeMaxDepth(Iterable<Doc> docs) {
772770 }
773771 }
774772
775- // Count this level if it represents a method call or similar construct
776- // A level is considered a "method call level" if it has breaks (can span multiple lines)
777- // and is not just a simple wrapper. We use the presence of breaks as a proxy for
778- // meaningful structural nesting.
773+ // We use the presence of breaks as a proxy for meaningful structural nesting.
779774 boolean hasBreaks = false ;
780775 for (Doc doc : docs ) {
781776 if (doc instanceof Break ) {
@@ -784,7 +779,7 @@ private int computeMaxDepth(Iterable<Doc> docs) {
784779 }
785780 }
786781
787- // Only count levels that have breaks (i.e., can actually be formatted across multiple lines)
782+ // Only count levels that have breaks (which can actually be formatted across multiple lines)
788783 return hasBreaks ? 1 + maxChildDepth : maxChildDepth ;
789784 }
790785
0 commit comments