File: Uncaught.j

package info (click to toggle)
jasmin-sable 1.2-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,464 kB
  • ctags: 1,903
  • sloc: java: 12,496; makefile: 126; csh: 93; sh: 93
file content (36 lines) | stat: -rw-r--r-- 970 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
; --- Copyright Jonathan Meyer 1996. All rights reserved. -----------------
; File:      jasmin/examples/Uncaught.j
; Author:    Jonathan Meyer, 10 July 1996
; Purpose:   Throws an exception - doesn't catch it
; -------------------------------------------------------------------------

;
; This example class contains a main() method that throws
; an exception but doesn't catch it -
;
.source Uncaught.j
.class public examples/Uncaught
.super java/lang/Object

; specify the initializer method (as for HelloWorld)

.method public <init>()V
    ; just call Object's initializer
    aload_0
    invokenonvirtual java/lang/Object/<init>()V
    return
.end method

; specify the "main" method - this throws an uncaught exception

.method public static main([Ljava/lang/String;)V
    .limit stack 2

    new java/lang/Exception
    dup
    invokenonvirtual java/lang/Exception/<init>()V
    athrow

    ; without this the verifier might complain ...
    return
.end method