/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Create new {@link JDefinedClass} and report class collision errors,
* if necessary.
*
* This is just a helper class that simplifies the class name collision
* detection. This object maintains no state, so it is OK to use
* multiple instances of this.
*
* @author
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public final class CodeModelClassFactory {
/** errors are reported to this object. */
/** unique id generator. */
this.errorReceiver = _errorReceiver;
}
}
}
}
public JDefinedClass createInterface( JClassContainer parent, int mod, String name, Locator source ) {
}
}
// report the error
return createDummyClass(parent);
}
try {
// use the metadata field to store the source location,
// so that we can report class name collision errors.
return r;
} catch( JClassAlreadyExistsException e ) {
// class collision.
// report the error
source ));
// on Windows, FooBar and Foobar causes name collision
}
source ));
}
return createDummyClass(parent);
}
}
/**
* Create a dummy class to recover from an error.
*
* We won't generate the code, so the client will never see this class
* getting generated.
*/
try {
} catch( JClassAlreadyExistsException ee ) {
return ee.getExistingClass();
}
}
}