I have a set declared static final and is additionally frozen.
class MyParent {
public final static var MY_FIELDS : Set<MyParent> = {
FIELD1, FIELD2, FIELD3, FIELD4, FIELD5
}.freeze()
}
Now, because the MyParent.MY_FIELD is called from multiple locations to do some magic stuff, I wish to take over the advantage of this and simply override the collection itself.
class MyChild extends MyParent {
public override static var MY_FIELDS : Set<MyChild> = {
FIELD1, FIELD3, FIELD5, FIELD8, FIELD9, FIELD10
}.freeze()
}
I also tried using the new
keyword as it's done in .NET.
class MyChild extends MyParent {
public new static var MY_FIELDS : Set<MyChild> = {
FIELD1, FIELD3, FIELD5, FIELD8, FIELD9, FIELD10
}.freeze()
}
However, no workaround worked so far. Then, I read that it's feasible through reflection.
And then, I can't access to the getClass()
method or class
member of my type, neither MyParent
's.
Is there any workaround that would allow me to achieve this, and how?
Using Gosu 8.0 in a Guidewire project.
Aucun commentaire:
Enregistrer un commentaire