Skip to content

Commit

Permalink
Nullable annotation for #attribute(key)
Browse files Browse the repository at this point in the history
And some trivial other cleanups
  • Loading branch information
jhy committed Aug 12, 2024
1 parent 55e50b9 commit f396007
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/org/jsoup/nodes/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected boolean hasChildNodes() {
return childNodes != EmptyNodes;
}

protected List<Node> ensureChildNodes() {
@Override protected List<Node> ensureChildNodes() {
if (childNodes == EmptyNodes) {
childNodes = new NodeList(this, 4);
}
Expand Down Expand Up @@ -261,7 +261,7 @@ public Element id(String id) {
*
* @return this element
*/
public Element attr(String attributeKey, String attributeValue) {
@Override public Element attr(String attributeKey, String attributeValue) {
super.attr(attributeKey, attributeValue);
return this;
}
Expand All @@ -288,7 +288,7 @@ public Element attr(String attributeKey, boolean attributeValue) {
@return the Attribute for this key, or null if not present.
@since 1.17.2
*/
public Attribute attribute(String key) {
@Nullable Attribute attribute(String key) {
return hasAttributes() ? attributes().attribute(key) : null;
}

Expand Down Expand Up @@ -1245,7 +1245,7 @@ public Elements getElementsByAttributeValueMatching(String key, Pattern pattern)
/**
* Find elements that have attributes whose values match the supplied regular expression.
* @param key name of the attribute
* @param regex regular expression to match against attribute values. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options.
* @param regex regular expression to match against attribute values. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as {@code (?i)} and {@code (?m)}) to control regex options.
* @return elements that have attributes matching this regular expression
*/
public Elements getElementsByAttributeValueMatching(String key, String regex) {
Expand Down Expand Up @@ -1319,7 +1319,7 @@ public Elements getElementsMatchingText(Pattern pattern) {

/**
* Find elements whose text matches the supplied regular expression.
* @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options.
* @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as {@code (?i)} and {@code (?m)}) to control regex options.
* @return elements matching the supplied regular expression.
* @see Element#text()
*/
Expand All @@ -1345,7 +1345,7 @@ public Elements getElementsMatchingOwnText(Pattern pattern) {

/**
* Find elements whose own text matches the supplied regular expression.
* @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options.
* @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as {@code (?i)} and {@code (?m)}) to control regex options.
* @return elements matching the supplied regular expression.
* @see Element#ownText()
*/
Expand Down Expand Up @@ -1397,7 +1397,7 @@ public TextAccumulator(StringBuilder accum) {
this.accum = accum;
}

public void head(Node node, int depth) {
@Override public void head(Node node, int depth) {
if (node instanceof TextNode) {
TextNode textNode = (TextNode) node;
appendNormalisedText(accum, textNode);
Expand All @@ -1410,7 +1410,7 @@ public void head(Node node, int depth) {
}
}

public void tail(Node node, int depth) {
@Override public void tail(Node node, int depth) {
// make sure there is a space between block tags and immediately following text nodes or inline elements <div>One</div>Two should be "One Two".
if (node instanceof Element) {
Element element = (Element) node;
Expand Down Expand Up @@ -1907,7 +1907,7 @@ private static final class NodeList extends ChangeNotifyingArrayList<Node> {
this.owner = owner;
}

public void onContentsChanged() {
@Override public void onContentsChanged() {
owner.nodelistChanged();
}
}
Expand Down

0 comments on commit f396007

Please sign in to comment.