3311 Fun with cloning

Ahem, not that I want to teach you guys java or anything, but the openAPI has a rather silly method:

com.intellij.j2ee.run.configuration.ServerModel implements Cloneable, and has the method:

com.intellij.j2ee.run.configuration.ServerModel clone() throws java.lang.CloneNotSupportedException;


This is illegal, and doesn't compile. You should return Object. I'm baffled by how you managed to produce such code and have it compile!

3 comments
Comment actions Permalink

You seems be using plain JDK 1.4 (that was ok for 1.4 compatible open
api before 3311), try using 1.4 + generics or 1.5

Hani Suleiman wrote:

Ahem, not that I want to teach you guys java or anything, but the openAPI has a rather silly method:

com.intellij.j2ee.run.configuration.ServerModel implements Cloneable, and has the method:

com.intellij.j2ee.run.configuration.ServerModel clone() throws java.lang.CloneNotSupportedException;


This is illegal, and doesn't compile. You should return Object. I'm baffled by how you managed to produce such code and have it compile!



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim,

Can you give me some help here? I can't build the JBoss plugin anymore
due to this clone method.

1) I don't want to use 1.5, since there are mac users using the plugin;
2) I didn't manage to get 1.4 + generics working.

Any hints?

Maxim Mossienko wrote:

You seems be using plain JDK 1.4 (that was ok for 1.4 compatible open
api before 3311), try using 1.4 + generics or 1.5

Hani Suleiman wrote:

>> Ahem, not that I want to teach you guys java or anything, but the
>> openAPI has a rather silly method:
>>
>> com.intellij.j2ee.run.configuration.ServerModel implements Cloneable,
>> and has the method:
>>
>> com.intellij.j2ee.run.configuration.ServerModel clone() throws
>> java.lang.CloneNotSupportedException;
>>
>>
>> This is illegal, and doesn't compile. You should return Object. I'm
>> baffled by how you managed to produce such code and have it compile!



--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

1.5 language supports covariant return types :)

Reverted to return Object in 3316 though to support 1.4 plugins development.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Ahem, not that I want to teach you guys java or anything, but the
openAPI has a rather silly method:

com.intellij.j2ee.run.configuration.ServerModel implements Cloneable,
and has the method:

com.intellij.j2ee.run.configuration.ServerModel clone() throws
java.lang.CloneNotSupportedException;

This is illegal, and doesn't compile. You should return Object. I'm
baffled by how you managed to produce such code and have it compile!



0

Please sign in to leave a comment.