diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/newmatch/Matcher.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/newmatch/Matcher.java
index fef875a12..cbf9d0674 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/newmatch/Matcher.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/newmatch/Matcher.java
@@ -20,6 +20,7 @@
*/
package org.xhtmlrenderer.css.newmatch;
+import org.jspecify.annotations.Nullable;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xhtmlrenderer.css.constants.MarginBoxName;
@@ -94,6 +95,7 @@ public CascadedStyle getCascadedStyle(Element e, boolean restyle) {
* May return null.
* We assume that restyle has already been done by a getCascadedStyle if necessary.
*/
+ @Nullable
public CascadedStyle getPECascadedStyle(Element e, String pseudoElement) {
synchronized (e) {
Mapper em = getMapper(e);
@@ -337,6 +339,7 @@ CascadedStyle getCascadedStyle(Node e) {
* May return null.
* We assume that restyle has already been done by a getCascadedStyle if necessary.
*/
+ @Nullable
public CascadedStyle getPECascadedStyle(Node e, String pseudoElement) {
Iterator To be implemented by any user agent using the panel. "User agent" is a
* term defined by the W3C in the documentation for XHTML and CSS; in most
@@ -51,7 +48,6 @@
*
* @author Torbjoern Gannholm
*/
-@ParametersAreNonnullByDefault
public interface UserAgentCallback {
/**
* Retrieves the CSS at the given URI. This is a synchronous call.
@@ -75,15 +71,15 @@ public interface UserAgentCallback {
* @param uri Location of the XML
* @return A XMLResource for the content at the URI.
*/
+ @Nullable
XMLResource getXMLResource(String uri);
/**
* Retrieves a binary resource located at a given URI and returns its contents
* as a byte array or {@code null} if the resource could not be loaded.
*/
- @Nullable
@CheckReturnValue
- byte[] getBinaryResource(String uri);
+ byte @Nullable [] getBinaryResource(String uri);
/**
* Normally, returns true if the user agent has visited this URI. UserAgent should consider
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/extend/package-info.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/extend/package-info.java
new file mode 100644
index 000000000..34451eede
--- /dev/null
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/extend/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package org.xhtmlrenderer.extend;
+
+import org.jspecify.annotations.NullMarked;
\ No newline at end of file
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/BoxBuilder.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/BoxBuilder.java
index b26a26f3a..b6887ecc2 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/BoxBuilder.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/BoxBuilder.java
@@ -20,6 +20,8 @@
*/
package org.xhtmlrenderer.layout;
+import com.google.errorprone.annotations.CheckReturnValue;
+import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -53,9 +55,6 @@
import org.xhtmlrenderer.render.FloatedBoxData;
import org.xhtmlrenderer.render.InlineBox;
-import javax.annotation.CheckReturnValue;
-import javax.annotation.Nullable;
-import javax.annotation.ParametersAreNonnullByDefault;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -81,7 +80,6 @@
* content for purposes of inserting anonymous block boxes and calculating
* the kind of content contained in a given block box.
*/
-@ParametersAreNonnullByDefault
public class BoxBuilder {
private static final Logger log = LoggerFactory.getLogger(BoxBuilder.class);
@@ -141,6 +139,7 @@ public static void createChildren(LayoutContext c, BlockBox parent) {
}
}
+ @Nullable
public static TableBox createMarginTable(
LayoutContext c,
PageInfo pageInfo,
@@ -244,6 +243,7 @@ public static TableBox createMarginTable(
return cellCount > 0 ? result : null;
}
+ @Nullable
private static TableCellBox createMarginBox(
LayoutContext c,
CascadedStyle cascadedStyle,
@@ -498,8 +498,8 @@ private static boolean isParentInline(BlockBox box) {
}
private static void createAnonymousTableContent(LayoutContext c, BlockBox source,
- IdentValue next,
- List{@code
* import org.xhtmlrenderer.simple.*;
- *
+ *
* public static void main(String[] args) {
- *
+ *
* // set up the xhtml panel XHTMLPanel xhtml = new XHTMLPanel();
* xhtml.setDocument(new URL("http://myserver.com/page.xhtml"));
- *
+ *
* JScrollPane scroll = new JScrollPane(xhtml);
* JFrame frame = new JFrame("Demo");
* frame.getContentPane().add(scroll);
@@ -70,7 +69,7 @@
* documents from a uri ({@link #setDocument(String uri)}),
* from a Document instance ({@link #setDocument(Document)}) or from an InputStream
* ({@link org.xhtmlrenderer.swing.BasicPanel#setDocument(java.io.InputStream,String)}).
* XHTMLPanel also lets you make simple changes with simple methods like
* {@link #setFontScalingFactor(float)}. If you want to make other changes you will
@@ -97,7 +96,6 @@
* @see The Flying Saucer Home Page
* @see RenderingContext
*/
-@ParametersAreNonnullByDefault
public class XHTMLPanel extends BasicPanel {
private static final long serialVersionUID = 1L;
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/DefaultFormSubmissionListener.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/DefaultFormSubmissionListener.java
index 25a474c52..66f37fff1 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/DefaultFormSubmissionListener.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/DefaultFormSubmissionListener.java
@@ -19,12 +19,9 @@
*/
package org.xhtmlrenderer.simple.extend;
-import javax.annotation.ParametersAreNonnullByDefault;
-
/**
* No-op implementation of a FormSubmissionListener; override the submit method in a subclass as needed.
*/
-@ParametersAreNonnullByDefault
public class DefaultFormSubmissionListener implements FormSubmissionListener {
public void submit(String query) { }
}
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/FormSubmissionListener.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/FormSubmissionListener.java
index 6d0496abd..56b500f93 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/FormSubmissionListener.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/FormSubmissionListener.java
@@ -20,7 +20,6 @@
package org.xhtmlrenderer.simple.extend;
-import javax.annotation.ParametersAreNonnullByDefault;
/**
* FormSubmissionListener is used to receive callbacks when an XhtmlForm has its submit action called. The entire
@@ -30,7 +29,6 @@
*
* @author Christophe Marchand
*/
-@ParametersAreNonnullByDefault
public interface FormSubmissionListener {
/**
* Called by XhtmlForm when a form is submitted.
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/NoReplacedElementFactory.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/NoReplacedElementFactory.java
index 8b06a2803..bab1bb28d 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/NoReplacedElementFactory.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/NoReplacedElementFactory.java
@@ -1,5 +1,6 @@
package org.xhtmlrenderer.simple.extend;
+import org.jspecify.annotations.Nullable;
import org.w3c.dom.Element;
import org.xhtmlrenderer.extend.ReplacedElement;
import org.xhtmlrenderer.extend.ReplacedElementFactory;
@@ -7,10 +8,6 @@
import org.xhtmlrenderer.layout.LayoutContext;
import org.xhtmlrenderer.render.BlockBox;
-import javax.annotation.Nullable;
-import javax.annotation.ParametersAreNonnullByDefault;
-
-@ParametersAreNonnullByDefault
public class NoReplacedElementFactory implements ReplacedElementFactory {
@Nullable
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/XhtmlCssOnlyNamespaceHandler.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/XhtmlCssOnlyNamespaceHandler.java
index 819c8a7a1..1a5359344 100644
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/XhtmlCssOnlyNamespaceHandler.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/XhtmlCssOnlyNamespaceHandler.java
@@ -18,6 +18,8 @@
*/
package org.xhtmlrenderer.simple.extend;
+import com.google.errorprone.annotations.CheckReturnValue;
+import org.jspecify.annotations.Nullable;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -30,10 +32,6 @@
import org.xhtmlrenderer.util.Configuration;
import org.xhtmlrenderer.util.XRLog;
-import javax.annotation.CheckReturnValue;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.ParametersAreNonnullByDefault;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -48,10 +46,10 @@
* Handles xhtml but only css styling is honored,
* no presentational html attributes (see css 2.1 spec, 6.4.4)
*/
-@ParametersAreNonnullByDefault
public class XhtmlCssOnlyNamespaceHandler extends NoNamespaceHandler {
private static final String _namespace = "http://www.w3.org/1999/xhtml";
+ @Nullable
private static volatile StylesheetInfo _defaultStylesheet;
private static boolean _defaultStylesheetError;
@@ -61,7 +59,6 @@ public class XhtmlCssOnlyNamespaceHandler extends NoNamespaceHandler {
* @return The namespace value
*/
@Override
- @Nonnull
@CheckReturnValue
public String getNamespace() {
return _namespace;
@@ -71,7 +68,6 @@ public String getNamespace() {
* Gets the class attribute of the XhtmlNamespaceHandler object
*/
@Override
- @Nonnull
@CheckReturnValue
public String getClass(Element e) {
return e.getAttribute("class");
@@ -117,7 +113,6 @@ protected String getAttribute(Element e, String attrName) {
* @return The elementStyling value
*/
@Override
- @Nonnull
@CheckReturnValue
public String getElementStyling(Element e) {
StringBuilder style = new StringBuilder();
@@ -225,7 +220,6 @@ private static String collapseWhiteSpace(String text) {
* @return The document's title, or "" if none found
*/
@Override
- @Nonnull
@CheckReturnValue
public String getDocumentTitle(Document doc) {
String title = "";
@@ -242,6 +236,7 @@ public String getDocumentTitle(Document doc) {
return title;
}
+ @Nullable
private Element findFirstChild(Element parent, String targetName) {
NodeList children = parent.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
@@ -254,6 +249,7 @@ private Element findFirstChild(Element parent, String targetName) {
return null;
}
+ @Nullable
protected StylesheetInfo readStyleElement(Element style) {
String media = style.getAttribute("media");
if (media.isEmpty()) {
@@ -283,6 +279,7 @@ protected StylesheetInfo readStyleElement(Element style) {
}
}
+ @Nullable
protected StylesheetInfo readLinkElement(Element link) {
String rel = link.getAttribute("rel").toLowerCase();
if (rel.contains("alternate")) {
@@ -323,7 +320,6 @@ protected StylesheetInfo readLinkElement(Element link) {
* Gets the stylesheetLinks attribute of the XhtmlNamespaceHandler object
*/
@Override
- @Nonnull
@CheckReturnValue
public List