Skip to content
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 .claude/commands/pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Create a branch (if needed), commit staged/unstaged changes, push, and open/upda

2. **Ensure JDK 25 is on the path**. This library requires JDK 25 or later to build.
Ensure that `java --version` shows `25` or later. If not, search for Java 25 in common
locaitons for the operating system. If you can't find it, exit early.
locations for the operating system. If you can't find it, exit early.

3. **Build locally** by running `./gradlew clean build`. If there are any checkstyle
or spotbugs failure, or javac errors, fix them and rerun this check to verify your changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public Color getDescriptionWindowColor() {
* @return The default list cell renderer.
* @see #setListCellRenderer(ListCellRenderer)
*/
public ListCellRenderer getListCellRenderer() {
public ListCellRenderer<Object> getListCellRenderer() {
DelegatingCellRenderer dcr = (DelegatingCellRenderer)list.
getCellRenderer();
return dcr.getFallbackCellRenderer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.awt.geom.Rectangle2D;
import java.beans.*;
import java.util.List;
import java.util.Objects;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
Expand Down Expand Up @@ -425,7 +426,7 @@ public static LinkRedirector getLinkRedirector() {
* @return The default list cell renderer.
* @see #setListCellRenderer(ListCellRenderer)
*/
public ListCellRenderer getListCellRenderer() {
public ListCellRenderer<Object> getListCellRenderer() {
return renderer;
}

Expand Down Expand Up @@ -978,10 +979,7 @@ public void setAutoCompleteSingleChoices(boolean autoComplete) {
* <code>null</code>.
*/
public void setCompletionProvider(CompletionProvider provider) {
if (provider == null) {
throw new IllegalArgumentException("provider cannot be null");
}
this.provider = provider;
this.provider = Objects.requireNonNull(provider, "provider cannot be null");
if (isHideOnCompletionProviderChange()) {
hidePopupWindow(); // In case new choices should be displayed.
}
Expand Down Expand Up @@ -1165,14 +1163,11 @@ public void setShowDescWindow(boolean show) {
* Sets the keystroke that should be used to trigger the auto-complete popup
* window.
*
* @param ks The keystroke.
* @throws IllegalArgumentException If <code>ks</code> is <code>null</code>.
* @param ks The keystroke. This cannot be {@code null}.
* @see #getTriggerKey()
*/
public void setTriggerKey(KeyStroke ks) {
if (ks == null) {
throw new IllegalArgumentException("trigger key cannot be null");
}
Objects.requireNonNull(ks, "trigger key cannot be null");
if (!ks.equals(trigger)) {
if (textComponent != null) {
// Put old trigger action back.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ protected void uninstallDefaults() {
* completions.
*/
@Override
@SuppressWarnings("unchecked") // BasicListUI has unparameterized JList
protected void updateLayoutState() {

ListModel<?> model = list.getModel();
ListModel<Object> model = list.getModel();
int itemCount = model.getSize();

// If the item count is small enough to run fast on practically all
Expand All @@ -157,7 +156,7 @@ protected void updateLayoutState() {

// Otherwise, assume all cells are the same height as the first cell,
// and estimate the necessary width.
ListCellRenderer<Object> renderer = (ListCellRenderer<Object>)list.getCellRenderer();
ListCellRenderer<Object> renderer = list.getCellRenderer();

cellWidth = list.getWidth();
if (list.getParent() instanceof JViewport) { // Always true for us
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.awt.event.MouseEvent;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.swing.text.JTextComponent;

import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
Expand Down Expand Up @@ -332,10 +333,7 @@ public void setCommentCompletionProvider(CompletionProvider provider) {
* @see #getDefaultCompletionProvider()
*/
public void setDefaultCompletionProvider(CompletionProvider provider) {
if (provider==null) {
throw new IllegalArgumentException("provider cannot be null");
}
this.defaultProvider = provider;
this.defaultProvider = Objects.requireNonNull(provider, "provider cannot be null");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import java.util.Objects;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.JTextComponent;
Expand Down Expand Up @@ -130,10 +131,7 @@ public Shape paintLayer(Graphics g, int p0, int p1, Shape viewBounds,
* @see #getColor()
*/
public void setColor(Color color) {
if (color==null) {
throw new IllegalArgumentException("color cannot be null");
}
this.color = color;
this.color = Objects.requireNonNull(color, "color cannot be null");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,7 @@ private int possiblyReplaceTabsWithSpaces(StringBuilder sb, String text,
}
}

StringBuilder sb2 = new StringBuilder();
for (int i = 0; i < size; i++) {
sb2.append(' ');
}
String tabStr = sb2.toString();
String tabStr = " ".repeat(Math.max(0, size));

int lastOffs = 0;
do {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SNAPSHOT builds of the in-development, unreleased version are hosted on
[Sonatype](https://oss.sonatype.org/content/repositories/snapshots/com/fifesoft/autocomplete/).

# Compiling
AutoComplete is built using Gradle. It requires Java 17 to buil but runs on
AutoComplete is built using Gradle. It requires Java 17 to build but runs on
Java 8 or later.
To compile the source, run all tests, and build the distribution jar,
simply run the following gradle command:
Expand Down
Loading