// Make sure that the type being rebound is in fact an interface.
if (targetClass.isInterface() == null) {
throw error(logger, name + " must be an interface");
}
ResourceList resourceList = null;
try {
resourceList = ResourceFactory.getBundle(logger, targetClass, locale,
assignableToConstants, context.getResourcesOracle().getResourceMap());
} catch (MissingResourceException e) {
throw error(logger,
"Localization failed; there must be at least one resource accessible through"
+ " the classpath in package '" + packageName
+ "' whose base name is '"
+ ResourceFactory.getResourceName(targetClass) + "'");
} catch (IllegalArgumentException e) {
// A bad key can generate an illegal argument exception.
throw error(logger, e.getMessage());
}
// generated implementations for interface X will be named X_, X_en,
// X_en_CA, etc.
GwtLocale generatedLocale = resourceList.findLeastDerivedLocale(locale);
String localeSuffix = String.valueOf(ResourceFactory.LOCALE_SEPARATOR);
localeSuffix += generatedLocale.getAsString();
// Use _ rather than "." in class name, cannot use $
String resourceName = targetClass.getName().replace('.', '_');
String className = resourceName + localeSuffix;