X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=kona%2Fz-testing%2Fsrc%2Ftest%2Fjava%2Fsemantics%2Finstance_of.java;fp=kona%2Fz-testing%2Fsrc%2Ftest%2Fjava%2Fsemantics%2Finstance_of.java;h=3900856608dec7fbfae8d314f62348c67847fe7d;hb=a6f0bcc36018952427cbab16387e06ebac58ddb6;hp=0000000000000000000000000000000000000000;hpb=c8d05b4db1f23b9d1e32dabe6b9eb548edb49687;p=feisty_meow.git diff --git a/kona/z-testing/src/test/java/semantics/instance_of.java b/kona/z-testing/src/test/java/semantics/instance_of.java new file mode 100644 index 00000000..39008566 --- /dev/null +++ b/kona/z-testing/src/test/java/semantics/instance_of.java @@ -0,0 +1,29 @@ + + +package test.java.semantics; + +import java.util.List; + +class instance_of +{ + public instance_of() {} + + public Object cogitate() { + return null; + } + + public static void main(String s[]) throws Exception + { + // we are just asserting that it is safe to do instanceof on an object that is null. + // let's test that theory. + instance_of tony = new instance_of(); + Object fred = tony.cogitate(); // will produce null. + if (fred instanceof List) { + throw new Exception("that should not have happened!"); + } else { + System.out.println("told us null is not an instance of List, which is correct."); + } + + } + +} \ No newline at end of file