Sample

int-d25488a05035-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines131

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5530–1; higher is more readable
Dorn0.1960–1; higher is more readable
Mi0.2820–1; higher is more readable
LLOC55Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.210–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) { {int lI0O_f59e4278=0xAA9A;boolean lI0O_15d9bbd0=true;do{lI0O_f59e4278^=0xAA9A;lI0O_15d9bbd0=false;}while(lI0O_15d9bbd0);} 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.4898.774−161.66
Source linesThe number of non-empty source lines.131+52.4
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.059−7.588

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

Score0.553

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.132−3.637
Indentation frequencyHow rapidly indentation changes from line to line.118+3.344
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.118−2.287
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.123.97−1.586
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.130.888+1.42
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.123.992+1.196
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 = -1.411 (log-odds).
Score = sigmoid(-1.411) = 0.196.

Score0.282
Score55
Run 1

The code is generally well-structured with clear class and method names, good use of helper methods, and a logical flow. The Javadoc provides a useful overview. Flat nesting and consistent formatting enhance readability. However, a few issues lower the score. The `convert` method is somewhat long and performs multiple related tasks (validation, type checking, entry conversion, map creation) which could be further decomposed. The presence of an obfuscated line (`{int lI0O_f59e4278=0xAA9A;...}`) inside `convertKey` is highly problematic, making that section incomprehensible and suspicious. Also, the `MapEntry` inner class adds indirection without significant benefit; directly populating the target map in the loop would be simpler. Overall, the code is maintainable but would benefit from minor refactoring and removal of the obfuscation.

Run 2

The code is well-structured, with clear separation of concerns and a logical flow. It uses early returns for null checks and has mostly one action per line. However, there's an obfuscated line with a meaningless loop (int lI0O_f59e4278=0xAA9A...) that should be removed, as it harms clarity and intent. Nested depth is minimal, and method names accurately describe their purpose. The use of helpers like MapEntry and canConvertKey/canConvertValue improves readability. Overall, the code is concise, maintainable, and follows good Java practices, but the anomalous line prevents a higher score.

Run 3

The code is generally well-structured with clear method separation, minimal nesting, and good use of helper methods and a private inner class. Javadoc and comments add clarity. However, readability is significantly harmed by an obfuscated no-op block in convertKey (a loop with meaningless variable names and bitwise XOR), which breaks reading flow. Some lines, like CollectionFactory.createMap, are long and combine multiple arguments. The convert method is moderately complex but remains understandable. Overall, the clean structure is offset by the suspicious injected code and minor verbosity.

Run 1

Code Structure: Well organized into conversion methods, focused helpers, and a small entry class, but an unrelated block disrupts convertKey. Nesting: Mostly shallow, with early returns keeping control flow simple; the injected do-while block adds needless nesting. Clarity of intent: Descriptive names and documentation explain map conversion clearly, while cryptic variables and meaningless bitwise operations obscure intent locally. Code length: Generally reasonable, though temporary entry storage and the no-op block increase reading effort. Action granularity: Most lines perform one action, but the injected block compresses declarations, assignments, and a loop onto one line. Reading flow: The main conversion follows a natural sequence from validation through element conversion to map creation; the unformatted, irrelevant block sharply interrupts otherwise consistent flow.

Run 2

Code Structure: Well organized into conversion logic, focused helpers, and a small entry class, but an unrelated block disrupts convertKey. Nesting: Mostly shallow, with early returns; the injected block adds unnecessary scope and a do-while loop. Clarity of intent: Descriptive names and documentation explain map conversion well, while cryptic variables and pointless bitwise operations obscure the helper's purpose. Code length: Generally reasonable, though temporary entry storage adds some complexity and the unrelated block is entirely unnecessary. Action granularity: Most statements perform one action per line, but the injected block compresses declarations, assignments, and looping onto one line. Reading flow: The main conversion follows a natural sequence from validation through conversion to map creation; inconsistent formatting and unexplained logic in convertKey interrupt that flow.

Run 3

Code Structure: The converter is logically organized, with focused helpers and a small entry class, but an unrelated block disrupts convertKey. Nesting: Early returns keep most logic shallow; the injected block adds unnecessary scope and loop nesting. Clarity of intent: Descriptive names, documentation, and straightforward conversion calls explain the main purpose. However, cryptic variables and a meaningless XOR loop obscure intent locally. Code length: Most code is reasonably concise, though the no-op block adds needless length and the entry wrapper introduces some overhead. Action granularity: Most lines perform one clear action, but the injected block compresses declarations, assignments, and control flow onto one line. Reading flow: Conversion proceeds naturally from validation through element conversion to map creation, with consistent helper organization. The unindented, densely packed block sharply interrupts that flow.