Skip to content

Commit

Permalink
#4 Checkstyle improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
amosshi committed Sep 10, 2019
1 parent 69c2cb7 commit 1d23aa2
Show file tree
Hide file tree
Showing 14 changed files with 260 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ private static void loadPlugins() {
if (plguinFile.isFile() & plguinFile.getName().toLowerCase().endsWith(".jar")) {
try {
JarFile jar = new JarFile(plguinFile);
if (jar == null) {
continue;
}

Manifest mf = jar.getManifest();
if (mf == null) {
Expand Down Expand Up @@ -86,20 +83,19 @@ private static void loadPlugin(File pluginFile, String pluginDescClassName) thro
if (cls == null) {
return;
}
PLUGINS.put(pluginFile.getName(), (PluginDescriptor) cls.newInstance());
PLUGINS.put(pluginFile.getName(), (PluginDescriptor) cls.getDeclaredConstructor().newInstance());
}

public static String getPlugedExtensions(){
StringBuilder builder = new StringBuilder(16);
if (!PLUGINS.isEmpty()) {
builder.append(" - ");
for (PluginDescriptor plugin : PLUGINS.values()) {
String[] exts = plugin.getExtensions();
PLUGINS.values().stream().map((plugin) -> plugin.getExtensions()).forEachOrdered((exts) -> {
for (String ext : exts) {
builder.append(ext);
builder.append(", ");
}
}
});
builder.append(" ...");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface DataInputEx {
* @return the signed 16-bit value read.
* @throws IOException I/O Error
*/
short readShort_LittleEndian() throws IOException;
short readShortInLittleEndian() throws IOException;

/**
* Reads two input bytes and returns an <code>int</code> value in the range
Expand All @@ -56,7 +56,7 @@ public interface DataInputEx {
* @return the unsigned 16-bit value read.
* @throws IOException I/O Error
*/
int readUnsignedShort_LittleEndian() throws IOException;
int readUnsignedShortInLittleEndian() throws IOException;

/**
* Reads four input bytes and returns an <code>int</code> value. Let
Expand All @@ -72,7 +72,7 @@ public interface DataInputEx {
* @return the <code>int</code> value read.
* @exception IOException if an I/O error occurs.
*/
int readInt_LittleEndian() throws IOException;
int readIntInLittleEndian() throws IOException;

/**
* Reads four input bytes as unsigned integer and returns a
Expand All @@ -90,15 +90,15 @@ public interface DataInputEx {
* @return the <code>long</code> value read.
* @throws java.io.IOException I/O Error
*/
long readUnsignedInt_LittleEndian() throws IOException;
long readUnsignedIntInLittleEndian() throws IOException;

/**
* Reads eight input bytes and returns a {@code long} value.
*
* @return the <code>long</code> value read.
* @throws java.io.IOException I/O Error
*/
long readLong_LittleEndian() throws IOException;
long readLongInLittleEndian() throws IOException;

/**
* Reads eight input bytes and returns a {@code unsigned long} value.
Expand All @@ -114,7 +114,7 @@ public interface DataInputEx {
* @return the <code>unsigned long</code> value read
* @throws java.io.IOException I/O Error
*/
BigInteger readUnsignedLong_LittleEndian() throws IOException;
BigInteger readUnsignedLongInLittleEndian() throws IOException;

/**
* Reads length input bytes as an ASCII string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;

/**
* Default implementation for {@link FileComponent}.
*
* @author Amos Shi
*/
Expand All @@ -18,7 +19,7 @@ public class DefaultFileComponent extends FileComponent implements GenerateTreeN
* @param start Start Position of the File component
* @param len Length of the File component
*/
public DefaultFileComponent(int start, int len) {
public DefaultFileComponent(final int start, final int len) {
super.startPos = start;
super.length = len;
}
Expand All @@ -30,13 +31,13 @@ public DefaultFileComponent(int start, int len) {
* @param len Length of the File component
* @param text Text of the Tree Node
*/
public DefaultFileComponent(int start, int len, String text) {
public DefaultFileComponent(final int start, final int len, final String text) {
this(start, len);
this.treeNodeText = text;
}

@Override
public void generateTreeNode(DefaultMutableTreeNode parentNode) {
public void generateTreeNode(final DefaultMutableTreeNode parentNode) {
parentNode.add(new DefaultMutableTreeNode(new JTreeNodeFileComponent(
super.startPos,
super.length,
Expand Down
Loading

0 comments on commit 1d23aa2

Please sign in to comment.