Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump checkstyle from 8.19 to 8.20 #4928

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ dependencies {
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.19'
checkstyle 'com.puppycrawl.tools:checkstyle:8.20'
}

jacoco {
Expand Down
33 changes: 3 additions & 30 deletions src/main/java/org/jabref/gui/autocompleter/SuggestionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
Expand All @@ -55,7 +54,6 @@ public abstract class SuggestionProvider<T> implements Callback<ISuggestionReque
/**
* Create a default suggestion provider based on the toString() method of the generic objects
* @param possibleSuggestions All possible suggestions
* @return
*/
public static <T> SuggestionProvider<T> create(Collection<T> possibleSuggestions) {
return create(null, possibleSuggestions);
Expand All @@ -67,7 +65,6 @@ public static <T> SuggestionProvider<T> create(Collection<T> possibleSuggestions
*
* @param stringConverter A stringConverter which converts generic T into a string
* @param possibleSuggestions All possible suggestions
* @return
*/
public static <T> SuggestionProvider<T> create(Callback<T, String> stringConverter, Collection<T> possibleSuggestions) {
SuggestionProviderString<T> suggestionProvider = new SuggestionProviderString<>(stringConverter);
Expand All @@ -77,15 +74,13 @@ public static <T> SuggestionProvider<T> create(Callback<T, String> stringConvert

/**
* Add the given new possible suggestions to this SuggestionProvider
* @param newPossible
*/
public void addPossibleSuggestions(@SuppressWarnings("unchecked") T... newPossible) {
addPossibleSuggestions(Arrays.asList(newPossible));
}

/**
* Add the given new possible suggestions to this SuggestionProvider
* @param newPossible
*/
public void addPossibleSuggestions(Collection<T> newPossible) {
synchronized (possibleSuggestionsLock) {
Expand Down Expand Up @@ -113,39 +108,21 @@ public final Collection<T> call(final ISuggestionRequest request) {
}
}
}
Collections.sort(suggestions, getComparator());
suggestions.sort(getComparator());
}
return suggestions;
}


/***************************************************************************
* *
* Static methods *
* *
**************************************************************************/

/**
* Get the comparator to order the suggestions
* @return
*/
protected abstract Comparator<T> getComparator();

/**
* Check the given possible suggestion is a match (is a valid suggestion)
* @param suggestion
* @param request
* @return
*/
protected abstract boolean isMatch(T suggestion, ISuggestionRequest request);


/***************************************************************************
* *
* Default implementations *
* *
**************************************************************************/

/**
* This is a simple string based suggestion provider.
* All generic suggestions T are turned into strings for processing.
Expand All @@ -166,18 +143,14 @@ public int compare(T o1, T o2) {

/**
* Create a new SuggestionProviderString
* @param stringConverter
*/
public SuggestionProviderString(Callback<T, String> stringConverter) {
this.stringConverter = stringConverter;

// In case no stringConverter was provided, use the default strategy
if (this.stringConverter == null) {
this.stringConverter = new Callback<T, String>() {
@Override
public String call(T obj) {
return obj != null ? obj.toString() : ""; //$NON-NLS-1$
}
this.stringConverter = obj -> {
return obj != null ? obj.toString() : ""; //$NON-NLS-1$
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public void setAccepted(boolean a) {
accepted = a;
}


/**
* This method returns a JComponent detailing the nature of the change.
* @return JComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ private void move(int dy) {
list.setSelectedIndex(newInd);
}


/**
* FocusListener to select the first entry in the list of fields when they are focused
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ private void saveAbbreviationsAndCloseDialog() {
close();
}


/**
* This class provides a editable text field that is used as table cell.
* It handles the editing of the name column.
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/jabref/gui/search/SearchWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,21 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* Not reusable. Always create a new instance for each search!
*/
class SearchWorker extends SwingWorker<List<BibEntry>, Void> {

private static final Logger LOGGER = LoggerFactory.getLogger(SearchWorker.class);

private final BasePanel basePanel;
private final BibDatabase database;

private final SearchQuery searchQuery;
private final SearchDisplayMode searchDisplayMode;

public SearchWorker(BasePanel basePanel, SearchQuery searchQuery, SearchDisplayMode searchDisplayMode) {
this.basePanel = Objects.requireNonNull(basePanel);
this.database = Objects.requireNonNull(basePanel.getDatabase());
this.searchQuery = Objects.requireNonNull(searchQuery);
this.searchDisplayMode = Objects.requireNonNull(searchDisplayMode);
LOGGER.debug("Search (" + this.searchDisplayMode.getDisplayName() + "): " + this.searchQuery);
LOGGER.debug("Search (" + searchDisplayMode.getDisplayName() + "): " + this.searchQuery);
}

@Override
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/util/TooltipTextUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public static String textToHTMLString(Text text) {
return textString;
}


/**
* Formats a String to multiple Texts by replacing some parts and adding font characteristics.
*/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/util/component/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.airhacks.afterburner.views.ViewLoader;
import org.fxmisc.easybind.EasyBind;


/**
* A tag item in a {@link TagBar}.
*/
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/logic/bibtex/DuplicateCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ public static double correlateByWords(final String s1, final String s2) {
return 1 - missRate;
}


/*
/**
* Calculates the similarity (a number within 0 and 1) between two strings.
* http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java
*/
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public char asChar() {
return asChar;
}


/**
* Convert bstFormat char into ENUM
*
Expand All @@ -72,7 +71,6 @@ private BibtexCaseChanger() {
*
* @param s the string to handle
* @param format the format
* @return
*/
public static String changeCase(String s, FORMAT_MODE format) {
return (new BibtexCaseChanger()).doChangeCase(s, format);
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/jabref/logic/bst/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,6 @@ private void read() {
* override any definition you define using this command. If you want to
* define a string the user can't touch, use the FUNCTION command, which has
* a compatible syntax.
*
* @param child
*/
private void macro(Tree child) {
String name = child.getChild(0).getText();
Expand All @@ -959,8 +957,7 @@ public void execute(BstEntry context) {
}
}


/*
/**
* Declares the fields and entry variables. It has three arguments, each a
* (possibly empty) list of variable names. The three lists are of: fields,
* integer entry variables, and string entry variables. There is an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.google.common.cache.LoadingCache;
import com.google.common.eventbus.Subscribe;


/**
* Caches the generated Citations for quicker access
* {@link CitationStyleGenerator} generates the citation with JavaScript which may take some time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* Facade to unify the access to the citation style engine. Use these methods if you need rendered BibTeX item(s) in a
* given journal style. This class uses {@link CSLAdapter} to create output.
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/jabref/logic/exporter/ModsExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.FieldName;


/**
* TemplateExporter for exporting in MODS XML format.
*/
class ModsExporter extends Exporter {

protected static final String MODS_NAMESPACE_URI = "http://www.loc.gov/mods/v3";
private static final String MODS_NAMESPACE_URI = "http://www.loc.gov/mods/v3";
private static final String MINUS = "-";
private static final String DOUBLE_MINUS = "--";
private static final String MODS_SCHEMA_LOCATION = "http://www.loc.gov/standards/mods/v3/mods-3-6.xsd";
Expand Down Expand Up @@ -320,7 +319,7 @@ private void handleAuthors(ModsDefinition mods, String value) {
name.getNamePartOrDisplayFormOrAffiliation().add(element);

//now take care of the forenames
String forename = author.substring(commaIndex + 1, author.length());
String forename = author.substring(commaIndex + 1);
String[] forenames = forename.split(" ");
for (String given : forenames) {
if (!given.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public class MedlineFetcher implements IdBasedParserFetcher, SearchBasedFetcher

private int numberOfResultsFound;


/**
* Replaces all commas in a given string with " AND "
*
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/openoffice/OOBibStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ private String getCitationMarkerField(BibEntry entry, BibDatabase database, Stri
return "";
}


/**
* Look up the nth author and return the proper last name for citation markers.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.jabref.model.metadata.FilePreferences;
import org.jabref.model.pdf.FileAnnotation;


/**
* Here all PDF files attached to a BibEntry are scanned for annotations using a PdfAnnotationImporter.
*/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/shared/DBMSProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public void setupSharedDatabase() throws SQLException {
*/
abstract String escape(String expression);


/**
* Inserts the given bibEntry into shared database.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.logic.shared.exception;


/**
* This exception is thrown when a shared database is required, but it actually isn't one.
*/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/undo/UndoChangeEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public boolean isCanRedo() {
return canRedo;
}


/**
*
* @return A description of the action to be redone
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public boolean isNewerThan(Version otherVersion) {
return false;
}


/**
* Checks if this version should be updated to one of the given ones.
* Ignoring the other Version if this one is Stable and the other one is not.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/util/io/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public static Optional<String> getFileExtension(String fileName) {
}
}


/**
* Returns the extension of a file or Optional.empty() if the file does not have one (no . in name).
*
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/model/cleanup/Formatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public abstract class Formatter {
*/
public abstract String getName();


/**
* Returns a unique key for the formatter that can be used for its identification
* @return the key of the formatter, always not null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public class DuplicationChecker {
/** use a map instead of a set since I need to know how many of each key is in there */
private final Map<String, Integer> allKeys = new HashMap<>();


/**
* Checks if there is more than one occurrence of this key
*/
public boolean isDuplicateCiteKeyExisting(String citeKey) {
private boolean isDuplicateCiteKeyExisting(String citeKey) {
return getNumberOfKeyOccurrences(citeKey) > 1;
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/model/entry/Month.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public enum Month {
this.number = number;
}


/**
* Find month by one-based number.
* If the number is not in the valid range, then an empty Optional is returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public static Optional<SpecialField> getSpecialFieldInstanceFromFieldName(String
}
}


/**
* @param fieldName the name of the field to check
* @return true if given field is a special field, false otherwise
Expand Down