Sample

int-d79a0daf5581-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines83

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4370–1; higher is more readable
Dorn0.0270–1; higher is more readable
Mi00–1; higher is more readable
LLOC50Logical lines; fewer is more readable
DeepSeek V4 Pro4.670–20; mean of three runs
GPT-6.1 Sol110–20; mean of three runs
BTTF0.1420–1; higher is more readable

Views

Source code

package org.springframework.core.convert.support; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import org.jspecify.annotations.Nullable; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; /** * Converts a Map to another Map. * * <p>First, creates a new Map of the requested targetType with a size equal to the * size of the source Map. Then copies each element in the source map to the target map. * Will perform a conversion from the source map's parameterized K,V types to the target * map's parameterized types K,V if necessary. * * @author Keith Donald * @author Juergen Hoeller * @since 3.0 */ final class MapToMapConverter implements ConditionalGenericConverter { private final ConversionService conversionService; public MapToMapConverter(ConversionService conversionService) { this.conversionService = conversionService; } @Override public Set<ConvertiblePair> getConvertibleTypes() { return Collections.singleton(new ConvertiblePair(Map.class, Map.class)); } @Override public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return canConvertKey(sourceType, targetType) && canConvertValue(sourceType, targetType); } @Override public @Nullable Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; } @SuppressWarnings("unchecked") Map<Object, Object> sourceMap = (Map<Object, Object>) source; // Shortcut if possible... boolean copyRequired = !targetType.getType().isInstance(source); if (!copyRequired && sourceMap.isEmpty()) { return sourceMap; } TypeDescriptor keyDesc = targetType.getMapKeyTypeDescriptor(); TypeDescriptor valueDesc = targetType.getMapValueTypeDescriptor(); List<MapEntry> targetEntries = new ArrayList<>(sourceMap.size()); for (Map.Entry<Object, Object> entry : sourceMap.entrySet()) { Object sourceKey = entry.getKey(); Object sourceValue = entry.getValue(); Object targetKey = convertKey(sourceKey, sourceType, keyDesc); Object targetValue = convertValue(sourceValue, sourceType, valueDesc); targetEntries.add(new MapEntry(targetKey, targetValue)); if (sourceKey != targetKey || sourceValue != targetValue) { copyRequired = true; } } if (!copyRequired) { return sourceMap; } Map<Object, Object> targetMap = CollectionFactory.createMap(targetType.getType(), (keyDesc != null ? keyDesc.getType() : null), sourceMap.size()); for (MapEntry entry : targetEntries) { entry.addToMap(targetMap); } return targetMap; } // internal helpers private boolean canConvertKey(TypeDescriptor sourceType, TypeDescriptor targetType) { return ConversionUtils.canConvertElements(sourceType.getMapKeyTypeDescriptor(), targetType.getMapKeyTypeDescriptor(), this.conversionService); } private boolean canConvertValue(TypeDescriptor sourceType, TypeDescriptor targetType) { return ConversionUtils.canConvertElements(sourceType.getMapValueTypeDescriptor(), targetType.getMapValueTypeDescriptor(), this.conversionService); } private @Nullable Object convertKey(Object sourceKey, TypeDescriptor sourceType, @Nullable TypeDescriptor targetType) { if (targetType == null) { return sourceKey; } return this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor(sourceKey), targetType); } private @Nullable Object convertValue(Object sourceValue, TypeDescriptor sourceType, @Nullable TypeDescriptor targetType) { if (targetType == null) { return sourceValue; } return this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor(sourceValue), targetType); } private static class MapEntry { private final @Nullable Object key; private final @Nullable Object value; public MapEntry(@Nullable Object key, @Nullable Object value) { this.key = key; this.value = value; } public void addToMap(Map<Object, Object> map) { map.put(this.key, this.value); } } }

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.4610.646−152.151
Source linesThe number of non-empty source lines.83+33.2
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.958−7.437

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

Score0.437

Feature contributions

