SE547: Security Automata: Disallow Println [18/20] Previous pageContentsNext page

public class TestPolicy extends Policy {
  public Suggestion query(Action a) {
    aswitch(a) {
      case <* *.*.println(..)>: return new HaltSuggestion(this, a);
      default: return new UnregSuggestion(this, a);
    }
  }

  public void accept(Suggestion s) {
    if(s.isHalt()) System.out.print("Halting target ; no printlns allowed!\n");
  }
}

Previous pageContentsNext page