diff --git a/src/main/java/run/halo/app/core/CommonResultControllerAdvice.java b/src/main/java/run/halo/app/core/CommonResultControllerAdvice.java index 8393089f365c156fcf630e3372dd925e79ed9b40..9cbd47870b92d158ca4f83e6816dd8af37239e4a 100644 --- a/src/main/java/run/halo/app/core/CommonResultControllerAdvice.java +++ b/src/main/java/run/halo/app/core/CommonResultControllerAdvice.java @@ -1,6 +1,5 @@ package run.halo.app.core; -import org.jetbrains.annotations.NotNull; import org.springframework.core.MethodParameter; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -26,18 +25,18 @@ public class CommonResultControllerAdvice implements ResponseBodyAdvice @Override public boolean supports(MethodParameter returnType, - @NotNull Class> converterType) { + @NonNull Class> converterType) { return AbstractJackson2HttpMessageConverter.class.isAssignableFrom(converterType); } @Override @NonNull public final Object beforeBodyWrite(@Nullable Object body, - @NotNull MethodParameter returnType, - @NotNull MediaType contentType, - @NotNull Class> converterType, - @NotNull ServerHttpRequest request, - @NotNull ServerHttpResponse response) { + @NonNull MethodParameter returnType, + @NonNull MediaType contentType, + @NonNull Class> converterType, + @NonNull ServerHttpRequest request, + @NonNull ServerHttpResponse response) { MappingJacksonValue container = getOrCreateContainer(body); // The contain body will never be null beforeBodyWriteInternal(container, contentType, returnType, request, response); diff --git a/src/main/java/run/halo/app/utils/footnotes/Footnote.java b/src/main/java/run/halo/app/utils/footnotes/Footnote.java index cb42eb08819f37477ec3b699315b75c42895b4dd..94d2bfc34dfc3dafb73e86ea5df5e5c2c8c2d92f 100644 --- a/src/main/java/run/halo/app/utils/footnotes/Footnote.java +++ b/src/main/java/run/halo/app/utils/footnotes/Footnote.java @@ -7,7 +7,7 @@ import com.vladsch.flexmark.util.ast.Document; import com.vladsch.flexmark.util.ast.Node; import com.vladsch.flexmark.util.ast.ReferencingNode; import com.vladsch.flexmark.util.sequence.BasedSequence; -import org.jetbrains.annotations.NotNull; +import org.springframework.lang.NonNull; import run.halo.app.utils.footnotes.internal.FootnoteRepository; /** @@ -30,7 +30,7 @@ public class Footnote extends Node implements DelimitedNode, DoNotDecorate, Link protected int referenceOrdinal; - @NotNull + @NonNull @Override public BasedSequence getReference() { return text; @@ -80,14 +80,14 @@ public class Footnote extends Node implements DelimitedNode, DoNotDecorate, Link this.footnoteBlock = footnoteBlock; } - @NotNull + @NonNull @Override public BasedSequence[] getSegments() { return new BasedSequence[] {openingMarker, text, closingMarker}; } @Override - public void getAstExtra(@NotNull StringBuilder out) { + public void getAstExtra(@NonNull StringBuilder out) { out.append(" ordinal: ") .append(footnoteBlock != null ? footnoteBlock.getFootnoteOrdinal() : 0).append(" "); delimitedSegmentSpanChars(out, openingMarker, text, closingMarker, "text"); diff --git a/src/main/java/run/halo/app/utils/footnotes/FootnoteBlock.java b/src/main/java/run/halo/app/utils/footnotes/FootnoteBlock.java index 87cb50f7b8adcd9b854e0f33f913b9e5c6cfa558..ec04db62cc5168c1fb2730ecfcfa267974e67e01 100644 --- a/src/main/java/run/halo/app/utils/footnotes/FootnoteBlock.java +++ b/src/main/java/run/halo/app/utils/footnotes/FootnoteBlock.java @@ -10,8 +10,8 @@ import com.vladsch.flexmark.util.data.DataHolder; import com.vladsch.flexmark.util.sequence.BasedSequence; import com.vladsch.flexmark.util.sequence.SequenceUtils; import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; import run.halo.app.utils.footnotes.internal.FootnoteRepository; /** @@ -43,7 +43,7 @@ public class FootnoteBlock extends Block @Nullable @Override - public Footnote getReferencingNode(@NotNull Node node) { + public Footnote getReferencingNode(@NonNull Node node) { return node instanceof Footnote ? (Footnote) node : null; } @@ -74,7 +74,7 @@ public class FootnoteBlock extends Block } @Override - public void getAstExtra(@NotNull StringBuilder out) { + public void getAstExtra(@NonNull StringBuilder out) { out.append(" ordinal: ").append(footnoteOrdinal).append(" "); segmentSpan(out, openingMarker, "open"); segmentSpan(out, text, "text"); @@ -82,7 +82,7 @@ public class FootnoteBlock extends Block segmentSpan(out, footnote, "footnote"); } - @NotNull + @NonNull @Override public BasedSequence[] getSegments() { return new BasedSequence[] {openingMarker, text, closingMarker, footnote}; diff --git a/src/main/java/run/halo/app/utils/footnotes/FootnoteExtension.java b/src/main/java/run/halo/app/utils/footnotes/FootnoteExtension.java index 7f65b4388410eb94186bedd134952fb0ae36c205..1706dbe1f2fcc34c4f1be6e1d307d64eb3474090 100644 --- a/src/main/java/run/halo/app/utils/footnotes/FootnoteExtension.java +++ b/src/main/java/run/halo/app/utils/footnotes/FootnoteExtension.java @@ -9,7 +9,7 @@ import com.vladsch.flexmark.util.data.DataKey; import com.vladsch.flexmark.util.data.MutableDataHolder; import com.vladsch.flexmark.util.format.options.ElementPlacement; import com.vladsch.flexmark.util.format.options.ElementPlacementSort; -import org.jetbrains.annotations.NotNull; +import org.springframework.lang.NonNull; import run.halo.app.utils.footnotes.internal.FootnoteBlockParser; import run.halo.app.utils.footnotes.internal.FootnoteLinkRefProcessor; import run.halo.app.utils.footnotes.internal.FootnoteNodeFormatter; @@ -63,8 +63,8 @@ public class FootnoteExtension } @Override - public void extend(@NotNull HtmlRenderer.Builder htmlRendererBuilder, - @NotNull String rendererType) { + public void extend(@NonNull HtmlRenderer.Builder htmlRendererBuilder, + @NonNull String rendererType) { if (htmlRendererBuilder.isRendererType("HTML")) { htmlRendererBuilder.nodeRendererFactory(new FootnoteNodeRenderer.Factory()); } @@ -77,7 +77,7 @@ public class FootnoteExtension } @Override - public void rendererOptions(@NotNull MutableDataHolder options) { + public void rendererOptions(@NonNull MutableDataHolder options) { } diff --git a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteBlockParser.java b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteBlockParser.java index 0ca6f6349ca4bd2cf96ca49931fa7acb72cc42d2..13f4d40e2f2113ac2a7ef444328dee4d37804005 100644 --- a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteBlockParser.java +++ b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteBlockParser.java @@ -16,8 +16,8 @@ import com.vladsch.flexmark.util.sequence.BasedSequence; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; import run.halo.app.utils.footnotes.FootnoteBlock; import run.halo.app.utils.footnotes.FootnoteExtension; @@ -115,9 +115,9 @@ public class FootnoteBlockParser extends AbstractBlockParser { return false; } - @NotNull + @NonNull @Override - public BlockParserFactory apply(@NotNull DataHolder options) { + public BlockParserFactory apply(@NonNull DataHolder options) { return new BlockFactory(options); } } diff --git a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteLinkRefProcessor.java b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteLinkRefProcessor.java index c6ec6722ba57da0e9f4e41f717ef4f7927896b16..770c3af17e5c9d297b67af3f01ec6a556885b6b0 100644 --- a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteLinkRefProcessor.java +++ b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteLinkRefProcessor.java @@ -6,7 +6,7 @@ import com.vladsch.flexmark.util.ast.Document; import com.vladsch.flexmark.util.ast.Node; import com.vladsch.flexmark.util.data.DataHolder; import com.vladsch.flexmark.util.sequence.BasedSequence; -import org.jetbrains.annotations.NotNull; +import org.springframework.lang.NonNull; import run.halo.app.utils.footnotes.Footnote; import run.halo.app.utils.footnotes.FootnoteBlock; import run.halo.app.utils.footnotes.FootnoteExtension; @@ -33,14 +33,14 @@ public class FootnoteLinkRefProcessor implements LinkRefProcessor { } @Override - public boolean isMatch(@NotNull BasedSequence nodeChars) { + public boolean isMatch(@NonNull BasedSequence nodeChars) { return nodeChars.length() >= 3 && nodeChars.charAt(0) == '[' && nodeChars.charAt(1) == '^' && nodeChars.endCharAt(1) == ']'; } - @NotNull + @NonNull @Override - public Node createNode(@NotNull BasedSequence nodeChars) { + public Node createNode(@NonNull BasedSequence nodeChars) { BasedSequence footnoteId = nodeChars.midSequence(2, -1).trim(); FootnoteBlock footnoteBlock = footnoteId.length() > 0 ? footnoteRepository.get(footnoteId.toString()) : null; @@ -55,39 +55,39 @@ public class FootnoteLinkRefProcessor implements LinkRefProcessor { return footnote; } - @NotNull + @NonNull @Override - public BasedSequence adjustInlineText(@NotNull Document document, @NotNull Node node) { + public BasedSequence adjustInlineText(@NonNull Document document, @NonNull Node node) { assert node instanceof Footnote; return ((Footnote) node).getText(); } @Override - public boolean allowDelimiters(@NotNull BasedSequence chars, @NotNull Document document, - @NotNull Node node) { + public boolean allowDelimiters(@NonNull BasedSequence chars, @NonNull Document document, + @NonNull Node node) { return true; } @Override - public void updateNodeElements(@NotNull Document document, @NotNull Node node) { + public void updateNodeElements(@NonNull Document document, @NonNull Node node) { } public static class Factory implements LinkRefProcessorFactory { - @NotNull + @NonNull @Override - public LinkRefProcessor apply(@NotNull Document document) { + public LinkRefProcessor apply(@NonNull Document document) { return new FootnoteLinkRefProcessor(document); } @Override - public boolean getWantExclamationPrefix(@NotNull DataHolder options) { + public boolean getWantExclamationPrefix(@NonNull DataHolder options) { return WANT_EXCLAMATION_PREFIX; } @Override - public int getBracketNestingLevel(@NotNull DataHolder options) { + public int getBracketNestingLevel(@NonNull DataHolder options) { return BRACKET_NESTING_LEVEL; } } diff --git a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeFormatter.java b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeFormatter.java index f6d7eeec028a8656e5924b28844bf8b07ec829bc..7a5dd05e394adad49d7a57f13843f372adef8ea7 100644 --- a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeFormatter.java +++ b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeFormatter.java @@ -15,8 +15,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; import run.halo.app.utils.footnotes.Footnote; import run.halo.app.utils.footnotes.FootnoteBlock; import run.halo.app.utils.footnotes.FootnoteExtension; @@ -100,9 +100,9 @@ public class FootnoteNodeFormatter public static class Factory implements NodeFormatterFactory { - @NotNull + @NonNull @Override - public NodeFormatter create(@NotNull DataHolder options) { + public NodeFormatter create(@NonNull DataHolder options) { return new FootnoteNodeFormatter(options); } } diff --git a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeRenderer.java b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeRenderer.java index 0d48d562703b430f801de063aeadfc4009b1ba07..e876b9ef7ad3eb90f0696c28eec0e3e9c3b356a1 100644 --- a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeRenderer.java +++ b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteNodeRenderer.java @@ -18,7 +18,7 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.jetbrains.annotations.NotNull; +import org.springframework.lang.NonNull; import run.halo.app.utils.footnotes.Footnote; import run.halo.app.utils.footnotes.FootnoteBlock; import run.halo.app.utils.footnotes.FootnoteExtension; @@ -53,8 +53,8 @@ public class FootnoteNodeRenderer implements PhasedNodeRenderer { } @Override - public void renderDocument(@NotNull NodeRendererContext context, @NotNull HtmlWriter html, - @NotNull Document document, @NotNull RenderingPhase phase) { + public void renderDocument(@NonNull NodeRendererContext context, @NonNull HtmlWriter html, + @NonNull Document document, @NonNull RenderingPhase phase) { if (phase == RenderingPhase.BODY_TOP) { if (recheckUndefinedReferences) { // need to see if have undefined footnotes that were defined after parsing @@ -171,9 +171,9 @@ public class FootnoteNodeRenderer implements PhasedNodeRenderer { public static class Factory implements NodeRendererFactory { - @NotNull + @NonNull @Override - public NodeRenderer apply(@NotNull DataHolder options) { + public NodeRenderer apply(@NonNull DataHolder options) { return new FootnoteNodeRenderer(options); } } diff --git a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteRepository.java b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteRepository.java index 0aca257ce03448d61c67e2cd8a66a63f034084ac..045945992c5293ac8dbcc2bf60eadeaddce457c3 100644 --- a/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteRepository.java +++ b/src/main/java/run/halo/app/utils/footnotes/internal/FootnoteRepository.java @@ -13,7 +13,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.jetbrains.annotations.NotNull; +import org.springframework.lang.NonNull; import run.halo.app.utils.footnotes.Footnote; import run.halo.app.utils.footnotes.FootnoteBlock; import run.halo.app.utils.footnotes.FootnoteExtension; @@ -79,19 +79,19 @@ public class FootnoteRepository extends NodeRepository { super(FootnoteExtension.FOOTNOTES_KEEP.get(options)); } - @NotNull + @NonNull @Override public DataKey getDataKey() { return FootnoteExtension.FOOTNOTES; } - @NotNull + @NonNull @Override public DataKey getKeepDataKey() { return FootnoteExtension.FOOTNOTES_KEEP; } - @NotNull + @NonNull @Override public Set getReferencedElements(Node parent) { HashSet references = new HashSet<>();