< prev index next >

test/compiler/exceptions/CatchInlineExceptions.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8059299
  27  * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr
  28  * @run main/othervm -Xbatch CatchInlineExceptions

  29  */
  30 
  31 class Exception1 extends Exception {};
  32 class Exception2 extends Exception {};
  33 
  34 public class CatchInlineExceptions {


  35     private static int counter0;
  36     private static int counter1;
  37     private static int counter2;
  38     private static int counter;
  39 
  40     static void foo(int i) throws Exception {
  41         if ((i & 1023) == 2) {
  42             counter0++;
  43             throw new Exception2();
  44         }
  45     }
  46 
  47     static void test(int i) throws Exception {
  48         try {
  49            foo(i);
  50         }
  51         catch (Exception e) {
  52             if (e instanceof Exception1) {
  53                 counter1++;
  54             } else if (e instanceof Exception2) {




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @bug 8059299
  27  * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr
  28  *
  29  * @run main/othervm -Xbatch compiler.exceptions.CatchInlineExceptions
  30  */
  31 
  32 package compiler.exceptions;

  33 
  34 public class CatchInlineExceptions {
  35     static class Exception1 extends Exception {};
  36     static class Exception2 extends Exception {};
  37     private static int counter0;
  38     private static int counter1;
  39     private static int counter2;
  40     private static int counter;
  41 
  42     static void foo(int i) throws Exception {
  43         if ((i & 1023) == 2) {
  44             counter0++;
  45             throw new Exception2();
  46         }
  47     }
  48 
  49     static void test(int i) throws Exception {
  50         try {
  51            foo(i);
  52         }
  53         catch (Exception e) {
  54             if (e instanceof Exception1) {
  55                 counter1++;
  56             } else if (e instanceof Exception2) {


< prev index next >