Skip to content

Skip import reordering when comments separate imports. - #1528

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_1010281495
Nov 17, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_1010281495

Conversation

@copybara-service

Copy link
Copy Markdown

Skip import reordering when comments separate imports.

When a block or Javadoc comment separates import declarations, it is ambiguous which import the comment belongs to. Return an empty replacement list in ImportOrderer.findReplacements instead of throwing a FormatterException so the rest of the file can still be formatted.

Fixes #424

When a block or Javadoc comment separates `import` declarations, it is ambiguous which import the comment belongs to. Return an empty replacement list in `ImportOrderer.findReplacements` instead of throwing a `FormatterException` so the rest of the file can still be formatted.

Fixes #424

PiperOrigin-RevId: 1023694754
@copybara-service
copybara-service Bot merged commit 46a200f into master Nov 17, 2026
4 checks passed
@copybara-service
copybara-service Bot deleted the test_1010281495 branch November 17, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter fails with Javadoc on import

1 participant