From 7b98a667fb9f837d30f4be5699d59fd64d01af0c Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sat, 12 Jul 2014 01:55:38 +0530 Subject: [PATCH] Trimmed ECS --- .../mode/experimental/CompilationChecker.java | 4 +- .../experimental/ErrorCheckerService.java | 67 +------------------ 2 files changed, 4 insertions(+), 67 deletions(-) diff --git a/pdex/src/processing/mode/experimental/CompilationChecker.java b/pdex/src/processing/mode/experimental/CompilationChecker.java index 442e6c0b2..e69b39fd2 100644 --- a/pdex/src/processing/mode/experimental/CompilationChecker.java +++ b/pdex/src/processing/mode/experimental/CompilationChecker.java @@ -433,11 +433,13 @@ public class CompilationChecker { settings = compilerSettings; } + CompilerOptions cop = new CompilerOptions(); + cop.set(settings); CompileRequestorImpl requestor = new CompileRequestorImpl(); Compiler compiler = new Compiler(new NameEnvironmentImpl(unit), DefaultErrorHandlingPolicies .proceedWithAllProblems(), - new CompilerOptions(settings), requestor, + settings, requestor, new DefaultProblemFactory(Locale .getDefault())); compiler.compile(new ICompilationUnit[] { unit }); diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index 79691cadf..a085ca01e 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -619,49 +619,17 @@ public class ErrorCheckerService implements Runnable{ // If imports have changed, reload classes with new classpath. if (loadCompClass) { - // if (classpathJars.size() > 0) - // System.out - // .println("Experimental Mode: Loading contributed libraries referenced by import statements."); - - // The folder SketchBook/modes/ExperimentalMode/mode -// File f = editor.getMode().getContentFile("mode"); -// -// if(!f.exists()) { -// System.err.println("Could not locate the files required for on-the-fly error checking. Bummer."); -// return; -// } -// -// FileFilter fileFilter = new FileFilter() { -// public boolean accept(File file) { -// return (file.getName().endsWith(".jar") && !file -// .getName().startsWith(editor.getMode().getClass().getSimpleName())); -// } -// }; - - // File[] jarFiles = f.listFiles(fileFilter); - // log( "Jar files found? " + (jarFiles != null)); - //for (File jarFile : jarFiles) { - //classpathJars.add(jarFile.toURI().toURL()); - //} - classpath = new URL[classpathJars.size()]; int ii = 0; for (; ii < classpathJars.size(); ii++) { classpath[ii] = classpathJars.get(ii); } -// for (int i = 0; i < jarFiles.length; i++) { -// classpath[ii++] = jarFiles[i].toURI().toURL(); -// } compilationChecker = null; -// checkerClass = null; classLoader = null; System.gc(); // log("CP Len -- " + classpath.length); classLoader = new URLClassLoader(classpath); - // log("1."); - - // log("2."); compilationChecker = new CompilationChecker(); loadCompClass = false; } @@ -669,13 +637,6 @@ public class ErrorCheckerService implements Runnable{ if (compilerSettings == null) { prepareCompilerSetting(); } -// Method getErrors = checkerClass.getMethod("getErrorsAsObjArr", -// new Class[] { String.class, String.class, Map.class }); -// -// Object[][] errorList = (Object[][]) getErrors -// .invoke(compilationChecker, className, sourceCode, -// compilerSettings); - synchronized (problemsList) { problems = compilationChecker.getErrors(className, sourceCode, compilerSettings, classLoader); @@ -685,25 +646,8 @@ public class ErrorCheckerService implements Runnable{ for (int i = 0; i < problems.length; i++) { - // for (int j = 0; j < errorList[i].length; j++) - // System.out.print(errorList[i][j] + ", "); - - - // added a -1 to line number because in compile check code - // an extra package statement is added, so all line numbers - // are increased by 1 - - // System.out - // .println("ECS: " + problems[i].getMessage() + "," - // + problems[i].isError() + "," - // + problems[i].isWarning()); - IProblem problem = problems[i]; - // log(problem.getMessage()); - // for (String j : problem.getArguments()) { - // log("arg " + j); - // } - + // added a -1 to line number because in compile check code // an extra package statement is added, so all line numbers // are increased by 1 @@ -727,15 +671,6 @@ public class ErrorCheckerService implements Runnable{ } } } -// catch (ClassNotFoundException e) { -// System.err.println("Compiltation Checker files couldn't be found! " -// + e + " compileCheck() problem."); -// pauseThread(); -// } catch (MalformedURLException e) { -// System.err.println("Compiltation Checker files couldn't be found! " -// + e + " compileCheck() problem."); -// pauseThread(); -// } catch (Exception e) { System.err.println("compileCheck() problem." + e);