diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index b528a5b3107..0010f4128fc 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -8,16 +8,30 @@ + + + + + + + + + + + + + + + + + + - - - - @@ -26,17 +40,18 @@ + + + + - - - - + + - - - - - - - - - + + diff --git a/src/main/java/org/jabref/gui/util/RecursiveTreeItem.java b/src/main/java/org/jabref/gui/util/RecursiveTreeItem.java index e86b791fd01..4926453ea7c 100644 --- a/src/main/java/org/jabref/gui/util/RecursiveTreeItem.java +++ b/src/main/java/org/jabref/gui/util/RecursiveTreeItem.java @@ -15,10 +15,7 @@ import javafx.util.Callback; /** - * Taken from https://gist.github.com/lestard/011e9ed4433f9eb791a8 - */ - -/** + * @implNote Taken from https://gist.github.com/lestard/011e9ed4433f9eb791a8 * @implNote As CheckBoxTreeItem extends TreeItem, this class will work for both. */ public class RecursiveTreeItem extends CheckBoxTreeItem { diff --git a/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java b/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java index 6f66284d85c..7c1dc1ab81a 100644 --- a/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java +++ b/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java @@ -137,7 +137,7 @@ private String doChangeCase(String s, FORMAT_MODE format) { * special with |colon|s. * * @param c - * @param i the current position. It points to the opening brace + * @param start the current position. It points to the opening brace * @param format * @return */ diff --git a/src/main/java/org/jabref/logic/bst/BibtexWidth.java b/src/main/java/org/jabref/logic/bst/BibtexWidth.java index 6bd3d2f90e4..a1e89430333 100644 --- a/src/main/java/org/jabref/logic/bst/BibtexWidth.java +++ b/src/main/java/org/jabref/logic/bst/BibtexWidth.java @@ -167,13 +167,6 @@ public static int getCharWidth(char c) { } } - /** - * - * @param toMeasure - * @param warn - * may-be-null - * @return - */ public static int width(String toMeasure) { /* diff --git a/src/main/java/org/jabref/logic/bst/VM.java b/src/main/java/org/jabref/logic/bst/VM.java index 68ce68dc013..79a745761a1 100644 --- a/src/main/java/org/jabref/logic/bst/VM.java +++ b/src/main/java/org/jabref/logic/bst/VM.java @@ -122,7 +122,7 @@ private VM(CommonTree tree) { this.buildInFunctions = new HashMap<>(37); - /** + /* * Pops the top two (integer) literals, compares them, and pushes * the integer 1 if the second is greater than the first, 0 * otherwise. @@ -141,7 +141,7 @@ private VM(CommonTree tree) { stack.push(((Integer) o1).compareTo((Integer) o2) > 0 ? VM.TRUE : VM.FALSE); }); - /** Analogous. */ + /* Analogous. */ buildInFunctions.put("<", context -> { if (stack.size() < 2) { throw new VMException("Not enough operands on stack for operation <"); @@ -156,7 +156,7 @@ private VM(CommonTree tree) { stack.push(((Integer) o1).compareTo((Integer) o2) < 0 ? VM.TRUE : VM.FALSE); }); - /** + /* * Pops the top two (both integer or both string) literals, compares * them, and pushes the integer 1 if they're equal, 0 otherwise. */ @@ -180,7 +180,7 @@ private VM(CommonTree tree) { stack.push(o1.equals(o2) ? VM.TRUE : VM.FALSE); }); - /** Pops the top two (integer) literals and pushes their sum. */ + /* Pops the top two (integer) literals and pushes their sum. */ buildInFunctions.put("+", context -> { if (stack.size() < 2) { throw new VMException("Not enough operands on stack for operation +"); @@ -195,7 +195,7 @@ private VM(CommonTree tree) { stack.push((Integer) o1 + (Integer) o2); }); - /** + /* * Pops the top two (integer) literals and pushes their difference * (the first subtracted from the second). */ @@ -213,7 +213,7 @@ private VM(CommonTree tree) { stack.push((Integer) o1 - (Integer) o2); }); - /** + /* * Pops the top two (string) literals, concatenates them (in reverse * order, that is, the order in which pushed), and pushes the * resulting string. @@ -232,7 +232,7 @@ private VM(CommonTree tree) { stack.push(o1.toString() + o2); }); - /** + /* * Pops the top two literals and assigns to the first (which must be * a global or entry variable) the value of the second. */ @@ -245,14 +245,14 @@ private VM(CommonTree tree) { assign(context, o1, o2); }); - /** + /* * Pops the top (string) literal, adds a `.' to it if the last non * '}' character isn't a `.', `?', or `!', and pushes this resulting * string. */ buildInFunctions.put("add.period$", context -> addPeriodFunction()); - /** + /* * Executes the function whose name is the entry type of an entry. * For example if an entry is of type book, this function executes * the book function. When given as an argument to the ITERATE @@ -271,7 +271,7 @@ private VM(CommonTree tree) { buildInFunctions.put("change.case$", new ChangeCaseFunction(this)); - /** + /* * Pops the top (string) literal, makes sure it's a single * character, converts it to the corresponding ASCII integer, and * pushes this integer. @@ -291,7 +291,7 @@ private VM(CommonTree tree) { stack.push((int) s.charAt(0)); }); - /** + /* * Pushes the string that was the \cite-command argument for this * entry. */ @@ -302,7 +302,7 @@ private VM(CommonTree tree) { stack.push(context.getBibtexEntry().getCiteKeyOptional().orElse(null)); }); - /** + /* * Pops the top literal from the stack and pushes two copies of it. */ buildInFunctions.put("duplicate$", context -> { @@ -315,7 +315,7 @@ private VM(CommonTree tree) { stack.push(o1); }); - /** + /* * Pops the top literal and pushes the integer 1 if it's a missing * field or a string having no non-white-space characters, 0 * otherwise. @@ -342,7 +342,7 @@ private VM(CommonTree tree) { buildInFunctions.put("format.name$", new FormatNameFunction(this)); - /** + /* * Pops the top three literals (they are two function literals and * an integer literal, in that order); if the integer is greater * than 0, it executes the second literal, else it executes the @@ -368,7 +368,7 @@ private VM(CommonTree tree) { } }); - /** + /* * Pops the top (integer) literal, interpreted as the ASCII integer * value of a single character, converts it to the corresponding * single-character string, and pushes this string. @@ -388,7 +388,7 @@ private VM(CommonTree tree) { stack.push(String.valueOf((char) i.intValue())); }); - /** + /* * Pops the top (integer) literal, converts it to its (unique) * string equivalent, and pushes this string. */ @@ -405,7 +405,7 @@ private VM(CommonTree tree) { stack.push(o1.toString()); }); - /** + /* * Pops the top literal and pushes the integer 1 if it's a missing * field, 0 otherwise. */ @@ -429,7 +429,7 @@ private VM(CommonTree tree) { stack.push(VM.FALSE); }); - /** + /* * Writes onto the bbl file what is accumulated in the output buffer. * It writes a blank line if and only if the output buffer is empty. * Since write$ does reasonable line breaking, you should use this @@ -438,7 +438,7 @@ private VM(CommonTree tree) { */ buildInFunctions.put("newline$", context -> VM.this.bbl.append('\n')); - /** + /* * Pops the top (string) literal and pushes the number of names the * string represents one plus the number of occurrences of the * substring "and" (ignoring case differences) surrounded by @@ -458,13 +458,13 @@ private VM(CommonTree tree) { stack.push(AuthorList.parse(s).getNumberOfAuthors()); }); - /** + /* * Pops the top of the stack but doesn't print it; this gets rid of * an unwanted stack literal. */ buildInFunctions.put("pop$", context -> stack.pop()); - /** + /* * The |built_in| function {\.{preamble\$}} pushes onto the stack * the concatenation of all the \.{preamble} strings read from the * database files. (or the empty string if there where none) @@ -475,7 +475,7 @@ private VM(CommonTree tree) { stack.push(preamble); }); - /** + /* * Pops the top (string) literal, removes nonalphanumeric characters * except for white-space characters and hyphens and ties (these all get * converted to a space), removes certain alphabetic characters @@ -484,19 +484,19 @@ private VM(CommonTree tree) { */ buildInFunctions.put("purify$", new PurifyFunction(this)); - /** + /* * Pushes the string consisting of the double-quote character. */ buildInFunctions.put("quote$", context -> stack.push("\"")); - /** + /* * Is a no-op. */ buildInFunctions.put("skip$", context -> { // Nothing to do! Yeah! }); - /** + /* * Pops and prints the whole stack; it's meant to be used for style * designers while debugging. */ @@ -507,7 +507,7 @@ private VM(CommonTree tree) { }); - /** + /* * Pops the top three literals (they are the two integers literals * len and start, and a string literal, in that order). It pushes * the substring of the (at most) len consecutive characters @@ -518,7 +518,7 @@ private VM(CommonTree tree) { */ buildInFunctions.put("substring$", context -> substringFunction()); - /** + /* * Swaps the top two literals on the stack. text.length$ Pops the * top (string) literal, and pushes the number of text characters * it contains, where an accented character (more precisely, a @@ -537,7 +537,7 @@ private VM(CommonTree tree) { stack.push(f2); }); - /** + /* * text.length$ Pops the top (string) literal, and pushes the number * of text characters it contains, where an accented character (more * precisely, a "special character", defined in Section 4) counts as @@ -550,7 +550,7 @@ private VM(CommonTree tree) { */ buildInFunctions.put("text.length$", context -> textLengthFunction()); - /** + /* * Pops the top two literals (the integer literal len and a string * literal, in that order). It pushes the substring of the (at most) len * consecutive text characters starting from the beginning of the @@ -563,12 +563,12 @@ private VM(CommonTree tree) { */ buildInFunctions.put("text.prefix$", new TextPrefixFunction(this)); - /** + /* * Pops and prints the top of the stack to the log file. It's useful for debugging. */ buildInFunctions.put("top$", context -> LOGGER.debug("Stack entry", stack.pop())); - /** + /* * Pushes the current entry's type (book, article, etc.), but pushes * the null string if the type is either unknown or undefined. */ @@ -580,7 +580,7 @@ private VM(CommonTree tree) { stack.push(context.getBibtexEntry().getType().getName()); }); - /** + /* * Pops the top (string) literal and prints it following a warning * message. This also increments a count of the number of warning * messages issued. @@ -595,7 +595,7 @@ public void execute(BstEntry context) { } }); - /** + /* * Pops the top two (function) literals, and keeps executing the * second as long as the (integer) literal left on the stack by * executing the first is greater than 0. @@ -604,7 +604,7 @@ public void execute(BstEntry context) { buildInFunctions.put("width$", new WidthFunction(this)); - /** + /* * Pops the top (string) literal and writes it on the output buffer * (which will result in stuff being written onto the bbl file when * the buffer fills up). @@ -1146,7 +1146,6 @@ private void function(Tree child) { * ables. You may have any number of these commands, but a variable's * declaration must precede its use. * - * @param child */ private void integers(Tree child) { Tree t = child.getChild(0); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java index f5e46f24606..2b42b3e44ae 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java @@ -91,7 +91,7 @@ public String getDescription() { /** * Contact the server with the title of the selected item * - * @param queryByTitle: The query holds the title of the selected entry. Used to make a query to the MDL Server + * @param queryByTitle the query holds the title of the selected entry. Used to make a query to the MDL Server * @return Returns the server response. This is an XML document as a String. */ private String makeServerRequest(String queryByTitle) throws FetcherException { @@ -112,7 +112,7 @@ private String makeServerRequest(String queryByTitle) throws FetcherException { /** * Constructs the query based on title of the BibEntry. Adds statistical stuff to the url. * - * @param queryWithTitle: the title of the bib entry. + * @param queryWithTitle the title of the bib entry. * @return the string used to make the query at mdl server */ private String constructQuery(String queryWithTitle) { diff --git a/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java b/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java index 67837f3e0f1..3cdfa7e10e1 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java @@ -233,12 +233,6 @@ private void parseRemainingContent() { } private void parseAndAddEntry(String type) { - /** - * Morten Alver 13 Aug 2006: Trying to make the parser more - * robust. If an exception is thrown when parsing an entry, - * drop the entry and try to resume parsing. Add a warning - * for the user. - */ try { // collect all comments and the entry type definition in front of the actual entry // this is at least `@Type` @@ -256,10 +250,12 @@ private void parseAndAddEntry(String type) { parserResult.addDuplicateKey(entry.getCiteKey()); } } catch (IOException ex) { + // Trying to make the parser more robust. + // If an exception is thrown when parsing an entry, drop the entry and try to resume parsing. + LOGGER.debug("Could not parse entry", ex); parserResult.addWarning(Localization.lang("Error occurred when parsing entry") + ": '" + ex.getMessage() + "'. " + Localization.lang("Skipped entry.")); - } } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java index c55da689f41..8451e1914b0 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java @@ -75,7 +75,7 @@ public boolean isRecognizedFormat(BufferedReader reader) throws IOException { int i = 0; while (((str = reader.readLine()) != null) && (i < 50)) { - /** + /* * The following line gives false positives for RIS files, so it * should not be uncommented. The hypen is a characteristic of the * RIS format. diff --git a/src/main/java/org/jabref/logic/layout/StringInt.java b/src/main/java/org/jabref/logic/layout/StringInt.java index 9904be0ce58..eb6b3fe0bf3 100644 --- a/src/main/java/org/jabref/logic/layout/StringInt.java +++ b/src/main/java/org/jabref/logic/layout/StringInt.java @@ -19,8 +19,6 @@ public class StringInt implements java.io.Serializable { /** * Constructor for the StringInt object * - * @param _s Description of the Parameter - * @param _i Description of the Parameter */ public StringInt(final String s, final int i) { this.s = s; diff --git a/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviator.java b/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviator.java index 1faf9b795b6..3395be35248 100644 --- a/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviator.java +++ b/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviator.java @@ -16,11 +16,7 @@ public class AuthorLastFirstAbbreviator implements LayoutFormatter { */ @Override public String format(String fieldText) { - - /** - * This formatter is a duplicate of AuthorAbbreviator, so we simply - * call that one. - */ + // This formatter is a duplicate of AuthorAbbreviator, so we simply call that one. return new AuthorAbbreviator().format(fieldText); } diff --git a/src/main/java/org/jabref/logic/shared/event/UpdateRefusedEvent.java b/src/main/java/org/jabref/logic/shared/event/UpdateRefusedEvent.java index 3bc8934023f..a941a8fd9f4 100644 --- a/src/main/java/org/jabref/logic/shared/event/UpdateRefusedEvent.java +++ b/src/main/java/org/jabref/logic/shared/event/UpdateRefusedEvent.java @@ -15,7 +15,7 @@ public class UpdateRefusedEvent { /** * @param bibDatabaseContext Affected {@link BibDatabaseContext} - * @param bibEntry Affected {@link BibEntry} + * @param localBibEntry Affected {@link BibEntry} */ public UpdateRefusedEvent(BibDatabaseContext bibDatabaseContext, BibEntry localBibEntry, BibEntry sharedBibEntry) { this.bibDatabaseContext = bibDatabaseContext; diff --git a/src/main/java/org/jabref/logic/xmp/XmpUtilShared.java b/src/main/java/org/jabref/logic/xmp/XmpUtilShared.java index 4dc65b77a68..b3efc6277b1 100644 --- a/src/main/java/org/jabref/logic/xmp/XmpUtilShared.java +++ b/src/main/java/org/jabref/logic/xmp/XmpUtilShared.java @@ -42,7 +42,7 @@ protected static XMPMetadata parseXmpMetadata(InputStream is) throws IOException * Caution: This method is as expensive as it is reading the actual metadata * itself from the PDF. * - * @param inputStream The inputStream to read the PDF from. + * @param path the path to the PDF. * @return whether a BibEntry was found in the given PDF. */ public static boolean hasMetadata(Path path, XmpPreferences xmpPreferences) { diff --git a/src/main/java/org/jabref/model/database/BibDatabaseContext.java b/src/main/java/org/jabref/model/database/BibDatabaseContext.java index 458a7548721..0798b168fe2 100644 --- a/src/main/java/org/jabref/model/database/BibDatabaseContext.java +++ b/src/main/java/org/jabref/model/database/BibDatabaseContext.java @@ -116,7 +116,7 @@ public Optional getDatabaseFile() { /** * - * @param Set the database file + * @param file the database file * @deprecated use {@link #setDatabaseFile(Path)} */ @Deprecated diff --git a/src/main/java/org/jabref/model/entry/Month.java b/src/main/java/org/jabref/model/entry/Month.java index 80d3e0b5ef5..6d6f6fbfe15 100644 --- a/src/main/java/org/jabref/model/entry/Month.java +++ b/src/main/java/org/jabref/model/entry/Month.java @@ -106,8 +106,7 @@ public static Optional parse(String value) { * Parses a month having the string in German standard form such as * "Oktober" or in German short form such as "Okt" * - * @param value, - * a String that represents a month in German form + * @param value a String that represents a month in German form * @return the corresponding month instance, empty if input is not in German * form */ diff --git a/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java b/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java index 4de7f143b1c..b81fb2ced06 100644 --- a/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java +++ b/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java @@ -18,8 +18,8 @@ public class FieldChangedEvent extends EntryChangedEvent { /** * @param bibEntry Affected BibEntry object * @param field Name of field which has been changed + * @param oldValue old field value * @param newValue new field value - * @param newValue old field value * @param location location Location affected by this event */ public FieldChangedEvent(BibEntry bibEntry, Field field, String newValue, String oldValue, @@ -45,9 +45,6 @@ public FieldChangedEvent(BibEntry bibEntry, Field field, String newValue, String } /** - * @param bibEntry Affected BibEntry object - * @param fieldName Name of field which has been changed - * @param newValue new field value * @param location location Location affected by this event */ public FieldChangedEvent(FieldChange fieldChange, EntryEventSource location) { diff --git a/src/main/java/org/jabref/model/entry/identifier/DOI.java b/src/main/java/org/jabref/model/entry/identifier/DOI.java index 8c02f9a4696..68e1ff2968d 100644 --- a/src/main/java/org/jabref/model/entry/identifier/DOI.java +++ b/src/main/java/org/jabref/model/entry/identifier/DOI.java @@ -81,7 +81,6 @@ public class DOI implements Identifier { * Creates a DOI from various schemes including URL, URN, and plain DOIs/Short DOIs. * * @param doi the DOI/Short DOI string - * @return an instance of the DOI class * @throws NullPointerException if DOI/Short DOI is null * @throws IllegalArgumentException if doi does not include a valid DOI/Short DOI */ diff --git a/src/main/java/org/jabref/model/entry/identifier/Eprint.java b/src/main/java/org/jabref/model/entry/identifier/Eprint.java index 766acee5b8a..99343c24410 100644 --- a/src/main/java/org/jabref/model/entry/identifier/Eprint.java +++ b/src/main/java/org/jabref/model/entry/identifier/Eprint.java @@ -51,7 +51,6 @@ public class Eprint implements Identifier { * @param eprint the Eprint identifier string * @throws NullPointerException if eprint is null * @throws IllegalArgumentException if eprint does not include a valid Eprint identifier - * @return an instance of the Eprint class */ public Eprint(String eprint) { Objects.requireNonNull(eprint);