th.co.edge.jseq
Class ConstructorFilter

java.lang.Object
  extended by th.co.edge.jseq.ConstructorFilter
All Implemented Interfaces:
ActivationList.Filter

public class ConstructorFilter
extends java.lang.Object
implements ActivationList.Filter

A Filter that accepts all methods, except constructors that are either synthetic (automatically created by the compiler), or are calls to super.

The reason that this filter was created was to remove "unnecessary" calls to <init> from the sequence diagrams. Since the sequence diagrams generated by JSeq are class-based, not instance-based (i.e., each lifeline belongs to a class, not to a specific instance), and since the class of the instance being called is used (not the declaring class), calls to synthetic constructors or to the super constructor would be represented as one or several calls to <init> back to the same class. This was deemed more confusing than helpful.

In order to determine if a call is a call to a super-class constructor, this filter needs access to a ClassLoader. When running JSeq stand-alone, this is not a problem, but when attaching to a running process, JSeq should have the same classpath as that process. If not, the only effect is that the "unnecessary" constructor calls are included in the diagram, so failure to set up the correct classpath when attaching to a process is far from catastrophic.

This filter was created after Jacek Ratzinger supplied his patch (SourceForge issue 2027500) since that change made calls to the super-class constructor look as calls back to the same class. In the process it also turned out that private nested classes use a synthetic constructor that need not be shown in the generated sequence diagrams.


Constructor Summary
ConstructorFilter(java.lang.ClassLoader classLoader)
          Creates a new ConstructorFilter that uses the given ClassLoader to determine if a call is to a super-class constructor.
 
Method Summary
 boolean accept(Activation activation)
          Returns true for all Activations, except calls to synthetic constructors and calls to super-class constructors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorFilter

public ConstructorFilter(java.lang.ClassLoader classLoader)
Creates a new ConstructorFilter that uses the given ClassLoader to determine if a call is to a super-class constructor.

Parameters:
classLoader - a ClassLoader that should match that of the process being traced
Method Detail

accept

public boolean accept(Activation activation)
Returns true for all Activations, except calls to synthetic constructors and calls to super-class constructors.

Specified by:
accept in interface ActivationList.Filter
Parameters:
activation - the Activation to check
Returns:
false if activation represents a call to a synthetic constructor or a call to a super-class constructor, true otherwise


Copyright © 2008 Edge Software, Co., Ltd.. All Rights Reserved.