harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Blewitt" <alex.blew...@gmail.com>
Subject Re: [classlib][pack200] Computing inner classes
Date Thu, 24 Jan 2008 23:31:46 GMT
On Jan 24, 2008 7:03 PM, Andrew Cornwall <andrew.pack200@gmail.com> wrote:
> I'm in the process of looking at inner classes. The pack200 spec has an
> algorithm for calculating which classes are relevant for a specific class.
> Part of that algorithm is:
>
>    (4) The previous step is repeated until closure. (That is, until
>    ic_Relevant(X) no longer changes.)
>    (5) The set ic_Relevant(X) is ordered into a sequence, so that its order
>    is consistent with ic_All. (I.e., it is a subsequence of ic_All.)
>
> I don't understand step 4 - it doesn't look as if step 3 will not change
> anything after the first time it runs. (In other words, it looks as if
> multiple iterations aren't necessary). Perhaps that's because I don't
> understand inner classes well enough - does anyone have any idea which
> classes need to be added to the InnerClasses attribute for a specific class?

I suspect it's to do with things like subclassing. Consider:

public class A {
  private B b;
  public class B extends C {
  }
  public class C {
  }
}

A directly references B, but will also need to transmit C as well. But
you only know that you need C when you hit B. On the plus side, you
only do 2 runs through and if ic_relevant isn't changed, you terminate
then; so in your examples so far, you can implement the iterative
behaviour without changing it :-)

Alex

Mime
View raw message