clean up several warnings

This commit is contained in:
Ben Fry
2014-07-26 11:21:17 -04:00
parent d01710cc45
commit faace6ca12
26 changed files with 81 additions and 118 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ public class JavaMode extends Mode {
public String getTitle() {
return "Java";
return "Java (2.0)";
}
@@ -12,6 +12,7 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="processing-experimental"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/processing-experimental/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+3 -3
View File
@@ -155,13 +155,13 @@ public class OSCBundle extends OSCPacket {
*/
protected void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream) {
if ((null == timestamp) || (timestamp == TIMESTAMP_IMMEDIATE)) {
stream.write((int) 0);
stream.write((int) 1);
stream.write(0);
stream.write(1);
return;
}
long millisecs = timestamp.getTime();
long secsSince1970 = (long) (millisecs / 1000);
long secsSince1970 = millisecs / 1000;
long secs = secsSince1970 + SECONDS_FROM_1900_TO_1970.longValue();
// this line was cribbed from jakarta commons-net's NTP TimeStamp code
@@ -2,14 +2,11 @@ package galsasson.mode.tweak;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.border.EmptyBorder;
import processing.core.PApplet;
import processing.core.PGraphics;
@@ -1,6 +1,5 @@
package galsasson.mode.tweak;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.AffineTransform;
@@ -20,10 +19,10 @@ public class HProgressBar {
setPos(0);
int xl[] = {0, 0, -(int)((float)size/1.5)};
int xl[] = {0, 0, -(int)(size/1.5)};
int yl[] = {-(int)((float)size/3), (int)((float)size/3), 0};
leftPoly = new Polygon(xl, yl, 3);
int xr[] = {0, (int)((float)size/1.5), 0};
int xr[] = {0, (int)(size/1.5), 0};
int yr[] = {-(int)((float)size/3), 0, (int)((float)size/3)};
rightPoly = new Polygon(xr, yr, 3);
}
+1 -6
View File
@@ -1,11 +1,6 @@
package galsasson.mode.tweak;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.math.BigDecimal;
import java.util.Comparator;
@@ -176,7 +171,7 @@ public class Handle {
private float getChange()
{
int pixels = xCurrent - xLast;
return (float)pixels*incValue;
return pixels*incValue;
}
public void setPos(int nx, int ny)
@@ -8,8 +8,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import processing.app.Sketch;
public class SketchParser
{
public ArrayList<ColorControlBox> colorBoxes[];
@@ -1008,28 +1008,23 @@ public class ASTGenerator {
ASTNode childExpr = getChildExpression(testnode);
log("Parent expression : " + getParentExpression(testnode));
log("Child expression : " + childExpr);
if (childExpr instanceof ASTNode) {
if (!noCompare) {
log("Original testnode "
+ getNodeAsString(testnode));
testnode = getParentExpression(testnode);
log("Corrected testnode "
+ getNodeAsString(testnode));
}
ClassMember expr = resolveExpression3rdParty(nearestNode, testnode,
noCompare);
if (expr == null) {
log("Expr is null");
} else {
log("Expr is " + expr.toString());
candidates = getMembersForType(expr, childExpr.toString(),
noCompare, false);
}
}
else
{
log("ChildExpr is null");
if (!noCompare) {
log("Original testnode "
+ getNodeAsString(testnode));
testnode = getParentExpression(testnode);
log("Corrected testnode "
+ getNodeAsString(testnode));
}
ClassMember expr = resolveExpression3rdParty(nearestNode, testnode,
noCompare);
if (expr == null) {
log("Expr is null");
} else {
log("Expr is " + expr.toString());
candidates = getMembersForType(expr, childExpr.toString(),
noCompare, false);
}
}
showPredictions(word);
@@ -1263,7 +1258,9 @@ public class ASTGenerator {
Class tehClass = null;
// First, see if the classname is a fully qualified name and loads straightaway
tehClass = loadClass(className);
if(tehClass instanceof Class){
// do you mean to check for 'null' here? otherwise, this expression is always true [fry]
if (tehClass instanceof Class) {
//log(tehClass.getName() + " located straightaway");
return tehClass;
}
@@ -1458,8 +1455,7 @@ public class ASTGenerator {
.structuralPropertiesForType().iterator();
// logE("Props of " + node.getClass().getName());
while (it.hasNext()) {
StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) it
.next();
StructuralPropertyDescriptor prop = it.next();
if (prop.isChildProperty() || prop.isSimpleProperty()) {
if (node.getStructuralProperty(prop) != null) {
@@ -1505,9 +1501,9 @@ public class ASTGenerator {
}
List<ASTNode> nodes = null;
if (parent instanceof TypeDeclaration) {
nodes = (List<ASTNode>) ((TypeDeclaration) parent).bodyDeclarations();
nodes = ((TypeDeclaration) parent).bodyDeclarations();
} else if (parent instanceof Block) {
nodes = (List<ASTNode>) ((Block) parent).statements();
nodes = ((Block) parent).statements();
} else {
System.err.println("THIS CONDITION SHOULD NOT OCCUR - findClosestNode "
+ getNodeAsString(parent));
@@ -2196,13 +2192,12 @@ public class ASTGenerator {
* @param tnode
*/
public static void visitRecur(ASTNode node, DefaultMutableTreeNode tnode) {
Iterator<StructuralPropertyDescriptor> it = node
.structuralPropertiesForType().iterator();
Iterator<StructuralPropertyDescriptor> it =
node.structuralPropertiesForType().iterator();
//logE("Props of " + node.getClass().getName());
DefaultMutableTreeNode ctnode = null;
while (it.hasNext()) {
StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) it
.next();
StructuralPropertyDescriptor prop = it.next();
if (prop.isChildProperty() || prop.isSimpleProperty()) {
if (node.getStructuralProperty(prop) != null) {
@@ -2274,11 +2269,10 @@ public class ASTGenerator {
while (!stack.isEmpty()) {
ASTNode node = (ASTNode) stack.pop();
//log("Popped from stack: " + getNodeAsString(node));
Iterator<StructuralPropertyDescriptor> it = node
.structuralPropertiesForType().iterator();
Iterator<StructuralPropertyDescriptor> it =
node.structuralPropertiesForType().iterator();
while (it.hasNext()) {
StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) it
.next();
StructuralPropertyDescriptor prop = it.next();
if (prop.isChildProperty() || prop.isSimpleProperty()) {
if (node.getStructuralProperty(prop) instanceof ASTNode) {
@@ -2463,8 +2457,7 @@ public class ASTGenerator {
.structuralPropertiesForType().iterator();
//logE("Props of " + node.getClass().getName());
while (it.hasNext()) {
StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) it
.next();
StructuralPropertyDescriptor prop = it.next();
if (prop.isChildProperty() || prop.isSimpleProperty()) {
if (node.getStructuralProperty(prop) != null) {
@@ -43,7 +43,6 @@ import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
/**
* Wrapper class for ASTNode objects
@@ -162,8 +161,7 @@ public class ASTNodeWrapper {
.structuralPropertiesForType().iterator();
boolean flag = true;
while (it.hasNext()) {
StructuralPropertyDescriptor prop = (StructuralPropertyDescriptor) it
.next();
StructuralPropertyDescriptor prop = it.next();
if (prop.isChildListProperty()) {
List<ASTNode> nodelist = (List<ASTNode>) thisNode
.getStructuralProperty(prop);
@@ -18,17 +18,16 @@
package processing.mode.experimental;
import static processing.mode.experimental.ExperimentalMode.log;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import processing.app.Base;
import processing.app.Sketch;
import static processing.mode.experimental.ExperimentalMode.log;
/**
* Autosave utility for saving sketch backups in the background after
* certain intervals
@@ -42,7 +41,7 @@ public class AutoSaveUtil {
private Timer timer;
private int saveTime;
// private int saveTime;
private File autosaveDir, pastSave;
@@ -334,6 +333,7 @@ public class AutoSaveUtil {
* @author quarkninja
*
*/
/*
private class SaveTask extends TimerTask{
@Override
@@ -348,5 +348,6 @@ public class AutoSaveUtil {
}
}
*/
}
@@ -26,7 +26,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -280,6 +279,7 @@ public class CompilationChecker {
/**
* ClassLoader implementation
*/
/*
private class CustomClassLoader extends ClassLoader {
private Map classMap;
@@ -301,6 +301,7 @@ public class CompilationChecker {
return super.findClass(name);
}
};
*/
private ICompilationUnit generateCompilationUnit() {
ASTParser parser = ASTParser.newParser(AST.JLS4);
@@ -432,13 +433,13 @@ public class CompilationChecker {
static private String[] getSimpleNames(String qualifiedName) {
StringTokenizer st = new StringTokenizer(qualifiedName, ".");
ArrayList list = new ArrayList();
ArrayList<String> list = new ArrayList<String>();
while (st.hasMoreTokens()) {
String name = st.nextToken().trim();
if (!name.equals("*"))
list.add(name);
}
return (String[]) list.toArray(new String[list.size()]);
return list.toArray(new String[0]);
}
public static void main(String[] args) {
@@ -1,5 +1,4 @@
package processing.mode.experimental;
import static processing.mode.experimental.ExperimentalMode.log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
@@ -24,7 +24,6 @@ import galsasson.mode.tweak.SketchParser;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.FlowLayout;
@@ -42,8 +41,6 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -63,7 +60,6 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import javax.swing.table.TableModel;
import javax.swing.text.Document;
@@ -74,7 +70,6 @@ import processing.app.Base;
import processing.app.EditorState;
import processing.app.EditorToolbar;
import processing.app.Mode;
import processing.app.Preferences;
import processing.app.Sketch;
import processing.app.SketchCode;
import processing.app.Toolkit;
@@ -82,7 +77,6 @@ import processing.app.syntax.JEditTextArea;
import processing.app.syntax.PdeTextAreaDefaults;
import processing.core.PApplet;
import processing.mode.java.JavaEditor;
import processing.mode.java.JavaToolbar;
/**
* Main View Class. Handles the editor window including tool bar and menu. Has
@@ -392,7 +386,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
for (String errMsg : errorCheckerService.tempErrorLog.keySet()) {
IProblem ip = errorCheckerService.tempErrorLog.get(errMsg);
if(ip != null){
sbuff.append(errorCheckerService.errorMsgSimplifier.getIDName(ip.getID()));
sbuff.append(ErrorMessageSimplifier.getIDName(ip.getID()));
sbuff.append(',');
sbuff.append("{");
for (int i = 0; i < ip.getArguments().length; i++) {
@@ -23,9 +23,9 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.logging.Level;
import java.util.logging.Logger;
import processing.app.Base;
import processing.app.Editor;
import processing.app.Preferences;
import processing.app.Toolkit;
import processing.mode.java.JavaToolbar;
@@ -960,7 +960,7 @@ public class Debugger implements VMEventListener {
*/
protected List<VariableNode> getLocals(ThreadReference t, int depth) {
//System.out.println("getting locals");
List<VariableNode> vars = new ArrayList();
List<VariableNode> vars = new ArrayList<VariableNode>();
try {
if (t.frameCount() > 0) {
StackFrame sf = t.frame(0);
@@ -1016,7 +1016,7 @@ public class Debugger implements VMEventListener {
*/
protected List<VariableNode> getFields(Value value, int depth, int maxDepth, boolean includeInherited) {
// remember: Value <- ObjectReference, ArrayReference
List<VariableNode> vars = new ArrayList();
List<VariableNode> vars = new ArrayList<VariableNode>();
if (depth <= maxDepth) {
if (value instanceof ArrayReference) {
return getArrayFields((ArrayReference) value);
@@ -1057,7 +1057,7 @@ public class Debugger implements VMEventListener {
* @return list of array fields
*/
protected List<VariableNode> getArrayFields(ArrayReference array) {
List<VariableNode> fields = new ArrayList();
List<VariableNode> fields = new ArrayList<VariableNode>();
if (array != null) {
String arrayType = array.type().name();
if (arrayType.endsWith("[]")) {
@@ -20,11 +20,7 @@ package processing.mode.experimental;
import static processing.mode.experimental.ExperimentalMode.log;
import static processing.mode.experimental.ExperimentalMode.logE;
import java.awt.EventQueue;
import java.io.File;
import java.io.FileFilter;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -50,7 +46,6 @@ import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
import processing.app.Base;
import processing.app.Editor;
@@ -7,8 +7,6 @@ import java.util.TreeMap;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
import static processing.mode.experimental.ExperimentalMode.log;
import static processing.mode.experimental.ExperimentalMode.logE;
public class ErrorMessageSimplifier {
@@ -116,7 +116,8 @@ public class ExperimentalMode extends JavaMode {
@Override
public String getTitle() {
return "PDE X";
//return "PDE X";
return "Java";
}
@@ -17,17 +17,16 @@
*/
package processing.mode.experimental;
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.Location;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.BreakpointRequest;
import static processing.mode.experimental.ExperimentalMode.log;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import static processing.mode.experimental.ExperimentalMode.log;
import static processing.mode.experimental.ExperimentalMode.logE;
import static processing.mode.experimental.ExperimentalMode.log2;
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.Location;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.BreakpointRequest;
/**
* Model/Controller of a line breakpoint. Can be set before or while debugging.
@@ -63,7 +63,7 @@ public class OffsetMatcher {
public int getPdeOffForJavaOff(int start, int length) {
// log("PDE :" + pdeCodeLine + "\nJAVA:" + javaCodeLine);
if(!matchingNeeded) return start;
int ans = getPdeOffForJavaOff(start), end = getPdeOffForJavaOff(start + length - 1);
int ans = getPdeOffForJavaOff(start); //, end = getPdeOffForJavaOff(start + length - 1);
// log(start + " java start off, pde start off "
// + ans);
// log((start + length - 1) + " java end off, pde end off "
@@ -1,7 +1,5 @@
package processing.mode.experimental;
import static processing.mode.experimental.ExperimentalMode.log;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
@@ -11,11 +9,9 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.io.File;
import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -38,8 +34,6 @@ import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import processing.app.Base;
public class SketchOutline {
protected JFrame frmOutlineView;
@@ -20,7 +20,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -32,7 +31,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
import processing.app.SketchCode;
import static processing.mode.experimental.ExperimentalMode.log;
public class TabOutline {
protected JFrame frmOutlineView;
@@ -38,7 +38,6 @@ import java.util.Map;
import javax.swing.DefaultListModel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.text.BadLocationException;
import processing.app.syntax.JEditTextArea;
import processing.app.syntax.TextAreaDefaults;
@@ -358,7 +358,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
// horizontalAdjustment);
int y = ta.lineToY(line);
y += fm.getLeading() + fm.getMaxDescent();
int height = fm.getHeight();
// int height = fm.getHeight();
int start = ta.getLineStartOffset(line) + problem.getPDELineStartOffset();
int pLength = problem.getPDELineStopOffset() + 1
- problem.getPDELineStartOffset();
@@ -623,7 +623,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
for (int tab=0; tab<code.length; tab++)
{
String tabCode = ((DebugEditor)ta.editor).baseCode[tab];
String tabCode = ta.editor.baseCode[tab];
ta.setText(tabCode);
for (Handle n : handles[tab])
{
@@ -657,7 +657,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
int charInc = 0;
int currentTab = ta.editor.getSketch().getCurrentCodeIndex();
SketchCode sc = ta.editor.getSketch().getCode(currentTab);
String code = ((DebugEditor)ta.editor).baseCode[currentTab];
String code = ta.editor.baseCode[currentTab];
for (Handle n : handles[currentTab])
{
@@ -18,6 +18,7 @@
package processing.mode.experimental;
import com.sun.jdi.Value;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
@@ -30,6 +31,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultCellEditor;
import javax.swing.GrayFilter;
import javax.swing.Icon;
@@ -47,6 +49,7 @@ import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import org.netbeans.swing.outline.DefaultOutlineCellRenderer;
import org.netbeans.swing.outline.DefaultOutlineModel;
import org.netbeans.swing.outline.ExtTreeWillExpandListener;
@@ -106,10 +109,10 @@ public class VariableInspector extends javax.swing.JFrame {
//System.out.println("renderer: " + tree.getDefaultRenderer(String.class).getClass());
//System.out.println("editor: " + tree.getDefaultEditor(String.class).getClass());
callStack = new ArrayList();
locals = new ArrayList();
thisFields = new ArrayList();
declaredThisFields = new ArrayList();
callStack = new ArrayList<DefaultMutableTreeNode>();
locals = new ArrayList<VariableNode>();
thisFields = new ArrayList<VariableNode>();
declaredThisFields = new ArrayList<VariableNode>();
this.setTitle(editor.getSketch().getName());
@@ -537,7 +540,6 @@ public class VariableInspector extends javax.swing.JFrame {
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -805,7 +807,7 @@ public class VariableInspector extends javax.swing.JFrame {
* @return the filtered list.
*/
protected List<VariableNode> filterNodes(List<VariableNode> nodes, VariableNodeFilter filter) {
List<VariableNode> filtered = new ArrayList();
List<VariableNode> filtered = new ArrayList<VariableNode>();
for (VariableNode node : nodes) {
if (filter.accept(node)) {
filtered.add(node);
@@ -107,14 +107,15 @@ public class XQPreprocessor {
// System.out.println("------------XQPreProc End-----------------");
// Calculate main class offset
int position = doc.get().indexOf("{") + 1;
int lines = 0;
for (int i = 0; i < position; i++) {
if (doc.get().charAt(i) == '\n') {
lines++;
}
}
lines += 2;
// removed unused 'lines' tabulation [fry 140726]
// int position = doc.get().indexOf("{") + 1;
// int lines = 0;
// for (int i = 0; i < position; i++) {
// if (doc.get().charAt(i) == '\n') {
// lines++;
// }
// }
// lines += 2;
// System.out.println("Lines: " + lines);
return doc.get();