MDR Troubleshooting
Contents:
- Compile errors in generated JMI interfaces.
Problem: When I generate JMI interfaces for a metamodel
and try to compile them I get compile errors.
Reason: This happens when the metamodel uses names of elements that
result in generating invalid Java identifiers when mapped using JMI. Here are
examples of problematic situations when this may happen:
- The metamodel contains class named "Class" - this is problematic, because the
JMI package proxy interface corresponding to the package containing the class
"Class" will contain "getClass" method, which is already present in
java.lang.Object.
- The metamodel contains classes "Foo" and "FooClass" - the problem is that
according to JMI, for each metamodel class two interfaces are generated
- instance interface (with the same name as the class in the metamodel) and class proxy
interfacece (with the name of the metamodel class suffixed by word "Class"). The
class proxy interface of class "Foo" will in this case collide with instance
interface of class "FooClass".
Solution: For these situations JMI defined a special tag that can be used
to tell JMI service to use different name for a particular element when mapping
it to Java. The name of the tag is javax.jmi.substituteName, value of the tag
should be set to the name to be used when mapping to Java. The tag should be
attached to the element with the problematic name. See JMI specification for
more information on this tag.
Problem:
Reason:
Solution: