if (Character.isLowerCase(name.charAt(0))) {
// this covers primitives and (unlikely) lower-case class names
try {
return getProxyClass(runtime, JavaClass.forNameQuiet(runtime, name));
} catch (RaiseException re) { /* not primitive or lc class */
RubyException rubyEx = re.getException();
if (rubyEx.kind_of_p(context, runtime.getStandardError()).isTrue()) {
RuntimeHelpers.setErrorInfo(runtime, runtime.getNil());
}
} catch (Exception e) { /* not primitive or lc class */ }
// TODO: check for Java reserved names and raise exception if encountered
final RubyModule packageModule = getJavaPackageModule(runtime, name);
// TODO: decompose getJavaPackageModule so we don't parse fullName
if (packageModule == null) {
return null;
}
RubyModule javaModule = runtime.getJavaSupport().getJavaModule();
if (javaModule.getMetaClass().isMethodBound(name, false)) {
return packageModule;
}
memoizePackageOrClass(javaModule, name, packageModule);
return packageModule;
} else {
RubyModule javaModule = null;
try {
javaModule = getProxyClass(runtime, JavaClass.forNameQuiet(runtime, name));
} catch (RaiseException re) { /* not a class */
RubyException rubyEx = re.getException();
if (rubyEx.kind_of_p(context, runtime.getStandardError()).isTrue()) {
RuntimeHelpers.setErrorInfo(runtime, runtime.getNil());
}
} catch (Exception e) { /* not a class */ }
// upper-case package name