[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AJC 1.0 compiler problem

Hello,

I am using AJC 1.0 's preprocess function to obtain the equivalent Java code 
from the AspectJ files.

The problem that I found is that the resulting Java code does not contain 
the method declarations of intertype method declarations but does contain 
before and after adviced methods.

Is there any way to obtain the full equivalent java code for a given aspect 
file?

Thanks,

Fayezin


=============================================
Original AspectJ Code
=============================================
// DFS.java   aspect
// GPL using AspectJ
// Roberto E. Lopez-Herrejon
// Product-Line Architecture Research Lab
// Department of Computer Sciences
// University of Texas at Austin
// Last update: May 3, 2002

package GPL;

import  java.util.LinkedList;

public aspect DFS
{
    // *********************************************************************
    // **** Graph class
    // Graph search receives a Working Space
    public void Graph.GraphSearch(WorkSpace w) {
 int           s, c;
 Vertex  v;

 // Step 1: initialize visited member of all nodes

 s = vertices.size();
 if (s == 0) return;             // if there are no vertices return

 // Initializig the vertices
 for (c = 0; c < s; c++) {
     v = (Vertex) vertices.get(c);
     v.init_vertex( w );
 }

 // Step 2: traverse neighbors of each node
 for (c = 0; c < s; c++) {
     v = (Vertex) vertices.get(c);
     if (!v.visited)  {
  w.nextRegionAction(v);
  v.dftNodeSearch( w);
     }
 } //end for
    } // end of GraphSearch

    // ****************** Order Testing
    pointcut graph_order(Graph g): target(g) && call(void Graph.order());

    // An before advice to display the weigth of the edge
    void around(Graph g): graph_order(g) {
 MyLog.println("DFS Aspect ");
 proceed(g);
    }

    // ********************************************************************
    // **** Vertex class
    public boolean Vertex.visited;

 public Vertex.new() {
     visited = false;
    }

    public void Vertex.init_vertex( WorkSpace w ) {
         visited = false;
         w.init_vertex((Vertex) this);
    }

    public void Vertex.dftNodeSearch( WorkSpace w) {
         int           s, c;
         Vertex v;
         Neighbor n;

         // Step 1: Do preVisitAction.
  //     If we've already visited this node return

         w.preVisitAction((Vertex) this);

         if (visited) return;

         // Step 2: else remember that we've visited and
         //         visit all neighbors

         visited = true;

  s = neighbors.size();
  for (c = 0; c < s; c++) {
      n = (Neighbor) neighbors.get(c);
      v = n.end;
      w.checkNeighborAction((Vertex) this, v);
      v.dftNodeSearch( w);
         };

         // Step 3: do postVisitAction now
         w.postVisitAction((Vertex) this);

    } // of dftNodeSearch

    // A point cut to calls to Vertex.display
    // Gets the pointcuts of the targets that call display of a Vertex
    pointcut vertex_display(Vertex v): target(v) &&
 call(void Vertex.display());

    // A before advice to display if the vertex has been visited or not
    before(Vertex v): vertex_display(v) {
 if (v.visited)
            MyLog.println("  visited ");
 else
            MyLog.println(" !visited ");
    }

} // end of aspect DFS



=============================================
Code generated by AJC 1.0 preprocess function
=============================================
/*   Generated by AspectJ version 1.0.6 */
package GPL;
import java.util.LinkedList;

public class DFS {
  /* IntroducedDec(dec: MethodDec(id: GraphSearch)) */

  public final void around0$ajc(Graph g,
      final org.aspectj.runtime.internal.AroundClosure ajc$closure) throws 
Throwable {
    MyLog.println("DFS Aspect ");
    org.aspectj.runtime.internal.Conversions.voidValue(ajc$closure.run(new 
java.lang.Object[] {
        g}));
  }

  /* IntroducedDec(dec: FieldDec(id: visited)) */

  /* IntroducedDec(dec: public DFS()) */

  /* IntroducedDec(dec: MethodDec(id: init_vertex)) */

  /* IntroducedDec(dec: MethodDec(id: dftNodeSearch)) */

  public final void before0$ajc(Vertex v) {
    if (v.visited) MyLog.println("  visited ");else MyLog.println(" !visited 
");
  }

  public DFS() {
    super();
  }
  public static DFS aspectInstance;
  public static DFS aspectOf() {
    return DFS.aspectInstance;
  }

  public static boolean hasAspect() {
    return DFS.aspectInstance != null;
  }

  static {
    DFS.aspectInstance = new DFS();
  }

}