Sample

int-ecf4265c3095-I10

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

Matched original source

Lines34

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6540–1; higher is more readable
Dorn0.0340–1; higher is more readable
Mi00–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.4640–1; higher is more readable

Views

Source code

package io.netty.example.uptime; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.MultiThreadIoEventLoopGroup; import io.netty.channel.nio.NioIoHandler; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; /** * Uptime server is served as a connection server. * So it simply discards all message received. */ public final class UptimeServer { private static final int PORT = Integer.parseInt(System.getProperty("port", "8080")); private static final UptimeServerHandler handler = new UptimeServerHandler(); private UptimeServer() { } public static void main(String[] args) throws Exception { EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()); try { ServerBootstrap b = new ServerBootstrap(); b.group(group) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { ch.pipeline().addLast(handler); } }); // Bind and start to accept incoming connections. ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. // In this example, this does not happen, but you can do that to gracefully // shut down your server. f.channel().closeFuture().sync(); } finally { group.shutdownGracefully(); } } }

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.1782.669−58.828
Source linesThe number of non-empty source lines.34+13.6
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.679−7.018

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

Score0.654

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.240−6.5
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.239.971+3.067
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.27−0.199
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.083+0.132
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.33.917+0.064

Intercept 0.07 + feature contributions = -3.336 (log-odds).
Score = sigmoid(-3.336) = 0.034.

Score0
Score13
Run 1

The code is readable for experienced Netty developers but suffers from formatting inconsistencies and nesting. Structure is logical, with clear setup of server bootstrap and lifecycle, while the single-purpose UptimeServer class is concise. However, import statements are jammed together, and method chaining is crammed onto single lines, harming scanability. The ChannelInitializer adds moderate nesting, though it’s a typical Netty pattern. Intent is mostly clear, with comments clarifying shutdown behavior, but inline anonymous class declaration is dense. Action granularity is acceptable despite chained configuration. Reading flow is uneven: static field initialization is compact, but the bootstrap chain and malformed line breaks disturb natural reading. Overall, the code is functional but would benefit from proper formatting, spacing, and broken-out configuration statements to achieve higher readability.

Run 2

The code has severe readability issues despite having a clear purpose. The package declaration, imports, and class definition are crammed onto single lines, making the header difficult to parse. The builder pattern is split awkwardly across lines with inconsistent indentation. The anonymous inner class is compressed onto one line containing multiple actions. The main method has only one try-finally nesting level, but the formatting obscures this. The logic itself is straightforward, but the formatting undermines clarity. Issues include: multiple statements per line, inconsistent spacing around dots and braces, poor indentation, and lack of visual separation between sections. The fluent API calls would benefit from consistent one-call-per-line formatting. The code would be significantly more readable with standard Java formatting conventions, proper line breaks after semicolons and opening braces, and consistent indentation.

Run 3

The code has a clear purpose and basic structure but suffers from formatting and organization issues. The single-line imports and method signatures reduce readability significantly. The nested ChannelInitializer with its inline override creates unnecessary nesting and breaks the natural flow. While the action granularity is mostly reasonable and comments help explain intent, the compressed layout makes the code harder to scan. Method chaining for server bootstrap configuration is acceptable but could be better formatted. Overall, it's functional and understandable but lacks the clean formatting and logical separation that would make it highly readable.

Run 1

Code Structure: The class logically separates configuration, startup, channel initialization, and cleanup, but compressed formatting obscures these sections. Nesting: Depth is moderate, with a try/finally and anonymous initializer; neither is excessive. Clarity of intent: The class name, Netty APIs, and lifecycle comments convey the server's purpose, though variable names b and f are vague and the introductory comment is awkward. Code length: The implementation is concise without substantial unnecessary code. Action granularity: Multiple imports, field declarations, and control-flow elements share lines, making individual actions harder to distinguish. Reading flow: The startup-to-shutdown sequence is natural, but crowded method chaining, inconsistent indentation, and inline braces interrupt scanning.

Run 2

Code Structure: The class follows a logical setup, bind, wait, and cleanup sequence, but compressed formatting obscures its organization. Nesting: Moderate nesting through try/finally and an anonymous channel initializer is appropriate, though awkward indentation makes it harder to follow. Clarity of intent: Netty API calls and comments explain the server lifecycle, but abbreviated names such as b and f reduce clarity. Code length: The implementation is reasonably concise without significant unnecessary logic. Action granularity: Multiple imports, field declarations, and control-flow statements share lines, making individual actions harder to distinguish. Reading flow: The overall execution order is natural, but crowded method chaining, inline annotations, and inconsistent line breaks interrupt scanning.

Run 3

Code Structure: The server follows a logical setup, bind, wait, and cleanup sequence, but compressed formatting obscures these sections. Nesting: Depth is moderate and justified by try/finally and the anonymous channel initializer. Clarity of intent: Netty API calls and lifecycle comments communicate the purpose, although names such as b and f are terse and the class documentation is awkward. Code length: The implementation is appropriately concise, with little unnecessary logic. Action granularity: Multiple imports, field declarations, and control-flow elements share lines, making distinct actions harder to identify. Reading flow: Inconsistent indentation, crowded method chaining, and inline braces interrupt an otherwise natural execution order. Conventional formatting and more descriptive local names would substantially improve readability.