|
1 | 1 | # Latest v1.6.2
|
2 | 2 |
|
| 3 | +## Breaking changes |
| 4 | +- Drop support of Node.js 12 |
| 5 | + |
| 6 | +## Enhancements |
| 7 | + |
| 8 | +- Support pattern matching guards (Issue [#535](https://github.com/jhipster/prettier-java/issues/535) closed with [#559](https://github.com/jhipster/prettier-java/pull/559)) |
| 9 | + |
| 10 | +```java |
| 11 | +// Input |
| 12 | +class T { |
| 13 | + |
| 14 | + void test(Buyer other) { |
| 15 | + return switch (other) { |
| 16 | + case null -> true; |
| 17 | + case Buyer b && this.bestPrice > b.bestPrice -> true; |
| 18 | + case Buyer b && this.bestPrice > b.bestPrice -> { |
| 19 | + return true; |
| 20 | + } |
| 21 | + case (Buyer b && this.bestPrice > b.bestPrice) -> true; |
| 22 | + case Buyer b && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice -> true; |
| 23 | + case Buyer b && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice -> { |
| 24 | + return true; |
| 25 | + } |
| 26 | + case (Buyer b && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice) -> true; |
| 27 | + case (Buyer b && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice && this.bestPrice > b.bestPrice) -> { |
| 28 | + return true; |
| 29 | + } |
| 30 | + default -> false; |
| 31 | + }; |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +// Output |
| 36 | +class T { |
| 37 | + void test(Buyer other) { |
| 38 | + return switch (other) { |
| 39 | + case null -> true; |
| 40 | + case Buyer b && this.bestPrice > b.bestPrice -> true; |
| 41 | + case Buyer b && this.bestPrice > b.bestPrice -> { |
| 42 | + return true; |
| 43 | + } |
| 44 | + case (Buyer b && this.bestPrice > b.bestPrice) -> true; |
| 45 | + case Buyer b && |
| 46 | + this.bestPrice > b.bestPrice && |
| 47 | + this.bestPrice > b.bestPrice && |
| 48 | + this.bestPrice > b.bestPrice && |
| 49 | + this.bestPrice > b.bestPrice -> true; |
| 50 | + case Buyer b && |
| 51 | + this.bestPrice > b.bestPrice && |
| 52 | + this.bestPrice > b.bestPrice && |
| 53 | + this.bestPrice > b.bestPrice && |
| 54 | + this.bestPrice > b.bestPrice -> { |
| 55 | + return true; |
| 56 | + } |
| 57 | + case ( |
| 58 | + Buyer b && |
| 59 | + this.bestPrice > b.bestPrice && |
| 60 | + this.bestPrice > b.bestPrice && |
| 61 | + this.bestPrice > b.bestPrice && |
| 62 | + this.bestPrice > b.bestPrice |
| 63 | + ) -> true; |
| 64 | + case ( |
| 65 | + Buyer b && |
| 66 | + this.bestPrice > b.bestPrice && |
| 67 | + this.bestPrice > b.bestPrice && |
| 68 | + this.bestPrice > b.bestPrice && |
| 69 | + this.bestPrice > b.bestPrice |
| 70 | + ) -> { |
| 71 | + return true; |
| 72 | + } |
| 73 | + default -> false; |
| 74 | + }; |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | + |
| 80 | +## Fixes |
| 81 | + |
| 82 | +- Fix parsing of escaped spaces in strings (Issue [#541](https://github.com/jhipster/prettier-java/issues/541) closed with [#543](https://github.com/jhipster/prettier-java/pull/543)) |
| 83 | + |
| 84 | +```java |
| 85 | +public class Test { |
| 86 | + |
| 87 | + public static final String REGEX = "^\s$"; |
| 88 | + |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +- Fix unwanted space in "exports"-statement in module-info.java (Issue [#550](https://github.com/jhipster/prettier-java/issues/550) closed with [#551](https://github.com/jhipster/prettier-java/pull/551)) |
| 93 | + Thanks to [@BjornJaspers](https://github.com/BjornJaspers) for the fix |
| 94 | + |
| 95 | +```java |
| 96 | +// Input |
| 97 | +open module org.myorg.module { |
| 98 | + requires some.required.module; |
| 99 | + |
| 100 | + exports org.myorg.module.exportpackage1; |
| 101 | + exports org.myorg.module.exportpackage2; |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +```java |
| 106 | +// Prettier 1.6.2 |
| 107 | +open module org.myorg.module { |
| 108 | + requires some.required.module; |
| 109 | + |
| 110 | + exports org.myorg.module.exportpackage1 ; |
| 111 | + exports org.myorg.module.exportpackage2 ; |
| 112 | +} |
| 113 | +``` |
| 114 | + |
| 115 | +```java |
| 116 | +// Prettier 1.6.3 |
| 117 | +open module org.myorg.module { |
| 118 | + requires some.required.module; |
| 119 | + |
| 120 | + exports org.myorg.module.exportpackage1; |
| 121 | + exports org.myorg.module.exportpackage2; |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +## Misc |
| 126 | +- doc: add VSCode Java import order configuration ([#546](https://github.com/jhipster/prettier-java/pull/546)) |
| 127 | + Thanks to [@derkoe](https://github.com/derkoe) for the contribution |
| 128 | + |
| 129 | +# v1.6.2 |
| 130 | + |
3 | 131 | ## Fixes
|
4 | 132 |
|
5 | 133 | - Fix parsing of nested sealed and non-sealed classes & interfaces inside interfaces (Issue [#533](https://github.com/jhipster/prettier-java/issues/533) closed with [#538](https://github.com/jhipster/prettier-java/pull/538))
|
|
0 commit comments