FeatureValueContribution
(log-odds)
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.286−8.449
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.285.976+3.81
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.84−1.938
Indentation frequencyHow rapidly indentation changes from line to line.70+1.684
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.82.808+0.748
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.089+0.074

Intercept 0.07 + feature contributions = -3.603 (log-odds).
Score = sigmoid(-3.603) = 0.027.

Score0
Score50
Run 1

The code is severely unreadable. Multiple methods and class declarations are packed onto single lines, violating standard formatting and making the structure hard to follow. The nesting level is moderate, but the lack of line breaks creates an impression of deep, tangled nesting. Intent is sometimes clear from the method names and Javadoc, but the compressed layout obscures it. The code is not concise; it is actually verbose in logic but presented in a compressed, unreadable way. Action granularity is broken—multiple statements per line make it impossible to scan. Reading flow is completely disorganized, as the eye cannot easily separate method boundaries or follow control flow. While the underlying logic is straightforward, the formatting alone drops the score from excellent to very poor.

Run 2

The code suffers from severe formatting issues that drastically reduce readability. Multiple statements and method declarations are crammed onto single lines, making it difficult to distinguish logical blocks and individual actions. Nesting is not overly deep, but the lack of line breaks creates a tangled appearance. Intent is partially clear from comments and naming, but the dense layout obscures the flow. Code length is reasonable but not helped by the formatting. Action granularity violates the 'one action per line' principle extensively. The reading flow is severely disrupted by the inconsistent line breaks and mashed-together methods, making it hard to scan and understand. The code could be readable with normal formatting, but as presented it is very hard to parse.

Run 3

The code is structurally logical but severely compromised by formatting. Multiple methods and statements are crammed onto single lines, making it difficult to parse. While the core logic and intent are understandable, the reading flow is poor due to inconsistent line breaks and indentation. Nesting is relatively shallow, and action granularity suffers from multiple actions being placed on one line. The code would be significantly more readable with standard formatting practices applied consistently.

Run 1

Code Structure: The converter has a logical organization with focused helper methods and an entry class, but compressed method boundaries obscure that structure. Nesting: Mostly shallow, with guard clauses and simple loops; nesting is not a major obstacle. Clarity of intent: Descriptive names and class documentation clearly explain map conversion, although the deferred copying logic requires some attention. Code length: Reasonably concise for the functionality, with little unnecessary logic. Action granularity: Multiple imports, declarations, assignments, and method definitions share lines, making individual actions difficult to scan. Reading flow: Inconsistent indentation, crowded braces, long lines, and annotations attached to preceding methods interrupt natural reading. Overall, the underlying design is readable, but poor formatting substantially reduces accessibility.

Run 2

Code Structure: Sensible separation into conversion methods, helpers, and an entry class, but compressed formatting obscures boundaries. Nesting: Mostly shallow, with early returns and straightforward loops. Clarity of intent: Descriptive names and documentation clearly communicate map conversion and conditional copying. Code length: Reasonably concise for its functionality, although entry buffering adds some reading overhead. Action granularity: Frequently poor; imports, declarations, assignments, method boundaries, and returns share lines. Reading flow: Inconsistent brace placement, crowded annotations, and merged statements interrupt otherwise logical execution flow. The underlying design is readable, but presentation substantially reduces scanability.

Run 3

Code Structure: Responsibilities are logically separated into conversion, compatibility checks, and an entry helper, but compressed formatting obscures method boundaries. Nesting: Mostly shallow, with early returns and straightforward loops. Clarity of intent: Descriptive names and class documentation clearly explain map conversion and copy avoidance. Code length: Reasonably concise for its functionality, though the entry helper adds some boilerplate. Action granularity: Multiple imports, declarations, assignments, and method boundaries share lines, making individual operations harder to distinguish. Reading flow: Inconsistent line breaks, crowded annotations, and misplaced closing braces interrupt an otherwise natural sequence of validation, conversion, and map construction.