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
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ else if (treeBorder instanceof EmptyBorder &&
/**
* Listens for events in this window.
*/
private class Listener extends MouseAdapter implements WindowFocusListener,
private final class Listener extends MouseAdapter implements WindowFocusListener,
ComponentListener, DocumentListener, ActionListener, KeyListener {

@Override
Expand Down Expand Up @@ -283,7 +283,7 @@ public void windowLostFocus(WindowEvent e) {
/**
* The border for the filtering text field.
*/
private static class TextFieldBorder implements Border {
private static final class TextFieldBorder implements Border {

@Override
public Insets getBorderInsets(Component c) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public SourceTreeNode(Object userObject, boolean sorted) {
@Override
public void add(MutableTreeNode child) {
//super.add(child);
if(child!=null && child.getParent()==this) {
if (child!=null && child.getParent()==this) {
insert(child, super.getChildCount() - 1);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public int compareTo(Completion c2) {
return 0;
}
// Check for classes with same name, but in different packages
else if(c2.toString().equalsIgnoreCase(toString())) {
else if (c2.toString().equalsIgnoreCase(toString())) {
if (c2 instanceof ClassCompletion) {
ClassCompletion cc2 = (ClassCompletion)c2;
return getClassName(true).compareTo(cc2.getClassName(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public boolean removeJar(File jar) {

private void setCommentCompletions(ShorthandCompletionCache shorthandCache) {
AbstractCompletionProvider provider = shorthandCache.getCommentProvider();
if(provider != null) {
if (provider != null) {
for (Completion c : shorthandCache.getCommentCompletions()) {
provider.addCompletion(c);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ else if (!type.isBasicType()) {
* @param set The set to add to.
*/
private void addShorthandCompletions(Set<Completion> set) {
if(shorthandCache != null) {
if (shorthandCache != null) {
set.addAll(shorthandCache.getShorthandCompletions());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public static CompilationUnit getCompilationUnitFromDisk(
lastCUClassFileParam = cf;
CompilationUnit cu = null;

if(loc != null) {
if (loc != null) {
try {
cu = loc.getCompilationUnit(cf);
} catch (IOException ioe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Jdk9LibraryInfo(File[] jmodFiles, SourceLocation sourceLoc) {

@Override
public void bulkClassFileCreationEnd() {
for( JarFile bulkCreateJar: bulkCreateJmods) {
for (JarFile bulkCreateJar: bulkCreateJmods) {
try {
bulkCreateJar.close();
} catch (IOException ioe) {
Expand All @@ -71,7 +71,7 @@ public void bulkClassFileCreationEnd() {
@Override
public void bulkClassFileCreationStart() {
bulkCreateJmods = new JarFile[jmodFiles.length];
for(int i = 0; i< jmodFiles.length; i++) {
for (int i = 0; i < jmodFiles.length; i++) {
File jarFile = jmodFiles[i];
try {
bulkCreateJmods[i] = new JarFile(jarFile);
Expand Down Expand Up @@ -105,10 +105,10 @@ public int compareTo(LibraryInfo info) {

@Override
public ClassFile createClassFile(String entryName) throws IOException {
for(File jarFile: jmodFiles) {
for (File jarFile: jmodFiles) {
try (JarFile jar = new JarFile(jarFile)) {
ClassFile c = createClassFileImpl(jar, entryName);
if(c!=null) {
if (c!=null) {
return c;
}
}
Expand All @@ -120,9 +120,9 @@ public ClassFile createClassFile(String entryName) throws IOException {

@Override
public ClassFile createClassFileBulk(String entryName) throws IOException {
for( JarFile bulkCreateJar: bulkCreateJmods) {
for (JarFile bulkCreateJar: bulkCreateJmods) {
ClassFile c = createClassFileImpl(bulkCreateJar, entryName);
if(c!=null) {
if (c!=null) {
return c;
}
}
Expand Down Expand Up @@ -153,14 +153,14 @@ private static ClassFile createClassFileImpl(JarFile jar,
public PackageMapNode createPackageMap() throws IOException {
PackageMapNode root = new PackageMapNode();

for( File jarFile: jmodFiles) {
for (File jarFile: jmodFiles) {
try (JarFile jar = new JarFile(jarFile)) {

Enumeration<JarEntry> e = jar.entries();
while (e.hasMoreElements()) {
ZipEntry entry = e.nextElement();
String entryName = entry.getName();
if(entryName.startsWith("classes/")) {
if (entryName.startsWith("classes/")) {
entryName = entryName.substring(8);
if (entryName.endsWith(".class")) {
root.add(entryName);
Expand Down Expand Up @@ -191,7 +191,7 @@ public String getLocationAsString() {
@Override
public int hashCodeImpl() {
int h = 0;
for( File jarFile: jmodFiles) {
for (File jarFile: jmodFiles) {
h += jarFile.hashCode();
}
return h;
Expand All @@ -204,7 +204,7 @@ public int hashCodeImpl() {
* @param jmodFiles The jar files location. This cannot be <code>null</code>.
*/
private void setJmodFiles(File[] jmodFiles) {
for( File jarFile: jmodFiles) {
for (File jarFile: jmodFiles) {
if (jarFile==null || !jarFile.exists()) {
String name = jarFile==null ? "null" : jarFile.getAbsolutePath();
throw new IllegalArgumentException("Jar does not exist: " + name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.fife.rsta.ac.java.buildpath;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

import org.fife.rsta.ac.java.JarManager;
Expand Down Expand Up @@ -172,23 +171,22 @@ public boolean equals(Object o) {
* @see #getMainJreJarInfo()
*/
public static LibraryInfo getJreJarInfo(File jreHome) {
// Check if the Jre is made of modules

// Check if the JRE is made of modules (Java 9+)
File mods = new File(jreHome,"jmods");
if(mods.isDirectory()) {
File[] files = mods.listFiles( new FileFilter() {
@Override
public boolean accept(File pathname) {
if(pathname.isFile()) {
String name = pathname.getName();
return name.endsWith(".jmod") && (name.startsWith("java.") || name.startsWith("jdk."));
}
return false;
if (mods.isDirectory()) {
File[] files = mods.listFiles(pathname -> {
if (pathname.isFile()) {
String name = pathname.getName();
return name.endsWith(".jmod") &&
(name.startsWith("java.") || name.startsWith("jdk."));
}
return false;
});

LibraryInfo info = new Jdk9LibraryInfo(files);
File sourceZip = new File(jreHome,"lib"+File.separator+"src.zip");
if (sourceZip.isFile()) { // Make sure our last guess actually exists
File sourceZip = new File(jreHome,"lib/src.zip");
if (sourceZip.isFile()) {
info.setSourceLocation(new ZipSourceLocation(sourceZip));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public String getTypeString(boolean qualified) {
case 'L':
String clazz = descriptor.substring(braceCount+1,
descriptor.length()-1);
if(qualified) {
if (qualified) {
clazz = clazz.replace('/', '.');
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public String getReturnTypeString(boolean fullyQualified) {
}
}
if (!fullyQualified) {
if(returnType != null && returnType.contains(".")) {
if (returnType != null && returnType.contains(".")) {
return returnType.substring(returnType.lastIndexOf(".") +1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public List<String> getMethodParamTypes(MethodInfo mi, ClassFile cf,
parseParamDescriptor(paramDescriptors, cf, additionalTypeArgs,
mi, "Error parsing method signature for ", res, qualified);
paramTypeList.add(res.type);
if(paramDescriptors.length()>res.pos) {
if (paramDescriptors.length()>res.pos) {
paramDescriptors = paramDescriptors.substring(res.pos);
} else {
break;
Expand Down Expand Up @@ -353,7 +353,7 @@ private ParamDescriptorResult parseParamDescriptor(String str,
parseParamDescriptor(paramDescriptors, cf, additionalTypeArgs,
mi, "Error parsing method signature for ", res2, qualified);
paramTypeList.add(res2.type);
if(paramDescriptors.length()>res2.pos) {
if (paramDescriptors.length()>res2.pos) {
paramDescriptors = paramDescriptors.substring(res2.pos);
} else {
break;
Expand Down Expand Up @@ -428,7 +428,7 @@ public String toString() {
}


private static class ParamDescriptorResult {
private static final class ParamDescriptorResult {

private String type;
private int pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void setPackage(Package pkg) {
/**
* An offset that always returns 0.
*/
private static class ZeroOffset implements Offset {
private static final class ZeroOffset implements Offset {

@Override
public int getOffset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public void updateUI() {
* Listens for events this tree is interested in (events in the associated
* editor, for example), as well as events in this tree.
*/
private class Listener implements PropertyChangeListener,
private final class Listener implements PropertyChangeListener,
TreeSelectionListener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private SortedSet<Completion> getVariableCompletions(JTextComponent comp) {
* A comparator that compares the input text of two {@link Completion}s
* lexicographically, ignoring case.
*/
private static class CaseInsensitiveComparator
private static final class CaseInsensitiveComparator
implements Comparator<Completion>, Serializable {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void updateUI() {
* Listens for events this tree is interested in (events in the associated
* editor, for example), as well as events in this tree.
*/
private class XmlEditorListener implements PropertyChangeListener,
private final class XmlEditorListener implements PropertyChangeListener,
TreeSelectionListener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void updateUI() {
* much faster (~ 4x faster), but still doesn't eliminate the issue for
* huge trees.
*/
private static class XmlTreeCellUI extends BasicLabelUI {
private static final class XmlTreeCellUI extends BasicLabelUI {

@Override
protected void installDefaults(JLabel label) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private static void makeSpringCompactGrid(Container parent, int rows,
/**
* The border of the "top section" of the About dialog.
*/
private static class TopBorder extends AbstractBorder {
private static final class TopBorder extends AbstractBorder {

@Override
public Insets getBorderInsets(Component c) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subprojects {
// apply plugin: 'com.github.spotbugs'

checkstyle {
toolVersion = '9.3'
toolVersion = '10.25.0'
configDirectory = file("$rootProject.projectDir/config/checkstyle")
}

Expand Down
Loading