author | twisti |
Mon, 27 Apr 2015 09:02:41 -0700 | |
changeset 30288 | 476c276de939 |
parent 27700 | a402738ebfcf |
child 31587 | e48945b7849c |
permissions | -rw-r--r-- |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
1 |
/* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
2 |
* Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
4 |
* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
10 |
* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
15 |
* accompanied this code). |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
16 |
* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
20 |
* |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
23 |
* questions. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
24 |
*/ |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
25 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
26 |
package java.lang; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
27 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
28 |
/** |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
29 |
* Slightly modified version of java.lang.Object that replaces |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
30 |
* finalize() by finalizeObject() to avoid overriding in subclasses. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
31 |
*/ |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
32 |
public class Object { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
33 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
34 |
private static native void registerNatives(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
35 |
static { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
36 |
registerNatives(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
37 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
38 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
39 |
public final native Class<?> getClass(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
40 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
41 |
public native int hashCode(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
42 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
43 |
public boolean equals(Object obj) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
44 |
return (this == obj); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
45 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
46 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
47 |
protected native Object clone() throws CloneNotSupportedException; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
48 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
49 |
public String toString() { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
50 |
return getClass().getName() + "@" + Integer.toHexString(hashCode()); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
51 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
52 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
53 |
public final native void notify(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
54 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
55 |
public final native void notifyAll(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
56 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
57 |
public final native void wait(long timeout) throws InterruptedException; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
58 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
59 |
public final void wait(long timeout, int nanos) throws InterruptedException { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
60 |
if (timeout < 0) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
61 |
throw new IllegalArgumentException("timeout value is negative"); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
62 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
63 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
64 |
if (nanos < 0 || nanos > 999999) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
65 |
throw new IllegalArgumentException( |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
66 |
"nanosecond timeout value out of range"); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
67 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
68 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
69 |
if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
70 |
timeout++; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
71 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
72 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
73 |
wait(timeout); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
74 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
75 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
76 |
public final void wait() throws InterruptedException { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
77 |
wait(0); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
78 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
79 |
|
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
80 |
/** |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
81 |
* Replaces original finalize() method and is therefore not |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
82 |
* overridden by any subclasses of Object. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
83 |
* @throws Throwable |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
84 |
*/ |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
85 |
// protected void finalize() throws Throwable { } |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
86 |
public void finalizeObject() throws Throwable { } |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
diff
changeset
|
87 |
} |