ptolemy.copernicus.kernel
Class ClassWriter

java.lang.Object
  extended by soot.Transformer
      extended by soot.SceneTransformer
          extended by ptolemy.copernicus.kernel.ClassWriter
All Implemented Interfaces:
soot.HasPhaseOptions

public class ClassWriter
extends soot.SceneTransformer
implements soot.HasPhaseOptions

Write all of the application classes out to class files. Jasmin files for the classes will be created in a temporary directory and then compiled into bytecode using the Jasmin assembler. The output directory is specified using the outputDirectory parameter. The class files will be placed in the appropriate subdirectory of that directory according to their package name.

Since:
Ptolemy II 2.0
Version:
$Id: ClassWriter.java 54721 2009-06-26 22:32:23Z cxh $
Author:
Stephen Neuendorffer
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
private static ClassWriter instance
           
 
Constructor Summary
private ClassWriter()
           
 
Method Summary
private  void _create(java.io.File file)
           
private  void _write(soot.SootClass cl, java.lang.String outputDir)
           
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
 java.lang.String getPhaseName()
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
          Write out the class file.
static ClassWriter v()
           
 
Methods inherited from class soot.SceneTransformer
transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static ClassWriter instance
Constructor Detail

ClassWriter

private ClassWriter()
Method Detail

v

public static ClassWriter v()

getPhaseName

public java.lang.String getPhaseName()
Specified by:
getPhaseName in interface soot.HasPhaseOptions

getDefaultOptions

public java.lang.String getDefaultOptions()
Specified by:
getDefaultOptions in interface soot.HasPhaseOptions

getDeclaredOptions

public java.lang.String getDeclaredOptions()
Specified by:
getDeclaredOptions in interface soot.HasPhaseOptions

internalTransform

protected void internalTransform(java.lang.String phaseName,
                                 java.util.Map options)
Write out the class file. This transform can be used to take snapshots, and is usually called in conjunction with JimpleWriter inside addTransforms():
   Scene.v().getPack("wjtp").add(new Transform("wjtp.snapshot1",
           ClassWriter.v()));
   Scene.v().getPack("wjtp").add(new Transform("wjtp.snapshot1",
           JimpleWriter.v()));
  
Sample option arguments: -p wjtp.snapshot1 outputDirectory:jimple1

Specified by:
internalTransform in class soot.SceneTransformer
Parameters:
phaseName - The name of the phase, for example wjtp.snapshot1.
options - The options Map. This method uses the outputDirectory option to specify where the .class file should be written
See Also:
JimpleWriter

_write

private void _write(soot.SootClass cl,
                    java.lang.String outputDir)

_create

private void _create(java.io.File file)
              throws java.io.IOException
Throws:
java.io.IOException