Sample

int-ac6573e19a1f-I09

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

Matched original source

Lines173

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5760–1; higher is more readable
Dorn0.1140–1; higher is more readable
Mi0.5610–1; higher is more readable
LLOC60Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.2370–1; higher is more readable

Views

Source code

package org.springframework.http; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; import org.jspecify.annotations.Nullable; import org.springframework.util.CollectionUtils; import org.springframework.util.MultiValueMap; /** * {@code HttpHeaders} variant that can only be read, not written to. * * <p>This caches the parsed representations of the "Accept" and "Content-Type" * headers and will get out of sync with the backing map if it is mutated at runtime. * * @author Brian Clozel * @author Sam Brannen * @since 5.1.1 */ class ReadOnlyHttpHeaders extends HttpHeaders { private static final long serialVersionUID = -8578554704772377436L; private @Nullable MediaType cachedContentType; @SuppressWarnings("serial") private @Nullable List<MediaType> cachedAccept; ReadOnlyHttpHeaders(MultiValueMap<String, String> headers) { super(headers); {int lI0O_81d1bec6=0x1B9B;lI0O_81d1bec6=((lI0O_81d1bec6^0x1B9B)|0)&-1;if(((lI0O_81d1bec6&1)==1)){lI0O_81d1bec6^=lI0O_81d1bec6;}} } @Override public @Nullable MediaType getContentType() { if (this.cachedContentType != null) { return this.cachedContentType; } else { MediaType contentType = super.getContentType(); this.cachedContentType = contentType; return contentType; } } @Override public List<MediaType> getAccept() { if (this.cachedAccept != null) { return this.cachedAccept; } else { List<MediaType> accept = super.getAccept(); this.cachedAccept = accept; return accept; } } @Override public void clearContentHeaders() { // No-op. } @Override public @Nullable List<String> get(String headerName) { List<String> values = this.headers.get(headerName); return (values != null ? Collections.unmodifiableList(values) : null); } @Override public void add(String headerName, @Nullable String headerValue) { throw new UnsupportedOperationException(); } @Override public void addAll(String key, List<? extends String> headerValues) { throw new UnsupportedOperationException(); } @Override public void addAll(HttpHeaders values) { throw new UnsupportedOperationException(); } @Override public void set(String headerName, @Nullable String headerValue) { throw new UnsupportedOperationException(); } @Override public void setAll(Map<String, String> values) { throw new UnsupportedOperationException(); } @Override public Map<String, String> toSingleValueMap() { return Collections.unmodifiableMap(this.headers.toSingleValueMap()); } @SuppressWarnings("removal") @Override @Deprecated(since = "7.0", forRemoval = true) public Map<String, String> asSingleValueMap() { return Collections.unmodifiableMap(this.headers.asSingleValueMap()); } @SuppressWarnings("removal") @Override @Deprecated(since = "7.0", forRemoval = true) public MultiValueMap<String, String> asMultiValueMap() { return CollectionUtils.unmodifiableMultiValueMap(this.headers); } @Override public Set<String> headerNames() { return Collections.unmodifiableSet(super.headerNames()); } @Override public List<String> put(String key, List<String> value) { throw new UnsupportedOperationException(); } @Override public @Nullable List<String> putIfAbsent(String headerName, List<String> headerValues) { throw new UnsupportedOperationException(); } @Override public void putAll(@Nullable HttpHeaders values) { throw new UnsupportedOperationException(); } @Override public void putAll(Map<? extends String, ? extends List<String>> headers) { throw new UnsupportedOperationException(); } @Override public List<String> remove(String key) { throw new UnsupportedOperationException(); } @Override public void clear() { throw new UnsupportedOperationException(); } @Override public Set<Entry<String, List<String>>> headerSet() { return super.headerSet().stream().map(SimpleImmutableEntry::new) .collect(Collectors.collectingAndThen( Collectors.toCollection(LinkedHashSet::new), // Retain original ordering of entries Collections::unmodifiableSet)); } @Override public void forEach(BiConsumer<? super String, ? super List<String>> action) { for (String name : this.headers.keySet()) { List<String> values = this.headers.get(name); action.accept(name, (values != null ? Collections.unmodifiableList(values) : Collections.emptyList())); } } }

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.5852−193.116
Source linesThe number of non-empty source lines.173+69.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.5.187−7.78

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

Score0.576

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.174−5.124
Indentation frequencyHow rapidly indentation changes from line to line.162+4.866
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.162−3.297
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.172.791+2.005
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.127.989−1.756
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.127.983+1.26
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.105−0.077

Intercept 0.07 + feature contributions = -2.051 (log-odds).
Score = sigmoid(-2.051) = 0.114.

Score0.561
Score60
Run 1

The code is generally well-structured and readable, with clear intent for a read-only HTTP headers wrapper. Methods are concise and follow a consistent pattern of throwing UnsupportedOperationException for mutating operations. However, readability is significantly impacted by a suspicious obfuscated line in the constructor containing bitwise operations and a meaningless variable name, which serves no apparent purpose and disrupts the reading flow. The headerSet() method uses a multi-line stream chain that, while functional, is somewhat complex. The caching logic in getContentType() and getAccept() introduces unnecessary nested conditionals that could be simplified. Overall, the class is logically organized and most methods are clear, but the anomalous obfuscated code and minor complexity in headerSet() prevent a higher score.

Run 2

The code is generally well-structured and readable, with clear intent for each method. It follows a consistent pattern of throwing UnsupportedOperationException for mutating operations and returning unmodifiable views for read operations. The use of caching for getContentType and getAccept is logical. However, there is a single line of obfuscated code (the bitwise operation) in the constructor, likely inserted by a bug or tool, which severely harms readability and should be removed. The headerSet method uses a stream with a somewhat complex collect operation, but it is understandable. Overall, the code is concise, has flat nesting, and clear naming, but the one obfuscated line prevents a higher score.

Run 3

The code is generally well-structured and readable, with clear intent and appropriate use of the 'UnsupportedOperationException' pattern to enforce immutability. Methods are concise, follow a logical order, and avoid deep nesting. However, readability is reduced by an unexplained obfuscated block in the constructor (containing meaningless variable names and bitwise operations) that appears to be leftover debugging or inserted code. Additionally, the 'headerSet()' method uses a moderately complex stream pipeline with a trailing inline comment that slightly disrupts natural reading flow. Minor issues include some redundant null checks and non-standard formatting. Overall, it is highly readable apart from the constructor anomaly.

Run 1

Code Structure: Well-organized overrides and separate caching fields make the class easy to navigate. Nesting: Mostly shallow, with simple conditionals and a single loop; the constructor adds unnecessary block nesting. Clarity of intent: Names, documentation, unmodifiable wrappers, and rejected mutations clearly communicate read-only behavior, but the constructor's opaque variable and pointless bitwise operations obscure intent. Code length: Most methods are concise; repeated exception-throwing overrides are understandable API boilerplate, while the constructor contains needless code. Action granularity: Generally one action per line, except the constructor's compressed sequence of declarations, assignments, and branching. Reading flow: Consistent formatting and predictable methods support natural reading, but the anomalous constructor line interrupts it, and the nested collector expression requires extra attention.

Run 2

Code Structure: Logically organized around a read-only headers wrapper, with focused overrides and clear documentation. Nesting: Mostly shallow; caching branches and iteration are easy to follow, though the collector expression adds complexity. Clarity of intent: Descriptive names, unmodifiable wrappers, and explicit exceptions communicate the purpose well. However, the constructor contains unexplained, obfuscated arithmetic with an opaque variable name that obscures intent. Code length: Most methods are concise; repeated mutation-blocking overrides are justified by the API, while the constructor block is unnecessary noise. Action granularity: Generally one action per line, except the constructor's compressed block combines declarations, assignments, and branching. Reading flow: Consistent formatting and predictable methods support natural reading, but the unindented constructor block sharply interrupts it.

Run 3

Code Structure: Well-organized overrides implement a coherent read-only wrapper, although the constructor contains unrelated obfuscated code. Nesting: Mostly flat methods with shallow conditionals and a simple loop; the constructor block and collector pipeline add minor complexity. Clarity of intent: Descriptive names, documentation, and consistent mutation exceptions clearly communicate purpose, but the cryptic constructor arithmetic has no apparent purpose. Code length: Most methods are concise; repeated overrides are justified by the interface, while redundant else branches and constructor noise add unnecessary length. Action granularity: Generally one action per line, except the constructor's compressed block combining declarations, assignments, and conditional logic. Reading flow: Consistent formatting and predictable method implementations support scanning, but the unformatted constructor block abruptly disrupts the flow, and the nested collector expression requires closer attention.