@@ -28,14 +28,17 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
28
28
internal lateinit var addOverride: (name: String , value: String ) -> Unit private set
29
29
30
30
override fun execute (context : BytecodeContext ) = GetFeatureValueFingerprint .result?.let {
31
+ val configurationClass = it.method.definingClass
32
+ val featureClass = it.method.parameterTypes[0 ].toString()
33
+
31
34
// The method we want to inject into does not have enough registers, so we inject a helper method
32
35
// and inject more instructions into it later, see addOverride.
33
36
// This is not in an integration since the unused variable would get compiled away and the method would
34
37
// get compiled to only have one register, which is not enough for our later injected instructions.
35
38
val helperMethod = ImmutableMethod (
36
39
it.method.definingClass,
37
40
" getValueOverride" ,
38
- listOf (ImmutableMethodParameter (" Lcom/tumblr/configuration/Feature; " , null , " feature" )),
41
+ listOf (ImmutableMethodParameter (featureClass , null , " feature" )),
39
42
" Ljava/lang/String;" ,
40
43
AccessFlags .PUBLIC or AccessFlags .FINAL ,
41
44
null ,
@@ -50,7 +53,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
50
53
0 ,
51
54
"""
52
55
# toString() the enum value
53
- invoke-virtual {p1}, Lcom/tumblr/configuration/Feature; ->toString()Ljava/lang/String;
56
+ invoke-virtual {p1}, $featureClass ->toString()Ljava/lang/String;
54
57
move-result-object v0
55
58
56
59
# !!! If you add more instructions above this line, update helperInsertIndex below!
@@ -75,7 +78,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
75
78
getFeatureIndex,
76
79
"""
77
80
# Call the Helper Method with the Feature
78
- invoke-virtual {p0, p1}, Lcom/tumblr/configuration/Configuration; ->getValueOverride(Lcom/tumblr/configuration/Feature; )Ljava/lang/String;
81
+ invoke-virtual {p0, p1}, $configurationClass ->getValueOverride($featureClass )Ljava/lang/String;
79
82
move-result-object v0
80
83
# If it returned null, skip
81
84
if-eqz v0, :is_null
0 commit comments