Home » Modeling » Epsilon » ClassCastException when assigning enum literal to attribute
ClassCastException when assigning enum literal to attribute [message #480082] |
Thu, 13 August 2009 17:28 |
Eclipse User |
|
|
|
Originally posted by: nyoescape.gmail.com
This is a multi-part message in MIME format.
--------------040603060700070605090205
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hello everyone,
This EOL script produces an ClassCastException in its very last line,
saying it can't convert an EEnumLiteralImpl into a LabelAccessMethod:
var lm := new GmfMap!FeatureLabelMapping;
var y := GmfMap!LabelTextAccessMethod#PRINTF;
y.println();
lm.viewMethod := y; -- ** here **
I've looked around and it seems to be as simple as applying the attached
patch, so we use the enumeration instance itself instead of the wrapper,
but I'm not sure if that's the right way to do it. I've sent a bug
report with more information and a test project over here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286549
Cheers,
Antonio
--------------040603060700070605090205
Content-Type: text/x-patch;
name="fix-enum-classcastexception.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="fix-enum-classcastexception.patch"
SW5kZXg6IHNyYy9vcmcvZWNsaXBzZS9lcHNpbG9uL2VtYy9lbWYvQWJzdHJh Y3RFbWZNb2Rl
bC5qYXZhCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT0KLS0tIHNyYy9vcmcvZWNsaXBzZS9lcHNp bG9uL2VtYy9l
bWYvQWJzdHJhY3RFbWZNb2RlbC5qYXZhCShyZXZpc2lvbiA1MjIpCisrKyBz cmMvb3JnL2Vj
bGlwc2UvZXBzaWxvbi9lbWMvZW1mL0Fic3RyYWN0RW1mTW9kZWwuamF2YQko d29ya2luZyBj
b3B5KQpAQCAtMTIxLDcgKzEyMSw3IEBACiAJCQkJCQlFRW51bSBlRW51bSA9 IChFRW51bSkg
Y2xhc3NpZmllcjsNCiAJCQkJCQlFRW51bUxpdGVyYWwgbGl0ZXJhbCA9IGVF bnVtLmdldEVF
bnVtTGl0ZXJhbChsYWJlbCk7DQogCQkJCQkJDQotCQkJCQkJaWYgKGxpdGVy YWwgIT0gbnVs
bCkgcmV0dXJuIGxpdGVyYWw7DQorCQkJCQkJaWYgKGxpdGVyYWwgIT0gbnVs bCkgcmV0dXJu
IGxpdGVyYWwuZ2V0SW5zdGFuY2UoKTsNCiAJCQkJCX0NCiAJCQkJfQ0KIAkJ CX0NCg==
--------------040603060700070605090205--
|
|
| |
Re: ClassCastException when assigning enum literal to attribute [message #480198 is a reply to message #480083] |
Fri, 14 August 2009 10:45 |
Eclipse User |
|
|
|
Originally posted by: nyoescape.gmail.com
Hello Dimitris,
You might want to avoid that patch, as it seems I did break something
with it :-/. I noticed that Eugenia suddenly stopped setting some of my
links to be dashed lines. In fact, the following code in the formatLine
operation of Formatting.eol stopped doing anything:
if (style.isDefined() and self.isKindOf(GmfGraph!Shape)) {
if (style = 'dash') {
self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
}
else if (style = 'dot') {
self.lineKind := GmfGraph!LineKind#LINE_DOT.instance;
}
else if (style = 'solid') {
self.lineKind := GmfGraph!LineKind#LINE_SOLID.instance;
}
}
I set up println() calls all over the place, and the right line is being
reached properly. Changing this:
self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
to this:
self.lineKind := GmfGraph!LineKind#LINE_DASH;
did the trick. It's probably because after applying the patch,
GmfGraph!LineKind#LINE_DASH itself returns the instance, and trying to
get the instance of the instance results in an undefined value. This
undefined value is then replaced by the default value, LINE_SOLID.
I'll add a notice about this in the bug report.
Cheers,
Antonio
|
|
|
Re: ClassCastException when assigning enum literal to attribute [message #480249 is a reply to message #480198] |
Fri, 14 August 2009 14:37 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Antonio,
I thought that this might happen... I'll look into this next week to see
if I can come up with a workaround that allows both things to work so
that we don't end up breaking existing code.
Cheers,
Dimitris
Antonio García Domínguez wrote:
> Hello Dimitris,
>
> You might want to avoid that patch, as it seems I did break something
> with it :-/. I noticed that Eugenia suddenly stopped setting some of my
> links to be dashed lines. In fact, the following code in the formatLine
> operation of Formatting.eol stopped doing anything:
>
> if (style.isDefined() and self.isKindOf(GmfGraph!Shape)) {
> if (style = 'dash') {
> self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
> }
> else if (style = 'dot') {
> self.lineKind := GmfGraph!LineKind#LINE_DOT.instance;
> }
> else if (style = 'solid') {
> self.lineKind := GmfGraph!LineKind#LINE_SOLID.instance;
> }
> }
>
> I set up println() calls all over the place, and the right line is being
> reached properly. Changing this:
>
> self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
>
> to this:
>
> self.lineKind := GmfGraph!LineKind#LINE_DASH;
>
> did the trick. It's probably because after applying the patch,
> GmfGraph!LineKind#LINE_DASH itself returns the instance, and trying to
> get the instance of the instance results in an undefined value. This
> undefined value is then replaced by the default value, LINE_SOLID.
>
> I'll add a notice about this in the bug report.
>
> Cheers,
> Antonio
|
|
| |
Re: ClassCastException when assigning enum literal to attribute [message #574106 is a reply to message #480083] |
Fri, 14 August 2009 10:45 |
|
Hello Dimitris,
You might want to avoid that patch, as it seems I did break something
with it :-/. I noticed that Eugenia suddenly stopped setting some of my
links to be dashed lines. In fact, the following code in the formatLine
operation of Formatting.eol stopped doing anything:
if (style.isDefined() and self.isKindOf(GmfGraph!Shape)) {
if (style = 'dash') {
self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
}
else if (style = 'dot') {
self.lineKind := GmfGraph!LineKind#LINE_DOT.instance;
}
else if (style = 'solid') {
self.lineKind := GmfGraph!LineKind#LINE_SOLID.instance;
}
}
I set up println() calls all over the place, and the right line is being
reached properly. Changing this:
self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
to this:
self.lineKind := GmfGraph!LineKind#LINE_DASH;
did the trick. It's probably because after applying the patch,
GmfGraph!LineKind#LINE_DASH itself returns the instance, and trying to
get the instance of the instance results in an undefined value. This
undefined value is then replaced by the default value, LINE_SOLID.
I'll add a notice about this in the bug report.
Cheers,
Antonio
|
|
|
Re: ClassCastException when assigning enum literal to attribute [message #574136 is a reply to message #480198] |
Fri, 14 August 2009 14:37 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Antonio,
I thought that this might happen... I'll look into this next week to see
if I can come up with a workaround that allows both things to work so
that we don't end up breaking existing code.
Cheers,
Dimitris
Antonio García Domínguez wrote:
> Hello Dimitris,
>
> You might want to avoid that patch, as it seems I did break something
> with it :-/. I noticed that Eugenia suddenly stopped setting some of my
> links to be dashed lines. In fact, the following code in the formatLine
> operation of Formatting.eol stopped doing anything:
>
> if (style.isDefined() and self.isKindOf(GmfGraph!Shape)) {
> if (style = 'dash') {
> self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
> }
> else if (style = 'dot') {
> self.lineKind := GmfGraph!LineKind#LINE_DOT.instance;
> }
> else if (style = 'solid') {
> self.lineKind := GmfGraph!LineKind#LINE_SOLID.instance;
> }
> }
>
> I set up println() calls all over the place, and the right line is being
> reached properly. Changing this:
>
> self.lineKind := GmfGraph!LineKind#LINE_DASH.instance;
>
> to this:
>
> self.lineKind := GmfGraph!LineKind#LINE_DASH;
>
> did the trick. It's probably because after applying the patch,
> GmfGraph!LineKind#LINE_DASH itself returns the instance, and trying to
> get the instance of the instance results in an undefined value. This
> undefined value is then replaced by the default value, LINE_SOLID.
>
> I'll add a notice about this in the bug report.
>
> Cheers,
> Antonio
|
|
|
Goto Forum:
Current Time: Fri Apr 19 09:59:52 GMT 2024
Powered by FUDForum. Page generated in 0.03488 seconds
|