Skip to content

Commit 9fc2417

Browse files
samebGuice Team
authored and
Guice Team
committed
Remove the word "experimental" from the MethodHandles flag.
PiperOrigin-RevId: 752352166
1 parent b82cc7b commit 9fc2417

12 files changed

+27
-27
lines changed

core/src/com/google/inject/internal/DefaultConstructionProxyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public ConstructionProxy<T> create() {
5454
@SuppressWarnings("unchecked") // the injection point is for a constructor of T
5555
final Constructor<T> constructor = (Constructor<T>) injectionPoint.getMember();
5656

57-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
57+
if (InternalFlags.getUseMethodHandlesOption()) {
5858
MethodHandle target = InternalMethodHandles.unreflectConstructor(constructor);
5959
// If construction fails fall through to the fastclass approach which can
6060
// access more constructors. See comments in ProviderMethod on how to change

core/src/com/google/inject/internal/InjectionRequestProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void injectMembers() {
145145
// Run injections if we're not in tool stage (ie, PRODUCTION or DEV),
146146
// or if we are in tool stage and the injection point is toolable.
147147
if (!isStageTool || memberInjector.getInjectionPoint().isToolable()) {
148-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
148+
if (InternalFlags.getUseMethodHandlesOption()) {
149149
try {
150150
// In theory, constructing the handle to invoke it exactly once is expensive and
151151
// wasteful, and it is true for

core/src/com/google/inject/internal/InternalFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private MethodHandleResult(MethodHandle methodHandle, Cachability cachability) {
127127
*/
128128
static <T> Provider<T> makeDefaultProvider(
129129
InternalFactory<T> factory, InjectorImpl injector, Dependency<?> dependency) {
130-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
130+
if (InternalFlags.getUseMethodHandlesOption()) {
131131
return InternalMethodHandles.makeProvider(factory, injector, dependency);
132132
}
133133
return new DefaultProvider<>(factory, injector, dependency);

core/src/com/google/inject/internal/InternalFlags.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public final class InternalFlags {
4444
private static final ColorizeOption COLORIZE_OPTION =
4545
getSystemOption("guice_colorize_error_messages", ColorizeOption.OFF);
4646

47-
private static final UseMethodHandlesOption USE_EXPERIMENTAL_METHOD_HANDLES =
48-
getSystemOption("guice_use_experimental_method_handles", UseMethodHandlesOption.NO);
47+
private static final UseMethodHandlesOption USE_METHOD_HANDLES =
48+
getSystemOption("guice_use_method_handles", UseMethodHandlesOption.NO);
4949

5050
/** The options for using `MethodHandles`. */
5151
public enum UseMethodHandlesOption {
@@ -170,8 +170,8 @@ public static boolean enableColorizeErrorMessages() {
170170
return COLORIZE_OPTION.enabled();
171171
}
172172

173-
public static boolean getUseExperimentalMethodHandlesOption() {
174-
return USE_EXPERIMENTAL_METHOD_HANDLES
173+
public static boolean getUseMethodHandlesOption() {
174+
return USE_METHOD_HANDLES
175175
== UseMethodHandlesOption.YES
176176
&& isBytecodeGenEnabled();
177177
}

core/src/com/google/inject/internal/MembersInjectorImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static <T> MembersInjectorImpl<T> create(
5353
(InternalFlags.isBytecodeGenEnabled() && !encounter.getAspects().isEmpty())
5454
? encounter.getAspects()
5555
: null;
56-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
56+
if (InternalFlags.getUseMethodHandlesOption()) {
5757
return new MethodHandleMembersInjectorImpl<>(
5858
injector,
5959
typeLiteral,

core/src/com/google/inject/internal/ProviderMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static <T> ProviderMethod<T> create(
7171
boolean skipFastClassGeneration,
7272
Annotation annotation) {
7373
int modifiers = method.getModifiers();
74-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
74+
if (InternalFlags.getUseMethodHandlesOption()) {
7575
// `unreflect` fails if the method is not public and there is either a security manager
7676
// blocking access (very rare) or application has set up modules that are not open.
7777
// In that case we fall back to fast class generation.

core/src/com/google/inject/internal/ProviderToInternalFactoryAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ProviderToInternalFactoryAdapter<T> implements Provider<T> {
4040

4141
static <T> ProviderToInternalFactoryAdapter<T> create(
4242
InjectorImpl injector, InternalFactory<? extends T> internalFactory) {
43-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
43+
if (InternalFlags.getUseMethodHandlesOption()) {
4444
return InternalMethodHandles.makeScopedProvider(internalFactory, injector);
4545
}
4646

core/src/com/google/inject/internal/SingleMethodInjector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Object invoke(Object target, Object... parameters)
5555
}
5656

5757
private MethodInvoker createMethodInvoker(final Method method) {
58-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
58+
if (InternalFlags.getUseMethodHandlesOption()) {
5959
MethodHandle methodHandle = InternalMethodHandles.unreflect(method);
6060
if (methodHandle != null) {
6161
methodHandle = InternalMethodHandles.dropReturn(methodHandle);
@@ -119,7 +119,7 @@ public MethodHandle getInjectHandle(
119119
if (fastMethod != null) {
120120
// (Object receiver, Object[]) -> void
121121
MethodHandle fastMethodHandle;
122-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
122+
if (InternalFlags.getUseMethodHandlesOption()) {
123123
var handle =
124124
BIFUNCTION_APPLY_HANDLE
125125
.bindTo(fastMethod)

core/test/com/google/inject/BUILD

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ guice_test_suites(
135135
)
136136

137137
[guice_test_suites(
138-
name = "gen_tests_stack_trace_%s_use_experimental_method_handles_%s" % (include_stack_trace_option, use_experimental_method_handles_option),
138+
name = "gen_tests_stack_trace_%s_use_method_handles_%s" % (include_stack_trace_option, use_method_handles_option),
139139
args = [
140140
"--guice_include_stack_traces=%s" % include_stack_trace_option,
141-
"--guice_use_experimental_method_handles=%s" % use_experimental_method_handles_option,
141+
"--guice_use_method_handles=%s" % use_method_handles_option,
142142
],
143143
jvm_flags = [
144144
# those 2 options are required for some tests that checks stack traces
@@ -149,24 +149,24 @@ guice_test_suites(
149149
"small",
150150
"medium",
151151
],
152-
suffix = "_stack_trace_%s_use_experimental_method_handles_%s" % (include_stack_trace_option, use_experimental_method_handles_option),
152+
suffix = "_stack_trace_%s_use_method_handles_%s" % (include_stack_trace_option, use_method_handles_option),
153153
deps = [
154154
":add_opens_tests",
155155
":tests",
156156
"//core/src/com/google/inject", # bazel requires this b/c of package_info.java
157157
],
158158
) for include_stack_trace_option in [
159159
"OFF",
160-
] for use_experimental_method_handles_option in [
160+
] for use_method_handles_option in [
161161
"NO",
162162
"YES",
163163
]]
164164

165165
[guice_test_suites(
166-
name = "gen_tests_class_loading_%s_method_handles_%s" % (custom_class_loading_option, use_experimental_method_handles_option),
166+
name = "gen_tests_class_loading_%s_method_handles_%s" % (custom_class_loading_option, use_method_handles_option),
167167
args = [
168168
"--guice_custom_class_loading=%s" % custom_class_loading_option,
169-
"--guice_use_experimental_method_handles=%s" % use_experimental_method_handles_option,
169+
"--guice_use_method_handles=%s" % use_method_handles_option,
170170
],
171171
jvm_flags = [
172172
# those 2 options are required for some tests that checks stack traces
@@ -177,7 +177,7 @@ guice_test_suites(
177177
"small",
178178
"medium",
179179
],
180-
suffix = "_custom_class_loading_%s_method_handles_%s" % (custom_class_loading_option, use_experimental_method_handles_option),
180+
suffix = "_custom_class_loading_%s_method_handles_%s" % (custom_class_loading_option, use_method_handles_option),
181181
deps = [
182182
":add_opens_tests",
183183
":tests",
@@ -187,7 +187,7 @@ guice_test_suites(
187187
"OFF",
188188
"ANONYMOUS",
189189
"CHILD",
190-
] for use_experimental_method_handles_option in [
190+
] for use_method_handles_option in [
191191
"NO",
192192
"YES",
193193
]]

core/test/com/google/inject/errors/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@ filegroup(
4646
)
4747

4848
[guice_test_suites(
49-
name = "gen_tests_stack_trace%s_use_experimental_method_handles_%s" % (include_stack_trace_option, use_experimental_method_handles_option),
49+
name = "gen_tests_stack_trace%s_use_method_handles_%s" % (include_stack_trace_option, use_method_handles_option),
5050
args = [
5151
"--guice_include_stack_traces=%s" % include_stack_trace_option,
52-
"--guice_use_experimental_method_handles=%s" % use_experimental_method_handles_option,
52+
"--guice_use_method_handles=%s" % use_method_handles_option,
5353
],
5454
sizes = [
5555
"small",
5656
],
57-
suffix = "_stack_trace_%s_use_experimental_method_handles_%s" % (include_stack_trace_option, use_experimental_method_handles_option),
57+
suffix = "_stack_trace_%s_use_method_handles_%s" % (include_stack_trace_option, use_method_handles_option),
5858
deps = [":tests"],
5959
) for include_stack_trace_option in [
6060
"OFF",
6161
"ONLY_FOR_DECLARING_SOURCE",
62-
] for use_experimental_method_handles_option in [
62+
] for use_method_handles_option in [
6363
"NO",
6464
"YES",
6565
]]

core/test/com/google/inject/spi/ProviderMethodsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ Float quux() {
635635

636636
@Test
637637
public void testShareFastClass() {
638-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
638+
if (InternalFlags.getUseMethodHandlesOption()) {
639639
// This test is not relevant for method handles.
640640
return;
641641
}
@@ -673,7 +673,7 @@ Long bar() {
673673

674674
@Test
675675
public void testShareFastClassWithSuperClass() {
676-
if (InternalFlags.getUseExperimentalMethodHandlesOption()) {
676+
if (InternalFlags.getUseMethodHandlesOption()) {
677677
return;
678678
}
679679
// FastClass is only used when bytecode generation is enabled and this test relies on package

core/test/com/googlecode/guice/BytecodeGenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public void testFastClassWithDifferentVersionsOfGuice() throws Throwable {
366366
// Test relies on package access which CHILD loading doesn't have and the methodhandle path
367367
// doesn't use fastclasses
368368
if (InternalFlags.getCustomClassLoadingOption() == CustomClassLoadingOption.CHILD
369-
|| InternalFlags.getUseExperimentalMethodHandlesOption()) {
369+
|| InternalFlags.getUseMethodHandlesOption()) {
370370
return;
371371
}
372372
Injector injector = Guice.createInjector();

0 commit comments

Comments
 (0)