Skip to content

Commit

Permalink
Add <p> tags to Javadoc comments (#1863)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Nov 16, 2023
2 parents 508a4be + 0189f71 commit 379a03d
Show file tree
Hide file tree
Showing 35 changed files with 83 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static class Runtime {

/**
* Default line ending, determined in this order (paths are a teensy different platform to platform).
*
* <p>
* - .git/config (per-repo)
* - ~/.gitconfig (per-user)
* - /etc/gitconfig (system-wide)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 DiffPlug
* Copyright 2020-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@ private GitWorkarounds() {}

/**
* Finds the .git directory for the given project directory.
*
* <p>
* Ordinarily one would just use JGit for this, but it doesn't support worktrees properly.
* So this applies an additional workaround for that.
*
Expand All @@ -55,7 +55,7 @@ private GitWorkarounds() {}

/**
* Creates a {@link RepositorySpecificResolver} for the given project directory.
*
* <p>
* This applies a workaround for JGit not supporting worktrees properly.
*
* @param projectDir the project directory.
Expand All @@ -67,7 +67,7 @@ static RepositorySpecificResolver fileRepositoryResolverForProject(File projectD

/**
* Creates a {@link RepositorySpecificResolver} for the given project directory.
*
* <p>
* This applies a workaround for JGit not supporting worktrees properly.
*
* @param projectDir the project directory.
Expand All @@ -86,7 +86,7 @@ static RepositorySpecificResolver fileRepositoryResolverForProject(File projectD

/**
* Piggyback on the {@link FileRepositoryBuilder} mechanics for finding the git directory.
*
* <p>
* Here we take into account that git repositories can share a common directory. This directory
* will contain ./config ./objects/, ./info/, and ./refs/.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/**
* Formatter step which calls out to the Eclipse CDT formatter.
*
* <p>
* Eclipse-CDT <code>org.eclipse.core.contenttype.contentTypes</code>
* extension <code>cSource</code>, <code>cHeader</code>, <code>cxxSource</code> and <code>cxxHeader</code>.
* can handle: "c", "h", "C", "cpp", "cxx", "cc", "c++", "h", "hpp", "hh", "hxx", "inc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ private String diff(File file) throws IOException {

/**
* Returns a git-style diff between the two unix strings.
*
* <p>
* Output has no trailing newlines.
*
* <p>
* Boolean args determine whether whitespace or line endings will be visible.
*/
private static String diffWhitespaceLineEndings(String dirty, String clean, boolean whitespace, boolean lineEndings) throws IOException {
Expand All @@ -278,7 +278,7 @@ private static String diffWhitespaceLineEndings(String dirty, String clean, bool

/**
* Makes the whitespace and/or the lineEndings visible.
*
* <p>
* MyersDiff wants inputs with only unix line endings. So this ensures that that is the case.
*/
private static String visibleWhitespaceLineEndings(String input, boolean whitespace, boolean lineEndings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class GrEclipseFormatterStepSpecialCaseTest {
/**
* https://github.com/diffplug/spotless/issues/1657
*
* <p>
* broken: ${parm == null ? "" : "<tag>$parm</tag>"}
* works: ${parm == null ? "" : "<tag>parm</tag>"}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* but linked against the `Url[]`. This allows us to ship classfiles which function as glue
* code but delay linking/definition to runtime after the user has specified which version
* of the formatter they want.
*
* <p>
* For `"org.slf4j.` and (`com.diffplug.spotless.` but not `com.diffplug.spotless.extra.`)
* the classes are loaded from the buildToolClassLoader.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/ForeignExe.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 DiffPlug
* Copyright 2020-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@
* Finds a foreign executable and checks its version.
* If either part of that fails, it shows you why
* and helps you fix it.
*
* <p>
* Usage: {@code ForeignExe.nameAndVersion("grep", "2.5.7").confirmVersionAndGetAbsolutePath()}
* will find grep, confirm that it is version 2.5.7, and then return.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@ public interface FormatExceptionPolicy extends Serializable, NoLambda {

/**
* Returns a byte array representation of everything inside this {@code FormatExceptionPolicy}.
*
* <p>
* The main purpose of this method is to ensure one can't instantiate this class with lambda
* expressions, which are notoriously difficult to serialize and deserialize properly.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/java/com/diffplug/spotless/Formatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void applyTo(File file) throws IOException {

/**
* Applies formatting to the given file.
*
* <p>
* Returns null if the file was already clean, or the
* formatted result with unix newlines if it was not.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/FormatterFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ interface Closeable extends FormatterFunc, AutoCloseable {

/**
* Dangerous way to create a {@link Closeable} from an AutoCloseable and a function.
*
* <p>
* It's important for FormatterStep's to allocate their resources as lazily as possible.
* It's easy to create a resource inside the state, and not realize that it may not be
* released. It's far better to use one of the non-deprecated {@code of()} methods below.
*
* <p>
* The bug (and its fix) which is easy to write using this method: https://github.com/diffplug/spotless/commit/7f16ecca031810b5e6e6f647e1f10a6d2152d9f4
* How the {@code of()} methods below make the correct thing easier to write and safer: https://github.com/diffplug/spotless/commit/18c10f9c93d6f18f753233d0b5f028d5f0961916
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/FormatterStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* An implementation of this class specifies a single step in a formatting process.
*
* <p>
* The input is guaranteed to have unix-style newlines, and the output is required
* to not introduce any windows-style newlines as well.
*/
Expand Down Expand Up @@ -75,7 +75,7 @@ public default FormatterStep filterByContent(OnMatch onMatch, String contentPatt
/**
* Returns a new FormatterStep which will only apply its changes
* to files which pass the given filter.
*
* <p>
* The provided filter must be serializable.
*/
public default FormatterStep filterByFile(SerializableFileFilter filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Standard implementation of FormatExtension which cleanly enforces
* separation of serializable configuration and a pure format function.
*
* <p>
* Not an inner-class of FormatterStep so that it can stay entirely private
* from the API.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/java/com/diffplug/spotless/JarState.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Grabs a jar and its dependencies from maven,
* and makes it easy to access the collection in
* a classloader.
*
* <p>
* Serializes the full state of the jar, so it can
* catch changes in a SNAPSHOT version.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,7 @@ public abstract class LazyForwardingEquality<T extends Serializable> implements
/**
* This function is guaranteed to be called at most once.
* If the state is never required, then it will never be called at all.
*
* <p>
* Throws exception because it's likely that there will be some IO going on.
*/
protected abstract T calculateState() throws Exception;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/main/java/com/diffplug/spotless/NoLambda.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,20 +21,20 @@
/**
* Marker interface to prevent lambda implementations of
* single-method interfaces that require serializability.
*
* <p>
* In order for Spotless to support up-to-date checks, all
* of its parameters must be {@link Serializable} so that
* entries can be written to file, and they must implement
* equals and hashCode correctly.
*
* <p>
* This interface and its standard implementation,
* {@link EqualityBasedOnSerialization}, are a quick way
* to accomplish these goals.
*/
public interface NoLambda extends Serializable {
/**
* Returns a byte array representation of everything inside this {@code SerializableFileFilter}.
*
* <p>
* The main purpose of this method is to ensure one can't instantiate this class with lambda
* expressions, which are notoriously difficult to serialize and deserialize properly. (See
* {@code SerializableFileFilterImpl.SkipFilesNamed} for an example of how to make a serializable
Expand Down
8 changes: 4 additions & 4 deletions lib/src/main/java/com/diffplug/spotless/PaddedCell.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@
/**
* Models the result of applying a {@link Formatter} on a given {@link File}
* while characterizing various failure modes (slow convergence, cycles, and divergence).
*
* <p>
* See {@link #check(Formatter, File)} as the entry point to this class.
*/
public final class PaddedCell {
Expand Down Expand Up @@ -78,9 +78,9 @@ public List<String> steps() {
/**
* Applies the given formatter to the given file, checking that
* F(F(input)) == F(input).
*
* <p>
* If it meets this test, {@link #misbehaved()} will return false.
*
* <p>
* If it fails the test, {@link #misbehaved()} will return true, and you can find
* out more about the misbehavior based on its {@link Type}.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/ProcessRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Shelling out to a process is harder than it ought to be in Java.
* If you don't read stdout and stderr on their own threads, you risk
* deadlock on a clogged buffer.
*
* <p>
* ProcessRunner allocates two threads specifically for the purpose of
* flushing stdout and stderr to buffers. These threads will remain alive until
* the ProcessRunner is closed, so it is especially useful for repeated
Expand Down Expand Up @@ -239,7 +239,7 @@ public boolean exitNotZero() {
/**
* Asserts that the exit code was zero, and if so, returns
* the content of stdout encoded with the given charset.
*
* <p>
* If the exit code was not zero, throws an exception
* with useful debugging information.
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/src/main/java/com/diffplug/spotless/ThrowingEx.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
/**
* Basic functional interfaces which throw exception, along with
* static helper methods for calling them.
*
* <p>
* Contains most of the functionality of Durian's Throwing and Errors
* classes, but stripped down and renamed to avoid any confusion.
*/
Expand Down Expand Up @@ -80,7 +80,7 @@ public static <T, R> java.util.function.Function<T, R> wrap(ThrowingEx.Function<

/**
* Casts or wraps the given exception to be a RuntimeException.
*
* <p>
* If the input exception is a RuntimeException, it is simply
* cast and returned. Otherwise, it wrapped in a
* {@link WrappedAsRuntimeException} and returned.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
/**
* Signifies that a {@code public} API is actually an implementation detail, and should be treated as if it
* were {@code private}.
*
* <p>
* The user of the API should be warned that it may unexpectedly disappear in future versions of
* Spotless. Usually the best place to put this warning is in the API's class JavaDoc.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/npm/JsonEscaper.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ private static String jsonEscape(JsonRawValue jsonRawValue) {
private static String jsonEscape(String unescaped) {
/**
* the following characters are reserved in JSON and must be properly escaped to be used in strings:
*
* <p>
* Backspace is replaced with \b
* Form feed is replaced with \f
* Newline is replaced with \n
* Carriage return is replaced with \r
* Tab is replaced with \t
* Double quote is replaced with \"
* Backslash is replaced with \\
*
* <p>
* additionally we handle xhtml '</bla>' string
* and non-ascii chars
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
* Forked from
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider ([email protected])
*
* <p>
* Based on DBPKeywordType from https://github.com/serge-rider/dbeaver,
* which itself is licensed under the Apache 2.0 license.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,11 +22,11 @@
/**
* **Warning:** Use this class at your own risk. It is an implementation detail and is not
* guaranteed to exist in future versions.
*
* <p>
* Forked from
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider ([email protected])
*
* <p>
* Based on SQLFormatterConfiguration from https://github.com/serge-rider/dbeaver,
* which itself is licensed under the Apache 2.0 license.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/sql/dbeaver/Pair.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
* Forked from
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider ([email protected])
*
* <p>
* Based on Pair from https://github.com/serge-rider/dbeaver,
* which itself is licensed under the Apache 2.0 license.
*/
Expand Down
Loading

0 comments on commit 379a03d

Please sign in to comment.