Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1233686

Test_011 fails in JDK 1.0 build 1/9/96.

XMLWordPrintable

    • sparc
    • solaris_2.4

      Expected output of Test011_beta is:

        Test011_beta is ok

      Output I got (on all three platforms) was:

        Test011_beta.java:23: Impossible for java.lang.Thread to be instance of Test011_beta.
                assert(!(t instanceof Test011_beta));
                           ^
        1 error

      Here's the code:

      /*
       * Copyright (c) 1994 by FirstPerson, Inc.
       * All rights reserved.
       *
       * @(#)Test011_beta.java 1.1 95/06/08 June 1994
       *
       * Arthur van Hoff, September 1994
       */
      interface Test011_betaa {
      }

      /**
       * Test instanceof
       */
      class Test011_beta extends Test implements Test011_betaa {
          void test1() {
              Object obj = this;
              Thread t = Thread.currentThread();
              assert(this instanceof Test011_beta);
              assert(!(null instanceof Test011_beta));
              assert(obj instanceof Test011_beta);
              assert(t instanceof Thread);
              assert(!(t instanceof Test011_beta));
              //assert(obj instanceof Test11a);
          }
          public static void main(String argv[]) {
              String test = "Test011_beta";
              Test t = (Test) new Test011_beta();
              testnr++; assertionnr = 0; t.test1();
              testnr++; assertionnr = 0; t.test2();
              testnr++; assertionnr = 0; t.test3();
              testnr++; assertionnr = 0; t.test4();
              testnr++; assertionnr = 0; t.test5();
              testnr++; assertionnr = 0; t.test7();
              testnr++; assertionnr = 0; t.test8();
              testnr++; assertionnr = 0; t.test9();
              testnr++; assertionnr = 0; t.test10();

              if (failed == 0) {
                  System.err.println(test + " is ok");
                  System.exit(0);
              } else {
                  System.err.println(test + " failed");
                  System.exit(1);
              }
          }

      }

            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: