This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Java: Fix for PR 4695


Bryce McKinlay wrote:
> 
> Alexandre Petit-Bianco wrote:
> 
> Well, this doesn't catch the case of trying to access the enclosing
> instance from the anonymous class, which is illegal. I thought that we
> could just make such classes static, which is what jikes does, but javac
> doesn't do this. Also the latest jikes has this in its changelog:

Jikes still has some issues with inner classes. I'm working on patching
jikes to do everything correctly; but it is not finished yet.  So I
can't completely recommend jikes as model behavior, yet.

> 
>    - never set ACC_STATIC bit on local classes
>    - make sure private methods and anonymous classes are always
>       final, and anonymous classes are never static.
> 

This observation is correct, even though jikes 1.15 does not implement
it correctly!  Note that there is a difference between a true static
class (ACC_STATIC bit set) and a local or anonymous class in a static
context.

> So, I think we need a way to treat them as static but not actually set the ACC_STATIC for the emitted class.

Yes, I think approach would get the right behavior.

> 
> regards
> 
> Bryce.

-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
  BYU student, free software programmer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]