Skip to content

Commit

Permalink
Remove dependency on javax.annotation. javax.annotation is replaced b…
Browse files Browse the repository at this point in the history
…y jakarta.annotation. javax.annotation is no longer maintained.
  • Loading branch information
andreasrosdal authored and asturio committed Feb 16, 2022
1 parent 42cfe87 commit 8e4109b
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 123 deletions.
2 changes: 1 addition & 1 deletion openpdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<!-- All com.lowagie.text.* packages are 'public' -->
<Export-Package>com.lowagie.text.*;version="${project.version}"</Export-Package>
<!-- Declare the Bouncycastle dependencies as optional -->
<Import-Package>org.bouncycastle.*;resolution:=optional,!com.lowagie.*,javax.annotation.*;version="[1,4)",*</Import-Package>
<Import-Package>org.bouncycastle.*;resolution:=optional,!com.lowagie.*,*</Import-Package>
</instructions>
</configuration>
</plugin>
Expand Down
3 changes: 0 additions & 3 deletions openpdf/src/main/java/com/lowagie/text/Chunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.draw.DrawInterface;

import javax.annotation.Nullable;

/**
* This is the smallest significant part of text that can be added to a
* document.
Expand Down Expand Up @@ -356,7 +354,6 @@ public void setFont(Font font) {
*
* @return a <CODE>Font</CODE>
*/
@Nullable
public Font getFont() {
return font;
}
Expand Down
3 changes: 1 addition & 2 deletions openpdf/src/main/java/com/lowagie/text/Font.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import com.lowagie.text.pdf.BaseFont;
import java.awt.Color;
import java.util.Locale;
import javax.annotation.Nullable;


/**
Expand Down Expand Up @@ -195,7 +194,7 @@ public Font(Font other) {
* @param color the <CODE>Color</CODE> of this font.
*/

