Fields Summary |
---|
public static final String | PROPERTY_EXCLUDE_SYNTHETIC_METHODS |
public static final String | PROPERTY_EXCLUDE_BRIDGE_METHODS |
public static final String | PROPERTY_DO_SUID_COMPENSATION |
public static final String | DEFAULT_EXCLUDE_SYNTHETIC_METHODS |
public static final String | DEFAULT_EXCLUDE_BRIDGE_METHODS |
public static final String | DEFAULT_DO_SUID_COMPENSATION |
protected File[] | m_instrPath |
protected boolean | m_dependsMode |
protected boolean | m_canonical |
protected com.vladium.emma.filter.IInclExclFilter | m_coverageFilter |
protected OutMode | m_outMode |
protected File | m_outDir |
protected File | m_mdataOutFile |
protected Boolean | m_mdataOutMerge |
protected int | m_classCopies |
protected int | m_classInstrs |
protected static final String | CLASSES |
protected static final String | LIB |
protected static final boolean | IN_CLASSES |
protected static final boolean | IN_LIB |
Methods Summary |
---|
public static com.vladium.emma.instr.InstrProcessor | create()
return new InstrProcessorST ();
|
protected final void | createDir(java.io.File dir, boolean mkall)
if (mkall)
{
if (! dir.mkdirs () && ! dir.exists ())
throw new EMMARuntimeException (IAppErrorCodes.OUT_MKDIR_FAILURE, new Object [] {dir.getAbsolutePath ()});
}
else
{
if (! dir.mkdir () && ! dir.exists ())
throw new EMMARuntimeException (IAppErrorCodes.OUT_MKDIR_FAILURE, new Object [] {dir.getAbsolutePath ()});
}
|
protected final java.io.File | getFullOutDir(java.io.File pathDir, boolean isClass)
if (m_outMode == OutMode.OUT_MODE_OVERWRITE)
{
return pathDir;
}
else if (m_outMode == OutMode.OUT_MODE_COPY)
{
return m_outDir;
}
else if (m_outMode == OutMode.OUT_MODE_FULLCOPY)
{
return isClass ? Files.newFile (m_outDir, CLASSES) : Files.newFile (m_outDir, LIB);
}
else throw new IllegalStateException ("invalid out mode state: " + m_outMode);
|
protected final java.io.File | getFullOutFile(java.io.File pathDir, java.io.File file, boolean isClass)
return Files.newFile (getFullOutDir (pathDir, isClass), file.getPath ());
|
protected void | reset()
m_classCopies = m_classInstrs = 0;
|
public final synchronized void | setDependsMode(boolean enable)
m_dependsMode = enable;
|
public final synchronized void | setInclExclFilter(java.lang.String[] specs)
if (specs == null)
m_coverageFilter = null;
else
m_coverageFilter = IInclExclFilter.Factory.create (specs);
|
public final synchronized void | setInstrOutDir(java.lang.String dir)
if (dir == null)
m_outDir = null;
else
{
final File _outDir = new File (dir);
if (_outDir.exists () && ! _outDir.isDirectory ())
throw new IllegalArgumentException ("not a directory: [" + _outDir.getAbsolutePath () + "]");
m_outDir = _outDir;
}
|
public final synchronized void | setInstrPath(java.lang.String[] path, boolean canonical)
if ((path == null) || (path.length == 0))
m_instrPath = IConstants.EMPTY_FILE_ARRAY;
else
m_instrPath = Files.pathToFiles (path, canonical);
m_canonical = canonical;
|
public final synchronized void | setMetaOutFile(java.lang.String fileName)
if (fileName == null)
m_mdataOutFile = null;
else
{
final File _file = new File (fileName);
if (_file.exists () && ! _file.isFile ())
throw new IllegalArgumentException ("not a file: [" + _file.getAbsolutePath () + "]");
m_mdataOutFile = _file;
}
|
public final synchronized void | setMetaOutMerge(java.lang.Boolean merge)
m_mdataOutMerge = merge;
|
public final synchronized void | setOutMode(com.vladium.emma.instr.InstrProcessor$OutMode mode)
if (mode == null)
throw new IllegalArgumentException ("null input: mode");
m_outMode = mode;
|
protected void | validateState()
super.validateState ();
if ((m_instrPath == null) || (m_instrPath.length == 0))
throw new IllegalStateException ("instrumentation path not set");
// [m_coverageFilter can be null]
if (m_outMode == null)
throw new IllegalStateException ("output mode not set");
if (m_outMode != OutMode.OUT_MODE_OVERWRITE)
{
if (m_outDir == null)
throw new IllegalStateException ("output directory not set");
// for non-overwrite modes output directory must not overlap
// with the instr path:
// [the logic below does not quite catch all possibilities due to
// Class-Path: manifest attributes and dir nesting, but it should
// intercept most common mistakes]
if ($assert.ENABLED)
{
$assert.ASSERT (m_outDir != null, "m_outDir = null");
$assert.ASSERT (m_instrPath != null, "m_instrPath = null");
}
final File canonicalOutDir = Files.canonicalizeFile (m_outDir);
final File [] canonicalInstrPath;
if (m_canonical)
canonicalInstrPath = m_instrPath;
else
{
canonicalInstrPath = new File [m_instrPath.length];
for (int ip = 0; ip < canonicalInstrPath.length; ++ ip)
{
canonicalInstrPath [ip] = Files.canonicalizeFile (m_instrPath [ip]);
}
}
// FR_SF988785: detect if the user attempted to use a parent of m_outDir as one of
// the input directories (prevents spurious "already instrumented" errors)
final int instrPathLength = canonicalInstrPath.length;
for (File dir = canonicalOutDir; dir != null; dir = dir.getParentFile ()) // getParentFile() does no real I/O
{
for (int ip = 0; ip < instrPathLength; ++ ip)
{
if (dir.equals (canonicalInstrPath [ip]))
throw new IllegalStateException ("output directory [" + canonicalOutDir + "] cannot be one of the instrumentation path directories (or a child thereof)");
}
}
}
// [m_mdataOutFile can be null]
// [m_mdataOutMerge can be null]
|