Skip to content

Commit 0ee7d35

Browse files
committed
Merge upstream/main, fix submodules
2 parents f35319f + 7f5edd6 commit 0ee7d35

File tree

310 files changed

+1799
-1425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+1799
-1425
lines changed

.idea/checkstyle-idea.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.jbang/JabLsLauncher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
//DEPS org.jspecify:jspecify:1.0.0
3535

3636
// from jabls
37+
//DEPS com.fasterxml.jackson.core:jackson-databind:2.20.0
3738
//DEPS com.github.eclipse:lsp4j:0.24.0
3839
//DEPS info.picocli:picocli:4.7.7
3940
//DEPS org.apache.logging.log4j:log4j-to-slf4j:2.25.2
40-
//DEPS org.hisp.dhis:json-tree:1.8.1
4141
//DEPS org.jabref:afterburner.fx:2.0.0
4242
//DEPS org.slf4j:jul-to-slf4j:2.0.17
4343
//DEPS org.slf4j:slf4j-api:2.0.17

build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,6 @@ extraJavaModuleInfo {
463463
requires("java.logging")
464464
}
465465

466-
module("org.hisp.dhis:json-tree", "org.hisp.dhis.jsontree") {
467-
preserveExisting()
468-
}
469-
470466
module("com.github.sialcasa.mvvmFX:mvvmfx-validation", "de.saxsys.mvvmfx.validation") {
471467
exportAllPackages()
472468
requireAllDefinedDependencies()

build-support/src/main/java/JournalListMvGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//DEPS org.openjfx:javafx-base:24.0.1
1010
//DEPS org.slf4j:slf4j-api:2.0.13
1111
//DEPS org.slf4j:slf4j-simple:2.0.13
12+
//DEPS org.jspecify:jspecify:1.0.0
1213

1314
//SOURCES ../../../../jablib/src/main/java/org/jabref/logic/journals/Abbreviation.java
1415
//SOURCES ../../../../jablib/src/main/java/org/jabref/logic/journals/AbbreviationFormat.java

build-support/src/main/java/LtwaListMvGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//DEPS info.debatty:java-string-similarity:2.0.0
88
//DEPS org.jooq:jool:0.9.14
99
//DEPS org.openjfx:javafx-base:24.0.1
10+
//DEPS org.jspecify:jspecify:1.0.0
1011
//DEPS org.slf4j:slf4j-api:2.0.13
1112
//DEPS org.slf4j:slf4j-simple:2.0.13
1213

docs/code-howtos/javafx.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public String getHeading() {
6868
* Create constructor which initializes the fields to their default values. Write tests to ensure that everything works as expected!
6969

7070
```java
71-
public MyDialogViewModel(Dependency dependency) {
72-
this.dependency = Objects.requireNonNull(dependency);
71+
public MyDialogViewModel(@NonNull Dependency dependency) {
72+
this.dependency = dependency;
7373
heading.set("Hello " + dependency.getUserName());
7474
}
7575
```

docs/decisions/0051-handle-nested-json-paths.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ When trying to parse nested JSON structures in JabLS which receives the VSCode s
1212
## Considered Options
1313

1414
* Use `org.hisp.dhis:json-tree`
15+
* Use Jackson
1516
* Use Unirest and Optional
1617
* Use GSON and chaining Optional
1718
* Use an own method to parse the path
1819

1920
## Decision Outcome
2021

21-
Chosen option: "Use `org.hisp.dhis:json-tree`", because comes out best (see below).
22+
Chosen option: "Use Jackson" because it comes out best (see below).
2223

2324
## Pros and Cons of the Options
2425

@@ -34,6 +35,17 @@ this.integrityCheck = json.getBoolean("jabref.integrityCheck.enabled").booleanVa
3435
* Good, because it has a fallback value
3536
* Bad, because it introduces a new dependency
3637

38+
### Use Jackson
39+
40+
```java
41+
this.consistencyCheck = node.at("/jabref/consistencyCheck/enabled").asBoolean(this.consistencyCheck);
42+
```
43+
44+
* Good, because very compact and readable
45+
* Good, because no Exception is thrown if path does not exist
46+
* Good, because it supports nested paths directly
47+
* Good, because it has a fallback value
48+
3749
### Use Unirest and Optional
3850

3951
```java
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Adopt JSpecify nullness annotations for compile-time null safety
3+
nav_order: 51
4+
parent: Decision Records
5+
status: pending
6+
---
7+
8+
# Adopt JSpecify nullness annotations for compile-time null safety
9+
10+
## Context and Problem Statement
11+
12+
Our Java codebase contains inconsistent handling of nullability.
13+
We want to detect null-safety issues earlier at compile time and improve API clarity.
14+
15+
## Decision Drivers
16+
17+
* Reduce `NullPointerException`s in production by shifting detection to compile time.
18+
* Provide clearer API contracts.
19+
* Keep runtime overhead low.
20+
* Ensure incremental and low-risk adoption.
21+
22+
## Considered Options
23+
24+
* Do nothing and keep status quo.
25+
* Use `Objects.requireNonNull` and defensive runtime checks.
26+
* Adopt JSpecify annotations.
27+
* Use `assert x == null`.
28+
29+
## Decision Outcome
30+
31+
Chosen option: "Adopt JSpecify annotations" because comes out best (see below).
32+
33+
## Consequences
34+
35+
* Earlier detection of potential NPEs.
36+
* Clearer API documentation.
37+
* Requires training and CI integration.
38+
* Some friction with unannotated third-party libraries.
39+
40+
## Pros and Cons of the Options
41+
42+
### Do nothing and keep status quo
43+
44+
* Good, because no immediate implementation work.
45+
* Bad, because NPEs remain runtime-only problems.
46+
* Bad, because a mix of different approaches leads to bad code.
47+
* Bad, because it increases technical debt.
48+
* Bad, because assumes that non-annotated symbols allow null.
49+
50+
### Use `Objects::requireNonNull`
51+
52+
* Good, because JDK native.
53+
* Good, because no external dependencies.
54+
* Good, because it makes NPEs more visible on runtime.
55+
* Bad, because it adds runtime overhead.
56+
* Bad, because it does not provide compile-time contracts.
57+
* Bad, because it is not self-documenting for API contract.
58+
59+
### Adopt JSpecify annotations
60+
61+
* Good, because it offers compile-time null safety detection.
62+
* Good, because it works well with common IDEs.
63+
* Good, because of standardized annotations.
64+
* Good, because incremental adoption possible.
65+
* Good, because static analysis supported.
66+
* Good, because compatibility with Kotlin.
67+
* Good, because it is the consensus among major organizations (Google, Microsoft, Jetbrains etc).
68+
* Bad, because it requires annotation effort.
69+
* Bad, because it requires developer training.
70+
71+
### Use `assert x == null`
72+
73+
* Good, because Java language native.
74+
* Good, because no external dependencies.
75+
* Good, because easily readable.
76+
* Good, because it makes NPEs more visible on runtime.
77+
* Bad, because runs by default only in debug mode with option "-ea".
78+
* Bad, because it does not provide compile-time null safety.
79+
* Bad, because it is not self-documenting for API contract.

jabgui/src/main/java/org/jabref/gui/JabRefGuiStateManager.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.ArrayList;
44
import java.util.List;
5-
import java.util.Objects;
65
import java.util.Optional;
76
import java.util.function.Function;
87

@@ -45,6 +44,7 @@
4544
import com.tobiasdiez.easybind.EasyBind;
4645
import com.tobiasdiez.easybind.EasyBinding;
4746
import com.tobiasdiez.easybind.PreboundBinding;
47+
import org.jspecify.annotations.NonNull;
4848
import org.slf4j.Logger;
4949
import org.slf4j.LoggerFactory;
5050

@@ -144,8 +144,7 @@ public void setSelectedEntries(List<BibEntry> newSelectedEntries) {
144144
}
145145

146146
@Override
147-
public void setSelectedGroups(BibDatabaseContext context, List<GroupTreeNode> newSelectedGroups) {
148-
Objects.requireNonNull(newSelectedGroups);
147+
public void setSelectedGroups(BibDatabaseContext context, @NonNull List<GroupTreeNode> newSelectedGroups) {
149148
selectedGroups.computeIfAbsent(context.getUid(), k -> FXCollections.observableArrayList()).setAll(newSelectedGroups);
150149
}
151150

0 commit comments

Comments
 (0)