public Font(int family, float size, int style, @Nullable Color color) {
public Font(int family, float size, int style, Color color) {
this.family = family;
this.size = size;
this.style = style;
Expand Down
7 changes: 3 additions & 4 deletions openpdf/src/main/java/com/lowagie/text/FontFactoryImp.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.Nullable;


/**
Expand Down Expand Up @@ -166,7 +165,7 @@ public FontFactoryImp() {
* @param color the <CODE>Color</CODE> of this font.
* @return the Font constructed based on the parameters
*/
public Font getFont(@Nullable String fontName, String encoding, boolean embedded, float size, int style, @Nullable Color color) {
public Font getFont(String fontName, String encoding, boolean embedded, float size, int style, Color color) {
return getFont(fontName, encoding, embedded, size, style, color, true);
}

Expand All @@ -185,8 +184,8 @@ public Font getFont(@Nullable String fontName, String encoding, boolean embedded
* the cache if new, false if the font is always created new
* @return the Font constructed based on the parameters
*/
public Font getFont(@Nullable String fontname, String encoding, boolean embedded, float size, int style,
@Nullable Color color, boolean cached) {
public Font getFont(String fontname, String encoding, boolean embedded, float size, int style,
Color color, boolean cached) {
if (fontname == null) {
return new Font(Font.UNDEFINED, size, style, color);
}
Expand Down
3 changes: 1 addition & 2 deletions openpdf/src/main/java/com/lowagie/text/FontProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

package com.lowagie.text;

import javax.annotation.Nullable;
import java.awt.Color;

/**
Expand Down Expand Up @@ -76,5 +75,5 @@ public interface FontProvider {
* @param color the <CODE>Color</CODE> of this font.
* @return the Font constructed based on the parameters
*/
Font getFont(@Nullable String fontName, String encoding, boolean embedded, float size, int style, @Nullable Color color);
Font getFont(String fontName, String encoding, boolean embedded, float size, int style, Color color);
}
5 changes: 2 additions & 3 deletions openpdf/src/main/java/com/lowagie/text/html/HtmlWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
import com.lowagie.text.Table;
import com.lowagie.text.pdf.BaseFont;

import javax.annotation.Nullable;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
Expand Down Expand Up @@ -530,7 +529,7 @@ public void setStandardFont(Font standardfont) {
* @param font the font of an object
* @return true if the font differs
*/
public boolean isOtherFont(@Nullable Font font) {
public boolean isOtherFont(Font font) {
try {
Font cFont = currentfont.peek();
return cFont.compareTo(font) != 0;
Expand Down Expand Up @@ -1026,7 +1025,7 @@ protected void writeSection(Section section, int indent) throws IOException {
* @param styleAttributes the style of the font
* @throws IOException thrown when an I/O operation fails
*/
protected void write(@Nullable Font font, @Nullable Properties styleAttributes) throws IOException {
protected void write(Font font, Properties styleAttributes) throws IOException {
if (font == null || !isOtherFont(font)) {
return;
}
Expand Down
10 changes: 3 additions & 7 deletions openpdf/src/main/java/com/lowagie/text/html/Markup.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@

package com.lowagie.text.html;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.Color;
import java.util.Locale;
import java.util.Properties;
Expand Down Expand Up @@ -351,7 +349,7 @@ public static float parseLength(String string) {
* @return a <code>float</code> number
* @since 2.1.3
*/
public static float parseLength(@Nullable String string, float actualFontSize) {
public static float parseLength(String string, float actualFontSize) {
if (string == null)
return 0f;
int pos = 0;
Expand Down Expand Up @@ -419,8 +417,7 @@ public static float parseLength(@Nullable String string, float actualFontSize) {
* @param color the <CODE>Color</CODE> that has to be converted.
* @return the HTML representation of this <CODE>Color</CODE>
*/
@Nullable
public static Color decodeColor(@Nullable String color) {
public static Color decodeColor(String color) {
if (color == null) {
return null;
}
Expand All @@ -442,8 +439,7 @@ public static Color decodeColor(@Nullable String color) {
* keyN="valueN" '
* @return a Properties object
*/
@Nonnull
public static Properties parseAttributes(@Nullable String string) {
public static Properties parseAttributes(String string) {
Properties result = new Properties();
if (string == null) {
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
package com.lowagie.text.html;

import java.util.Properties;
import javax.annotation.Nullable;

import com.lowagie.text.DocListener;
import com.lowagie.text.DocumentException;
Expand Down Expand Up @@ -123,7 +122,7 @@ public SAXmyHtmlHandler(DocListener document, BaseFont bf) {
* @param attrs the list of attributes
*/
@Override
public void startElement(String uri, String localName, String name, @Nullable Attributes attrs) {
public void startElement(String uri, String localName, String name, Attributes attrs) {
// super.handleStartingTags is replaced with handleStartingTags
// suggestion by Vu Ngoc Tan/Hop
String lowerCaseName = name.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@ParametersAreNonnullByDefault
package com.lowagie.text.html;

import javax.annotation.ParametersAreNonnullByDefault;

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class ChainedProperties {

Expand All @@ -74,7 +72,6 @@ public class ChainedProperties {
public ChainedProperties() {
}

@Nullable
public String getProperty(String key) {
return findProperty(key).orElse(null);
}
Expand All @@ -86,7 +83,6 @@ public String getProperty(String key) {
* @return {@link Optional} containing the value or {@link Optional#empty()} if there is no value or
* it equals {@code null}
*/
@Nonnull
public Optional<String> findProperty(String key) {
for (int k = chain.size() - 1; k >= 0; --k) {
Object[] obj = (Object[]) chain.get(k);
Expand All @@ -106,7 +102,6 @@ public Optional<String> findProperty(String key) {
* @param defaultValue default property value
* @return property or default value if it's null
*/
@Nonnull
public String getOrDefault(String key, String defaultValue) {
return findProperty(key).orElse(defaultValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import javax.annotation.Nullable;

/**
* @author psoares
Expand All @@ -97,7 +96,7 @@ public class FactoryProperties {
*/
private FontProvider fontImp = FontFactory.getFontImp();

private static void setParagraphLeading(Paragraph paragraph, @Nullable String leading) {
private static void setParagraphLeading(Paragraph paragraph, String leading) {
if (leading == null) {
paragraph.setLeading(0, 1.5f);
return;
Expand Down Expand Up @@ -189,8 +188,7 @@ public static HyphenationEvent getHyphenation(HashMap props) {
* @return a HyphenationEvent
* @since 2.1.2
*/
@Nullable
public static HyphenationEvent getHyphenation(@Nullable String s) {
public static HyphenationEvent getHyphenation(String s) {
if (s == null || s.length() == 0) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import java.util.Map;
import java.util.Stack;
import java.util.StringTokenizer;
import javax.annotation.Nullable;

public class HTMLWorker implements SimpleXMLDocHandler, DocListener {

Expand Down Expand Up @@ -136,12 +135,12 @@ public static ArrayList<Element> parseToList(Reader reader, StyleSheet style) th
*/
@Deprecated
@SuppressWarnings("unchecked")
public static ArrayList<Element> parseToList(Reader reader, @Nullable StyleSheet style, HashMap interfaceProps)
public static ArrayList<Element> parseToList(Reader reader, StyleSheet style, HashMap interfaceProps)
throws IOException {
return parseToList(reader, style, (Map<String, Object>) interfaceProps);
}

public static ArrayList<Element> parseToList(Reader reader, @Nullable StyleSheet style, Map<String, Object> interfaceProps)
public static ArrayList<Element> parseToList(Reader reader, StyleSheet style, Map<String, Object> interfaceProps)
throws IOException {
HTMLWorker worker = new HTMLWorker(null);
if (style != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
@ParametersAreNonnullByDefault
package com.lowagie.text.html.simpleparser;

import javax.annotation.ParametersAreNonnullByDefault;
4 changes: 1 addition & 3 deletions openpdf/src/main/java/com/lowagie/text/pdf/PdfPCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
import com.lowagie.text.ExceptionConverter;
import com.lowagie.text.pdf.events.PdfPCellEventForwarder;

import javax.annotation.Nullable;

/**
* A cell in a PdfPTable.
*/
Expand Down Expand Up @@ -146,7 +144,7 @@ public PdfPCell() {
*
* @param phrase the text
*/
public PdfPCell(@Nullable Phrase phrase) {
public PdfPCell(Phrase phrase) {
super(0, 0, 0, 0);
borderWidth = 0.5f;
border = BOX;
Expand Down
6 changes: 0 additions & 6 deletions openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Encoding;
Expand Down Expand Up @@ -300,7 +298,6 @@ public TimeStampToken getTimeStampToken() {
* @return a date
* @since 2.1.6
*/
@Nullable
public Calendar getTimeStampDate() {
if (timeStampToken == null)
return null;
Expand Down Expand Up @@ -1076,7 +1073,6 @@ public boolean isRevocationValid() {
return false;
}

@Nullable
private static ASN1Primitive getExtensionValue(X509Certificate cert,
String oid) throws IOException {
byte[] bytes = cert.getExtensionValue(oid);
Expand All @@ -1089,7 +1085,6 @@ private static ASN1Primitive getExtensionValue(X509Certificate cert,
return aIn.readObject();
}

@Nonnull
private static String getStringFromGeneralName(ASN1Primitive names) {
ASN1TaggedObject taggedObject = (ASN1TaggedObject) names ;
return new String(ASN1OctetString.getInstance(taggedObject, false)
Expand Down Expand Up @@ -1765,7 +1760,6 @@ public X509Name(String dirName) {

}

@Nullable
public String getField(String name) {
List<String> vs = valuesMap.get(name);
return vs == null ? null : vs.get(0);
Expand Down
6 changes: 2 additions & 4 deletions openpdf/src/main/java/com/lowagie/text/pdf/TextField.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;

import javax.annotation.Nullable;

/**
* Supports text, combo and list fields generating the correct appearances.
* All the option in the Acrobat GUI are supported in an easy to use API.
Expand Down Expand Up @@ -719,7 +717,7 @@ public void addChoiceSelection( int selection) {
*/
@Deprecated
@SuppressWarnings("unchecked")
public void setChoiceSelections(@Nullable ArrayList selections ) {
public void setChoiceSelections(ArrayList selections ) {
setChoiceSelections((List<Integer>) selections);
}

Expand All @@ -728,7 +726,7 @@ public void setChoiceSelections(@Nullable ArrayList selections ) {
* list, all but the first element will be removed.
* @param selections new selections. If null, it clear()s the underlying ArrayList.
*/
public void setChoiceSelections(@Nullable List<Integer> selections ) {
public void setChoiceSelections(List<Integer> selections ) {
if (selections != null) {
choiceSelections = new ArrayList<>( selections );
if (choiceSelections.size() > 1 && (options & BaseField.MULTISELECT) == 0 ) {
Expand Down
9 changes: 4 additions & 5 deletions openpdf/src/main/java/com/lowagie/text/pdf/XfaForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down Expand Up @@ -305,7 +304,7 @@ public String findDatasetsName(String name) {
* @param name the complete or partial name
* @return the <CODE>Node</CODE> or <CODE>null</CODE> if not found
*/
public Node findDatasetsNode(@Nullable String name) {
public Node findDatasetsNode(String name) {
if (name == null)
return null;
name = findDatasetsName(name);
Expand All @@ -319,7 +318,7 @@ public Node findDatasetsNode(@Nullable String name) {
* @param n the <CODE>Node</CODE>
* @return the text found or "" if no text was found
*/
public static String getNodeText(@Nullable Node n) {
public static String getNodeText(Node n) {
if (n == null)
return "";
return getNodeText(n, "");
Expand All @@ -346,7 +345,7 @@ else if (n2.getNodeType() == Node.TEXT_NODE) {
* @param n the <CODE>Node</CODE> to add the text to
* @param text the text to add
*/
public void setNodeText(@Nullable Node n, String text) {
public void setNodeText(Node n, String text) {
if (n == null)
return;
Node nc;
Expand Down Expand Up @@ -1061,7 +1060,7 @@ public String getFieldType(String s) {
return null;
}

private void processTemplate(Node n, @Nullable Map<String, Integer> ff) {
private void processTemplate(Node n, Map<String, Integer> ff) {
if (ff == null)
ff = new HashMap<>();
Map<String, Integer> ss = new HashMap<>();
Expand Down
Loading

0 comments on commit 8e4109b

Please sign in to comment.