Hi Doug: Larry is checking the LoD for general Java programs using Binoy's cd. His question is about how to get at the interface of a Java class for which only the .class file is given. How does one do this kind of Java compile time reengineering? Doug writes: >Any chain longer than 1 is a violation, isn't it? That is true according to the object form of the LoD. But Larry checks the class form. But I think your suggestion is actually a very good practical mixture of class and object form. We view any chain longer than 1 as a violation. It is also much easier to check. Of course, this.b().c() is length 1. So Larry has then only to check calls like: H h = a.b(); This does not require an interface look up of b since we know the return-type is H. -- Karl >From dougo@ccs.neu.edu Tue Dec 2 22:21:50 1997 >Cc: Karl Lieberherr >Subject: Re: Memory and java class interface questions > >Larry Dodds writes: > > > My other problem is dealing with calculating the violations of LoD. When a > > statement like the following is executed: > > H h = a.b().c(); > > > > The problem is that I would normally look up the b() method and determine > > the type of object that it returns so I could determine if the c() call is > > a violation. However, in Java, the b() could return a class that is not > > in the Java system I am parsing or worse is not available to me in any > > way. For example what if b() returns a class that is in java.io or > > java.util. I this case, I have no access to the interface without parsing > > the .class file. > >Demeter considers all external classes (i.e. those not in the class >dictionary) to be terminal classes. Thus you shouldn't need to know >what methods are on them. > > > This problem obviously continues with longer chains. > >Any chain longer than 1 is a violation, isn't it? > >--Doug >