Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: don't inline level prefix if breaks occurred inside #85

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-85.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: fix
fix:
description: "When inlining a level's leading docs, check that no breaks were introduced
more robustly."
links:
- https://github.com/palantir/palantir-java-format/pull/85
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ private Optional<State> tryBreakLastLevel(
SplitsBreaks prefixSplitsBreaks = splitByBreaks(leadingDocs);

State state1 = tryToLayOutLevelOnOneLine(commentsHelper, maxWidth, state, prefixSplitsBreaks, explorationNode);
Preconditions.checkState(
!state1.mustBreak(), "We messed up, it wants to break a bunch of splits that shouldn't be broken");
// If a break was still forced somehow even though we could fit the leadingWidth, then abort.
// This could happen if inner levels have set a `columnLimitBeforeLastBreak` or something like that.
if (state1.numLines() != state.numLines()) {
return Optional.empty();
}

// Ok now how to handle the last level?
// There are two options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ class PalantirConjureJavaRuntime1285_SslSocketFactories {
KeyManager[] keyManagers = null;
if (config.keyStorePath().isPresent()) {
keyManagers = createKeyManagerFactory(
config.keyStorePath().get(), config.keyStorePassword()
.get(), config.keyStoreType(), config.keyStoreKeyAlias())
config.keyStorePath().get(),
config.keyStorePassword().get(),
config.keyStoreType(),
config.keyStoreKeyAlias())
.getKeyManagers();
}

Expand Down