Update JavaBuild.java

Fix bug #8.
This commit is contained in:
George Bateman
2013-12-18 19:55:17 +00:00
parent 0f0f2b2e50
commit 045c80b5d2

View File

@@ -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>();
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) {