|
41 | 41 | import com.oracle.svm.core.option.SubstrateOptionsParser; |
42 | 42 | import com.oracle.svm.core.util.UserError; |
43 | 43 | import com.oracle.svm.core.util.VMError; |
| 44 | +import com.oracle.svm.util.LogUtils; |
44 | 45 | import com.oracle.svm.util.StringUtil; |
45 | 46 |
|
46 | 47 | import jdk.graal.compiler.options.Option; |
@@ -79,8 +80,10 @@ public class FutureDefaultsOptions { |
79 | 80 |
|
80 | 81 | private static final String RUN_TIME_INITIALIZE_SECURITY_PROVIDERS = "run-time-initialize-security-providers"; |
81 | 82 | private static final String RUN_TIME_INITIALIZE_FILE_SYSTEM_PROVIDERS = "run-time-initialize-file-system-providers"; |
| 83 | + private static final List<String> ALL_FUTURE_DEFAULTS = List.of(RUN_TIME_INITIALIZE_FILE_SYSTEM_PROVIDERS, RUN_TIME_INITIALIZE_SECURITY_PROVIDERS); |
| 84 | + |
82 | 85 | private static final String COMPLETE_REFLECTION_TYPES = "complete-reflection-types"; |
83 | | - private static final List<String> ALL_FUTURE_DEFAULTS = List.of(RUN_TIME_INITIALIZE_FILE_SYSTEM_PROVIDERS, RUN_TIME_INITIALIZE_SECURITY_PROVIDERS, COMPLETE_REFLECTION_TYPES); |
| 86 | + private static final List<String> RETIRED_FUTURE_DEFAULTS = List.of(COMPLETE_REFLECTION_TYPES); |
84 | 87 |
|
85 | 88 | public static final String RUN_TIME_INITIALIZE_FILE_SYSTEM_PROVIDERS_REASON = "Initialize JDK classes at run time (--" + OPTION_NAME + " includes " + RUN_TIME_INITIALIZE_FILE_SYSTEM_PROVIDERS + |
86 | 89 | ")"; |
@@ -140,6 +143,15 @@ public static void parseAndVerifyOptions() { |
140 | 143 | getOptionHelpText()); |
141 | 144 | } |
142 | 145 |
|
| 146 | + if (RETIRED_FUTURE_DEFAULTS.contains(value)) { |
| 147 | + LogUtils.warning("The '%s' option from %s contains the value '%s' which is enabled by default in this GraalVM release (%s) and can be removed.", |
| 148 | + SubstrateOptionsParser.commandArgument(FutureDefaults, value), |
| 149 | + valueWithOrigin.origin(), |
| 150 | + value, |
| 151 | + VM.getVersion()); |
| 152 | + return; |
| 153 | + } |
| 154 | + |
143 | 155 | if (!getAllValues().contains(value)) { |
144 | 156 | throw UserError.abort("The '%s' option from %s contains invalid value '%s'. It can only contain: %s.%n%nUsage:%n%n%s", |
145 | 157 | SubstrateOptionsParser.commandArgument(FutureDefaults, value), |
@@ -169,26 +181,31 @@ public static void parseAndVerifyOptions() { |
169 | 181 |
|
170 | 182 | /* Set build-time properties for user features */ |
171 | 183 | for (String futureDefault : getFutureDefaults()) { |
172 | | - System.setProperty(FutureDefaultsOptions.SYSTEM_PROPERTY_PREFIX + futureDefault, Boolean.TRUE.toString()); |
| 184 | + setSystemProperty(futureDefault, true); |
173 | 185 | } |
| 186 | + |
| 187 | + for (String retiredFutureDefault : RETIRED_FUTURE_DEFAULTS) { |
| 188 | + setSystemProperty(retiredFutureDefault, true); |
| 189 | + } |
| 190 | + } |
| 191 | + |
| 192 | + private static void setSystemProperty(String futureDefault, boolean value) { |
| 193 | + System.setProperty(FutureDefaultsOptions.SYSTEM_PROPERTY_PREFIX + futureDefault, Boolean.toString(value)); |
174 | 194 | } |
175 | 195 |
|
176 | 196 | public static Set<String> getFutureDefaults() { |
177 | 197 | return Collections.unmodifiableSet(Objects.requireNonNull(futureDefaults, "must be initialized before usage")); |
178 | 198 | } |
179 | 199 |
|
180 | | - /** |
181 | | - * @see FutureDefaultsOptions#FutureDefaults |
182 | | - */ |
183 | | - public static boolean allFutureDefaults() { |
184 | | - return getFutureDefaults().containsAll(ALL_FUTURE_DEFAULTS); |
| 200 | + public static List<String> getRetiredFutureDefaults() { |
| 201 | + return RETIRED_FUTURE_DEFAULTS; |
185 | 202 | } |
186 | 203 |
|
187 | 204 | /** |
188 | 205 | * @see FutureDefaultsOptions#FutureDefaults |
189 | 206 | */ |
190 | | - public static boolean completeReflectionTypes() { |
191 | | - return getFutureDefaults().contains(COMPLETE_REFLECTION_TYPES); |
| 207 | + public static boolean allFutureDefaults() { |
| 208 | + return getFutureDefaults().containsAll(ALL_FUTURE_DEFAULTS); |
192 | 209 | } |
193 | 210 |
|
194 | 211 | /** |
|
0 commit comments