From: <cr...@us...> - 2010-10-02 13:42:58
|
Revision: 5758 http://jnode.svn.sourceforge.net/jnode/?rev=5758&view=rev Author: crawley Date: 2010-10-02 13:42:51 +0000 (Sat, 02 Oct 2010) Log Message: ----------- Some refactoring of code that uses 'compileHighOptLevelPackages'. Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-10-02 09:48:09 UTC (rev 5757) +++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-10-02 13:42:51 UTC (rev 5758) @@ -995,18 +995,16 @@ * @return {@code true} if it should, {@code false} if not. */ protected boolean isCompileHighOptLevel(VmType<?> vmClass) { - if (vmClass.isArray()) { - return true; - } - - final String name = vmClass.getName(); + return vmClass.isArray() || isCompileHighOptLevel(vmClass.getName()); + } + + private boolean isCompileHighOptLevel(String name) { if (compileHighOptLevelPackages.contains(name)) { return true; } final int lastDotIdx = name.lastIndexOf('.'); - final String pkg = (lastDotIdx > 0) ? name.substring(0, lastDotIdx) - : ""; + final String pkg = (lastDotIdx > 0) ? name.substring(0, lastDotIdx) : ""; if (compileHighOptLevelPackages.contains(pkg)) { return true; @@ -1022,6 +1020,8 @@ return false; } + + /** * Link all undefined symbols from the kernel native code. @@ -1110,39 +1110,14 @@ if (eName.endsWith(".class")) { final String cName = eName.substring(0, eName.length() - ".class".length()).replace('/', '.'); - boolean load = false; - - if (compileHighOptLevelPackages.contains(cName)) { - load = true; - } else if (preloadPackages.contains(cName)) { - load = true; - } - final int lastDotIdx = cName.lastIndexOf('.'); - final String pkg = (lastDotIdx > 0) ? cName.substring(0, - lastDotIdx) : ""; - - if (compileHighOptLevelPackages.contains(pkg)) { - load = true; - } else if (preloadPackages.contains(pkg)) { - load = true; - } else { - for (String s : compileHighOptLevelPackages) { - if (s.endsWith("*")) { - if (cName.startsWith(s.substring(0, s.length() - 1))) { - load = true; - break; - } - } - } - } - - if (load) { + final String pkg = (lastDotIdx > 0) ? cName.substring(0, lastDotIdx) : ""; + if (isCompileHighOptLevel(cName) || + preloadPackages.contains(cName) || preloadPackages.contains(pkg)) { loadClass(cName, true); } } } - } protected abstract void logStatistics(NativeStream os); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |