clean up some warnings

This commit is contained in:
Ben Fry
2014-11-16 18:02:13 -07:00
parent 2e55b11ddb
commit 71cd0c32ee
7 changed files with 25 additions and 29 deletions

View File

@@ -2281,7 +2281,7 @@ public class ASTGenerator {
temp.push(codeTree);
while(!temp.isEmpty()){
DefaultMutableTreeNode cnode = (DefaultMutableTreeNode) temp.pop();
DefaultMutableTreeNode cnode = temp.pop();
for (int i = 0; i < cnode.getChildCount(); i++) {
temp.push((DefaultMutableTreeNode) cnode.getChildAt(i));
}
@@ -2380,7 +2380,7 @@ public class ASTGenerator {
temp.push(codeTree);
while (!temp.isEmpty()) {
DefaultMutableTreeNode cnode = (DefaultMutableTreeNode) temp.pop();
DefaultMutableTreeNode cnode = temp.pop();
for (int i = 0; i < cnode.getChildCount(); i++) {
temp.push((DefaultMutableTreeNode) cnode.getChildAt(i));
}

View File

@@ -20,6 +20,7 @@ package processing.mode.experimental;
import static processing.mode.experimental.ExperimentalMode.log;
import static processing.mode.experimental.ExperimentalMode.logE;
import static processing.mode.experimental.ExperimentalMode.log2;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
@@ -157,7 +158,8 @@ public class ASTNodeWrapper {
if (jd == null) {
log("Visiting children of node " + getNodeAsString(thisNode));
Iterator<StructuralPropertyDescriptor> it = (Iterator<StructuralPropertyDescriptor>)
@SuppressWarnings("unchecked")
Iterator<StructuralPropertyDescriptor> it =
thisNode.structuralPropertiesForType().iterator();
boolean flag = true;
while (it.hasNext()) {
@@ -213,7 +215,7 @@ public class ASTNodeWrapper {
* @return
*/
private int getJavadocOffset(FieldDeclaration fd){
List<ASTNode> list = (List<ASTNode>) fd.modifiers();
List<ASTNode> list = fd.modifiers();
SimpleName sn = (SimpleName) getNode();
Type tp = fd.getType();
@@ -247,7 +249,8 @@ public class ASTNodeWrapper {
* @return
*/
private int getJavadocOffset(MethodDeclaration md) {
List<ASTNode> list = (List<ASTNode>) md.modifiers();
@SuppressWarnings("unchecked")
List<ASTNode> list = md.modifiers();
SimpleName sn = (SimpleName) getNode();
int lineNum = getLineNumber(sn);
log("SN " + sn + ", " + lineNum);
@@ -282,7 +285,8 @@ public class ASTNodeWrapper {
*/
private int getJavadocOffset(TypeDeclaration td){
// TODO: This isn't perfect yet. Class \n \n \n className still breaks it.. :'(
List<ASTNode> list= (List<ASTNode>)td.modifiers();
@SuppressWarnings("unchecked")
List<ASTNode> list = td.modifiers();
SimpleName sn = (SimpleName) getNode();
int lineNum = getLineNumber(sn);

View File

@@ -380,11 +380,11 @@ public class CompilationChecker {
return null;
}
private void compileMeQuitely(ICompilationUnit unit, Map compilerSettings) {
private void compileMeQuitely(ICompilationUnit unit, Map<String, String> compilerSettings) {
Map settings;
Map<String, String> settings;
if (compilerSettings == null) {
settings = new HashMap();
settings = new HashMap<>();
settings.put(CompilerOptions.OPTION_LineNumberAttribute,
CompilerOptions.GENERATE);
@@ -423,7 +423,6 @@ public class CompilationChecker {
IProblem problem = (IProblem) it.next();
prob[count++] = problem;
}
}
private void compileMeQuitely(ICompilationUnit unit) {
@@ -506,7 +505,7 @@ public class CompilationChecker {
* @param classLoader - custom classloader which can load all dependencies
* @return IProblem[] - list of compiler errors and warnings
*/
public IProblem[] getErrors(String sourceName, String source, Map settings,
public IProblem[] getErrors(String sourceName, String source, Map<String, String> settings,
URLClassLoader classLoader) {
fileName = sourceName;
readFromFile = false;
@@ -528,7 +527,7 @@ public class CompilationChecker {
}
@SuppressWarnings("rawtypes")
public IProblem[] getErrors(String sourceName, String source, Map settings) {
public IProblem[] getErrors(String sourceName, String source, Map<String, String> settings) {
fileName = sourceName;
readFromFile = false;
sourceText = "package " + fileName + ";\n" + source;

View File

@@ -117,8 +117,7 @@ public class CompletionPanel {
scrollPane.setViewportView(completionList = createSuggestionList(position, items));
popupMenu.add(scrollPane, BorderLayout.CENTER);
popupMenu.setPopupSize(calcWidth(), calcHeight(items.getSize())); //TODO: Eradicate this evil
this.textarea.errorCheckerService.getASTGenerator()
.updateJavaDoc((CompletionCandidate) completionList.getSelectedValue());
this.textarea.errorCheckerService.getASTGenerator().updateJavaDoc(completionList.getSelectedValue());
textarea.requestFocusInWindow();
popupMenu.show(textarea, location.x, textarea.getBaseline(0, 0)
+ location.y);
@@ -227,8 +226,7 @@ public class CompletionPanel {
float min = 0;
FontMetrics fm = textarea.getGraphics().getFontMetrics();
for (int i = 0; i < completionList.getModel().getSize(); i++) {
float h = fm.stringWidth(((CompletionCandidate) completionList.getModel()
.getElementAt(i)).getLabel());
float h = fm.stringWidth(completionList.getModel().getElementAt(i).getLabel());
min = Math.max(min, h);
}
int w = Math.min((int) min, maxWidth);
@@ -307,8 +305,8 @@ public class CompletionPanel {
int currentSubwordLen = currentSubword == null ? 0 : currentSubword
.length();
//logE(currentSubword + " <= subword,len => " + currentSubword.length());
String selectedSuggestion = ((CompletionCandidate) completionList
.getSelectedValue()).getCompletionString();
String selectedSuggestion =
completionList.getSelectedValue().getCompletionString();
if (currentSubword != null) {
selectedSuggestion = selectedSuggestion.substring(currentSubwordLen);
@@ -316,8 +314,8 @@ public class CompletionPanel {
currentSubword = "";
}
String completionString = ((CompletionCandidate) completionList
.getSelectedValue()).getCompletionString();
String completionString =
completionList.getSelectedValue().getCompletionString();
if (selectedSuggestion.endsWith(" )")) { // the case of single param methods
// selectedSuggestion = ")";
if (completionString.endsWith(" )")) {
@@ -358,8 +356,7 @@ public class CompletionPanel {
}
log("Suggestion inserted: " + System.currentTimeMillis());
if (((CompletionCandidate) completionList.getSelectedValue())
.getLabel().contains("...")) {
if (completionList.getSelectedValue().getLabel().contains("...")) {
// log("No hide");
// Why not hide it? Coz this is the case of
// overloaded methods. See #2755
@@ -488,8 +485,7 @@ public class CompletionPanel {
.getVerticalScrollBar()
.getValue()
- step);
textarea.errorCheckerService.getASTGenerator()
.updateJavaDoc((CompletionCandidate) completionList.getSelectedValue());
textarea.errorCheckerService.getASTGenerator().updateJavaDoc(completionList.getSelectedValue());
}
@@ -506,8 +502,7 @@ public class CompletionPanel {
.getSize() - 1);
selectIndex(index);
}
textarea.errorCheckerService.getASTGenerator()
.updateJavaDoc((CompletionCandidate) completionList.getSelectedValue());
textarea.errorCheckerService.getASTGenerator().updateJavaDoc(completionList.getSelectedValue());
int step = scrollPane.getVerticalScrollBar().getMaximum()
/ completionList.getModel().getSize();
scrollPane.getVerticalScrollBar().setValue(scrollPane

View File

@@ -7,7 +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;
public class ErrorMessageSimplifier {
/**

View File

@@ -22,7 +22,6 @@
package processing.mode.experimental;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@@ -133,7 +133,7 @@ public class XQErrorTable extends JTable {
// String tip = null;
// java.awt.Point p = evt.getPoint();
int rowIndex = rowAtPoint(evt.getPoint());
int colIndex = columnAtPoint(evt.getPoint());
// int colIndex = columnAtPoint(evt.getPoint());
synchronized (errorCheckerService.problemsList) {
if (rowIndex < errorCheckerService.problemsList.size()) {