commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r231525 - in /jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow: ./ ant/ bytecode/ bytecode/asm/ bytecode/bcel/ bytecode/bcel/analyser/ bytecode/transformation/ bytecode/transformation/asm/ bytecode/transformation/...
Date Thu, 11 Aug 2005 21:59:23 GMT
Author: tcurdt
Date: Thu Aug 11 14:59:00 2005
New Revision: 231525

URL: http://svn.apache.org/viewcvs?rev=231525&view=rev
Log:
re-organized package structure


Added:
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/RewritingResourceStore.java
      - copied, changed from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingResourceStore.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/ClassTransformer.java
      - copied, changed from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/ClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/NopClassTransformer.java
      - copied, changed from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/NopClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/
      - copied from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/asm/
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
      - copied, changed from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java
      - copied, changed from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/DecompilingVisitor.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/
      - copied from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/analyser/
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/utils/RewritingUtils.java
Removed:
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/ClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/NopClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingResourceStore.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingUtils.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/asm/
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/DecompilingVisitor.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/analyser/
Modified:
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationClassLoader.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationCompilingClassLoader.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationURLClassLoader.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationClassLoader.java?rev=231525&r1=231524&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationClassLoader.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationClassLoader.java
Thu Aug 11 14:59:00 2005
@@ -18,8 +18,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.javaflow.bytecode.ClassTransformer;
-import org.apache.commons.javaflow.bytecode.bcel.BcelClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationCompilingClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationCompilingClassLoader.java?rev=231525&r1=231524&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationCompilingClassLoader.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationCompilingClassLoader.java
Thu Aug 11 14:59:00 2005
@@ -16,8 +16,6 @@
 package org.apache.commons.javaflow;
 
 import java.io.File;
-
-import org.apache.commons.javaflow.bytecode.RewritingResourceStore;
 import org.apache.commons.jci.CompilingClassLoader;
 import org.apache.commons.jci.stores.MemoryResourceStore;
 import org.apache.commons.logging.Log;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationURLClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationURLClassLoader.java?rev=231525&r1=231524&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationURLClassLoader.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ContinuationURLClassLoader.java
Thu Aug 11 14:59:00 2005
@@ -15,10 +15,6 @@
  */
 package org.apache.commons.javaflow;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.javaflow.bytecode.ClassTransformer;
-
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -37,6 +33,9 @@
 import java.util.Map;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * {@link URLClassLoader} with bytecode instrumentation for javaflow.

Copied: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/RewritingResourceStore.java
(from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingResourceStore.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/RewritingResourceStore.java?p2=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/RewritingResourceStore.java&p1=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingResourceStore.java&r1=231523&r2=231525&rev=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/RewritingResourceStore.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/RewritingResourceStore.java
Thu Aug 11 14:59:00 2005
@@ -13,14 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode;
+package org.apache.commons.javaflow;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import org.apache.bcel.Repository;
 import org.apache.bcel.util.ClassLoaderRepository;
-import org.apache.commons.javaflow.bytecode.bcel.BcelClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 import org.apache.commons.jci.stores.ResourceStore;
 import org.apache.commons.jci.stores.TransactionalResourceStore;
 import org.apache.commons.logging.Log;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java?rev=231525&r1=231524&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/ant/AntRewriteTask.java
Thu Aug 11 14:59:00 2005
@@ -17,20 +17,19 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
-import java.util.zip.ZipEntry;
-
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.commons.javaflow.bytecode.ClassTransformer;
-import org.apache.commons.javaflow.bytecode.bcel.BcelClassTransformer;
-import org.apache.commons.io.IOUtils;
 
 /**
  * Ant task that enhances class files with javaflow instrumentation.

Copied: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/ClassTransformer.java
(from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/ClassTransformer.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/ClassTransformer.java?p2=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/ClassTransformer.java&p1=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/ClassTransformer.java&r1=231523&r2=231525&rev=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/ClassTransformer.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/ClassTransformer.java
Thu Aug 11 14:59:00 2005
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode;
+package org.apache.commons.javaflow.bytecode.transformation;
 
 import org.apache.commons.javaflow.Continuation;
-import org.apache.commons.javaflow.bytecode.bcel.BcelClassTransformer;
-import org.apache.commons.javaflow.bytecode.asm.AsmClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 /**

Copied: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/NopClassTransformer.java
(from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/NopClassTransformer.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/NopClassTransformer.java?p2=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/NopClassTransformer.java&p1=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/NopClassTransformer.java&r1=231523&r2=231525&rev=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/NopClassTransformer.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/NopClassTransformer.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode;
+package org.apache.commons.javaflow.bytecode.transformation;
 
 public final class NopClassTransformer implements ClassTransformer {
 

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformer.java
Thu Aug 11 14:59:00 2005
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.asm;
+package org.apache.commons.javaflow.bytecode.transformation.asm;
 
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.javaflow.bytecode.BytecodeClassLoader;
-import org.apache.commons.javaflow.bytecode.ClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.objectweb.asm.ClassAdapter;
@@ -32,8 +32,9 @@
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.tree.MethodNode;
 import org.objectweb.asm.tree.analysis.Analyzer;
-import org.objectweb.asm.tree.analysis.BasicVerifier;
+import org.objectweb.asm.tree.analysis.DataflowInterpreter;
 import org.objectweb.asm.tree.analysis.Frame;
+import org.objectweb.asm.util.TraceClassVisitor;
 
 /**
  * @author tcurdt
@@ -85,7 +86,8 @@
                     // once the MethodNode is complete, compute the frames
                     final Frame[] frames;
                     if (instructions.size() > 0) {
-                        Analyzer a = new Analyzer(new BasicVerifier());
+                        Analyzer a = new Analyzer(new DataflowInterpreter());
+                        //Analyzer a = new Analyzer(new BasicVerifier());
                         try {
                             a.analyze(className, this);
                         } catch (Exception ignored) {
@@ -211,8 +213,6 @@
         cr.accept(cv, false);
         final byte[] transformed = cw.toByteArray();
         
-        //new ClassReader(transformed).accept(new TraceClassVisitor(new ClassWriter(false),
new PrintWriter(System.out)), false);
-
         return transformed;
     }
 
@@ -234,11 +234,15 @@
         }
         System.out.println("original finished");
         */
-        
+
+        new ClassReader(transformed).accept(new TraceClassVisitor(new ClassWriter(false),
new PrintWriter(System.out)), false);
+
+        /*
         System.out.println("running the transformed");
         Class transformedClass = new BytecodeClassLoader().loadClass(transformed);
         Runnable transformedRunnable = (Runnable) transformedClass.newInstance();
         transformedRunnable.run();
         System.out.println("transformed finished");
+        */
     }
 }

