package Samples;

/*Generated by MPS */


public class UnlessSample {
  public UnlessSample() {
  }
  public static void main(String[] args) {
    // Type "unless" followed by Control + Space to create an "unless statement"

    System.out.println("Surround me with unless (Select the line, then Control + Alt + T)");

    // Checking rules with quick-fixes
    if (!(1 > 0)) {
      System.out.println("Remove this line and you'll get a warning about an empty unless block. Try Alt + Enter then.");
    }

    // Intentions
    if (!(false)) {
      System.out.println("Try the intention offered after Alt + Enter when positioned on the unless keyword");
    }

    // Potential NPE reporting
    String s = null;
    if (!(UnlessSample.condition())) {
      s = "value";
    }
    System.out.println("Dangerous reference. Note the warning issues by the dataflow engine " + s.length());

    // Unreachable code detection
    if (!(false)) {
      System.out.println("So far so good");
    }
    System.out.println("We can become unreachable by uncommenting the return expression above.");
  }
  private static boolean condition() {
    return 1 < 0;
  }
}
