prettier-plugin-java 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright 2013-2020 Shahar Soel and the respective prettier-java contributors
2
+ Copyright 2018-2021 the original author or authors from the JHipster project
3
3
 
4
4
  Apache License
5
5
  Version 2.0, January 2004
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "prettier-plugin-java",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Prettier Java Plugin",
5
5
  "main": "src/index.js",
6
6
  "repository": "https://github.com/jhipster/prettier-java",
7
7
  "license": "Apache-2.0",
8
8
  "dependencies": {
9
- "java-parser": "1.0.0",
10
- "lodash": "4.17.20",
9
+ "java-parser": "1.0.2",
10
+ "lodash": "4.17.21",
11
11
  "prettier": "2.2.1"
12
12
  },
13
13
  "scripts": {
@@ -20,5 +20,5 @@
20
20
  "test:all": "npm-run-all test test:e2e-jhipster1 test:e2e-jhipster2",
21
21
  "clone-samples": "node scripts/clone-samples.js"
22
22
  },
23
- "gitHead": "f25534b7ad3720f5fb22d48b1edf5e601c794837"
23
+ "gitHead": "d4dbac80d37d361f314205956547becfafca685f"
24
24
  }
@@ -354,6 +354,7 @@ class ClassesPrettierVisitor {
354
354
  currentSegment = [];
355
355
  } else if (token.name === "annotation") {
356
356
  currentSegment.push(this.visit([token]));
357
+ currentSegment.push(" ");
357
358
  } else {
358
359
  currentSegment.push(token);
359
360
  if (
@@ -167,7 +167,7 @@ class ExpressionsPrettierVisitor {
167
167
  groupsOfOperator,
168
168
  sortedBinaryOperators
169
169
  } = separateTokensIntoGroups(ctx);
170
- const segmentsSplittedByBinaryOperator = [];
170
+ const segmentsSplitByBinaryOperator = [];
171
171
  let currentSegment = [];
172
172
 
173
173
  if (groupsOfOperator.length === 1 && groupsOfOperator[0].length === 0) {
@@ -212,7 +212,7 @@ class ExpressionsPrettierVisitor {
212
212
  );
213
213
  }
214
214
  }
215
- segmentsSplittedByBinaryOperator.push(
215
+ segmentsSplitByBinaryOperator.push(
216
216
  group(rejectAndJoin(" ", currentSegment))
217
217
  );
218
218
  });
@@ -227,7 +227,7 @@ class ExpressionsPrettierVisitor {
227
227
  group(
228
228
  rejectAndJoinSeps(
229
229
  sortedBinaryOperators.map(elt => concat([" ", elt, line])),
230
- segmentsSplittedByBinaryOperator
230
+ segmentsSplitByBinaryOperator
231
231
  )
232
232
  )
233
233
  ])
@@ -241,7 +241,7 @@ class ExpressionsPrettierVisitor {
241
241
  return group(
242
242
  rejectAndJoinSeps(
243
243
  sortedBinaryOperators.map(elt => concat([" ", elt, line])),
244
- segmentsSplittedByBinaryOperator
244
+ segmentsSplitByBinaryOperator
245
245
  )
246
246
  );
247
247
  }
@@ -341,7 +341,10 @@ class ExpressionsPrettierVisitor {
341
341
  suffixes.push(this.visit(ctx.primarySuffix[i]));
342
342
  }
343
343
 
344
- if (countMethodInvocation === 1) {
344
+ if (
345
+ countMethodInvocation === 1 &&
346
+ ctx.primaryPrefix[0].children.newExpression === undefined
347
+ ) {
345
348
  return group(
346
349
  rejectAndConcat([
347
350
  primaryPrefix,
@@ -583,10 +586,6 @@ class ExpressionsPrettierVisitor {
583
586
  }
584
587
 
585
588
  methodInvocationSuffix(ctx, params) {
586
- if (ctx.argumentList === undefined) {
587
- return rejectAndConcat([ctx.LBrace[0], ctx.RBrace[0]]);
588
- }
589
-
590
589
  const argumentList = this.visit(ctx.argumentList);
591
590
  if (params && params.shouldDedent) {
592
591
  return dedent(