jhipster / jhipster/prettier-java

sort module-info

オープン
#643 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
1.2k
フォーク
120
平均マージ
1日 14時間
マージ済み PR(30日)
27

説明

**Prettier-Java 2.5.0**

**Input:**

```java
module com.xenoterracide.tools.java {
exports com.xenoterracide.tools0.java.function;
exports com.xenoterracide.tools0.java.annotation;
requires java.base;
requires jakarta.annotation;
}
```

**Output:**

```java
module com.xenoterracide.tools.java {
exports com.xenoterracide.tools0.java.function;
exports com.xenoterracide.tools0.java.annotation;
requires java.base;
requires jakarta.annotation;
}
```

**Expected behavior:**

some kind of sorting, for convienience, like sorting imports. Note: I don't think functionally the order matters, but I've linked the JLS spec in case it defines it. It does seem to show an order (that's not alphabetic only). Also I don't have an opinion other than it should sort and should conform to JLS.

I'll be honest, I haven't really read this spec, so please verify my output conforms.. but it looks like it should be as follows. Obviously my example is not comprehensive https://docs.oracle.com/javase/specs/jls/se9/html/jls-7.html#jls-7.7

```java
module com.xenoterracide.tools.java {
requires jakarta.annotation;
requires java.base;
exports com.xenoterracide.tools0.java.annotation;
exports com.xenoterracide.tools0.java.function;
}
```

note: I think it's acceptable just to make this an alpha sort with some grouping, e.g. `requires` and `requires static` and `requires transient` are different groups. `requires stuff` shouldn't be mixed next to `requires static`. This is currently one of my most complex examples.

```java
import org.jspecify.annotations.NullMarked;

/**
* JPA utilities.
*/
@NullMarked module com.xenoterracide.commons.jpa {
exports com.xenoterracide.commons.jpa;
exports com.xenoterracide.commons.jpa.annotation;
exports com.xenoterracide.commons.jpa.util;
exports com.xenoterracide.commons.jpa.transaction to spring.beans, spring.context;

opens com.xenoterracide.commons.jpa to org.hibernate.orm.core, spring.core, org.hibernate.validator;
opens com.xenoterracide.commons.jpa.transaction to spring.core;

requires org.apache.commons.lang3;
requires spring.data.commons;
requires spring.beans;
requires spring.context;
requires spring.tx;
requires org.hibernate.orm.envers;

requires static org.jspecify;
requires static com.xenoterracide.tools.java;
requires static jakarta.annotation;
requires static org.jmolecules.architecture.layered;

requires transitive jakarta.persistence;
requires transitive jakarta.validation;
requires transitive com.xenoterracide.model;
requires org.jmolecules.ddd;
}
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reviewing the module-info.java examples in the issue and the linked JLS section 7.7 to determine the required directive and modifier ordering. Done means module declarations are sorted consistently, with separate groups for requires, requires static, and requires transitive, while exports and opens are ordered appropriately.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。