-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Nullability assertions to jspecify (#2048)
Away from jsr305 With the goal of having a nullability assertion annotation that supports Java modules, so we can release the next version of jsoup. Annotation options appear limited and does not support @WillClose, but rest appears OK. Fixes #2028 Fixes #1992
- Loading branch information
Showing
42 changed files
with
81 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
Package containing classes supporting the core jsoup code. | ||
*/ | ||
@NonnullByDefault | ||
@NullMarked | ||
package org.jsoup.helper; | ||
|
||
import org.jsoup.internal.NonnullByDefault; | ||
import org.jspecify.annotations.NullMarked; |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/jsoup/internal/FieldsAreNonnullByDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.jsoup.internal; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.meta.TypeQualifierDefault; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
Indicates that fields types are not nullable, unless otherwise specified by @Nullable. | ||
@see javax.annotation.ParametersAreNonnullByDefault | ||
@deprecated Previously indicated that fields types are not nullable, unless otherwise specified by @Nullable. | ||
*/ | ||
@Deprecated | ||
@Documented | ||
@Nonnull | ||
@TypeQualifierDefault(ElementType.FIELD) | ||
@NullMarked | ||
@Retention(value = RetentionPolicy.CLASS) | ||
public @interface FieldsAreNonnullByDefault { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.jsoup.internal; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.meta.TypeQualifierDefault; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
Indicates that all components (methods, returns, fields) are not nullable, unless otherwise specified by @Nullable. | ||
@see javax.annotation.ParametersAreNonnullByDefault | ||
@deprecated Previously indicated that all components (methods, returns, fields) are not nullable, unless otherwise specified by @Nullable. | ||
*/ | ||
@Deprecated | ||
@Documented | ||
@Nonnull | ||
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) | ||
@NullMarked | ||
@Retention(value = RetentionPolicy.CLASS) | ||
public @interface NonnullByDefault { | ||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/org/jsoup/internal/ReturnsAreNonnullByDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package org.jsoup.internal; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.meta.TypeQualifierDefault; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
Indicates return types are not nullable, unless otherwise specified by @Nullable. | ||
@see javax.annotation.ParametersAreNonnullByDefault | ||
@deprecated Previously indicated that return types are not nullable, unless otherwise specified by @Nullable. | ||
*/ | ||
@Deprecated | ||
@Documented | ||
@Nonnull | ||
@TypeQualifierDefault(ElementType.METHOD) | ||
@NullMarked | ||
@Retention(value = RetentionPolicy.RUNTIME) | ||
public @interface ReturnsAreNonnullByDefault { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
HTML document structure nodes. | ||
*/ | ||
@NonnullByDefault | ||
@NullMarked | ||
package org.jsoup.nodes; | ||
|
||
import org.jsoup.internal.NonnullByDefault; | ||
import org.jspecify.annotations.NullMarked; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
Contains the main {@link org.jsoup.Jsoup} class, which provides convenient static access to the jsoup functionality. | ||
*/ | ||
@NonnullByDefault | ||
@NullMarked | ||
package org.jsoup; | ||
|
||
import org.jsoup.internal.NonnullByDefault; | ||
import org.jspecify.annotations.NullMarked; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.