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();
String methodName = transform.getTriggerMethodName();
if (throwable != null) {
if (throwable instanceof ParseException) {
System.out.println("ERROR : Failed to parse rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine());
parseErrorCount++;
errorCount++;
} else if (throwable instanceof TypeWarningException) {
System.out.println("WARNING : Warning type checking rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine() + (methodName == null ? "" : " against method " + methodName));
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() + (methodName == null ? "" : " against method " + methodName));
typeErrorCount++;
errorCount++;
} else {
System.out.println("ERROR : Unexpected exception transforming class " + targetClassName + " using rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine() + (methodName == null ? "" : " against method " + methodName));
errorCount++;
}
System.out.println(throwable);
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() + (methodName == null ? "" : " against method " + methodName));
typeWarningCount++;
warningCount++;
System.out.println(te);
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() + (methodName == null ? "" : " against method " + methodName));
typeErrorCount++;
errorCount++;
System.out.println(te);
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++;