JDK-8286190 : Add test to verify constant folding for Enum fields
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18,19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-05-05
  • Updated: 2022-05-06
  • Resolved: 2022-05-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 masterFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
There is the JDK-8161245 to make compilers trust Enum final fields. It was implicitly implemented by JDK-8234049, which added the wildcard trust for everything in java/lang:
  https://github.com/openjdk/jdk/blob/c5a0687f80367a3a284dfd56781c371826264d3b/src/hotspot/share/ci/ciField.cpp#L230

It would be better to have the explicit test that verifies the constant folding of Enum fields indeed happens.
Comments
Changeset: 080f3c5d Author: Aleksey Shipilev <shade@openjdk.org> Date: 2022-05-06 16:32:02 +0000 URL: https://git.openjdk.java.net/jdk/commit/080f3c5d8a2f7b2d13baf98c594d4ace67608fc4
06-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8551 Date: 2022-05-05 13:35:37 +0000
05-05-2022