Sample

int-66a295ee493a-I05

Rewrite eligible decimal integer literals in hexadecimal notation

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 Pro160–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.3080–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 = 0x0; }

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.3215.336−106.106
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.88−7.32

Intercept 8.87 + feature contributions = -62.956 (log-odds).
Score = sigmoid(-62.956) = 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.85+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.905−0.524
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.083+0.131

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

Score0.381
Score32
Run 1

The code is well-structured and follows clear conventions. Class purpose is documented and the delegation pattern is straightforward. Nesting is minimal—only one conditional in descendingMultiset(). Method names and override annotations make intent clear. Most methods are concise, with one action per line and natural reading flow. The main readability drawbacks are the unusual lazy-initialization cycle in descendingMultiset() (with a TODO explaining the reason), the type-casting in delegate() and elementSet(), and the long method signature for subMultiset(). However, these are justified by framework constraints and do not significantly obscure intent. Overall, the code is highly readable for experienced Java developers.

Run 2

The code is well-structured with clear separation of concerns. Each method has a single, obvious purpose and delegates consistently to the wrapped SortedMultiset. Nesting is minimal, with only one level in the lazy initialization block. The class hierarchy (extending UnmodifiableMultiset, implementing SortedMultiset) is logical and follows established patterns. Method names and annotations convey intent clearly. The only slight deductions are due to the lazy initialization pattern for descendingMultiset requiring careful reading to understand the circular reference, and the Javadoc TODO adds some cognitive overhead. Overall, this is idiomatic Guava-style code that is concise, flows naturally, and maintains one action per line throughout the delegate wrappers.

Run 3

The code is an extension of a base class with clear, concise methods, making good use of delegation and consistent naming. It follows a logical structure and generally avoids deep nesting. However, the `descendingMultiset` method's lazy initialization with the cycle-break TODO adds complexity and slightly hampers reading flow. The class relies on several external annotations (`@ParametricNullness`, `@LazyInit`, etc.) which, while informative, require knowledge of those frameworks to fully understand intent. The methods are named clearly (`firstEntry`, `pollFirstEntry`, etc.), but the unconventional opening brace placement on class declarations slightly deviates from standard Java formatting, potentially affecting readability. Overall, it is well-organized and concise but requires domain knowledge to parse some elements.

Run 1

Code Structure: A cohesive wrapper class with logically grouped delegation, navigation, and range-view methods; the cached field's placement midway through methods slightly interrupts organization. Nesting: Almost entirely flat, with only one simple conditional for lazy initialization. Clarity of intent: Descriptive names, documentation, and explicit unsupported mutation operations clearly communicate an unmodifiable sorted multiset. Casts and platform-specific annotations require some library knowledge. Code length: Concise methods and necessary interface overrides keep the implementation focused, although delegation is repetitive. Action granularity: Most statements perform one action; returning an assignment in descendingMultiset combines caching and returning, slightly reducing clarity. Reading flow: Consistent formatting and predictable overrides make scanning easy. The lengthy platform-specific TODO and densely combined annotations introduce minor interruptions.

Run 2

Code Structure: A well-organized wrapper class with focused methods and consistent delegation; the cached field appearing midway through the methods slightly weakens organization. Nesting: Nearly flat, with only one simple conditional. Clarity of intent: Descriptive names, documentation, unmodifiable wrappers, and explicit exceptions clearly communicate purpose. The reciprocal descending-view cache requires slightly more thought. Code length: Concise overall; repetitive overrides are appropriate for the interface rather than unnecessary verbosity. Action granularity: Most lines perform one action, although 'return descendingMultiset = result' combines assignment and return. Reading flow: Consistent formatting and predictable method implementations make scanning easy. Dense annotations, casts, and the lengthy platform-specific TODO introduce minor interruptions.

Run 3

Code Structure: A cohesive wrapper class with logically grouped delegation, navigation, and range-view methods. Nesting: Almost entirely flat, with only one simple conditional in lazy initialization. Clarity of intent: The class name, documentation, unmodifiable wrappers, and explicit exceptions clearly communicate its purpose; reciprocal caching requires slightly more attention. Code length: Concise methods and minimal boilerplate beyond necessary interface overrides, though the platform-specific TODO adds some visual weight. Action granularity: Most lines perform one action, but 'return descendingMultiset = result' combines assignment and return. Reading flow: Consistent formatting and predictable delegation make scanning easy. Minor interruptions come from the cache field appearing between methods, densely combined annotations, and casts requiring familiarity with the superclass.