< prev index next > test/hotspot/jtreg/runtime/cds/appcds/cacheObject/CheckIntegerCacheApp.java
Print this page
/*
! * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
//
// Help test archived box cache consistency.
//
// args[0]: the expected maximum value expected to be archived
//
+
+ import jdk.internal.misc.PreviewFeatures;
+
public class CheckIntegerCacheApp {
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new RuntimeException(
"FAILED. Incorrect argument length: " + args.length);
if (Integer.valueOf(high) != Integer.valueOf(high)) {
throw new RuntimeException(
"FAILED. Value expected to be retrieved from cache: " + high);
}
! if (Integer.valueOf(high + 1) == Integer.valueOf(high + 1)) {
! throw new RuntimeException(
! "FAILED. Value not expected to be retrieved from cache: " + high);
}
}
}
if (Integer.valueOf(high) != Integer.valueOf(high)) {
throw new RuntimeException(
"FAILED. Value expected to be retrieved from cache: " + high);
}
! // In preview mode the Integer is a value class and the Integer cache is disabled
! if (!PreviewFeatures.isEnabled()) {
! if (Integer.valueOf(high + 1) == Integer.valueOf(high + 1)) {
+ throw new RuntimeException(
+ "FAILED. Value not expected to be retrieved from cache: " + high);
+ }
+ } else {
+ if (Integer.valueOf(high + 1) != Integer.valueOf(high + 1)) {
+ throw new RuntimeException(
+ "FAILED. Values must be equal in preview mode: " + high);
+ }
}
}
}
< prev index next >