8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.lang; 27 28 /** 29 * Slightly modified version of java.lang.Object that replaces 30 * finalize() by finalizeObject() to avoid overriding in subclasses. 31 */ 32 public class Object { 33 34 private static native void registerNatives(); 35 static { 36 registerNatives(); 37 } 38 39 public final native Class<?> getClass(); 40 41 public native int hashCode(); 42 43 public boolean equals(Object obj) { 44 return (this == obj); 45 } 46 47 protected native Object clone() throws CloneNotSupportedException; 48 49 public String toString() { 50 return getClass().getName() + "@" + Integer.toHexString(hashCode()); 51 } 52 53 public final native void notify(); 54 55 public final native void notifyAll(); 56 57 public final native void wait(long timeout) throws InterruptedException; 58 59 public final void wait(long timeout, int nanos) throws InterruptedException { 60 if (timeout < 0) { 61 throw new IllegalArgumentException("timeout value is negative"); 62 } 63 64 if (nanos < 0 || nanos > 999999) { 65 throw new IllegalArgumentException( 66 "nanosecond timeout value out of range"); | 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.lang; 27 28 import jdk.internal.HotSpotIntrinsicCandidate; 29 30 /** 31 * Slightly modified version of java.lang.Object that replaces 32 * finalize() by finalizeObject() to avoid overriding in subclasses. 33 */ 34 public class Object { 35 36 @HotSpotIntrinsicCandidate 37 public Object() {} 38 39 private static native void registerNatives(); 40 static { 41 registerNatives(); 42 } 43 44 @HotSpotIntrinsicCandidate 45 public final native Class<?> getClass(); 46 47 @HotSpotIntrinsicCandidate 48 public native int hashCode(); 49 50 public boolean equals(Object obj) { 51 return (this == obj); 52 } 53 54 @HotSpotIntrinsicCandidate 55 protected native Object clone() throws CloneNotSupportedException; 56 57 public String toString() { 58 return getClass().getName() + "@" + Integer.toHexString(hashCode()); 59 } 60 61 public final native void notify(); 62 63 public final native void notifyAll(); 64 65 public final native void wait(long timeout) throws InterruptedException; 66 67 public final void wait(long timeout, int nanos) throws InterruptedException { 68 if (timeout < 0) { 69 throw new IllegalArgumentException("timeout value is negative"); 70 } 71 72 if (nanos < 0 || nanos > 999999) { 73 throw new IllegalArgumentException( 74 "nanosecond timeout value out of range"); |