Skip to content

Commit

Permalink
Fixing some IntelliJ warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbylight committed Sep 28, 2022
1 parent 75bf536 commit 21664e7
Show file tree
Hide file tree
Showing 29 changed files with 57 additions and 165 deletions.
2 changes: 1 addition & 1 deletion AutoComplete/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 64,7 @@ publishing {
'complete with full HTML support and navigable with hyperlinks. Optional parameter completion '
'assistance for functions and methods, ala Eclipse and NetBeans. Completion information is '
'typically specified in an XML file, but can even be dynamic.'
url = 'http://www.fifesoft.com/rsyntaxtextarea/'
url = 'https://github.com/bobbylight/AutoComplete'
inceptionYear = '2003'
packaging = 'jar'
licenses {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,7 @@ public abstract class AbstractCompletion implements Completion {
/**
* The provider that created this completion.
*/
private CompletionProvider provider;
private final CompletionProvider provider;

/**
* The icon to use for this completion.
Expand Down Expand Up @@ -71,9 71,6 @@ protected AbstractCompletion(CompletionProvider provider, Icon icon) {
}


/**
* {@inheritDoc}
*/
@Override
public int compareTo(Completion c2) {
if (c2==this) {
Expand All @@ -86,18 83,12 @@ else if (c2!=null) {
}


/**
* {@inheritDoc}
*/
@Override
public String getAlreadyEntered(JTextComponent comp) {
return provider.getAlreadyEnteredText(comp);
}


/**
* {@inheritDoc}
*/
@Override
public Icon getIcon() {
return icon;
Expand All @@ -118,18 109,12 @@ public String getInputText() {
}


/**
* {@inheritDoc}
*/
@Override
public CompletionProvider getProvider() {
return provider;
}


/**
* {@inheritDoc}
*/
@Override
public int getRelevance() {
return relevance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 157,6 @@ public List<Completion> getCompletionByInputText(String inputText) {
}


/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected List<Completion> getCompletionsImpl(JTextComponent comp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 484,6 @@ private void setDisplayedDesc(Completion completion, final String anchor,
}


/**
* {@inheritDoc}
*/
@Override
public void setVisible(boolean visible) {
if (!visible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 126,7 @@ public class AutoCompletion {
private boolean autoActivationEnabled;

/**
* Whether or not, when there is only a single auto-complete option that
* Whether, when there is only a single auto-complete option that
* matches the text at the current text position, that text should be
* auto-inserted, instead of the completion window displaying.
*/
Expand Down Expand Up @@ -213,14 213,14 @@ public class AutoCompletion {
private EventListenerList listeners;

/**
* Whether or not the popup should be hidden when user types a space (or any
* Whether the popup should be hidden when user types a space (or any
* character that resets the completion list to "all completions"). Defaults
* to true.
*/
private boolean hideOnNoText;

/**
* Whether or not the popup should be hidden when the CompletionProvider
* Whether the popup should be hidden when the CompletionProvider
* changes. If set to false, caller has to ensure refresh of the popup
* content. Defaults to true.
*/
Expand Down Expand Up @@ -757,7 757,7 @@ public boolean isAutoCompleteEnabled() {


/**
* Whether or not the popup should be hidden when the CompletionProvider
* Whether the popup should be hidden when the CompletionProvider
* changes. If set to false, caller has to ensure refresh of the popup
* content.
*
Expand All @@ -771,7 771,7 @@ protected boolean isHideOnCompletionProviderChange() {


/**
* Whether or not the popup should be hidden when user types a space (or
* Whether the popup should be hidden when user types a space (or
* any character that resets the completion list to "all completions").
*
* @return Whether the popup should be hidden when the completion list is
Expand Down Expand Up @@ -1061,10 1061,10 @@ protected void setHideOnCompletionProviderChange(


/**
* Sets whether or not the popup should be hidden when user types a space
* Sets whether the popup should be hidden when user types a space
* (or any character that resets the completion list to "all completions").
*
* @param hideOnNoText Whether the popup sh ould be hidden when the
* @param hideOnNoText Whether the popup should be hidden when the
* completion list is reset to show all completions.
* @see #isHideOnNoText()
*/
Expand Down Expand Up @@ -1208,9 1208,8 @@ private void startParameterizedCompletionAssistance(
String template = "${}" text "${cursor}";
textComponent.replaceSelection(Character.toString(p
.getParameterListStart()));
TemplateCompletion tc = new TemplateCompletion(p, null, null,
template);
pc = tc;
pc = new TemplateCompletion(p, null, null,
template);
}
else {
text = p.getParameterListStart() text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ public class AutoCompletionEvent extends EventObject {
/**
* The type of this event.
*/
private Type type;
private final Type type;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@
*/
public class BasicCompletion extends AbstractCompletion {

private String replacementText;
private final String replacementText;
private String shortDesc;
private String summary;

Expand Down Expand Up @@ -72,9 72,6 @@ public BasicCompletion(CompletionProvider provider, String replacementText,
}


/**
* {@inheritDoc}
*/
@Override
public String getReplacementText() {
return replacementText;
Expand All @@ -93,9 90,6 @@ public String getShortDescription() {
}


/**
* {@inheritDoc}
*/
@Override
public String getSummary() {
return summary;
Expand Down Expand Up @@ -127,9 121,9 @@ public void setSummary(String summary) {
/**
* Returns a string representation of this completion. If the short
* description is not <code>null</code>, this method will return:
*
* <p>
* <code>getInputText() " - " shortDesc</code>
*
* <p>
* otherwise, it will return {@code getInputText()}.
*
* @return A string representation of this completion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 121,7 @@ public CompletionCellRenderer() {

/**
* Constructor. This is primarily a hook for Substance, or any other
* Look and Feel whose renderers look drastically different than standard
* Look and Feel whose renderers look drastically different from standard
* <code>DefaultListCellRenderer</code>s. Everything except for the text
* rendering will be done by the delegate. In almost all scenarios, you
* will want to use the no-argument constructor instead of this one.
Expand Down Expand Up @@ -398,7 398,7 @@ protected void paintComponent(Graphics g) {
* @param selected Whether the item is selected.
* @param hasFocus Whether the item has focus.
*/
protected void prepareForFunctionCompletion(JList list,
protected void prepareForFunctionCompletion(JList<?> list,
FunctionCompletion fc, int index, boolean selected, boolean hasFocus) {

StringBuilder sb = new StringBuilder(PREFIX);
Expand Down Expand Up @@ -464,14 464,9 @@ protected void prepareForFunctionCompletion(JList list,
* @param selected Whether the item is selected.
* @param hasFocus Whether the item has focus.
*/
protected void prepareForMarkupTagCompletion(JList list,
MarkupTagCompletion mc, int index, boolean selected, boolean hasFocus) {

StringBuilder sb = new StringBuilder(PREFIX);
sb.append(mc.getName());

setText(sb.toString());

protected void prepareForMarkupTagCompletion(JList<?> list,
MarkupTagCompletion mc, int index, boolean selected, boolean hasFocus) {
setText(PREFIX mc.getName());
}


Expand All @@ -485,7 480,7 @@ protected void prepareForMarkupTagCompletion(JList list,
* @param selected Whether the item is selected.
* @param hasFocus Whether the item has focus.
*/
protected void prepareForOtherCompletion(JList list,
protected void prepareForOtherCompletion(JList<?> list,
Completion c, int index, boolean selected, boolean hasFocus) {

StringBuilder sb = new StringBuilder(PREFIX);
Expand Down Expand Up @@ -519,7 514,7 @@ protected void prepareForOtherCompletion(JList list,
* @param selected Whether the item is selected.
* @param hasFocus Whether the item has focus.
*/
protected void prepareForTemplateCompletion(JList list,
protected void prepareForTemplateCompletion(JList<?> list,
TemplateCompletion tc, int index, boolean selected, boolean hasFocus) {

StringBuilder sb = new StringBuilder(PREFIX);
Expand Down Expand Up @@ -551,7 546,7 @@ protected void prepareForTemplateCompletion(JList list,
* @param selected Whether the item is selected.
* @param hasFocus Whether the item has focus.
*/
protected void prepareForVariableCompletion(JList list,
protected void prepareForVariableCompletion(JList<?> list,
VariableCompletion vc, int index, boolean selected, boolean hasFocus) {

StringBuilder sb = new StringBuilder(PREFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ class CompletionListModel extends AbstractListModel<Completion> {
/**
* Container for items in this model.
*/
private List<Completion> delegate;
private final List<Completion> delegate;


/**
Expand All @@ -40,7 40,7 @@ class CompletionListModel extends AbstractListModel<Completion> {


/**
* Removes all of the elements from this list. The list will
* Removes all the elements from this list. The list will
* be empty after this call returns (unless it throws an exception).
*
* @see #setContents(Collection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 73,7 @@ public abstract class CompletionProviderBase implements CompletionProvider {
/**
* A segment to use for fast char access.
*/
private Segment s = new Segment();
private final Segment s = new Segment();

protected static final String EMPTY_STRING = "";

Expand Down Expand Up @@ -105,7 105,7 @@ public List<Completion> getCompletions(JTextComponent comp) {
}

// NOTE: We can't sort by relevance prior to this; we need to have
// things alphabetical so we can easily narrow down completions to
// things alphabetical, so we can easily narrow down completions to
// those starting with what was already typed.
if (/*sortByRelevance*/true) {
completions.sort(SORT_BY_RELEVANCE_COMPARATOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 357,7 @@ public void reset(CompletionProvider provider) {


@Override
public InputSource resolveEntity(String publicID,
String systemID) throws SAXException {
public InputSource resolveEntity(String publicID, String systemID) {
return new InputSource(getClass().
getResourceAsStream("CompletionXml.dtd"));
}
Expand Down
Loading

0 comments on commit 21664e7

Please sign in to comment.