IllegalAccess in mixin field override #949
brian
31 Jan 2010
Promoted to ticket #949 and assigned to brian
Its definitely a bug somewhere in how the class is overriding the mixin field.
brian
31 Jan 2010
Renamed from Bug or PEBKAC? to IllegalAccess in mixin field override
tactics
3 days ago
I narrowed down the problem a little more. It's an issue with making the objs slot internal. Remove the internal keyword from the slot and its override, and the code works normally.
mixin Collection
{
abstract internal Obj[] objs
Obj add(Obj obj)
{
objs.add(obj)
return obj
}
}
class ListCollection : Collection
{
override internal Obj[] objs := [,]
}
class Main
{
Void main()
{
list := ListCollection()
list.add("ASD")
}
}
msl
31 Jan 2010
I'm trying to assemble a hierarchy that looks something like:
mixin BottomMI { abstract internal Obj[] objs } mixin MiddleMI : BottomMI { Obj addObj(Obj obj) { objs.add(obj) return obj } } abstract class MiddleCL : MiddleMI { override internal Obj[] objs := [,] abstract Void doSomething() } class TopCL : MiddleCL { override Void doSomething() { echo("Doing something") } }However, when I try to use these classes (built into a pod by the standard build::BuildPod class - not that this seems to matter as putting all of the code listed here into a single file and running it behaves much the same, as does fansh) using code such as:
using bugquestionmark class Test { Void main() { tc := TopCL() tc.doSomething() tc.addObj("ASD") } }I get the following:
The error is obviously around visibility of the declared Obj[] (internal) but my understanding of internal is that other classes within the same pod should be able to see but not outside of the pod - criteria which are met by this sample.
Thoughts?
Martin