if (script.hasTransform(targetClass)) {
List<Transform> transforms = script.getTransformed();
int numTransforms = transforms.size();
for (Transform transform : transforms) {
Throwable throwable = transform.getThrowable();
Rule rule = transform.getRule();
if (throwable != null) {
if (throwable instanceof ParseException) {
System.out.println("ERROR : Failed to parse rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
System.out.println();
parseErrorCount++;
errorCount++;
} else if (throwable instanceof TypeWarningException) {
System.out.println("WARNING : Unable to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
System.out.println();
typeWarningCount++;
warningCount++;
} else if (throwable instanceof TypeException) {
System.out.println("ERROR : Failed to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
System.out.println();
typeErrorCount++;
errorCount++;
} else {
System.out.println("ERROR : Unexpected exception transforming class " + targetClassName + " using rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
System.out.println();
errorCount++;
}
throwable.printStackTrace(System.out);
System.out.println();
continue;
}
System.out.println("parsed rule \"" + script.getName() + "\" for class " + transform.getInternalClassName());
if (verbose) {
System.out.println("# File " + script.getFile() + " line " + script.getLine());
System.out.println(rule);
}
// ok, now see if we can type check the rule
try {
rule.typeCheck();
} catch (TypeWarningException te) {
System.out.println("WARNING : Unable to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
typeWarningCount++;
warningCount++;
te.printStackTrace(System.out);
System.out.println();
continue;
} catch (TypeException te) {
System.out.println("ERROR : Failed to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
typeErrorCount++;
errorCount++;
te.printStackTrace(System.out);
System.out.println();
continue;
}
if (script.isOverride()) {
System.out.println("type checked overriding rule \"" + script.getName() + "\" against method in declared class");
} else {
System.out.println("type checked rule \"" + script.getName() + "\"");
}
System.out.println();
}
} else if (targetClass.isInterface() || script.isOverride()) {
// ok, not necessarily a surprise - let's see if we can create a rule and parse/type check it
final Rule rule;
try {
rule = Rule.create(script, loader, null);
} catch (ParseException pe) {
System.out.println("ERROR : Failed to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
parseErrorCount++;