Thanks Stephane. Method 1 worked -- except I had to take the "static" out
of the two classes at the end of the file as well (the Fail and Success
classes that extends'ed SoundTask.BuildAlert) -- hope that's all kosher.
Diane
--- St�phane_Bailliez <[EMAIL PROTECTED]> wrote:
> Hi Diane,
>
> ----- Original Message -----
> From: "Diane Holt" <[EMAIL PROTECTED]>
>
> > 137. log(src + " is not a valid file.", Project.MSG_WARN) ;
> > <->
> > *** Error: An instance of "SoundTask.this" is not accessible here
> because
> > it would have to cross a static region in the intervening type
> > "SoundTask$BuildAlert".
>
> This is because BuildAlert is a static inner class and thus cannot
> reference
> implicitely SoundTask.log()
>
> When an inner class is not static the compiler add a reference to its
> outer
> class.
>
> class Outer {
> class Inner {
> ..
> log("something"); // this is the same as
> Outer.this.log("something");
> }
> }
>
> class Outer {
> static class Inner {
> ..
> log("something"); // not possible, Inner doesn't have access to
> Outer instance
> }
> }
>
> You could either:
> 1) make your inner class non static (I just look at it briefly but It
> seems
> that the only place where it could have a sense to be created would be
> the
> soundtask itself, so it is probably the best solution so far. The
> factory
> methods are in the soundtask itself.)
>
> 2) subclass your static class so that your subclass is non static.
> class MySecureBuildAlert extends BuildAlert {
> public File getSource(){
> log("getting source");
> return super.getSource();
> }
> }
> fail = new MySecureBuildAlert();
>
> I'm not sure what I said is meaningful...so just tell me, if you don't
> understand.
>
> Use solution one for now. Unless I didn't sleep enough this should work
> fine
> without side effects.
>
> --
> Stephane Bailliez, Paris - France
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> .
>
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> .
>
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/