RAT (Release Audit Tool) results

The following document contains the results of RAT (Release Audit Tool) .

*****************************************************
Summary
-------
Notes: 2
Binaries: 2
Archives: 4
Standards: 103

Apache Licensed: 34
Generated Documents: 0

JavaDocs are generated and so license header is optional
Generated files do not required license headers

69 Unknown Licenses

*******************************

Archives (+ indicates readable, $ unreadable): 

 + lib/asm-all-2.2.1.jar
 + lib/bcel-5.2.jar
 + lib/commons-io-20050621.133116.jar
 + lib/commons-jci-r291284.jar
 
*****************************************************
  Files with AL headers will be marked L
  Binary files (which do not require AL headers) will be marked B
  Compressed archives will be marked A
  Notices, licenses etc will be marked N
 !????? CREDITS.txt
  A     lib/asm-all-2.2.1.jar
  A     lib/bcel-5.2.jar
  A     lib/commons-io-20050621.133116.jar
  A     lib/commons-jci-r291284.jar
  N     LICENSE.txt
 !????? maven.xml
  N     NOTICE.txt
 !????? pom.xml
 !????? project.properties
  AL    project.xml
  AL    src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java
 !????? src/java/org/apache/commons/javaflow/ant/tasks.properties
 !????? src/java/org/apache/commons/javaflow/bytecode/BytecodeClassLoader.java
  AL    src/java/org/apache/commons/javaflow/bytecode/Continuable.java
  AL    src/java/org/apache/commons/javaflow/bytecode/EmptyStackException.java
  AL    src/java/org/apache/commons/javaflow/bytecode/Stack.java
  AL    src/java/org/apache/commons/javaflow/bytecode/StackRecorder.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationClassAdapter.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAdapter.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java
 !????? src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionPath.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/NopResourceTransformer.java
  AL    src/java/org/apache/commons/javaflow/bytecode/transformation/ResourceTransformer.java
  AL    src/java/org/apache/commons/javaflow/Continuation.java
  AL    src/java/org/apache/commons/javaflow/ContinuationClassLoader.java
 !????? src/java/org/apache/commons/javaflow/ContinuationDeath.java
  AL    src/java/org/apache/commons/javaflow/stores/JavaflowResourceStore.java
  AL    src/java/org/apache/commons/javaflow/stores/TransformingResourceStore.java
 !????? src/java/org/apache/commons/javaflow/utils/CompositeTransformer.java
  AL    src/java/org/apache/commons/javaflow/utils/ReflectionUtils.java
  AL    src/java/org/apache/commons/javaflow/utils/RewritingUtils.java
 !????? src/java/simplelog.properties
 !????? src/site/site.xml
  AL    src/test/Justice.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/AbstractTransformerTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/BlackRedTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/ClassAccessTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/CounterTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/DefaultConstructorTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/InvokerTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/NewObjectTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/NoReferenceTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/ResumeTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/SerializationTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/SimpleTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/StackTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/DefaultConstructorDump.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/Invoker.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/BlackRed.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess1.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess2.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess3.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/CounterFlow.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/DefaultConstructor.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NewObject.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NoReference.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NullVariableMethodFlow.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/Simple.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleSerializable.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleSynchronized.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleTryCatch.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/Stack.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractBlackRedTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractClassAccessTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractCounterTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractDefaultConstructorTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractInvokerTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractNewObjectTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractNoReferenceTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractResumeTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractSerializationTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractSimpleTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractStackTestCase.java
 !????? src/test/org/apache/commons/javaflow/bytecode/transformation/UsageTestCase.java
  AL    src/test/RewriteTool.java
 !????? TODO
 !????? xdocs/antTask.xml
 !????? xdocs/downloads.xml
  B     xdocs/images/javaflow-logo-white.png
  B     xdocs/images/javaflow-logo-white.xcf
 !????? xdocs/index.xml
  AL    xdocs/issue-tracking.xml
 !????? xdocs/navigation.xml
 !????? xdocs/tutorial.xml
 
 *****************************************************
 Printing headers for files without AL header...
 
 
 =======================================================================
 ==CREDITS.txt
 =======================================================================
 C R E D I T S

This file is meant to provide the deserved visibility
for major efforts or donation to the javaflow project.

The initial idea of using bytecode transformation for
implementing a portable execution state serialization
and migration mechanism was borrowed from the discontinued
Brakes research project. The javaflow project would like
to thank the Brakes team for their efforts in this space.

http://www.cs.kuleuven.ac.be/cwis/research/distrinet/public/research/showproject.php?ABBREV=brakes

 =======================================================================
 ==maven.xml
 =======================================================================
 <?xml version="1.0"?>
<project
  xmlns:j="jelly:core"
  xmlns:util="jelly:util"
  xmlns:ant="jelly:ant"
  >

<!--
  <postGoal name="test:compile">

    <ant:path id="rewrite.classpath">
      <ant:path refid="maven.dependency.classpath"/>
      <ant:pathelement path="${maven.build.dest}"/>
    </ant:path>

    <ant:taskdef name="rewrite"
                 classname="org.apache.commons.javaflow.ant.AntRewriteTask"
                 classpathref="rewrite.classpath"
                 />

    <rewrite srcDir="target/test-classes" dstDir="target/test-classes"
        mode="${test.transformer}">
      <include name="org/apache/commons/javaflow/bytecode/transformation/asm/data/**"/>
      <include name="org/apache/commons/javaflow/flow/**"/>
    </rewrite>

  </postGoal>
-->          

</project>



 =======================================================================
 ==pom.xml
 =======================================================================
 <?xml version="1.0" encoding="UTF-8"?>
<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-sandbox-parent</artifactId>
    <version>6</version>
  </parent>
  
  <artifactId>javaflow</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Commons Javaflow (Sandbox)</name>
  <url>http://commons.apache.org/sandbox/javaflow/</url>
  <inceptionYear>2004</inceptionYear>

  <repositories>
<!--
    <repository>
      <id>apache-maven1-snapshots</id>
      <name>Apache Maven1 Repository</name>
      <url>http://people.apache.org/repository</url>
      <layout>legacy</layout>
    </repository>
    <repository>
      <id>apache-maven2-snapshots</id>
      <name>Apache Maven2 Repository</name>
      <url>http://people.apache.org/maven-snapshot-repository</url>
    </repository>
    <repository>
      <id>codehaus-snapshot</id>
      <name>Maven snapshot Repository</name>
      <url>http://snapshots.maven.codehaus.org/maven2</url>
    </repository>
-->
  </repositories>

  <developers>
    <developer>
      <id>tcurdt</id>
      <name>Torsten Curdt</name>
      <email>tcurdt at apache.org</email>
      <organization>ASF</organization>
      <organizationUrl>http://www.apache.org/</organizationUrl>
      <timezone>+10</timezone>
    </developer>
    <developer>

 =======================================================================
 ==project.properties
 =======================================================================
 maven.repo.remote=http://repo1.maven.org/maven

maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory

maven.username = ${user.name}

maven.javadoc.author=false
maven.javadoc.links=http://java.sun.com/products/jdk/1.4/docs/api

maven.xdoc.jsl=../commons-build/commons-site.jsl
maven.xdoc.date=bottom
maven.xdoc.poweredby.image=maven-feather.png
maven.xdoc.version=${pom.currentVersion}
maven.xdoc.developmentProcessUrl=http://commons.apache.org/charter.html
maven.xdoc.includeProjectDocumentation=yes

maven.compile.debug=on
maven.compile.deprecation=off
maven.compile.optimize=off

# Jar Manifest Additional Attributes
maven.jar.manifest.attributes.list=Implementation-Vendor-Id,X-Compile-Source-JDK,X-Compile-Target-JDK
maven.jar.manifest.attribute.Implementation-Vendor-Id=org.apache
maven.jar.manifest.attribute.X-Compile-Source-JDK=${maven.compile.source}
maven.jar.manifest.attribute.X-Compile-Target-JDK=${maven.compile.target}

maven.jarResources.basedir=src/java
maven.jar.excludes=**/package.html
maven.junit.fork=true
maven.test.failure.ignore = true
#maven.test.skip = true
maven.junit.sysproperties=org.xml.sax.driver
org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
# 'BCEL' or 'ASM' to specify the transformer to use for testing.
test.transformer=BCEL

# ------------------------------------------------------------------------
# M A V E N  J A R  O V E R R I D E
# ------------------------------------------------------------------------
maven.jar.override = on

# ------------------------------------------------------------------------
# Jars set explicity by path.
# ------------------------------------------------------------------------
maven.jar.commons-jci = lib/commons-jci-r291284.jar
#maven.jar.commons-io = lib/commons-io-20050621.133116.jar
maven.jar.bcel = lib/bcel-5.2.jar
maven.jar.asm-all = lib/asm-all-2.2.1.jar

 =======================================================================
 ==src/java/org/apache/commons/javaflow/ant/tasks.properties
 =======================================================================
 javaflow=org.apache.commons.javaflow.ant.AntRewriteTask

 =======================================================================
 ==src/java/org/apache/commons/javaflow/bytecode/BytecodeClassLoader.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode;

import org.objectweb.asm.ClassAdapter;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.commons.EmptyVisitor;


public class BytecodeClassLoader extends ClassLoader {

    class NameClassAdapter extends ClassAdapter {
        private String className;

        public NameClassAdapter() {
            super(new EmptyVisitor());
        }
        
        public void visit( int version, int access, String name, String signature, String superName, String[] interfaces ) {
            className = name;
        }
        
        public String getName() {
            return className;
        }
    }
    
    public Class loadClass( final byte[] bytecode ) {
        final NameClassAdapter nameClassAdapter = new NameClassAdapter();
        
        new ClassReader(bytecode).accept(nameClassAdapter, false);
        
        final String name = nameClassAdapter.getName().replace('/', '.');
        
//        System.out.println("loading class " + name);
        
        final Class clazz = defineClass(name, bytecode, 0, bytecode.length);
        
        return clazz;
    }
}

 =======================================================================
 ==src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionPath.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;

import org.apache.bcel.generic.Instruction;
import org.apache.bcel.generic.RET;
import org.apache.bcel.generic.JsrInstruction;

/**
 * List of {@link InstructionContext} that represents a sequence of an execution.
 *
 * <p>
 * This object is immutable.
 * The sequence is represented in left-associative style; that is,
 * a sequence of [a,b,c,d] is represented as prev=[a,b,c] and last=d.
 *
 * @author Kohsuke Kawaguchi
 */
public final class ExecutionPath {
    /**
     * Singleton {@link ExecutionPath} that represents an empty sequence [].
     */
    public static final ExecutionPath EMPTY = new ExecutionPath(null,null);

    private final ExecutionPath prev;
    private final InstructionContext last;

    private ExecutionPath(ExecutionPath prev, InstructionContext last) {
        this.prev = prev;
        this.last = last;
    }

    /**
     * Creates a new {@link ExecutionPath} that has
     * <tt>[... list in this ExecutionPath ..., ins]</tt>.
     */
    public ExecutionPath append(InstructionContext ins) {
        return new ExecutionPath(this,ins);
    }

