Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

sort module-info

Offen
#643 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
java
Bereich
tooling

Rechercherichtung

Beginne damit, die module-info.java-Beispiele im Issue und den verlinkten JLS-Abschnitt 7.7 zu prüfen, um die erforderliche Reihenfolge von Direktiven und Modifiern zu bestimmen. Erledigt ist die Aufgabe, wenn Moduldeklarationen konsistent sortiert sind, mit separaten Gruppen für requires, requires static und requires transitive, während exports und opens angemessen geordnet sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Prettier-Java 2.5.0

Input:

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

Output:

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

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.

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;
}
Vorherrschende Sprache
Java
Sterne
1.2k
Forks
123
Ø Merge
2 T. 10 Std.
Gemergte PRs (30 T.)
35

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus jhipster/prettier-java

Alle Issues in jhipster/prettier-java

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.