Sample

int-4c07a4bd17c1-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines104

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.580–1; higher is more readable
Dorn0.3360–1; higher is more readable
Mi0.3910–1; higher is more readable
LLOC32Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.4390–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> del) { super(del); } @Override protected SortedMultiset<E> del() { return (SortedMultiset<E>) super.delegate(); } @Override public Comparator<? super E> com() { return del().comparator(); } @Override NavigableSet<E> create() { return unmodifiableNavigableSet(del().elementSet()); } @Override public NavigableSet<E> element() { 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> descending() { UnmodifiableSortedMultiset<E> res = descendingMultiset; if (res == null) { res = new UnmodifiableSortedMultiset<>(del().descendingMultiset()); res.descendingMultiset = this; return descendingMultiset = res; } return res; } @Override public @Nullable Entry<E> first() { return del().firstEntry(); } @Override public @Nullable Entry<E> last() { return del().lastEntry(); } @Override public @Nullable Entry<E> poll() { throw new UnsupportedOperationException(); } @Override public @Nullable Entry<E> poll2() { throw new UnsupportedOperationException(); } @Override public SortedMultiset<E> head(@ParametricNullness E upper, BoundType bound) { return Multisets.unmodifiableSortedMultiset(del().headMultiset(upper, bound)); } @Override public SortedMultiset<E> sub( @ParametricNullness E lower, BoundType lower2, @ParametricNullness E upper2, BoundType upper3) { return Multisets.unmodifiableSortedMultiset( del().subMultiset(lower, lower2, upper2, upper3)); } @Override public SortedMultiset<E> tail(@ParametricNullness E lower3, BoundType bound2) { return Multisets.unmodifiableSortedMultiset(del().tailMultiset(lower3, bound2)); } @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.3290.404−108.583
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.885−7.327

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

Score0.58

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.94+1.043
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.09+0.069

Intercept 0.07 + feature contributions = -0.679 (log-odds).
Score = sigmoid(-0.679) = 0.336.

Score0.391
Score32
Run 1

The code is well-structured with clear class hierarchy and delegation patterns. The class serves a focused purpose: wrapping a SortedMultiset as unmodifiable. Methods are concise and delegate cleanly to the underlying implementation. Naming is generally clear, though some parameter names (like 'lower2', 'upper3') are less descriptive than ideal. The descendingMultiset lazy initialization is understandable but adds slight complexity. The class maintains good clarity with minimal nesting and logical method organization. One minor readability concern is the incomplete method names like 'com()' and 'poll2()' which appear to be abbreviations or placeholders. The TODO comment is helpful for context. Overall, the code follows clean coding practices with clear intent, appropriate delegation, and manageable complexity.

Run 2

The code is generally well-structured and readable. It clearly separates class definition, constructor, overrides, and fields. Nesting is minimal—only one conditional in descending(). Intent is clear: an unmodifiable sorted multiset wrapper. However, readability is hurt by non-descriptive method names like com(), create(), element(), poll(), poll2(), sub(), and parameters like lower2, upper2, lower3, bound2. These likely override interface methods but still reduce clarity. Action granularity is mostly one action per line, with good reading flow from constructor through method overrides. Code length is appropriate for the functionality. The TODO comment is helpful but long. Annotation clutter (GwtCompatible, J2ktIncompatible, etc.) is excessive in the snippet and visually interrupts reading, though this may be necessary for the project's cross-platform support.

Run 3

The code is well-structured and follows a clear, consistent pattern for a wrapper class. Methods are short, with one primary action per line, contributing to good readability. The nesting depth is minimal, with only one conditional block in the descending() method. The intent of each method is mostly clear from its name and implementation, though some parameter names like 'upper2' and 'bound2' are ambiguous. The class-level Javadoc and inline comments provide helpful context. However, the use of method names like 'com()', 'create()', 'element()', 'del()', and 'poll2()' obscures intent compared to standard Java naming conventions. Overall, this is readable code with minor clarity improvements possible.

Run 1

Code Structure: Small, logically grouped wrapper methods provide good organization, although fields are interspersed with methods. Nesting: Almost entirely flat, with only one simple conditional. Clarity of intent: The class documentation and delegation make the unmodifiable-wrapper purpose clear, but abbreviated names such as del, com, create, poll2, and numbered parameters obscure individual operations and bound semantics. Code length: Concise overall; the detailed lifecycle TODO is relevant but interrupts scanning. Action granularity: Most lines perform one action, though returning an assignment combines caching and control flow. Reading flow: Consistent formatting and straightforward delegation help, but ambiguous naming, inline annotation declarations, and the placement of the cache field reduce smoothness.

Run 2

Code Structure: Logically organized as a wrapper with small delegation methods, though the cached field interrupts the method sequence. Nesting: Very shallow, with only one conditional in descending(). Clarity of intent: Class documentation and delegation reveal the unmodifiable-wrapper purpose, but abbreviated names such as del(), com(), poll2(), and numbered bound parameters obscure individual operations. Code length: Concise overall; repetition is appropriate for interface delegation, and the longer TODO explains a specific maintenance concern. Action granularity: Most lines perform one action, but return descendingMultiset = res combines assignment and return. Reading flow: Consistent formatting and short methods support easy scanning, while cryptic naming, densely grouped annotations, and the embedded TODO slightly disrupt the flow.

Run 3

Code Structure: A well-organized wrapper class with small, focused methods, although the cached field interrupts the method sequence. Nesting: Nearly flat, with only one simple conditional. Clarity of intent: Documentation and delegation reveal the unmodifiable-wrapper purpose, but abbreviated names such as com, del, poll2, and numbered bound parameters obscure individual operations. Code length: Concise overall; repetitive forwarding methods are appropriate for this wrapper. Action granularity: Most lines perform one action, but returning an assignment combines cache mutation and return. Reading flow: Consistent formatting and straightforward delegation support scanning, while unclear naming, densely grouped annotations, and the long lifecycle TODO introduce friction.