    /**
     * Returns the InstructionContextImpl with an JSR/JSR_W
     * that was last in the ExecutionChain, without
     * a corresponding RET, i.e.
     * we were called by this one.
     * Returns null if we were called from the top level.
     */
    public InstructionContext lastExecutionJSR(){
        int retcount = 0;

        for( ExecutionPath ptr = this; ptr!=EMPTY; ptr=ptr.prev) {
            Instruction i = ptr.last.getInstruction().getInstruction();

 =======================================================================
 ==src/java/org/apache/commons/javaflow/ContinuationDeath.java
 =======================================================================
 package org.apache.commons.javaflow;

import org.apache.commons.javaflow.bytecode.StackRecorder;

/**
 * This exception is used to signal
 * a control flow change that needs
 * the cooperation inside {@link StackRecorder}.
 *
 * <p>
 * This class is only for javaflow internal code.
 *
 * @author Kohsuke Kawaguchi
 */
public final class ContinuationDeath extends Error {
    final String mode;

    public ContinuationDeath(String mode) {
        this.mode = mode;
    }

    /**
     * Signals that the continuation wants to exit the execution.
     */
    static final String MODE_EXIT = "exit";
    /**
     * Signals that the execution should restart immediately
     * from where it resumed.
     */
    static final String MODE_AGAIN = "again";
    /**
     * Signals that the exeuction should suspend,
     * by using the original continuation.
     */
    static final String MODE_CANCEL = "cancel";
}

 =======================================================================
 ==src/java/org/apache/commons/javaflow/utils/CompositeTransformer.java
 =======================================================================
 package org.apache.commons.javaflow.utils;

import org.apache.commons.javaflow.bytecode.transformation.ResourceTransformer;

/**
 * {@link ResourceTransformer} whose transformation
 * is defined in terms of multiple {@link ResourceTransformer}s.
 *
 * @author Kohsuke Kawaguchi
 */
public class CompositeTransformer implements ResourceTransformer {
    private final ResourceTransformer[] transformers;

    public CompositeTransformer(ResourceTransformer[] transformers) {
        this.transformers = transformers;
    }

    public byte[] transform(byte[] image) {
        for (int i = 0; i < transformers.length; i++) {
            image = transformers[i].transform(image);
        }
        return image;
    }
}

 =======================================================================
 ==src/java/simplelog.properties
 =======================================================================
 org.apache.commons.logging.simplelog.defaultlog=debug
org.apache.commons.logging.simplelog.showdatetime=true

 =======================================================================
 ==src/site/site.xml
 =======================================================================
 <?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Commons Javaflow">
  <bannerRight>
    <name>Commons Javaflow</name>
    <src>images/javaflow-logo-white.png</src>
    <href>http://commons.apache.org/sandbox/javaflow/</href>
  </bannerRight>
  <body>
    <menu name="Commons Javaflow">
      <item name="Overview" href="/index.html" />
      <item name="Downloads" href="/downloads.html"/>
      <item name="Tutorial" href="/tutorial.html" />
      <item name="Ant Task" href="/antTask.html" />
    </menu>

    <menu name="Development">
      <item name="Mailing Lists"           href="/mail-lists.html"/>
      <item name="Issue Tracking"          href="/issue-tracking.html"/>
      <item name="Team"                    href="/team-list.html"/>
      <item name="Source Repository"       href="/source-repository.html"/>
      <item name="Javadoc (latest)"        href="/apidocs/index.html"/>
    </menu>
  </body>
</project>

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/AbstractTransformerTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation;

import junit.framework.TestCase;


public abstract class AbstractTransformerTestCase extends TestCase {

	public static String getTestCaseClassName( final Class pClazz ) {
		final String pkg = pClazz.getPackage().getName();
		final String cls = pClazz.getName();
		return pkg.substring(0, pkg.lastIndexOf('.'))
			+ ".tests.Abstract"
			+ cls.substring(cls.lastIndexOf('.') + 1); 
	}

	public static String getTestCaseName( final Class pClazz ) {
		final String cls = pClazz.getName();
		return cls.substring(cls.lastIndexOf('.') + 1); 
	}
	
//    protected void assertSameTransformation( final String pClazzName ) throws IOException {
//        final InputStream is = getStream(pClazzName);
//        final ClassReader cr = new ClassReader(is);
//        
//        final AsmClassTransformer t1 = new AsmClassTransformer();
//        final BcelClassTransformer t2 = new BcelClassTransformer();
//        
//        final byte[] bytecode = t1.transform(cr.b);
//        CheckClassAdapter.verify(new ClassReader(bytecode), true);
//
//        final StringWriter sw1 = new StringWriter();
//        new ClassReader(bytecode).accept(new TraceClassVisitor(new PrintWriter(sw1)), false);
//
//        final StringWriter sw2 = new StringWriter();
//        new ClassReader(t2.transform(cr.b)).accept(new TraceClassVisitor(new PrintWriter(sw2)), false);
//        
//        assertEquals(sw2.toString(), sw1.toString());
//    }
    
  protected void runTest() throws Throwable {
	  try {
		  super.runTest();

	  } catch( Throwable e) {
		  throw e;
	  }
  }

//  private InputStream getStream( String name) {
//    return getClass().getResourceAsStream("/" + name.replace( '.', '/') + ".class");

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;

public final class BlackRedTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				BlackRedTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
    
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public class ClassAccessTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				ClassAccessTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
  
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class CounterTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				CounterTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
 
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class DefaultConstructorTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				DefaultConstructorTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
    
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class InvokerTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				InvokerTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
    
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class NewObjectTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				NewObjectTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class NoReferenceTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				NoReferenceTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
   
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class ResumeTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				ResumeTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + AbstractTransformerTestCase.getTestCaseName(ResumeTestCase.class));
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class SerializationTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				SerializationTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + AbstractTransformerTestCase.getTestCaseName(SerializationTestCase.class));
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class SimpleTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				SimpleTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
 
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.asm;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class StackTestCase extends TestCase {
 
    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new AsmClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				StackTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("ASM " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/BlackRedTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;

public final class BlackRedTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				BlackRedTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
    
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/ClassAccessTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public class ClassAccessTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				ClassAccessTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
  
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/CounterTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class CounterTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				CounterTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
 
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/DefaultConstructorTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class DefaultConstructorTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				DefaultConstructorTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
    
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/InvokerTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class InvokerTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				InvokerTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
    
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/NewObjectTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class NewObjectTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				NewObjectTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/NoReferenceTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class NoReferenceTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				NoReferenceTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
   
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/ResumeTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class ResumeTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				ResumeTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/SerializationTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class SerializationTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				SerializationTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/SimpleTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class SimpleTestCase extends TestCase {

    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				SimpleTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }

}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/bcel/StackTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.bcel;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;


public final class StackTestCase extends TestCase {
 
    public static Test suite() throws Exception {

    	final ClassTransformerClassLoader classloader =
            new ClassTransformerClassLoader(new BcelClassTransformer());
        
        final Class clazz = classloader.loadClass(
        		AbstractTransformerTestCase.getTestCaseClassName(
        				StackTestCase.class));

        final TestSuite suite = new TestSuite(classloader.createImplementationOf(clazz));
        suite.setName("BCEL " + clazz.getName());
        return suite;
    }
 
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;
import org.apache.commons.javaflow.bytecode.BytecodeClassLoader;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class ClassTransformerClassLoader extends BytecodeClassLoader {

    private final ResourceTransformer transformer;
    private final String prefix;

    public ClassTransformerClassLoader(final ResourceTransformer pTransformer) {
    	this("org.apache.commons.javaflow.bytecode.transformation.", pTransformer);
    }

    public ClassTransformerClassLoader(final String pPrefix, final ResourceTransformer pTransformer) {
        prefix = pPrefix;
        transformer = pTransformer;
    }

    protected byte[] transform(final String pName, final InputStream pClassStream) throws IOException {
        final byte[] oldClass = IOUtils.toByteArray(pClassStream);
        final byte[] newClass = transformer.transform(oldClass);

//    	CheckClassAdapter.verify(new ClassReader(newClass), true);

//        
//    	new ClassReader(oldClass).accept(
//    			new ASMifierClassVisitor(
//    					new PrintWriter(
//    							new FileOutputStream(
//    									transformer.getClass().getSimpleName() + pName + ".old"))), false);
//
//    	new ClassReader(newClass).accept(
//    			new ASMifierClassVisitor(
//    					new PrintWriter(
//    							new FileOutputStream(
//    									transformer.getClass().getSimpleName() + pName + ".new"))), false);
    	
        return newClass;
    }

    

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/DefaultConstructorDump.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;


public class DefaultConstructorDump implements Opcodes {

  public static byte[] dump() throws Exception {
    FieldVisitor fv;
    MethodVisitor mv;
    AnnotationVisitor av0;

    ClassWriter cw = new ClassWriter(true);
    cw.visit( V1_2, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, "org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor", null, "java/lang/Thread", null);

    cw.visitSource( "DefaultConstructor.java", null);

    {
      mv = cw.visitMethod( ACC_PUBLIC, "<init>", "()V", null, null);
      mv.visitCode();
      
      Label l0 = new Label();
      mv.visitLabel( l0);
      
      mv.visitVarInsn( ALOAD, 0);
      mv.visitMethodInsn( INVOKESPECIAL, "java/lang/Thread", "<init>", "()V");

      mv.visitMethodInsn( INVOKESTATIC, "org/apache/commons/javaflow/bytecode/StackRecorder", "get", "()Lorg/apache/commons/javaflow/bytecode/StackRecorder;");
      mv.visitInsn( DUP);
      mv.visitVarInsn( ASTORE, 1);
      Label l1 = new Label();
      mv.visitJumpInsn( IFNULL, l1);
      mv.visitVarInsn( ALOAD, 1);
      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "isRestoring", "()Z");
      mv.visitJumpInsn( IFEQ, l1);
      mv.visitVarInsn( ALOAD, 1);
      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "popInt", "()I");
      Label l2 = new Label();
      mv.visitTableSwitchInsn( 0, 0, l1, new Label[] { l2});
      
      mv.visitLabel( l2);
      mv.visitLdcInsn( "restore locals");
      mv.visitInsn( POP);
      mv.visitVarInsn( ALOAD, 1);
      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "popObject", "()Ljava/lang/Object;");

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/Invoker.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation;


public final class Invoker implements Runnable {

    private Runnable runnable;
    
    public Invoker(Runnable runnable) {
        this.runnable = runnable;
    }
    
    public void run() {
        runnable.run();
    }
    
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/BlackRed.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

import java.io.Serializable;


/**
 * Test for making sure that rstack works correctly. For this test we need to
 * have a stack frame that goes through multiple objects of different types.
 * 
 * @author Kohsuke Kawaguchi
 */
public final class BlackRed implements Runnable, Serializable {

  public void run() {
    // new Black( new Red( new Black( new Suspend()))).run();
    new Black( new Suspend()).run();
  }

  
  class Black implements Runnable {
    final Runnable r;

    public Black( Runnable r) {
      this.r = r;
    }

    public void run() {
      String s = "foo"; // have some random variable
      r.run();
    }
  }

  
  class Red implements Runnable {
    final Runnable r;

    public Red( Runnable r) {
      this.r = r;
    }

    public void run() {
      int i = 5; // have some random variable
      r.run();
    }
  }

  
  class Suspend implements Runnable {

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess1.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

public final class ClassAccess1 implements Runnable {

    public void run() {
        final Class clazz1 = ClassAccess1.class;
        final Class clazz2 = this.getClass();
        
        Continuation.suspend();
    }

}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess2.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;


public final class ClassAccess2 implements Runnable {

    public void run() {
        Object o = ClassAccess2.class;
    }
    
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/ClassAccess3.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

public final class ClassAccess3 implements Runnable {

    /*
       L0 (0)
        GETSTATIC ClassAccess2.class$0 : Class
        DUP
        IFNONNULL L1
        POP
       
       L2 (5)
        LDC "asm.data.ClassAccess2"
        INVOKESTATIC Class.forName(String) : Class
       
       L3 (8)
        DUP
        PUTSTATIC ClassAccess2.class$0 : Class
        GOTO L1
       
       L4 (12)
        NEW NoClassDefFoundError
        DUP_X1
        SWAP
        INVOKEVIRTUAL Throwable.getMessage() : String
        INVOKESPECIAL NoClassDefFoundError.<init>(String) : void
        ATHROW
       
       L1 (19)
        ASTORE 1: clazz1
       L5 (21)
        INVOKESTATIC Continuation.suspend() : void
       L6 (23)
        RETURN

       L7 (25)
        TRYCATCHBLOCK L2 L3 L4 ClassNotFoundException
     */
  
    static Class class$0;
  
    public void run() {
        // final Class clazz1 = ClassAccess2.class;
        // final Class clazz2 = this.getClass();
        // if(class$0==null) {
          try {
            class$0 = Class.forName("asm.data.ClassAccess2");
          } catch(ClassNotFoundException ex) {

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/CounterFlow.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;


/**
 * @author Kohsuke Kawaguchi
 */
public final class CounterFlow implements Runnable {

  final int up;

  public CounterFlow( int up) {
    this.up = up;
  }

  public void run() {
    for( int i = 0; i < up; i++) {
//      System.err.println(i);
      Continuation.suspend();
    }
  }
}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/DefaultConstructor.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;


public final class DefaultConstructor implements Runnable {

    public DefaultConstructor() {
    }
    
    public void run() {
    }
    
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NewObject.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import junit.framework.Assert;


/**
 * Test that allocates a lot of new objects. Javaflow performs some tricky
 * instrumentation on new object allocations, especially when it has arguments.
 * Nesting object allocations makes it even more interesting.
 * 
 * @author Kohsuke Kawaguchi
 */
public final class NewObject implements Runnable {
  static char[] ch = { 'a', 'b', 'c'};
  
  public void run() {

    String s = new String( new String( new String( ch, 0, ch.length).toCharArray(), 0, ch.length));
    // String s = new String( new String( ch).toCharArray());

    Assert.assertEquals( s, "abc");
  }

}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NoReference.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;


public final class NoReference implements Runnable {

  public void run() {
    new Object();
    Continuation.suspend();
  }

}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/NullVariableMethodFlow.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import java.util.Properties;

/**
 * A regression test case for handling null in the local variables.
 *
 * @author Kohsuke Kawaguchi
 */
public class NullVariableMethodFlow implements Runnable {

    public void run() {
        getLocalAddress(System.getProperties());
    }

    public static String getLocalAddress(Properties session) {
        String x = null, y;

        // when javaflow generates the store/load code around this invocation,
        // x is of the type 'null'. we have to restore the local variable
        // in the correct type (in particular not java/lang/Object, but "null")
        // or otherwise VerifyError occurs.
        y = session.getProperty("a");
        if (y == null) {
            x = session.getProperty("b");
        }

        if (y == null)
            y = x;

        return y;
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/Simple.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

public final class Simple implements Runnable {

    public int g = -1; // global count throughout all continuations
    public int l = -1; // local count mapped to a global variable so
                       // we can access is
    
    public void run() {
        int local = -1;
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
    }

}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleSerializable.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import java.io.Serializable;
import org.apache.commons.javaflow.Continuation;


public final class SimpleSerializable implements Runnable, Serializable {
    private static final long serialVersionUID = 1L;
    
    public int g = -1; // global count throughout all continuations
    public int l = -1; // local count mapped to a global variable so
                       // we can access is
    
    public void run() {
        int local = -1;
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
        Continuation.suspend();
        ++g; l=++local;
    }

}


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleSynchronized.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

public final class SimpleSynchronized implements Runnable {

	public boolean a = false;
	public boolean b = false;
	public boolean c = false;
	public boolean d = false;
	public boolean e = false;
	public boolean f = false;

	private Object o = new Object();
	
	public void run() {		
		a = true;
		Continuation.suspend();
		b = true;
		synchronized(o) {
			c = true;
			Continuation.suspend();
			d = true;
		}
		e = true;
		Continuation.suspend();
		f = true;		
    }

}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/SimpleTryCatch.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

import org.apache.commons.javaflow.Continuation;

public final class SimpleTryCatch implements Runnable {

	public boolean a = false;
	public boolean b = false;
	public boolean c = false;
	public boolean d = false;
	public boolean e = false;
	public boolean f = false;

	private final boolean throwException;
	
	public SimpleTryCatch(final boolean pThrowException) {
		throwException = pThrowException;
	}
	
	public void run() {
    	try {
    		a = true;
    		Continuation.suspend();
    		if (throwException) {
    			throw new Exception("exception");
    		}
    		b = true;
    	} catch(Exception e) {
    		c = true;
    		Continuation.suspend();
    		d = true;
    	} finally {
    		e = true;
    		Continuation.suspend();
    		f = true;
    	}    	
    }

}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/rewrite/Stack.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.rewrite;

/**
 * Regression test case.
 *
 * <p>
 * When the stack size reaches the maximum in a constructor method invocation,
 * there was a bug where we failed to expand the stack size appropriately.
 *
 * This is a regression test for that case.
 *
 *
 * @author Kohsuke Kawaguchi
 */
public final class Stack implements Runnable {
    public void run() {
        final Object o = foo("abc","def");
    }

    private Object foo(String a, String b) {
        return new StrStr(a,b);
    }

    private static final class StrStr {
        private final String value;

        public StrStr(String a, String b) {
            value = a+b;
        }

        public String toString() {
            return value;
        }
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractBlackRedTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.BlackRed;

public abstract class AbstractBlackRedTestCase extends AbstractTransformerTestCase {

    public void testBlackRed() {
        final Runnable r = new BlackRed();
        final Continuation c1 = Continuation.startWith(r);
        assertTrue(c1 != null);
        final Continuation c2 = Continuation.continueWith(c1);
        assertTrue(c2 == null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractClassAccessTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.ClassAccess1;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.ClassAccess2;

public abstract class AbstractClassAccessTestCase extends AbstractTransformerTestCase {

    public void testClassAccess1() throws Exception {
        final ClassAccess1 r = new ClassAccess1();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c != null);
    }
    
    public void testClassAccess2() throws Exception {
        final ClassAccess2 r = new ClassAccess2();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c != null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractCounterTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.CounterFlow;

public abstract class AbstractCounterTestCase extends AbstractTransformerTestCase {

    public void testCounter() {
        final int count = 5;
        final Runnable r = new CounterFlow(count);
        int i = 0;
        Continuation c = Continuation.startWith(r);
        while (c != null) {
            c = Continuation.continueWith(c);
            i++;
        }
        assertTrue(i == count);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractDefaultConstructorTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import junit.framework.TestCase;
import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.DefaultConstructor;

public abstract class AbstractDefaultConstructorTestCase extends TestCase {

    public void testInvoker() {
        Runnable o = new DefaultConstructor();
        Continuation c = Continuation.startWith(o);
        assertTrue(c == null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractInvokerTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.Invoker;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.Simple;

public abstract class AbstractInvokerTestCase extends AbstractTransformerTestCase {

    public void testInvoker() {
        final Runnable r = new Simple();
        final Runnable o = new Invoker(r);
        final Continuation c = Continuation.startWith(o);
        assertNotNull(c);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractNewObjectTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.NewObject;

public abstract class AbstractNewObjectTestCase extends AbstractTransformerTestCase {

    public void testNewObject() throws Exception {
        final Runnable r = new NewObject();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c == null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractNoReferenceTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.NoReference;

public abstract class AbstractNoReferenceTestCase extends AbstractTransformerTestCase {

    public void testNoReference() throws Exception {
        final Runnable r = new NoReference();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c != null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractResumeTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.SimpleSerializable;

public abstract class AbstractResumeTestCase extends AbstractTransformerTestCase {

    public void testSimpleSuspendResume() throws Exception {
        final SimpleSerializable r = new SimpleSerializable();
        assertTrue(r.g == -1);
        assertTrue(r.l == -1);
        Continuation c1 = Continuation.startWith(r);
        assertNotNull(c1);
        assertTrue(r.g == 0);
        assertTrue(r.l == 0);
        Continuation c2 = Continuation.continueWith(c1);
        assertNotNull(c2);
        assertTrue(r.g == 1);
        assertTrue(r.l == 1);
        Continuation c3 = Continuation.continueWith(c2);
        assertNotNull(c3);
        assertTrue(r.g == 2);
        assertTrue(r.l == 2);
    }


    public void testContinuationBranching() throws Exception {
        final SimpleSerializable r = new SimpleSerializable();
        assertTrue(r.g == -1);
        assertTrue(r.l == -1);
        Continuation c1 = Continuation.startWith(r);
        assertNotNull(c1);
        assertTrue(r.g == 0);
        assertTrue(r.l == 0);
        Continuation c2 = Continuation.continueWith(c1);
        assertNotNull(c2);
        assertTrue(r.g == 1);
        assertTrue(r.l == 1);
        Continuation c31 = Continuation.continueWith(c2);
        assertNotNull(c31);
        assertTrue(r.g == 2);
        assertTrue(r.l == 2);
        Continuation c32 = Continuation.continueWith(c2);
        assertNotNull(c32);
        assertTrue(r.g == 3);
        assertTrue(r.l == 2);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractSerializationTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.lang.reflect.Proxy;

import junitx.util.PrivateAccessor;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.StackRecorder;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.Invoker;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.Simple;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.SimpleSerializable;

public abstract class AbstractSerializationTestCase extends AbstractTransformerTestCase {

    private File output;


    public void testSuspend() throws Exception {
        final SimpleSerializable r = new SimpleSerializable();
        assertTrue(r.g == -1);
        assertTrue(r.l == -1);
        Continuation c1 = Continuation.startWith(r);
        assertTrue(r.g == 0);
        assertTrue(r.l == 0);
        
        output = File.createTempFile("continuation", "xml");
        output.deleteOnExit();

        saveJDK(c1, output);
        
    }

    public class ObjectInputStreamExt extends ObjectInputStream {

        private ClassLoader classloader;

        public ObjectInputStreamExt(InputStream in, ClassLoader loader) throws IOException {
            super(in);
            this.classloader = loader;
        }


 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractSimpleTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.Simple;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.SimpleSynchronized;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.SimpleTryCatch;

public abstract class AbstractSimpleTestCase extends AbstractTransformerTestCase {

    public void testSimpleSuspend() throws Exception {
        final Simple r = new Simple();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c != null);
    }

    public void testSimpleTryCatchWithoutException() throws Exception {
        final SimpleTryCatch r = new SimpleTryCatch(false);
        Continuation c;

        c = Continuation.startWith(r);
        assertTrue(c != null);
        assertTrue(r.a);
        assertFalse(r.b);
        assertFalse(r.c);
        assertFalse(r.d);
        assertFalse(r.e);
        assertFalse(r.f);

        c = Continuation.continueWith(c);
        assertTrue(c != null);
        assertTrue(r.a);
        assertTrue(r.b);
        assertFalse(r.c);
        assertFalse(r.d);
        assertTrue(r.e);
        assertFalse(r.f);

        c = Continuation.continueWith(c);
        assertTrue(c != null);
        assertTrue(r.a);
        assertTrue(r.b);
        assertFalse(r.c);
        assertFalse(r.d);
        assertTrue(r.e);
        assertTrue(r.f);    
    }

    public void testSimpleTryCatchWithException() throws Exception {
        final SimpleTryCatch r = new SimpleTryCatch(true);

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/tests/AbstractStackTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation.tests;

import org.apache.commons.javaflow.Continuation;
import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
import org.apache.commons.javaflow.bytecode.transformation.rewrite.Stack;

public abstract class AbstractStackTestCase extends AbstractTransformerTestCase {

    public void testStack() throws Exception {
        final Runnable r = new Stack();
        final Continuation c = Continuation.startWith(r);
        assertTrue(c == null);
    }
}

 =======================================================================
 ==src/test/org/apache/commons/javaflow/bytecode/transformation/UsageTestCase.java
 =======================================================================
 package org.apache.commons.javaflow.bytecode.transformation;

import junit.framework.TestCase;

import org.apache.commons.javaflow.bytecode.transformation.rewrite.Simple;



public final class UsageTestCase extends TestCase {
    
    public void testIncorrectUsageWithNormalClassLoader() throws Exception {
        try {
            final Runnable r = new Simple();
            r.run();
            fail();
        } catch (final Exception e) {
            assertTrue(e instanceof IllegalStateException);
        }
    }
    
}

 =======================================================================
 ==TODO
 =======================================================================
 In no particular order:

o integrate just4log into the build system
o testcases!!!!
o documentation of the rewriting process
o fix rewriting bugs/limitations:
  o fix unintialized objects for method/constructor calls
  o inner classes
  o try/catch/finally
  o synchronized(obj)
  o accessing .class
  o new Object() without assignment
o only wrap the function calls
  that may lead to a suspend (control
  flow analysis) requires 2-pass
  analysing/rewriting
o maybe: evaluate making the Stack class use a hierarchical
  approach to support differential continuations
o maybe: asm implementation instead of BCEL

o BCEL
  o commit bug fixes in BCEL

   http://issues.apache.org/bugzilla/show_bug.cgi?id=27646
   http://issues.apache.org/bugzilla/show_bug.cgi?id=27854
   http://issues.apache.org/bugzilla/show_bug.cgi?id=27855

  o get rid of the static repository approach
   http://issues.apache.org/bugzilla/show_bug.cgi?id=38057

o talk to the RIFE guys about joining forces
o talk to the aspectwerkz and aspectj folks
  about working together

 =======================================================================
 ==xdocs/antTask.xml
 =======================================================================
 <?xml version="1.0"?>
<document>
  <properties>
    <title>Ant Task</title>
    <author email="dev@commons.apache.org">Commons Documentation Team</author>
    <revision>$Id: downloads.xml 155451 2005-02-26 13:22:47Z dirkv $</revision>
  </properties>
  <body>
    <section name="Introduction">
      <p>
        <tt>commons-javaflow.jar</tt> contains an Ant task implementation that instruments class files for javaflow. To use this task in your build script, first declare it as follows:
      </p>
<source><![CDATA[
<taskdef name="javaflow"
  classname="org.apache.commons.javaflow.ant.AntRewriteTask">
  <classpath>
    ...
  </classpath>
</taskdef>
]]></source>
    </section>
    <section name="Synopsis">
      <p>
        The <tt>javaflow</tt> task forms an implicit <a href="http://ant.apache.org/manual/CoreTypes/fileset.html">FileSet</a> and supports all attributes of &lt;fileset> (dir becomes srcdir) as well as the nested &lt;include>, &lt;exclude> and &lt;patternset> elements.
      </p>
      <subsection name="Parameter attributes">
        <table>
          <thead>
            <tr>
              <td>Attribute</td>
              <td>Description</td>
              <td>Required?</td>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>srcdir</td>
              <td>directory from which the instrumented class files will be read. This is used as the base directory for the implicit <a href="http://ant.apache.org/manual/CoreTypes/fileset.html">FileSet</a> that the <tt>javaflow</tt> task forms.</td>
              <td>yes</td>
            </tr>
            <tr>
              <td>dstdir</td>
              <td>directory to which the instrumented class files will be placed. This can be the same directory as the source directory.</td>
              <td>yes</td>
            </tr>
          </tbody>
        </table>
        <p>
          When srcdir==dstdir, class files are touched only when they are not yet instrumented.
        </p>

 =======================================================================
 ==xdocs/downloads.xml
 =======================================================================
 <?xml version="1.0"?>
<document>
   <properties>
      <title>Downloads</title>
      <author email="dev@commons.apache.org">Commons Documentation Team</author>
      <revision>$Id: downloads.xml 560803 2007-07-29 20:11:17Z bayard $</revision>
   </properties>

   <body>
      <section name="Releases">
         <p>There are no releases available.</p>

<!--
         <p>The following releases are available:</p>
         <ul>
           <li>Version 1.1 - 20 October 2003</li>
           <li>Version 1.0 - 12 August 2002</li>
         </ul>
         <br/>
         <p>
            The latest binary release is always available on the 
            <a href="http://jakarta.apache.org/site/binindex.cgi#commons-javaflow">
            Jakarta Binary Downloads page</a>,
            its source is available from 
            <a href="http://jakarta.apache.org/site/sourceindex.cgi#commons-javaflow">
            Jakarta Source Downloads page</a>.
         </p>
         <p>
            Older releases are retained by the Apache Software Foundation but are 
            moved into a
            <a href="http://archive.apache.org/dist/jakarta/commons/javaflow/">
            special archive area</a>.
         </p>
         <p>
           <a href="http://people.apache.org/builds/jakarta-commons/nightly/commons-javaflow/">
           Nightly source and binary drops</a> are available.
         </p>
-->
         <p>
            Access to the source tree to see the latest and greatest code is possible
            through <a href="cvs-usage.html">anonymous SVN access</a>.
         </p>
      </section>

<!--
      <section name="Release Candidate">
         <p>
            Release candidates for the upcoming 1.1 release can be downloaded 
            <a href="http://people.apache.org/~dirkv/builds/">here</a>.
         </p>

 =======================================================================
 ==xdocs/index.xml
 =======================================================================
 <?xml version="1.0"?>

<document>

 <properties>
  <title>Overview</title>
  <author email="dev@commons.apache.org">Commons Documentation Team</author>
 </properties>

 <body>

<section name="The Javaflow Component">

<p>
   Sometimes it is usefull if we can capture the state of the application, its 
   stack of function calls, which includes local variables, the global variables 
   and the program counter, and save them into an object. If this object would 
   give us the ability to restart the processing from the point stored in it.
</p>
<p>
   A continuation is exactly the type of object that we need. Think of a 
   continuation as an object that, for a given point in your program, contains
   a snapshot of the stack trace, including all the local variables, and the 
   program counter. You can not only store these things in the continuation 
   object, but also restore the execution of the program from a continuation 
   object. This means that the stack trace and the program counter of the 
   running program become the ones stored in a continuation.
</p>
<p>
   Continuations are powerful concepts from the world of functional languages,
   like Scheme, but they are becoming popular in other languages as well.
</p>

</section>

<section name="Releases">
    <p>
       See the <a href="downloads.html">downloads</a> page for information on obtaining releases.
    </p>
</section>

<section name="Documentation">
  <p>
     Starts with <a href="tutorial.html">the tutorial</a>.
     The <a href="apidocs/index.html">JavaDoc API documents</a> are also available.
  </p>
</section>

</body>
</document>

 =======================================================================
 ==xdocs/navigation.xml
 =======================================================================
 <?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE org.apache.commons.menus SYSTEM '../../commons-build/menus/menus.dtd'>
<project name="Commons&#xA0;JCI">
    <title>Commons&#xA0;Javaflow</title>
    <body>
        <menu name="Commons&#xA0;Javaflow">
            <item name="Overview"                      href="/index.html" />
            <item name="Downloads"                     href="/downloads.html"/>
            <item name="Tutorial"                      href="/tutorial.html" />
            <item name="API&#xA0;Documentation"        href="/apidocs/index.html"/>
            <item name="Ant Task"                      href="/antTask.html" />
        </menu>
        &common-menus;
    </body>
</project>

 =======================================================================
 ==xdocs/tutorial.xml
 =======================================================================
 <?xml version="1.0"?>
<document>
  <properties>
    <title>Tutorial</title>
    <author email="dev@commons.apache.org">Commons Documentation Team</author>
    <revision>$Id: downloads.xml 155451 2005-02-26 13:22:47Z dirkv $</revision>
  </properties>
  <body>
  <section name="Tutorial">
    <p>
      This document shows the basic usage of the javaflow API.
    </p>
    <p>
      First, consider the following program:
    </p>
<source>
class MyRunnable implements Runnable {
  public void run() {
    System.out.println("started!");
    for( int i=0; i&lt;10; i++ )
      echo(i);
  }
  private void echo(int x) {
    System.out.println(x);
    Continuation.suspend();
  }
}

Continuation c = Continuation.startWith(new MyRunnable());
System.out.println("returned a continuation");
</source>
    <p>
      When the <tt>startWith</tt> method is invoked, Javaflow sets up the "environment", then invoke the run method of the object it received. It's not very important for users to know what this environment is, but that is what enables all the magics we'll see in this document.
    </p>
    <p>
      As a result of this, you'll see the "started!" message printed in the console. The thread then goes into a for loop, calls the echo method, prints "0", then calls the <tt>Continuation.suspend()</tt>.
    </p>
    <p>
      This is where an interesting thing happens. In this method, the stack frames that are leading up to the Continuation.suspend() and all local variables are captured into a <tt>Continuation</tt> object, and then the execution resumes by returning from the <tt>startWith</tt> method (instead of returning from the <tt>suspend</tt> method.) So the next message you'll see on the console is "returned a continuation". This all happens by using just one thread.
    </p>
    <p>
      You can then do something else, and eventually you'll do the following:
    </p>
<source>
Continuation d = Continuation.continueWith(c);
System.out.println("returned another continuation");
</source>
    <p>
      When the <tt>continueWith</tt> method is invoked, javaflow sets up the environment again, and restores stack frames and local variables. Instead of returning from the <tt>continueWith</tt> method, the execution resumes by returning from the <tt>suspend</tt> method that never returned before.
    </p>