Copied: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
(from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java?p2=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java&p1=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java&r1=231523&r2=231525&rev=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/BcelClassTransformer.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
Thu Aug 11 14:59:00 2005
@@ -13,8 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel;
+package org.apache.commons.javaflow.bytecode.transformation.bcel;
 
+import java.io.ByteArrayInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Vector;
 import org.apache.bcel.Constants;
 import org.apache.bcel.Repository;
 import org.apache.bcel.classfile.ClassFormatException;
@@ -54,26 +60,19 @@
 import org.apache.bcel.generic.TargetLostException;
 import org.apache.bcel.generic.Type;
 import org.apache.bcel.verifier.exc.AssertionViolatedException;
-import org.apache.commons.javaflow.bytecode.ClassTransformer;
 import org.apache.commons.javaflow.bytecode.Continuable;
 import org.apache.commons.javaflow.bytecode.StackRecorder;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.ControlFlowGraph;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.ExceptionHandler;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.ExecutionVisitor;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.Frame;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.InstructionContext;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.LocalVariables;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.OperandStack;
-import org.apache.commons.javaflow.bytecode.bcel.analyser.UninitializedObjectType;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.ControlFlowGraph;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.ExceptionHandler;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.ExecutionVisitor;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.Frame;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.InstructionContext;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.LocalVariables;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.OperandStack;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.analyser.UninitializedObjectType;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Vector;
 
 
 /**

Copied: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java
(from r231523, jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/DecompilingVisitor.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java?p2=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java&p1=jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/DecompilingVisitor.java&r1=231523&r2=231525&rev=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/bcel/DecompilingVisitor.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/DecompilingVisitor.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel;
+package org.apache.commons.javaflow.bytecode.transformation.bcel;
 
 import java.io.OutputStream;
 import java.io.PrintWriter;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ControlFlowGraph.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import java.util.ArrayList;
 import java.util.HashMap;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandler.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.generic.*;
 

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExceptionHandlers.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.generic.*;
 import java.util.HashSet;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/ExecutionVisitor.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.Constants;
 import org.apache.bcel.classfile.Constant;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Frame.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 /**
  * This class represents a JVM execution frame; that means,

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/InstructionContext.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import java.util.ArrayList;
 

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/LocalVariables.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.generic.Type;
 import org.apache.bcel.generic.ReferenceType;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/OperandStack.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.generic.*;
 import org.apache.bcel.verifier.exc.*;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutine.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.generic.*;
 

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/Subroutines.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import java.awt.Color;
 import java.util.ArrayList;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java?rev=231525&r1=231523&r2=231525&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/analyser/UninitializedObjectType.java
Thu Aug 11 14:59:00 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.javaflow.bytecode.bcel.analyser;
+package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
 
 import org.apache.bcel.*;
 import org.apache.bcel.generic.*;

Added: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/utils/RewritingUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/utils/RewritingUtils.java?rev=231525&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/utils/RewritingUtils.java
(added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/utils/RewritingUtils.java
Thu Aug 11 14:59:00 2005
@@ -0,0 +1,96 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.javaflow.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.javaflow.bytecode.transformation.ClassTransformer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public final class RewritingUtils {
+
+    private final static Log log = LogFactory.getLog(RewritingUtils.class);
+
+    /*
+     * @todo multiple transformers
+     */
+    public static void rewriteClassFile(
+            final File input,
+            final ClassTransformer transformer,
+            final File output
+            ) throws IOException {
+        
+        final byte[] original = FileUtils.readFileToByteArray(input);
+        final byte[] transformed = transformer.transform(original);
+        final FileOutputStream os = new FileOutputStream(output);
+        os.write(transformed);
+        os.close();
+    }
+    
+    /*
+     * @todo recurse
+     * @todo multiple transformers
+     */
+    public static void rewriteJar(
+            final JarInputStream input,
+            final ClassTransformer transformer,
+            final JarOutputStream output
+            ) throws IOException {
+
+        while(true) {
+            final JarEntry entry = input.getNextJarEntry();
+            
+            if (entry == null) {
+                break;
+            }
+            
+            if (entry.isDirectory()) {
+                continue;
+            }
+            
+            final String name = entry.getName();
+            
+            final byte[] original = IOUtils.toByteArray(input);
+            
+            output.putNextEntry(new JarEntry(name));
+
+            if (name.endsWith(".class")) {
+                
+                if (log.isDebugEnabled()) {
+                    log.debug("transforming " + name);
+                }
+
+                final byte[] transformed = transformer.transform(original);
+                IOUtils.copy(new ByteArrayInputStream(transformed), output);
+                
+            } else {
+                
+                IOUtils.copy(new ByteArrayInputStream(original), output);
+            }
+        }
+        
+        input.close();
+        output.close();
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message