< prev index next > src/java.base/share/classes/java/lang/Short.java
Print this page
*/
package java.lang;
import jdk.internal.misc.CDS;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import jdk.internal.vm.annotation.Stable;
import java.lang.constant.Constable;
import java.lang.constant.DynamicConstantDesc;
import java.util.Optional;
import static java.lang.constant.ConstantDescs.BSM_EXPLICIT_CAST;
- import static java.lang.constant.ConstantDescs.CD_int;
import static java.lang.constant.ConstantDescs.CD_short;
import static java.lang.constant.ConstantDescs.DEFAULT_NAME;
/**
* The {@code Short} class is the {@linkplain
*/
package java.lang;
import jdk.internal.misc.CDS;
+ import jdk.internal.value.DeserializeConstructor;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import jdk.internal.vm.annotation.Stable;
import java.lang.constant.Constable;
import java.lang.constant.DynamicConstantDesc;
import java.util.Optional;
import static java.lang.constant.ConstantDescs.BSM_EXPLICIT_CAST;
import static java.lang.constant.ConstantDescs.CD_short;
import static java.lang.constant.ConstantDescs.DEFAULT_NAME;
/**
* The {@code Short} class is the {@linkplain
* @author Nakul Saraiya
* @author Joseph D. Darcy
* @see java.lang.Number
* @since 1.1
*/
+ @jdk.internal.MigratedValueClass
@jdk.internal.ValueBased
public final class Short extends Number implements Comparable<Short>, Constable {
/**
* A constant holding the minimum value a {@code short} can
* @param s a short value.
* @return a {@code Short} instance representing {@code s}.
* @since 1.5
*/
@IntrinsicCandidate
+ @DeserializeConstructor
public static Short valueOf(short s) {
final int offset = 128;
int sAsInt = s;
if (sAsInt >= -128 && sAsInt <= 127) { // must cache
return ShortCache.cache[sAsInt + offset];
< prev index next >