Sample

int-d5601936f1e7-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines61

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8220–1; higher is more readable
Dorn0.5270–1; higher is more readable
Mi0.2170–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro18.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.8060–1; higher is more readable

Views

Source code

package org.springframework.http.converter.cbor; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.cbor.CBORFactory; import org.springframework.http.MediaType; import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.util.Assert; /** * Implementation of {@link org.springframework.http.converter.HttpMessageConverter * HttpMessageConverter} that can read and write the <a href="https://cbor.io/">CBOR</a> * data format using <a href="https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor"> * the dedicated Jackson 2.x extension</a>. * * <p>By default, this converter supports the {@link MediaType#APPLICATION_CBOR_VALUE} * media type. This can be overridden by setting the {@link #setSupportedMediaTypes * supportedMediaTypes} property. * * <p>The default constructor uses the default configuration provided by * {@link Jackson2ObjectMapperBuilder}. * * @author Sebastien Deleuze * @since 5.0 * @deprecated since 7.0 in favor of {@link JacksonCborHttpMessageConverter} */ @Deprecated(since = "7.0", forRemoval = true) @SuppressWarnings("removal") public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter { /** * Construct a new {@code MappingJackson2CborHttpMessageConverter} using the * default configuration provided by {@code Jackson2ObjectMapperBuilder}. */ public MappingJackson2CborHttpMessageConverter() { this(Jackson2ObjectMapperBuilder.cbor().build()); } /** * Construct a new {@code MappingJackson2CborHttpMessageConverter} with a * custom {@link ObjectMapper} (must be configured with a {@code CBORFactory} * instance). * <p>You can use {@link Jackson2ObjectMapperBuilder} to build it easily. * @see Jackson2ObjectMapperBuilder#cbor() */ public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper) { super(objectMapper, MediaType.APPLICATION_CBOR); Assert.isInstanceOf(CBORFactory.class, objectMapper.getFactory(), "CBORFactory required"); } /** * {@inheritDoc} * <p>The {@code ObjectMapper} must be configured with a {@code CBORFactory} instance. */ @Override public void setObjectMapper(ObjectMapper objectMapper) { Assert.isInstanceOf(CBORFactory.class, objectMapper.getFactory(), "CBORFactory required"); super.setObjectMapper(objectMapper); } }

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.1055.401−34.828
Source linesThe number of non-empty source lines.61+24.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.161−7.741

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

Score0.822

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.62−1.159
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.103.968+0.873
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.103.968−0.738
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.04+0.552
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.60.905+0.441
Indentation frequencyHow rapidly indentation changes from line to line.33+0.404
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.33−0.336

Intercept 0.07 + feature contributions = 0.107 (log-odds).
Score = sigmoid(0.107) = 0.527.

Score0.217
Score6
Run 1

This code is exceptionally readable. Structure is logical with clear class-level Javadoc explaining purpose, deprecation, and usage. Imports are clean. Nesting is essentially flat; no complex conditional or loop structures exist. Intent is unambiguous: the class provides CBOR message conversion via Jackson, with clear constructors and a setter. Code length is minimal and focused, avoiding unnecessary boilerplate. Each method performs one clear action or delegates appropriately, and the constructor chaining is concise. The reading flow is natural from class documentation to constructors to override methods. Assertions are used effectively to enforce preconditions without clutter.

Run 2

The code is highly readable. The class has a clear, single responsibility: it defines a CBOR-specific HTTP message converter. Imports are focused, and the class-level Javadoc thoroughly explains the purpose, default media type, and deprecation. Structure is logical with two concise constructors, a delegated setter, and clear validation using Assert.isInstanceOf. Nesting is essentially flat; there are no conditional blocks or loops. Clarity of intent is strong due to descriptive naming and informative comments. Code length is minimal and avoids boilerplate, largely delegating to the parent class and Jackson builder. Action granularity is good, with the validation assert on its own line before the super call in the setter, improving readability. The reading flow is natural: declaration, constructors, then the overridden setter. Minor deductive points are due to the slight repetition in the Assert validation between constructor and setter, but this is acceptable for enforcing the invariant at different lifecycle stages.

Run 3

The code is highly readable. It has a clear, single-purpose class structure with a natural reading flow: Javadoc, class declaration, constructors, then overridden method. Nesting is minimal (only class-level methods), and each action is on its own line. Intent is explicit via comprehensive Javadoc and clear method names. Length is concise—no unnecessary code. Validation logic is cleanly separated using Assert calls. Import statements are organized and sparse, aiding clarity. Minor points: the long class name slightly reduces readability, and the deprecation/ suppression annotations add a bit of noise, but they are standard and contextually necessary.

Run 1

Code Structure: Logically organized into imports, class documentation, constructors, and an overridden setter. Nesting: Flat method bodies with no conditional or loop nesting. Clarity of intent: Descriptive names, explicit CBOR factory validation, and useful documentation clearly communicate purpose and constraints. Code length: Implementation is concise; documentation is proportionate, although repeated factory requirements and validation add minor redundancy. Action granularity: Each statement performs one distinct action on its own line. Reading flow: Natural progression from default construction to custom configuration and mapper replacement. Minor formatting inconsistencies, including extra blank lines and no separation between the package declaration and imports, slightly reduce polish.

Run 2

Code Structure: Logically organized into constructors and an overridden setter, with imports and documentation clearly separated. Nesting: Flat methods with no conditional or loop nesting. Clarity of intent: Descriptive names, explicit CBORFactory validation, and Javadoc make the converter's purpose and requirements clear. Code length: Implementation is concise; documentation is somewhat verbose but useful. Action granularity: Each statement performs one primary action, with straightforward constructor delegation and validation. Reading flow: Natural progression from class description to default construction, custom construction, and mapper replacement. Minor formatting inconsistencies, including extra blank lines and no spacing between the package declaration and imports, slightly reduce polish.

Run 3

Code Structure: Logically organized into constructors and an overridden setter, with consistent validation. Nesting: Flat methods with no nested control flow. Clarity of intent: Descriptive names, explicit CBORFactory checks, and useful documentation clearly communicate purpose and constraints. Code length: Implementation is concise; documentation is somewhat verbose relative to the small class but remains useful. Action granularity: Each statement performs one primary action, with straightforward builder chaining in the default constructor. Reading flow: Imports, class documentation, constructors, and setter follow a natural sequence. Minor spacing inconsistencies and reliance on superclass behavior slightly reduce readability.