public static int findLeftmostIdentifier(String[] all) { int firstElement = all.length - 1; for (; firstElement >= 0; firstElement--) { if (!isJavaIdentifier(all[firstElement])) { break; } } return firstElement + 1; // go forward one to the last good element }
int leftmostIdentifier = findLeftmostIdentifier(all); CharSequence serviceName = buildServiceName(all[all.length - 1]); buildClassName(classNameBuilder, classFileBuilder, all, i, serviceName); return new ClassExtensionLibrary(className + ".java", theClass); } catch (ClassNotFoundException cnfe) {
state.library = new ClassExtensionLibrary(className + ".java", theClass); debugLogFound("jarWithExtension", className); } catch (ClassNotFoundException cnfe) {
public boolean trySearch(SearchState state) { debugLogTry("jarWithExtension", state.searchFile); // This code exploits the fact that all .jar files will be found for the JarredScript feature. // This is where the basic extension mechanism gets fixed Library oldLibrary = state.library; state.library = ClassExtensionLibrary.tryFind(runtime, state.searchFile); debugLogFound("jarWithExtension", state.searchFile); // If there was a good library before, we go back to that if(state.library == null && oldLibrary != null) { state.library = oldLibrary; } return true; } }
int leftmostIdentifier = findLeftmostIdentifier(all); CharSequence serviceName = buildServiceName(all[all.length - 1]); buildClassName(classNameBuilder, classFileBuilder, all, i, serviceName); return new ClassExtensionLibrary(className + ".java", theClass); } catch (ClassNotFoundException cnfe) {
public void load(Ruby runtime, boolean wrap) { try { URL jarFile = resource.getURL(); // Make Java class files in the jar reachable from Ruby runtime.getJRubyClassLoader().addURL(jarFile); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } // If an associated Service library exists, load it as well ClassExtensionLibrary serviceExtension = ClassExtensionLibrary.tryFind(runtime, searchName); if (serviceExtension != null) { serviceExtension.load(runtime, wrap); } } }
state.library = new ClassExtensionLibrary(className + ".java", theClass); debugLogFound("jarWithExtension", className); } catch (ClassNotFoundException cnfe) {
public boolean trySearch(SearchState state) { debugLogTry("jarWithExtension", state.searchFile); // This code exploits the fact that all .jar files will be found for the JarredScript feature. // This is where the basic extension mechanism gets fixed Library oldLibrary = state.library; state.library = ClassExtensionLibrary.tryFind(runtime, state.searchFile); debugLogFound("jarWithExtension", state.searchFile); // If there was a good library before, we go back to that if(state.library == null && oldLibrary != null) { state.library = oldLibrary; } return true; } }
public void load(Ruby runtime, boolean wrap) { try { URL jarFile = resource.getURL(); // Make Java class files in the jar reachable from Ruby runtime.getJRubyClassLoader().addURL(jarFile); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } // If an associated Service library exists, load it as well ClassExtensionLibrary serviceExtension = ClassExtensionLibrary.tryFind(runtime, searchName); if (serviceExtension != null) { serviceExtension.load(runtime, wrap); } } }
private FoundLibrary findServiceLibrary(String name) { DebugLog.JarExtension.logTry(name); Library extensionLibrary = ClassExtensionLibrary.tryFind(runtime, name); if (extensionLibrary != null) { DebugLog.JarExtension.logFound(name); return new FoundLibrary(extensionLibrary, name); } else { return null; } }
public static int findLeftmostIdentifier(String[] all) { int firstElement = all.length - 1; for (; firstElement >= 0; firstElement--) { if (!isJavaIdentifier(all[firstElement])) { break; } } return firstElement + 1; // go forward one to the last good element }
private FoundLibrary findServiceLibrary(String name) { DebugLog.JarExtension.logTry(name); Library extensionLibrary = ClassExtensionLibrary.tryFind(runtime, name); if (extensionLibrary != null) { DebugLog.JarExtension.logFound(name); return new FoundLibrary(extensionLibrary, name); } else { return null; } }