-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possible exception with initializer body close to column limit (#257
- Loading branch information
1 parent
1848986
commit 438feb7
Showing
4 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type: fix | ||
fix: | ||
description: Fix edge case with empty levels causing formattings very close to the | ||
column limit to throw. | ||
links: | ||
- https://github.com/palantir/palantir-java-format/pull/257 |
This file contains 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
25 changes: 25 additions & 0 deletions
25
...ir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
public class Palantir12 { | ||
|
||
@Override | ||
public | ||
void | ||
foo() { | ||
new DogWalker() | ||
.walk( | ||
DogBreed.FOX_TERRIER, | ||
new RoadWalker<Void>() { | ||
@Override | ||
public Void call(Dog dog) { | ||
routes.forEach((route) -> route.getCoordinates() | ||
.forEach((coordinate) -> { | ||
coordinate.getOtherDogs().forEach(otherDog -> { | ||
if (!dog.likes(otherDog)) { | ||
badEncounters.computeIfAbsent(coordinate, _x -> new HashSet<>()) | ||
.add(dog).add(otherDog); | ||
} | ||
}); | ||
})); | ||
} | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...r-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.output
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
public class Palantir12 { | ||
|
||
@Override | ||
public void foo() { | ||
new DogWalker().walk(DogBreed.FOX_TERRIER, new RoadWalker<Void>() { | ||
@Override | ||
public Void call(Dog dog) { | ||
routes.forEach((route) -> route.getCoordinates().forEach((coordinate) -> { | ||
coordinate.getOtherDogs().forEach(otherDog -> { | ||
if (!dog.likes(otherDog)) { | ||
badEncounters | ||
.computeIfAbsent(coordinate, _x -> new HashSet<>()) | ||
.add(dog) | ||
.add(otherDog); | ||
} | ||
}); | ||
})); | ||
} | ||
}); | ||
} | ||
} |