|
Re: problems with enums and generics [message #426404 is a reply to message #426402] |
Sat, 03 January 2009 11:30 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090609090304040709000900
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Klaus,
Comments below.
klaus wiederanders wrote:
> HI,
>
> Given the interface:
>
> package emf.generics;
> /** @model */
> public interface Command<C> {
> }
>
>
> Now consider the following enum:
>
> package emf.generics;
> /** @model */
> public enum LampCommand implements Command<LampCommand> {
> OFF,
> ON,
> BLINK;
> }
>
> The model enum generated starts like this:
>
> /** @model */
> public enum LampCommand implements Enumerator {
> ..
>
> Where is the implements Command<LampCommand> gone?
EEnums are EDataTypes and the don't support having eSuperTypes the way
EClasses do.
You'll need to add
@implements Command<LampCommand>
so that JMerger will inject this non-modeled information into the result.
>
>
> Furthermore, the generated model for the interfaces below
> still shows up the problems already described in:
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg3 4332.html
> and bugzilla 209420.
>
>
> Here the Java code:
>
> package emf.generics;
> /** @model */
> public interface Element<C extends Command<C>> {
> /** @model */
> void execute( C command );
> }
>
> package emf.generics;
> /** @model */
> public interface Lamp extends Element<LampCommand> {
> }
Given that LampCommand is not an EClass and hence is not known to extend
Command, it's a valid conclusion about what's actually been captured in
the Ecore model.
The @implements can be used to "remove" this from the model as well.
Making EEnums be like EClasses with inheritance is simply beyond what's
intended to be possible with Ecore...
>
> After a little patching things can be compiled.
>
> Thank you,
> Klaus
>
>
--------------090609090304040709000900
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Klaus,<br>
<br>
Comments below.<br>
<br>
klaus wiederanders wrote:
<blockquote
cite="mid:5bda6f89056a92915189f6c4ec490ea7$1@www.eclipse.org"
type="cite">HI,
<br>
<br>
Given the interface:
<br>
<br>
package emf.generics;
<br>
/** @model */
<br>
public interface Command<C> {
<br>
}
<br>
<br>
<br>
Now consider the following enum:
<br>
<br>
package emf.generics;
<br>
/** @model */
<br>
public enum LampCommand implements Command<LampCommand> {
<br>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02860 seconds