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

chore(deps): update dependency prettier-plugin-java to v2 #14

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 2, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
prettier-plugin-java (source) ~1.0.2 -> ~2.6.0 age adoption passing confidence

Release Notes

jhipster/prettier-java (prettier-plugin-java)

v2.6.4: 2.6.4

Compare Source

Fixes

Misc

v2.6.3

Compare Source

v2.6.2

Compare Source

v2.6.1

Compare Source

v2.6.0

Compare Source

Enhancements

Fixes

Misc

v2.5.0

Compare Source

Enhancements

Fixes

Miscellaneous

v2.4.0

Compare Source

Enhancements

v2.3.1

Compare Source

Fixes

v2.3.0

Compare Source

Enhancements

  • Break long lines on type arguments (#​584)
  • Break and indent binary expression with cast properly (#​587)
  • Adjust indentation of multiline string (Issue #​593 fixed with #​596)
  • Improves binary expression formatting (#​594)
  • Supports JLS annotation style (#​586

Thanks to @​jtkiesel for all of these contributions !

Fixes

v2.2.0

Compare Source

Enhancements

  • Upgrade prettier version to Prettier v3

v2.1.0

Compare Source

Enhancements

// Input
/**
 * @​prettier
 */
public class Example {

  private int test = -1;
}

// Output with require-pragma option activated
/**
 * @​prettier
 */
public class Example {

  private int test = -1;
}

// Input
public class Example {

  private int test = -1;
}

// Output with require-pragma option activated
public class Example {

  private int test = -1;
}

Fixes

// Input
class Example {

  void example() {
    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      new Object().someMethod();

    Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes2 =
      new Object[] { new Object(), new Object() };

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes3 =
      SomeClass.someStaticMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      someMethod().anotherMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      anotherValue != null ? anotherValue : new Object();
  }
}

// Output
class Example {

  void example() {
    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      new Object().someMethod();

    Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes2 =
      new Object[] { new Object(), new Object() };

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes3 =
      SomeClass.someStaticMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      someMethod().anotherMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      anotherValue != null ? anotherValue : new Object();
  }
}

v2.0.0

Compare Source

Breaking changes

  • Drop support of Node.js 12

Enhancements

// Input
class T {

  void test(Buyer other) {
    return switch (other) {
      case null -> true;
      case Buyer b && this.bestPrice > b.bestPrice -> true;
      case Buyer b && this.bestPrice > b.bestPrice -> {
        return true;
      }
      case (Buyer b && this.bestPrice > b.bestPrice) -> true;
      case Buyer b &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice -> true;
      case Buyer b &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice -> {
        return true;
      }
      case (
          Buyer b &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice
        ) -> true;
      case (
          Buyer b &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice
        ) -> {
        return true;
      }
      default -> false;
    };
  }
}

// Output
class T {

  void test(Buyer other) {
    return switch (other) {
      case null -> true;
      case Buyer b && this.bestPrice > b.bestPrice -> true;
      case Buyer b && this.bestPrice > b.bestPrice -> {
        return true;
      }
      case (Buyer b && this.bestPrice > b.bestPrice) -> true;
      case Buyer b &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice -> true;
      case Buyer b &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice &&
        this.bestPrice > b.bestPrice -> {
        return true;
      }
      case (
          Buyer b &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice
        ) -> true;
      case (
          Buyer b &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice &&
          this.bestPrice > b.bestPrice
        ) -> {
        return true;
      }
      default -> false;
    };
  }
}

Fixes

  • Fix parsing of escaped spaces in strings (Issue #​541 closed with #​543)
public class Test {

  public static final String REGEX = "^\s$";
}
// Input
open module org.myorg.module {
  requires some.required.module;

  exports org.myorg.module.exportpackage1;
  exports org.myorg.module.exportpackage2;
}
// Prettier 1.6.2
open module org.myorg.module {
  requires some.required.module;

  exports org.myorg.module.exportpackage1;
  exports org.myorg.module.exportpackage2;
}
// Prettier 1.6.3
open module org.myorg.module {
  requires some.required.module;

  exports org.myorg.module.exportpackage1;
  exports org.myorg.module.exportpackage2;
}

Misc

  • doc: add VSCode Java import order configuration (#​546)
    Thanks to @​derkoe for the contribution

v1.6.2

Compare Source

Fixes

  • Fix parsing of nested sealed and non-sealed classes & interfaces inside interfaces (Issue #​533 closed with #​538)
public interface Test {
  sealed interface Inner {}

  public abstract static sealed class SealedParent {}

  non-sealed interface Inner {}

  public abstract static non-sealed class SealedParent {}

  static final class SealedChild extends SealedParent {}
}
  • Fix incorrect reformating of type bounds in a generic extends clause (Issue #​536 closed with #​537)
// Input
public class Foo<T> {

  public <U extends @&#8203;NotNull T> void example(U u) {}

  public <U extends com.java.Any.@&#8203;NotNull T> void example(U u) {}
}

// Prettier 1.6.1
public class Foo<T> {

  public <U extends @&#8203;NotNullT> void example(U u) {}

  public <U extends com.java.Any.@&#8203;NotNullT> void example(U u) {}
}

// Prettier 1.6.2
public class Foo<T> {

  public <U extends @&#8203;NotNull T> void example(U u) {}

  public <U extends com.java.Any.@&#8203;NotNull T> void example(U u) {}
}

v1.6.1

Compare Source

Fixes

  • Fix parsing of nested sealed and non-sealed classes (Issue #​522 closed with #​523)
// Input
public class SealedClasses {

  public abstract static sealed class SealedParent permits SealedChild {}

  static final class SealedChild extends SealedParent {}
}

// Output
public class NestedSealedClasses {

  public abstract static sealed class SealedParent permits SealedChild {}

  static final class SealedChild extends SealedParent {}
}

v1.6.0

Compare Source

Enhancements

  • Improve formatting of records parameters with annotations
// Input
public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description")
  Status status,

  @&#8203;NotNull Integer number
) {}

public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description")
  // comment
  Status status,

  // another comment
  @&#8203;NotNull Integer number
) {}

// Prettier v1.5.0
public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description")
  Status status,
  @&#8203;NotNull Integer number
) {}

public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description") // comment
  Status status,
  // another comment
  @&#8203;NotNull Integer number
) {}

// Prettier v1.6.0
public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description")
  Status status,

  @&#8203;NotNull Integer number
) {}

public record Record(
  @&#8203;JsonSerialize(
    using = StatusSerializer.class,
    nullsUsing = NullSerializer.class
  )
  @&#8203;Schema(type = "integer", description = "Some fancy description")
  // comment
  Status status,

  // another comment
  @&#8203;NotNull Integer number
) {}

Fixes

  • Fix casting with additional bounds
// Input
class Example {
  void should_cast_with_single_element() {
    var myElem = (int) othrElement;
    var myElem = (A) othrElement;
    var myElem = (A) (othrElement, value) -> othrElement + value;
    var myElem = (Aaeaozeaonzeoazneaozenazonelkadndpndpazdpazdpazdpazdpazeazpeaazdpazdpazpdazdpa) othrElement;
  }

  void should_cast_with_additional_bounds() {
    foo((A & B) obj);
    foo((A & B & C) obj);
    foo((Aaeaozeaonzeoazneaozenazone & Bazoieoainzeonaozenoazne & Cjneazeanezoanezoanzeoaneonazeono) obj);
    foo((Aaeaozeaonzeoazneaozenazone & Bazoieoainzeonaozenoazne & Cjneazeanezoanezoanzeoaneonazeono) (othrElement, value) -> othrElement + value);
  }
}

// Prettier v1.5.0
class Example {

  void should_cast_with_single_element() {
    var myElem = (int) othrElement;
    var myElem = (A) othrElement;
    var myElem = (A) (othrElement, value) -> othrElement + value;
    var myElem = (Aaeaozeaonzeoazneaozenazonelkadndpndpazdpazdpazdpazdpazeazpeaazdpazdpazpdazdpa) othrElement;
  }

  void should_cast_with_additional_bounds() {
    foo((A) & B obj);
    foo((A) & B& C obj);
    foo(
      (Aaeaozeaonzeoazneaozenazone) & Bazoieoainzeonaozenoazne& Cjneazeanezoanezoanzeoaneonazeono obj
    );
    foo(
      (Aaeaozeaonzeoazneaozenazone) & Bazoieoainzeonaozenoazne& Cjneazeanezoanezoanzeoaneonazeono (
          othrElement,
          value
        ) ->
        othrElement + value
    );
  }
}

// Prettier v1.6.0
class Example {

  void should_cast_with_single_element() {
    var myElem = (int) othrElement;
    var myElem = (A) othrElement;
    var myElem = (A) (othrElement, value) -> othrElement + value;
    var myElem = (Aaeaozeaonzeoazneaozenazonelkadndpndpazdpazdpazdpazdpazeazpeaazdpazdpazpdazdpa) othrElement;
  }

  void should_cast_with_additional_bounds() {
    foo((A & B) obj);
    foo((A & B & C) obj);
    foo(
      (
        Aaeaozeaonzeoazneaozenazone
        & Bazoieoainzeonaozenoazne
        & Cjneazeanezoanezoanzeoaneonazeono
      ) obj
    );
    foo(
      (
        Aaeaozeaonzeoazneaozenazone
        & Bazoieoainzeonaozenoazne
        & Cjneazeanezoanezoanzeoaneonazeono
      ) (othrElement, value) -> othrElement + value
    );
  }
}

v1.5.0

Compare Source

Enhancements

  • Split record parameters on several lines if they do not fit on a single line (#​509)

    // Input
    public record Person(
      String firstName,
      String lastName,
      String email,
      String phoneNumber,
      String streetAddress,
      String city,
      String state,
      String zipCode
    ) {}
    
    // Prettier 1.4.0
    public record Person(
      String firstName,
      String lastName,
      String email,
      String phoneNumber,
      String streetAddress,
      String city,
      String state,
      String zipCode
    ) {}
    
    // Prettier 1.5.0
    public record Person(
      String firstName,
      String lastName,
      String email,
      String phoneNumber,
      String streetAddress,
      String city,
      String state,
      String zipCode
    ) {}
  • Support pattern matching in switch statements preview feature (#​511)

    // Input
    class T {
    
      static String formatterPatternSwitch(Object o) {
        return switch (o) {
          case Integer i -> String.format("int %d", i);
          case Long l -> String.format("long %d", l);
          case Double d -> String.format("double %f", d);
          case String s -> String.format("String %s", s);
          case TOTO -> String.format("TOTO %s", o);
          case null -> String.format("Null !");
          case default -> String.format("Default !");
          default -> o.toString();
        };
      }
    }
    
    // Output
    class T {
    
      static String formatterPatternSwitch(Object o) {
        return switch (o) {
          case Integer i -> String.format("int %d", i);
          case Long l -> String.format("long %d", l);
          case Double d -> String.format("double %f", d);
          case String s -> String.format("String %s", s);
          case TOTO -> String.format("TOTO %s", o);
          case null -> String.format("Null !");
          case default -> String.format("Default !");
          default -> o.toString();
        };
      }
    }
  • Improve printing of class with long typeParameterList (#​512)

    // Input
    public class ComplexGenericClass<
      BEAN extends AbstractBean & BeanItemSelect<BEANTYPE>,
      BEANTYPE,
      CONFIG extends BeanConfig<BEAN, BEANTYPE, CONFIG>
    > {}
    
    // Prettier 1.4.0
    public class ComplexGenericClass<
      BEAN extends AbstractBean & BeanItemSelect<BEANTYPE>,
      BEANTYPE,
      CONFIG extends BeanConfig<BEAN, BEANTYPE, CONFIG>
    > {}
    
    // Prettier 1.5.0
    public class ComplexGenericClass<
      BEAN extends AbstractBean & BeanItemSelect<BEANTYPE>,
      BEANTYPE,
      CONFIG extends BeanConfig<BEAN, BEANTYPE, CONFIG>
    > {}

v1.4.0

Compare Source

Enhancements

  • Improve method invocation with lambda parameters (#​497)

Fixes

  • Fix parsing of static imports of yield methods (#​499)
  • Improve java-parser types signatures (#​496)

v1.3.1

Compare Source

Fixes

  • Fix interface member detection to support inner records
    (From @​rnorth: #​492)
  • Remove yarn-error.log file from releases

v1.3.0

Compare Source

Enhancements

  • Add a space after generic constructor type parameters (#​485)
// Input
public <T> GenericConstructor(T genericParameter) {}

// Prettier 1.2.0
public <T>GenericConstructor(T genericParameter) {}

// Prettier 1.2.1
public <T> GenericConstructor(T genericParameter) {}

v1.2.0

Compare Source

Enhancements

  • Supports of instance of pattern matching (#​476)
// Input
if (o instanceof Integer i || p instanceof Point || q instanceof Circle c || r instanceof Square) {
  formatted = String.format("int %d", i);
} else if (o instanceof Long l) {
  formatted = String.format("long %d", l);
} else if (o instanceof Double d) {
  formatted = String.format("double %f", d);
} else if (o instanceof String s) {
  formatted = String.format("String %s", s);
}

// Output
if (
  o instanceof Integer i ||
  p instanceof Point ||
  q instanceof Circle c ||
  r instanceof Square
) {
  formatted = String.format("int %d", i);
} else if (o instanceof Long l) {
  formatted = String.format("long %d", l);
} else if (o instanceof Double d) {
  formatted = String.format("double %f", d);
} else if (o instanceof String s) {
  formatted = String.format("String %s", s);
}
  • Supports of sealed classes and interfaces (#​478)
// Input
public sealed class Rectangle implements Shape permits Square {

  private final double length;
  private final double height;

  public Rectangle(double length, double height) {
    this.length = length;
    this.height = height;
  }

  @&#8203;Override
  public double area() {
    return length * height;
  }
}

// Output
public sealed class Rectangle implements Shape permits Square {

  private final double length;
  private final double height;

  public Rectangle(double length, double height) {
    this.length = length;
    this.height = height;
  }

  @&#8203;Override
  public double area() {
    return length * height;
  }
}

Miscellaneous

v1.1.1

Compare Source

Fixes

  • Fix parsing records inside class declarations
    and records with simplified constructors
    (#​470)

Miscellaneous

v1.1.0

Compare Source

Enhancements

// Input
public record Pet(
  @&#8203;NotNull String name,
  int age,
  String... others,
  Object @&#8203;Nullable... errorMessageArgs
) {
  public Pet {
    if (age < 0) {
      throw new IllegalArgumentException("Age cannot be negative");
    }

    if (name == null || name.isBlank()) {
      throw new IllegalArgumentException("Name cannot be blank");
    }
  }

  public void test() {}
}

// Output
public record Pet(
  @&#8203;NotNull String name,
  int age,
  String... others,
  Object @&#8203;Nullable... errorMessageArgs
) {
  public Pet {
    if (age < 0) {
      throw new IllegalArgumentException("Age cannot be negative");
    }

    if (name == null || name.isBlank()) {
      throw new IllegalArgumentException("Name cannot be blank");
    }
  }

  public void test() {}
}

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch 2 times, most recently from 5e7692d to c1e2426 Compare April 4, 2023 18:19
@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch from c1e2426 to 3e28106 Compare July 11, 2023 10:21
@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch from 3e28106 to 2cd4bc4 Compare August 24, 2023 21:08
@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch from 2cd4bc4 to 7114761 Compare November 15, 2023 20:13
@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch from 7114761 to 8884778 Compare November 29, 2023 20:20
@renovate renovate bot force-pushed the renovate/prettier-plugin-java-2.x branch from 8884778 to ef45a82 Compare February 25, 2024 11:00
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.

0 participants