}
DependencyAnalyzer da = new DependencyAnalyzer();
Graph dependencyGraph = null;
log.info("parsing input files to determine dependencies.");
long start = System.currentTimeMillis();
MultipleCompilationUnitState multipleCompilationUnitState = new MultipleCompilationUnitState();
try
{
for (int targetIndex = 0; targetIndex < targets.size(); targetIndex++)
{
String filename = ((Target) targets.elementAt(targetIndex)).getName();
try
{
Reader is = new FileReader(filename);
try
{
BufferedReader bufferedIs = new BufferedReader(is);
try
{
recent_file = filename;
if (++number_of_files % 50 == 0 && number_of_files > 0)
{
log.info(" (" + number_of_files + " files parsed)");
}
net.sf.jcontracts.codeparser.Parser parser = new net.sf.jcontracts.codeparser.Parser(
bufferedIs, filename, multipleCompilationUnitState);
MetaclassFactory metaclassFactory = new MetaclassFactory(filename);
parser.setMetaclassFactory(metaclassFactory);
Vector v = parser.getUsedTypes();
da.process(v);
}
finally
{
bufferedIs.close();
}
}
finally
{
is.close();
}
}
catch (FileNotFoundException _ex)
{
throw new RuntimeException("Java Contract Suite: error file " + filename + " not found!", _ex);
}
}
long end = System.currentTimeMillis();
log.info("Analyzed " + targets.size() + " files in " + (end - start) / 1000D + " s.");
}
catch (Exception e)
{
log.error("parsing problem while looking at " + recent_file);
throw e;
}
if (multipleCompilationUnitState.hasUnresolvedNames())
{
String unresolvedNames = multipleCompilationUnitState.getUnresolvedNamesAsString();
log.error("could not resolve the following type names:\n" + unresolvedNames);
throw new RuntimeException("could not resolve the following type names:\n" + unresolvedNames);
}
dependencyGraph = da.getGraph();
log.info("found " + dependencyGraph.getSize() + " relavant types referenced in the " + targets.size()