remove a bunch of compiler warnings

This commit is contained in:
Ben Fry
2015-02-24 02:55:52 -05:00
parent 2538a6a1e5
commit 6d930c0d5b
14 changed files with 26 additions and 29 deletions
@@ -426,15 +426,14 @@ public class AutoFormat implements Formatter {
/**
* Takes all whitespace off the end of its argument.
*/
private void trimRight(final StringBuilder sb) {
while (sb.length() >= 1 && Character.isWhitespace(sb.charAt(sb.length() - 1)))
static private void trimRight(final StringBuilder sb) {
while (sb.length() >= 1 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
sb.setLength(sb.length() - 1);
}
}
/**
* Entry point
*/
/** Entry point */
public String format(final String source) {
final String normalizedText = source.replaceAll("\r", "");
final String cleanText =
+1 -1
View File
@@ -355,7 +355,7 @@ public class DebugTray extends JFrame {
}
@Override
public Class getColumnClass(int column) {
public Class<?> getColumnClass(int column) {
if (column == 0) {
return VariableNode.class;
}
+2 -2
View File
@@ -1381,12 +1381,12 @@ public class Debugger implements VMEventListener {
}
private void log(Level level, String msg) {
static private void log(Level level, String msg) {
Logger.getLogger(Debugger.class.getName()).log(level, msg);
}
private void log(Level level, String msg, Object obj) {
static private void log(Level level, String msg, Object obj) {
Logger.getLogger(Debugger.class.getName()).log(level, msg, obj);
}
}
@@ -2553,7 +2553,7 @@ public class JavaEditor extends Editor {
}
private boolean[] getModifiedTabs(List<List<Handle>> handles) {
static private boolean[] getModifiedTabs(List<List<Handle>> handles) {
boolean[] modifiedTabs = new boolean[handles.size()];
for (int i = 0; i < handles.size(); i++) {
@@ -2785,13 +2785,13 @@ public class JavaEditor extends Editor {
}
private String replaceString(String str, int start, int end, String put) {
static private String replaceString(String str, int start, int end, String put) {
return str.substring(0, start) + put + str.substring(end, str.length());
}
//private int howManyInts(ArrayList<Handle> handles[])
private int howManyInts(List<List<Handle>> handles) {
static private int howManyInts(List<List<Handle>> handles) {
int count = 0;
//for (int i=0; i<handles.length; i++) {
for (List<Handle> list : handles) {
@@ -2807,7 +2807,7 @@ public class JavaEditor extends Editor {
//private int howManyFloats(ArrayList<Handle> handles[])
private int howManyFloats(List<List<Handle>> handles) {
static private int howManyFloats(List<List<Handle>> handles) {
int count = 0;
//for (int i=0; i<handles.length; i++) {
for (List<Handle> list : handles) {
+1 -1
View File
@@ -208,7 +208,7 @@ public class JavaMode extends Mode {
// TODO Why is this necessary? Why isn't Sketch.isModified() used?
private boolean isSketchModified(Sketch sketch) {
static private boolean isSketchModified(Sketch sketch) {
for (SketchCode sc : sketch.getCode()) {
if (sc.isModified()) {
return true;
@@ -234,7 +234,7 @@ public class VariableNode implements MutableTreeNode {
}
@Override
public Enumeration children() {
public Enumeration<MutableTreeNode> children() {
return Collections.enumeration(children);
}
@@ -1449,7 +1449,7 @@ public class ASTGenerator {
}
}
Class probableClass = null;
Class<?> probableClass = null;
if (tehClass.getClass_() != null) {
probableClass = tehClass.getClass_();
} else {
@@ -370,10 +370,10 @@ public class CompilationChecker {
.getDefault()));
compiler.compile(new ICompilationUnit[] { unit });
List problems = requestor.getProblems();
List<IProblem> problems = requestor.getProblems();
prob = new IProblem[problems.size()];
int count = 0;
for (Iterator it = problems.iterator(); it.hasNext();) {
for (Iterator<IProblem> it = problems.iterator(); it.hasNext();) {
IProblem problem = (IProblem) it.next();
prob[count++] = problem;
}
@@ -479,7 +479,6 @@ public class CompilationChecker {
}
@SuppressWarnings("rawtypes")
public IProblem[] getErrors(String sourceName, String source, Map<String, String> settings) {
fileName = sourceName;
sourceText = "package " + fileName + ";\n" + source;
@@ -183,7 +183,7 @@ public class CompletionPanel {
return createZeroButton();
}
private JButton createZeroButton() {
static private JButton createZeroButton() {
JButton jbutton = new JButton();
jbutton.setPreferredSize(new Dimension(0, 0));
jbutton.setMinimumSize(new Dimension(0, 0));
@@ -967,14 +967,13 @@ public class ErrorCheckerService implements Runnable {
/**
* Various option for JDT Compiler
*/
protected Map compilerSettings;
protected Map<String, String> compilerSettings;
/**
* Sets compiler options for JDT Compiler
*/
@SuppressWarnings("rawtypes")
protected void prepareCompilerSetting() {
compilerSettings = new HashMap();
compilerSettings = new HashMap<String, String>();
compilerSettings.put(CompilerOptions.OPTION_LineNumberAttribute,
CompilerOptions.GENERATE);
@@ -420,7 +420,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
* @param string
* @return - String
*/
private String trimRight(String string) {
static private String trimRight(String string) {
String newString = "";
for (int i = 0; i < string.length(); i++) {
if (string.charAt(i) != ' ') {
@@ -65,7 +65,7 @@ public class JavadocHelper {
String msg = "";
String methodName = docFile.getName().substring(0, docFile.getName().indexOf('_'));
//System.out.println(methodName);
for (Iterator it = elm.iterator(); it.hasNext();) {
for (Iterator<Element> it = elm.iterator(); it.hasNext();) {
Element ele = (Element) it.next();
msg = "<html><body> <strong><div style=\"width: 300px; text-justification: justify;\"></strong><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"ref-item\">"
+ ele.html() + "</table></div></html></body></html>";
@@ -48,7 +48,7 @@ public class PdeEmitter implements PdeTokenTypes {
* @returns a child AST of the given type. If it can't find a child of the
* given type, return null.
*/
private AST getChild(final AST ast, final int childType) {
static private AST getChild(final AST ast, final int childType) {
AST child = ast.getFirstChild();
while (child != null) {
if (child.getType() == childType) {
@@ -126,7 +126,7 @@ public class PdeEmitter implements PdeTokenTypes {
* Tells whether an AST has any children or not.
* @return true iff the AST has at least one child
*/
private boolean hasChildren(final AST ast) {
static private boolean hasChildren(final AST ast) {
return (ast.getFirstChild() != null);
}
@@ -35,6 +35,7 @@ import java.util.*;
import com.sun.jdi.*;
import com.sun.jdi.connect.*;
import com.sun.jdi.connect.Connector.Argument;
import com.sun.jdi.event.*;
import com.sun.jdi.request.*;
@@ -149,7 +150,6 @@ public class Runner implements MessageConsumer {
}
@SuppressWarnings("unchecked")
public boolean launchVirtualMachine(boolean presenting) {
String[] vmParams = getMachineParams();
String[] sketchParams = getSketchParams(presenting);
@@ -175,7 +175,7 @@ public class Runner implements MessageConsumer {
findConnector("com.sun.jdi.SocketAttach");
//PApplet.println(connector); // gets the defaults
Map arguments = connector.defaultArguments();
Map<String, Argument> arguments = connector.defaultArguments();
// Connector.Argument addressArg =
// (Connector.Argument)arguments.get("address");
@@ -564,7 +564,7 @@ public class Runner implements MessageConsumer {
protected Connector findConnector(String connectorName) {
// List connectors =
// com.sun.jdi.Bootstrap.virtualMachineManager().allConnectors();
List connectors =
List<Connector> connectors =
org.eclipse.jdi.Bootstrap.virtualMachineManager().allConnectors();
// // debug: code to list available connectors