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

@Immutable annotation for value classes

Offen
#36 0 Kommentare 14 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

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

Das Issue nennt keine Quelldatei oder keinen Testpfad; beginne damit, die vorhandenen Annotationsdefinitionen des Repositorys und ihre Konventionen zu überprüfen. Die Aufgabe ist erledigt, wenn eine entsprechende @Immutable-Annotation mit dokumentierter Unveränderlichkeitssemantik und geeigneten Typ-, Retention- und Dokumentationsmetadaten hinzugefügt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi!

I am currently migrating a projeect from jsr305 to java-annotations. One of the annotations I can't really seem to find an equivalent for is @Immutable. A class being @Immutable should not have setters and possibly not even non-final fields.

The original implementation and documentation:

/**
 * The class to which this annotation is applied is immutable. This means that
 * its state cannot be seen to change by callers. Of necessity this means that
 * all public fields are final, and that all public final reference fields refer
 * to other immutable objects, and that methods do not publish references to any
 * internal state which is mutable by implementation even if not by design.
 * Immutable objects may still have internal mutable state for purposes of
 * performance optimization; some state variables may be lazily computed, so
 * long as they are computed from immutable state and that callers cannot tell
 * the difference.
 * <p>
 * Immutable objects are inherently thread-safe; they may be passed between
 * threads or published without synchronization.
 */
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface Immutable {
}
Vorherrschende Sprache
Kotlin
Sterne
465
Forks
73
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

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 JetBrains/java-annotations

Alle Issues in JetBrains/java-annotations

Ähnliche Issues

Weitere Issues zu Kotlin

Neue Issues direkt in Ihr Postfach

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