public class Object { private static native void registerNatives(); static { registerNatives(); } @HotSpotIntrinsicCandidate public Object() {} @HotSpotIntrinsicCandidate public final native Class<?> getClass(); @HotSpotIntrinsicCandidate public native int hashCode(); public boolean equals(Object obj) { return (this == obj); } @HotSpotIntrinsicCandidate protected native Object clone() throws CloneNotSupportedException; public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } @HotSpotIntrinsicCandidate public final native void notify(); @HotSpotIntrinsicCandidate public final native void notifyAll(); public final void wait() throws InterruptedException { wait(0L); } public final native void wait(long timeoutMillis) throws InterruptedException; public final void wait(long timeoutMillis, int nanos) throws InterruptedException { if (timeoutMillis < 0) { throw new IllegalArgumentException("timeoutMillis value is negative"); } if (nanos < 0 || nanos > 999999) { throw new IllegalArgumentException( "nanosecond timeout value out of range"); } if (nanos > 0) { timeoutMillis++; } wait(timeoutMillis); } @Deprecated(since="9") protected void finalize() throws Throwable { } }
JDK 9 出现的注解@HotSpotIntrinsicCandidate,表示该方法在HotSpot中有一套高效的实现,运行时可能会替换JDK的源码实现。