remove additional imports, use a stricter list

This commit is contained in:
benfry
2012-11-24 18:15:12 +00:00
parent 8ca080d488
commit e5d7bddd9b
3 changed files with 17 additions and 6 deletions

View File

@@ -27,7 +27,6 @@ import java.io.Writer;
import java.util.List;
import processing.app.*;
import processing.core.PApplet;
import processing.mode.java.preproc.PdePreprocessor;
import processing.mode.java.preproc.PreprocessorResult;
import antlr.RecognitionException;
@@ -179,6 +178,9 @@ public class AndroidPreprocessor extends PdePreprocessor {
}
// As of revision 0215 (2.0b7-ish), the default imports are now identical
// between desktop and Android (to avoid unintended incompatibilities).
/*
@Override
public String[] getCoreImports() {
return new String[] {
@@ -218,4 +220,5 @@ public class AndroidPreprocessor extends PdePreprocessor {
return androidImports;
}
*/
}

View File

@@ -934,8 +934,17 @@ public class PdePreprocessor {
public String[] getDefaultImports() {
// These may change in-between (if the prefs panel adds this option)
String prefsLine = Preferences.get("preproc.imports");
return PApplet.splitTokens(prefsLine, ", ");
//String prefsLine = Preferences.get("preproc.imports");
//return PApplet.splitTokens(prefsLine, ", ");
return new String[] {
"java.util.HashMap",
"java.util.ArrayList",
"java.io.BufferedReader",
"java.io.PrintWriter",
"java.io.InputStream",
"java.io.OutputStream",
"java.io.IOException"
};
}
/**
@@ -957,10 +966,8 @@ public class PdePreprocessor {
* this info. In fact, we should be descending the AST passed in.
*/
String getFirstClassName(AST ast) {
String t = advClassName;
advClassName = "";
return t;
}

View File

@@ -574,6 +574,7 @@ public class Runner implements MessageConsumer {
Value messageValue = or.getValue(messageField);
// System.out.println("mess val " + messageValue);
//"java.lang.ArrayIndexOutOfBoundsException"
int last = exceptionName.lastIndexOf('.');
String message = exceptionName.substring(last + 1);
if (messageValue != null) {
@@ -630,7 +631,7 @@ public class Runner implements MessageConsumer {
System.err.println("This version of Processing only supports libraries and JAR files compiled for Java 1.6 or earlier.");
System.err.println("A library used by this sketch was compiled for Java 1.7 or later, ");
System.err.println("and needs to be recompiled to be compatible with Java 1.6.");
} else if (exceptionClass.equals("java.lang.NoSuchMethodError") ||
exceptionClass.equals("java.lang.NoSuchFieldError")) {
listener.statusError(exceptionClass.substring(10) + ": " +