GoogleCloudPlatform / GoogleCloudPlatform/google-cloud-eclipse

Investigate using null analysis via annotations

Offen
#430 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
cleanup priority: p4
Vorherrschende Sprache
Java
Sterne
90
Forks
52
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

JDT supports using JSR305-like annotations for indicating whether methods and field can return or hold `null` values.
- [Eclipse Help: Using Null Annotations](http://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.user/tasks/task-using_null_annotations.htm?cp=1_3_9_0)

We can use FindBugs/JSR305-style `javax.annotation.Nullable` and `Nonnull` annotations and/or the Eclipse JDT equivalents `org.eclipse.jdt.annotations.Nullable`, and `NonNull`. JDT supports specifying multiple annotations so we could mix both (or use libraries using either).

The JSR305-style annotations:
- 👍 FindBugs will use them too
- 👎 [imperfect match to Eclipse JDT null analysis](https://sourceforge.net/p/findbugs/bugs/1355/)

JDT annotations:
- 👍 @NonNullByDefault covers method return values too
- 👍 under Java 8, supports [annotating type uses](http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/task-using_null_type_annotations.htm), which allows things like `int processWithoutNulls (@NonNull List<@NonNull Integer> ints)` to guarantee that `null` won't be present in `ints`
- 👍 👎 Unsure if we can configure FindBugs to use these annotations though [it seems some are using them](https://sourceforge.net/p/findbugs/bugs/1425/)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verlinkten Eclipse Help-Seite zu null annotations und vergleiche anschließend die im Issue beschriebenen Annotationsoptionen im JSR305-Stil und für Eclipse JDT, einschließlich ihrer FindBugs-Kompatibilität. Als abgeschlossen gilt die Recherche, wenn der unterstützte Annotationsansatz und sein Umfang eindeutig bestimmt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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