Checkstyle operator-wrap formatting: move binary operators to start of continuation line#1037
Merged
akshayrai merged 1 commit intoJun 29, 2026
Conversation
…f continuation line
Mechanical formatting fix for OperatorWrap violations the LinkedIn-internal
checkstyle (a stricter superset of the OSS Checker) flags on the current
OSS Brooklin tree. No behavior change in any file -- only whitespace,
operator placement, and line-break position move. The rule is not
currently enabled in OSS Brooklin's own checkstyle.xml, so this PR
addresses the latent violations without proposing a config change.
The rule states that when a binary expression is split across two
lines, the operator must lead the continuation line rather than trail
the first line. The well-known argument is that the leading operator
makes the structure of the expression visible at the line break and
shifts the eye to the right place when scanning. Both styles produce
identical bytecode.
Before:
foo &&
bar
"first part of message " +
"second part"
After:
foo
&& bar
"first part of message "
+ "second part"
30 fixes across 15 files, by operator:
'&&' (10):
Coordinator.{getCustomCheckpointing, waitForStopToPropagateAndMarkDatastreamsStopped}
DatastreamProducerRecord.equals (combined two lines into one
contiguous run of && operators)
DatastreamResources.{validateUpdateDatastreams, resume,
resume (paused-or-stopped branch -> || variant)}
KafkaMirrorMakerConnectorTask (topic-manager factory init)
ReflectionUtils.findMatchingMethod (assignability check)
'||' (2):
ReflectionUtils.isCompatiblePrimitive (boxed-type pair check)
DatastreamResources.resume
'?' / ':' (10):
BroadcastStrategy.getOrCreateDatastreamTask (multi-line ternary)
Coordinator.onAssignmentChange (x2) -- isDatastreamUpdate
handle-event picker
DirectoryTransportProvider.copyPathToDir (file vs directory copy fn)
KafkaBasedConnectorTaskMetrics ctor x3 (histogram registration
gated by enableAdditionalMetrics)
LoadBasedPartitionAssignmentStrategy (info-log throughput-assignment
enabled/disabled formatter)
StickyMulticastStrategy.assign (reuse-task vs create-new)
StickyPartitionAssignmentStrategy.{constructExpectedNumberOfTasks,
computePartitionsPerTask} (elastic-task vs default;
allowedPartitionsPerTask threshold)
'+' (7):
Coordinator.{waitForStopToPropagateAndMarkDatastreamsStopped,
assignPartitionsToInstances} (multi-line log/exception messages)
DatastreamTaskImpl ctor (multi-line transient-exception message)
EmbeddedZookeeper.start (multi-line LOG.info "Zookeeper started")
LoadBasedPartitionAssigner.validatePartitionCountAndThrow
(multi-line String.format message)
'/' (1):
LoadBasedTaskCountEstimator.getTaskCount (throughput / capacity
division split across lines)
Motivation outside OSS Brooklin: brooklin-server consumes Brooklin
in-tree (subtree-merge at brooklin-core/) and runs a stricter
checkstyle on the merged code; the rule fires 30 times today, forcing
a build-level carve-out. With this PR merged upstream, brooklin-server's
next OSS sync inherits the cleanup and the rule drops out of its
checkstyle-suppress list.
harshOSS
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
No behavior changes in any file. This PR contains formatting-only fixes for OperatorWrap violations reported by LinkedIn's internal Checkstyle configuration (a stricter superset of the OSS configuration). The rule is not currently enabled in OSS Brooklin's checkstyle.xml, so this PR resolves the latent violations without proposing a configuration change.
The updates only adjust whitespace, line breaks, and operator placement. Specifically, binary operators are moved to the beginning of continuation lines, as required by the rule, improving readability while producing identical bytecode.
Testing Done
No change in logic, PR checks only