From 045c80b5d22d7a843b8744c22dfc9a6551ae3eda Mon Sep 17 00:00:00 2001 From: George Bateman Date: Wed, 18 Dec 2013 19:55:17 +0000 Subject: [PATCH] Update JavaBuild.java Fix bug #8. --- app/src/processing/mode/java/JavaBuild.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index f42d0930d..f22fe7a9c 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -397,7 +397,7 @@ public class JavaBuild { throw new SketchException(ex.toString()); } - // grab the imports from the code just preproc'd + // grab the imports from the code just preprocessed importedLibraries = new ArrayList(); Library core = mode.getCoreLibrary(); @@ -408,10 +408,21 @@ public class JavaBuild { // System.out.println("extra imports: " + result.extraImports); for (String item : result.extraImports) { +// System.out.println("item = '" + item + "'"); // remove things up to the last dot int dot = item.lastIndexOf('.'); // http://dev.processing.org/bugs/show_bug.cgi?id=1145 String entry = (dot == -1) ? item : item.substring(0, dot); +// System.out.print(entry + " => "); + + if (item.startsWith("static ")) { + // import static - https://github.com/processing/processing/issues/8 + // Remove more stuff. + int dot2 = item.lastIndexOf('.'); + entry = entry.substring(7, (dot2 == -1) ? entry.length() : dot2); +// System.out.println(entry); + } + // System.out.println("library searching for " + entry); Library library = mode.getLibrary(entry); // System.out.println(" found " + library); @@ -427,7 +438,7 @@ public class JavaBuild { // If someone insists on unnecessarily repeating the code folder // import, don't show an error for it. if (codeFolderPackages != null) { - String itemPkg = item.substring(0, item.lastIndexOf('.')); + String itemPkg = entry; for (String pkg : codeFolderPackages) { if (pkg.equals(itemPkg)) { found = true; @@ -435,7 +446,7 @@ public class JavaBuild { } } } - if (ignorableImport(item)) { + if (ignorableImport(entry + '.')) { found = true; } if (!found) {