Skip to content

Commit fe13c3a

Browse files
committed
clean up warnings
1 parent fa0e060 commit fe13c3a

File tree

15 files changed

+97
-519
lines changed

15 files changed

+97
-519
lines changed

app/src/processing/app/syntax/TextAreaPainter.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,14 @@ public Segment getCurrentLine() {
631631
}
632632

633633

634-
/** Old paintLine() method with kooky args order, kept around for X Mode. */
635-
@Deprecated
636-
protected void paintLine(Graphics gfx, TokenMarker tokenMarker,
637-
int line, int x) {
634+
// /** Old paintLine() method with kooky args order, kept around for X Mode. */
635+
// @Deprecated
636+
// protected void paintLine(Graphics gfx, TokenMarker tokenMarker,
637+
// int line, int x) {
638638
// Font defaultFont = getFont();
639639
// Color defaultColor = getForeground();
640-
640+
protected void paintLine(Graphics gfx, int line, int x,
641+
TokenMarker tokenMarker) {
641642
currentLineIndex = line;
642643
int y = textArea.lineToY(line);
643644

@@ -651,10 +652,10 @@ protected void paintLine(Graphics gfx, TokenMarker tokenMarker,
651652
}
652653

653654

654-
protected void paintLine(Graphics gfx, int line, int x,
655-
TokenMarker tokenMarker) {
656-
paintLine(gfx, tokenMarker, line, x);
657-
}
655+
// protected void paintLine(Graphics gfx, int line, int x,
656+
// TokenMarker tokenMarker) {
657+
// paintLine(gfx, tokenMarker, line, x);
658+
// }
658659

659660

660661
// protected void paintPlainLine(Graphics gfx, int line, Font defaultFont,

java/src/processing/mode/java/PresentMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class PresentMode {
6666
names.add(name);
6767
}
6868

69-
selector = new JComboBox(names);
69+
selector = new JComboBox<String>(names);
7070
selector.addActionListener(new ActionListener() {
7171
public void actionPerformed(ActionEvent e) {
7272
int index = selector.getSelectedIndex();

java/src/processing/mode/java/debug/Compiler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.*;
2424
import java.lang.reflect.Method;
25+
2526
import processing.app.Base;
2627
import processing.app.SketchException;
2728
import processing.core.PApplet;
@@ -121,6 +122,7 @@ public void close() { }
121122
Class.forName("org.eclipse.jdt.core.compiler.CompilationProgress", false, loader);
122123
Class[] compileArgs =
123124
new Class[] { String[].class, PrintWriter.class, PrintWriter.class, progressClass };
125+
@SuppressWarnings("unchecked")
124126
Method compileMethod = batchClass.getMethod("compile", compileArgs);
125127
success = (Boolean)
126128
compileMethod.invoke(null, new Object[] { command, outWriter, writer, null });

java/src/processing/mode/java/debug/DebugEditor.java

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
import processing.app.syntax.PdeTextAreaDefaults;
8282
import processing.core.PApplet;
8383
import processing.mode.java.JavaEditor;
84-
import processing.mode.java.pdex.AutoSaveUtil;
8584
import processing.mode.java.pdex.ErrorBar;
8685
import processing.mode.java.pdex.ErrorCheckerService;
8786
import processing.mode.java.pdex.ErrorMessageSimplifier;
@@ -103,8 +102,6 @@
103102
*
104103
* @author Martin Leopold <[email protected]>
105104
* @author Manindra Moharana &lt;[email protected]&gt;
106-
*
107-
*
108105
*/
109106
public class DebugEditor extends JavaEditor implements ActionListener {
110107
// important fields from superclass
@@ -212,11 +209,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
212209
*/
213210
public boolean hasJavaTabs;
214211

215-
/**
216-
* UNUSED. Disbaled for now.
217-
*/
218-
protected AutoSaveUtil autosaver;
219-
212+
220213
public DebugEditor(Base base, String path, EditorState state, Mode mode) {
221214
super(base, path, state, mode);
222215

@@ -1025,38 +1018,6 @@ public boolean handleSaveAs() {
10251018

10261019
private boolean viewingAutosaveBackup;
10271020

1028-
/**
1029-
* Loads and starts the auto save service
1030-
* Also handles the case where an auto save backup is found.
1031-
* The user is asked to save the sketch to a new location
1032-
*/
1033-
private void loadAutoSaver(){
1034-
log("Load Auto Saver()");
1035-
autosaver = new AutoSaveUtil(this, ExperimentalMode.autoSaveInterval);
1036-
if(!autosaver.checkForPastSave()) {
1037-
autosaver.init();
1038-
return;
1039-
}
1040-
File pastSave = autosaver.getPastSave();
1041-
int response = Base
1042-
.showYesNoQuestion(this,
1043-
"Unsaved backup found!",
1044-
"An automatic backup of \""
1045-
+ pastSave.getParentFile().getName()
1046-
+ "\" sketch has been found. This may mean Processing " +
1047-
"was closed unexpectedly last time.",
1048-
"Select YES to view it or NO to delete the backup.");
1049-
if(response == JOptionPane.YES_OPTION){
1050-
handleOpenInternal(pastSave.getAbsolutePath());
1051-
// Base.showMessage("Save it..", "Remember to save the backup sketch to a specific location if you want to.");
1052-
//log(getSketch().getMainFilePath());
1053-
log("loadAutoSaver, viewing autosave? " + viewingAutosaveBackup);
1054-
return;
1055-
}
1056-
else{
1057-
autosaver.init();
1058-
}
1059-
}
10601021

10611022
/**
10621023
* Set text contents of a specific tab. Updates underlying document and text

java/src/processing/mode/java/pdex/ASTGenerator.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
import com.google.classpath.ClassPathFactory;
122122
import com.google.classpath.RegExpResourceFilter;
123123

124+
@SuppressWarnings({ "deprecation", "unchecked" })
124125
public class ASTGenerator {
125126

126127
protected ErrorCheckerService errorCheckerService;
@@ -1512,7 +1513,6 @@ public void run() {
15121513
*/
15131514
}
15141515

1515-
@SuppressWarnings("unchecked")
15161516
protected static ASTNode findClosestParentNode(int lineNumber, ASTNode node) {
15171517
Iterator<StructuralPropertyDescriptor> it = node
15181518
.structuralPropertiesForType().iterator();
@@ -2248,7 +2248,7 @@ protected DefaultMutableTreeNode findAllOccurrences(){
22482248
return defCU;
22492249
}
22502250

2251-
@SuppressWarnings({ "unchecked" })
2251+
22522252
/**
22532253
* Generates AST Swing component
22542254
* @param node
@@ -2280,23 +2280,23 @@ public static void visitRecur(ASTNode node, DefaultMutableTreeNode tnode) {
22802280
.getStructuralProperty(prop)));
22812281
}
22822282
}
2283-
}
2284-
2285-
else if (prop.isChildListProperty()) {
2286-
List<ASTNode> nodelist = (List<ASTNode>) node
2287-
.getStructuralProperty(prop);
2283+
} else if (prop.isChildListProperty()) {
2284+
List<ASTNode> nodelist = (List<ASTNode>)
2285+
node.getStructuralProperty(prop);
22882286
for (ASTNode cnode : nodelist) {
22892287
if (isAddableASTNode(cnode)) {
22902288
ctnode = new DefaultMutableTreeNode(new ASTNodeWrapper(cnode));
22912289
tnode.add(ctnode);
22922290
visitRecur(cnode, ctnode);
2293-
} else
2291+
} else {
22942292
visitRecur(cnode, tnode);
2293+
}
22952294
}
22962295
}
22972296
}
22982297
}
22992298

2299+
23002300
public void dfsNameOnly(DefaultMutableTreeNode tnode,ASTNode decl, String name) {
23012301
Stack<DefaultMutableTreeNode> temp = new Stack<DefaultMutableTreeNode>();
23022302
temp.push(codeTree);
@@ -2356,8 +2356,8 @@ public ASTNode dfsLookForASTNode(ASTNode root, String name, int startOffset,
23562356
}
23572357
}
23582358
else if (prop.isChildListProperty()) {
2359-
List<ASTNode> nodelist = (List<ASTNode>) node
2360-
.getStructuralProperty(prop);
2359+
List<ASTNode> nodelist =
2360+
(List<ASTNode>) node.getStructuralProperty(prop);
23612361
for (ASTNode temp : nodelist) {
23622362
if (temp.getStartPosition() <= startOffset
23632363
&& (temp.getStartPosition() + temp.getLength()) >= endOffset) {
@@ -2552,7 +2552,7 @@ else if (prop.isChildListProperty()) {
25522552
}
25532553
}
25542554

2555-
@SuppressWarnings("unchecked")
2555+
25562556
protected static ASTNode findLineOfNode(ASTNode node, int lineNumber,
25572557
int offset, String name) {
25582558

@@ -2610,7 +2610,6 @@ protected static ASTNode findLineOfNode(ASTNode node, int lineNumber,
26102610
* @param root
26112611
* @return
26122612
*/
2613-
@SuppressWarnings("unchecked")
26142613
public static ASTNode pinpointOnLine(ASTNode node, int offset,
26152614
int lineStartOffset, String name) {
26162615
//log("pinpointOnLine node class: " + node.getClass().getSimpleName());
@@ -2669,7 +2668,6 @@ public static ASTNode pinpointOnLine(ASTNode node, int offset,
26692668
* @param findMe
26702669
* @return
26712670
*/
2672-
@SuppressWarnings("unchecked")
26732671
protected static ASTNode findDeclaration(Name findMe) {
26742672

26752673
// WARNING: You're entering the Rube Goldberg territory of Experimental Mode.
@@ -3224,7 +3222,8 @@ public static SimpleType extracTypeInfo(ASTNode node) {
32243222
return (SimpleType) t;
32253223
}
32263224

3227-
public static Type extracTypeInfo2(ASTNode node) {
3225+
3226+
static public Type extracTypeInfo2(ASTNode node) {
32283227
if (node == null)
32293228
return null;
32303229
switch (node.getNodeType()) {
@@ -3245,8 +3244,8 @@ public static Type extracTypeInfo2(ASTNode node) {
32453244
return null;
32463245
}
32473246

3248-
@SuppressWarnings("unchecked")
3249-
protected static ASTNode definedIn(ASTNode node, String name,
3247+
3248+
static protected ASTNode definedIn(ASTNode node, String name,
32503249
ArrayList<Integer> constrains,
32513250
ASTNode declaringClass) {
32523251
if (node == null)

java/src/processing/mode/java/pdex/ASTNodeWrapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848
import org.eclipse.jdt.core.dom.Type;
4949
import org.eclipse.jdt.core.dom.TypeDeclaration;
5050

51+
5152
/**
5253
* Wrapper class for ASTNode objects
5354
* @author Manindra Moharana <[email protected]>
5455
*
5556
*/
5657
public class ASTNodeWrapper {
5758
private ASTNode Node;
58-
5959
private String label;
60-
6160
private int lineNumber;
62-
63-
//private int apiLevel;
61+
6462

6563
/*
6664
* TODO: Every ASTNode object in ASTGenerator.codetree is stored as a
@@ -168,6 +166,7 @@ public int[] getJavaCodeOffsets(ErrorCheckerService ecs) {
168166
while (it.hasNext()) {
169167
StructuralPropertyDescriptor prop = it.next();
170168
if (prop.isChildListProperty()) {
169+
@SuppressWarnings("unchecked")
171170
List<ASTNode> nodelist = (List<ASTNode>)
172171
thisNode.getStructuralProperty(prop);
173172
log("prop " + prop);
@@ -218,6 +217,7 @@ public int[] getJavaCodeOffsets(ErrorCheckerService ecs) {
218217
* @return
219218
*/
220219
private int getJavadocOffset(FieldDeclaration fd){
220+
@SuppressWarnings("unchecked")
221221
List<ASTNode> list = fd.modifiers();
222222
SimpleName sn = (SimpleName) getNode();
223223

0 commit comments

Comments
 (0)