User:Jdev/Code/DebugCode

From Robowiki
Jump to navigation Jump to search

It's a technique for inject into robots permanent debugging code without impact on "production". Feel free to adopt and/or use it

DebugCode:

public class DebugCode {

    public boolean e() { return true;}

}

Usage:

assert new DebugCode() {{
    // this code will be executed only if JVM are runned with "-ea" flag
    dangers.addValue(cmo.danger);
    dangers.addValue(smo.danger);
    dangers.addValue(ccmo.danger);
}}.e();