Sample

int-6d0e138fb673-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines143

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4320–1; higher is more readable
Dorn0.5630–1; higher is more readable
Mi0.1630–1; higher is more readable
LLOC33Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.4090–1; higher is more readable

Views

Source code

package org.springframework.core; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.jspecify.annotations.Nullable; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; public final class MethodIntrospector { private MethodIntrospector() { } public static <T> Map<Method, T> selectMethods(Class<?> targetType, final MetadataLookup<T> metadataLookup) { final Map<Method, T> methodMap = new LinkedHashMap<>(); Set<Class<?>> handlerTypes = new LinkedHashSet<>(); Class<?> specificHandlerType = null; if (!Proxy.isProxyClass(targetType)) { specificHandlerType = ClassUtils.getUserClass(targetType); handlerTypes.add(specificHandlerType); } handlerTypes.addAll(ClassUtils.getAllInterfacesForClassAsSet(targetType)); for (Class<?> currentHandlerType : handlerTypes) { final Class<?> targetClass = (specificHandlerType != null ? specificHandlerType : currentHandlerType); ReflectionUtils.doWithMethods(currentHandlerType, method -> { Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass); T result = metadataLookup.inspect(specificMethod); if (result != null) { Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(specificMethod); if (bridgedMethod == specificMethod || bridgedMethod == method || bridgedMethod.equals(specificMethod) || bridgedMethod.equals(method) || metadataLookup.inspect(bridgedMethod) == null) { methodMap.put(specificMethod, result); } } }, ReflectionUtils.USER_DECLARED_METHODS); } return methodMap; } public static Set<Method> selectMethods(Class<?> targetType, final ReflectionUtils.MethodFilter methodFilter) { return selectMethods(targetType, (MetadataLookup<Boolean>) method -> (methodFilter.matches(method) ? Boolean.TRUE : null)).keySet(); } public static Method selectInvocableMethod(Method method, Class<?> targetType) { if (method.getDeclaringClass().isAssignableFrom(targetType)) { return method; } try { String methodName = method.getName(); Class<?>[] parameterTypes = method.getParameterTypes(); for (Class<?> ifc : targetType.getInterfaces()) { try { return ifc.getMethod(methodName, parameterTypes); } catch (NoSuchMethodException ex) { } } return targetType.getMethod(methodName, parameterTypes); } catch (NoSuchMethodException ex) { throw new IllegalStateException(String.format( "Need to invoke method '%s' declared on target class '%s', " + "but not found in any interface(s) of the exposed proxy type. " + "Either pull the method up to an interface or switch to CGLIB " + "proxies by enforcing proxy-target-class mode in your configuration.", method.getName(), method.getDeclaringClass().getSimpleName())); } } @FunctionalInterface public interface MetadataLookup<T> { @Nullable T inspect(Method method); } }

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.3736.929−123.319
Source linesThe number of non-empty source lines.143+57.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.094−7.641

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

Score0.432

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.143+4.209
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.143−4.027
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.142.912+1.588
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.111.986−1.078
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.107−0.101

Intercept 0.07 + feature contributions = 0.255 (log-odds).
Score = sigmoid(0.255) = 0.563.

Score0.163
Score33
Run 1

The code has clear structure and purpose, but suffers from readability issues. Positives: public methods are separated, the MetadataLookup interface is well-defined, and comments explain the purpose of selectInvocableMethod. However, there are excessive blank lines between methods (20+ empty lines in places), which disrupts flow. The selectMethods method has deep nesting (4+ levels) with a complex conditional chain using multiple 'or' conditions, making it hard to follow. The lambda body contains multiple actions per line and embedded logic. Variable names are generally clear, but the bridged method comparison condition is cryptic. The selectInvocableMethod has nested try-catch blocks with empty catch statements containing only comments, which is confusing. Action granularity is inconsistent—some lines contain multiple operations. Overall, the code is maintainable by experienced developers but would benefit from extraction of complex conditions into helper methods and removal of excessive whitespace.

Run 2

The code has a clear logical structure with well-separated methods and consistent naming, but several issues reduce readability. The selectMethods method has overly complex boolean conditions with deep nesting in the lambda. The bridge method resolution logic is particularly dense and hard to follow, with a compound condition that could be extracted. The selectInvocableMethod has nested try-catch blocks with empty catch bodies that lack explanatory comments. While the code is relatively concise and has good action granularity with one action per line in most places, the intent of the bridge method filtering logic is not immediately clear. The overall structure could benefit from extracting the bridge method condition into a well-named helper method and documenting the empty catch blocks with meaningful comments.

Run 3

The code is moderately readable, with clear class structure and method separation but suffers from several clarity issues. The main selectMethods method has unclear logic in the bridge method resolution conditional, which combines multiple conditions in a single complex boolean expression. Variable names like 'handlerTypes' and 'specificHandlerType' are slightly confusing without domain context. There are multiple empty comment blocks and inconsistent spacing that break natural reading flow, creating visual noise. The code has reasonable nesting depth but the lambda expression inside the loop makes the flow harder to follow. The selectInvocableMethod has good sequential logic but the nested try-catch with empty catch blocks and comments that are just whitespace reduces readability. Action granularity is generally good, with one main operation per line. The class achieves its purpose but would benefit from method extraction for the complex conditional logic and removal of empty comment blocks to improve overall clarity.

Run 1

Code Structure: Well-organized utility class with focused methods and a small functional interface. Nesting: Mostly manageable, but the callback with nested conditionals and the nested try/catch inside a loop increase complexity. Clarity of intent: Descriptive method and variable names communicate the main purpose; bridge-method handling, proxy behavior, and the empty catch block would benefit from explanatory comments. Code length: Implementation is reasonably concise, but excessive blank lines unnecessarily inflate the listing. Action granularity: Generally one action per line, although the chained overload and compound bridge-method condition require extra parsing. Reading flow: Method boundaries and consistent indentation support navigation, but large whitespace gaps and specialized reflection logic interrupt an otherwise natural flow.

Run 2

Code Structure: A cohesive utility class with well-separated methods and a small lookup interface. Nesting: Generally moderate, but the loop/lambda/conditional combination and nested try/catch blocks require extra attention. Clarity of intent: Descriptive method and variable names convey the purpose, although bridge-method comparisons, nullable metadata filtering, and an empty catch block lack explanatory comments. Code length: Implementation is reasonably concise, but excessive blank lines inflate its visual length. Action granularity: Most statements perform one action; the filter adapter and compound bridge-method condition compress several concepts. Reading flow: Method ordering and consistent indentation support a natural flow, while large whitespace gaps and complex conditional logic interrupt it.

Run 3

Code Structure: Methods are logically separated by responsibility, with a small functional interface supporting metadata lookup. Nesting: Mostly moderate, but the loop/lambda/conditional chain and nested try-catch blocks increase complexity. Clarity of intent: Descriptive method and variable names communicate purpose, although bridge-method comparisons and silent exception handling lack explanatory comments. Code length: Implementation is reasonably concise, but excessive blank lines unnecessarily expand the listing. Action granularity: Most lines perform one action; the filter overload compresses casting, a lambda, a ternary, and key-set extraction into one expression. Reading flow: Consistent indentation and sensible execution order help, while large whitespace gaps, a dense compound condition, and unexplained exception suppression interrupt flow.