try {
if(parent.isClass() && kind==ClassType.CLASS)
mod |= JMod.STATIC;
JDefinedClass r = parent._class(mod,name,kind);
// use the metadata field to store the source location,
// so that we can report class name collision errors.
r.metadata = source;
return r;
} catch( JClassAlreadyExistsException e ) {
// class collision.
JDefinedClass cls = e.getExistingClass();
// report the error
errorReceiver.error( new SAXParseException(
Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
(Locator)cls.metadata ));
errorReceiver.error( new SAXParseException(
Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
source ));
if( !name.equals(cls.name()) ) {
// on Windows, FooBar and Foobar causes name collision
errorReceiver.error( new SAXParseException(
Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
name, cls.name() ), null ) );
}
if(Util.equals((Locator)cls.metadata,source)) {
errorReceiver.error( new SAXParseException(
Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),