Sample

int-6fdaf3f2945d-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines134

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6590–1; higher is more readable
Dorn0.090–1; higher is more readable
Mi0.4080–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.4840–1; higher is more readable

Views

Source code

package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; import java.util.Map; import org.jspecify.annotations.Nullable; @GwtCompatible public abstract class ArrayBasedCharEscaper extends CharEscaper { private final char[][] replacements; private final int replacementsLength; private final char safeMin; private final char safeMax; protected ArrayBasedCharEscaper( Map<Character, String> replacementMap, char safeMin, char safeMax) { this(ArrayBasedEscaperMap.create(replacementMap), safeMin, safeMax); } protected ArrayBasedCharEscaper(ArrayBasedEscaperMap escaperMap, char safeMin, char safeMax) { checkNotNull(escaperMap); this.replacements = escaperMap.getReplacementArray(); this.replacementsLength = replacements.length; if (safeMax < safeMin) { safeMax = Character.MIN_VALUE; safeMin = Character.MAX_VALUE; } this.safeMin = safeMin; this.safeMax = safeMax; } @Override public final String escape(String s) { checkNotNull(s); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if ((c < replacementsLength && replacements[c] != null) || c > safeMax || c < safeMin) { return escapeSlow(s, i); } } return s; } @Override protected final char @Nullable [] escape(char c) { if (c < replacementsLength) { char[] chars = replacements[c]; if (chars != null) { return chars; } } if (c >= safeMin && c <= safeMax) { return null; } return escapeUnsafe(c); } protected abstract char @Nullable [] escapeUnsafe(char c); }

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.2136.485−70.504
Source linesThe number of non-empty source lines.134+53.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.643−6.965

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

Score0.659

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.134+3.898
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.135−3.744
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.134−2.654
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.133.866+1.461
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.95.978−0.4
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.111−0.136

Intercept 0.07 + feature contributions = -2.309 (log-odds).
Score = sigmoid(-2.309) = 0.09.

Score0.408
Score31
Run 1

The code is well-structured and readable. It follows a clear logical organization with fields, constructors, and methods separated appropriately. Nesting depth is minimal, with only one or two levels in conditional checks, keeping the logic easy to follow. The intent is clear: this is a character escaper using a lookup array with safe-range optimization. The variable names like `replacements`, `safeMin`, and `safeMax` are descriptive. Action granularity is good, with one operation per line in most cases. The constructors are slightly verbose but not excessively long. Minor issues include the unusual spacing/indentation before the constructors and the redundant `escape` override that could be inherited from the parent class, but these don't significantly impact readability. Overall, the code is clean, maintainable, and follows common Java conventions.

Run 2

The code is generally well-structured with clear class responsibility. Flat, single-level nesting in methods and one action per line improve readability. Field and method names are descriptive. However, some ambiguities exist: the diagonal comment blocks are unusual and create visual noise; logic like the safe min/max swap and the escape condition in `escape(String)` mixes multiple concerns in one line, reducing clarity for first-time readers. Also, several long Javadoc-like comments with blank filler lines inflate file length without adding value. Overall, readable but could be more concise and conventional.

Run 3

The code is well-structured and readable. It has a clear class hierarchy, logical field organization, and flat nesting with minimal indentation. Intent is evident from method names and Javadoc comments. The constructor overloads are concise, and each line performs a single logical action. The escape methods use simple early returns and straightforward conditionals, maintaining a natural reading flow. Minor deductions are due to the excessive vertical whitespace between imports and class declaration, and slight ambiguity in the nullability annotations placement. The empty comment blocks may reduce readability slightly.

Run 1

Code Structure: Fields, constructors, and escaping methods are logically organized with clear responsibilities. Nesting: Control flow is shallow, with only one nested conditional in character escaping. Clarity of intent: Descriptive names make the replacement lookup and safe-character checks understandable, though the inverted safe-range initialization and null-return convention lack explanation. Code length: Executable code is concise, but excessive blank lines unnecessarily expand the file. Action granularity: Statements generally perform one action per line; loop syntax and compound conditions remain conventional. Reading flow: Constructor delegation and early returns support natural reading, but large whitespace gaps disrupt continuity, and the compound condition in escape(String) requires some careful parsing.

Run 2

Code Structure: Fields, constructors, and escaping methods are logically organized with clear separation of responsibilities. Nesting: Shallow loops and conditionals, plus early returns, keep control flow manageable. Clarity of intent: Descriptive names communicate the escaping logic, but the reversed safe-range initialization and null return semantics lack explanatory comments. Code length: Functional code is concise, though excessive blank lines substantially inflate its visual length. Action granularity: Statements generally perform one action per line; the compound escape condition is somewhat dense but still understandable. Reading flow: Method ordering and consistent indentation support natural reading, while large whitespace gaps interrupt continuity and make navigation unnecessarily cumbersome.

Run 3

Code Structure: Fields, constructors, overrides, and the abstract extension method are logically organized. Nesting: Shallow loops and conditionals, with early returns keeping control flow simple. Clarity of intent: Descriptive names make the escaping logic understandable, although the inverted safe-range initialization and null-return convention lack explanations. Code length: The implementation is concise, but excessive blank lines unnecessarily expand its visual length. Action granularity: Most statements perform one action per line; the compound escape condition is slightly dense but manageable. Reading flow: Method ordering and consistent indentation support natural reading, while large whitespace gaps interrupt continuity. Overall, the code is structurally readable but would benefit from normalized spacing and brief documentation of non-obvious behavior.