Sample

int-23ef98ace082-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines104

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5430–1; higher is more readable
Dorn0.350–1; higher is more readable
Mi0.3810–1; higher is more readable
LLOC32Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.4230–1; higher is more readable

Views

Source code

package com.google.common.collect; import static com.google.common.collect.Sets.unmodifiableNavigableSet; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.collect.Multisets.UnmodifiableMultiset; import com.google.errorprone.annotations.concurrent.LazyInit; import java.util.Comparator; import java.util.NavigableSet; import org.jspecify.annotations.Nullable; /** * Implementation of {@link Multisets#unmodifiableSortedMultiset(SortedMultiset)}, split out into * its own file so it can be GWT emulated (to deal with the differing elementSet() types in GWT and * non-GWT). * * @author Louis Wasserman */ @GwtCompatible final class UnmodifiableSortedMultiset<E extends @Nullable Object> extends UnmodifiableMultiset<E> implements SortedMultiset<E> { UnmodifiableSortedMultiset(SortedMultiset<E> delegate) { super(delegate); } @Override protected SortedMultiset<E> delegate() { return (SortedMultiset<E>) super.delegate(); } @Override public Comparator<? super E> comparator() { return delegate().comparator(); } @Override NavigableSet<E> createElementSet() { return unmodifiableNavigableSet(delegate().elementSet()); } @Override public NavigableSet<E> elementSet() { return (NavigableSet<E>) super.elementSet(); } @LazyInit private transient @Nullable UnmodifiableSortedMultiset<E> descendingMultiset; // TODO(b/418181860): This method creates retain cycles in J2ObjC. In order to break the cycle, // there needs to be separate classes for primary and descending multiset, where the primary one // would hold {@code @LazyInit @RetainedWith @Nullable} reference to its descending multiset, and // the other {@code final} reference. @Override public SortedMultiset<E> descendingMultiset() { UnmodifiableSortedMultiset<E> result = descendingMultiset; if (result == null) { result = new UnmodifiableSortedMultiset<>(delegate().descendingMultiset()); result.descendingMultiset = this; return descendingMultiset = result; } return result; } @Override public @Nullable Entry<E> firstEntry() { return delegate().firstEntry(); } @Override public @Nullable Entry<E> lastEntry() { return delegate().lastEntry(); } @Override public @Nullable Entry<E> pollFirstEntry() { throw new UnsupportedOperationException(); } @Override public @Nullable Entry<E> pollLastEntry() { throw new UnsupportedOperationException(); } @Override public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().headMultiset(upperBound, boundType)); } @Override public SortedMultiset<E> subMultiset( @ParametricNullness E lowerBound, BoundType lowerBoundType, @ParametricNullness E upperBound, BoundType upperBoundType) { return Multisets.unmodifiableSortedMultiset( delegate().subMultiset(lowerBound, lowerBoundType, upperBound, upperBoundType)); } @Override public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) { return Multisets.unmodifiableSortedMultiset(delegate().tailMultiset(lowerBound, boundType)); } @GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0; }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.3200.27−105.609
Source linesThe number of non-empty source lines.104+41.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.877−7.316

Intercept 8.87 + feature contributions = -62.454 (log-odds).
Score = sigmoid(-62.454) = 0.

Score0.543

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.105−2.681
Indentation frequencyHow rapidly indentation changes from line to line.94+2.514
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.94−1.736
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.103.84+1.042
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85+0.567
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.98.933−0.525
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.084+0.13

Intercept 0.07 + feature contributions = -0.62 (log-odds).
Score = sigmoid(-0.62) = 0.35.

Score0.381
Score32
Run 1

The code is well-structured with clear separation of concerns, following a standard class pattern for immutable collection wrappers. The class has a clear purpose and is documented. Methods are concise, each performing a single action, and the code length is proportional to the functionality required. Nesting is minimal, limited to a single null check pattern in descendingMultiset(). Reading flow is generally natural, with methods grouped logically. Minor readability drawbacks include the generic type declaration with `@Nullable Object`, which adds cognitive overhead, and the one-liner field declaration `@LazyInit private transient @Nullable UnmodifiableSortedMultiset<E> descendingMultiset;` which combines multiple modifiers. The TODO comment is helpful but slightly verbose. Overall, it's readable code that would be easy for experienced Guava contributors to understand, but the specialized annotations and type constraints require domain familiarity.

Run 2

The code demonstrates strong readability through clear structure and organization. It follows a logical class hierarchy with a focused purpose, implementing an unmodifiable sorted multiset wrapper. Nesting is minimal, with only one if statement in descendingMultiset(). Each method has a clear, single responsibility and delegates appropriately. The naming convention is descriptive and consistent with Java standards. The code is concise without sacrificing clarity - methods are short and direct. Action granularity is appropriate, with one logical operation per line. Reading flow follows a natural progression from constructor through overridden methods to utility methods. The only minor deductions are for the long Javadoc TODO comment explaining a complex J2ObjC cycle issue, and the slightly complex descendingMultiset() method with its bidirectional reference setup, which requires careful reading to understand.

Run 3

The code is well-structured and readable. The class has a clear single responsibility: providing an unmodifiable sorted multiset wrapper. Method organization follows a logical progression from constructor and delegate to comparator, element set, entries, and range views. Nesting is minimal—only one conditional block in descendingMultiset(). Each method expresses its intent clearly through naming and delegation, with no ambiguity about what it does. Code length is appropriate; no method is unnecessarily long. Action granularity is good, with most methods performing a single delegation or operation per logical unit. The reading flow is natural, with related methods grouped together. Minor deductions: the nullable annotations on every type parameter slightly increase visual noise, and the descendingMultiset() logic with the lazy init cycle-avoidance is the most complex part, though the TODO comment explains the context. Overall, this is representative of high-quality, idiomatic Java from a mature codebase like Guava.

Run 1

Code Structure: Well-organized wrapper class with focused overrides and clear separation of delegation, immutable views, and prohibited mutations. Nesting: Almost entirely flat, with only one shallow conditional for lazy initialization. Clarity of intent: Descriptive names, documentation, and explicit UnsupportedOperationException calls clearly communicate the unmodifiable sorted-multiset behavior. Code length: Concise methods and minimal implementation logic; repetitive overrides are appropriate for the interface. Action granularity: Most lines perform one action, although 'return descendingMultiset = result' combines assignment and return. Reading flow: Consistent formatting and predictable method grouping make scanning easy. Minor distractions include the cached field appearing between methods, densely combined annotations, and a lengthy platform-specific TODO.

Run 2

Code Structure: A well-organized wrapper class separates delegation, immutable views, and prohibited mutations into focused methods. Nesting: Almost entirely flat, with only one shallow conditional for lazy initialization. Clarity of intent: Descriptive names, the class documentation, and explicit UnsupportedOperationException throws clearly convey an unmodifiable sorted multiset; casts and platform annotations require some library knowledge. Code length: Concise implementations avoid unnecessary logic, though repeated forwarding methods add unavoidable boilerplate. Action granularity: Most lines perform one action, but 'return descendingMultiset = result' combines assignment and return. Reading flow: Consistent formatting and predictable method patterns make scanning easy; the mid-class cache field, lengthy platform-specific TODO, and densely combined annotations slightly interrupt the flow.

Run 3

Code Structure: Well-organized wrapper class with focused methods and consistent delegation, though the cache field interrupts the method sequence. Nesting: Nearly flat, with only one simple conditional. Clarity of intent: Descriptive names, documentation, unmodifiable wrappers, and explicit mutation exceptions clearly communicate purpose; reciprocal caching and type casts require some familiarity. Code length: Appropriately concise, with repetitive overrides justified by the interface. Action granularity: Most lines perform one action, but 'return descendingMultiset = result' combines assignment and return. Reading flow: Consistent formatting and straightforward methods make scanning easy; dense annotations and the lengthy platform-specific TODO slightly interrupt the flow.