22
33import java .util .TreeMap ;
44
5- import jadx .api .plugins .input .data .annotations .EncodedType ;
6- import jadx .api .plugins .input .data .annotations .EncodedValue ;
7- import jadx .api .plugins .input .data .attributes .JadxAttrType ;
85import jadx .api .plugins .pass .JadxPassInfo ;
96import jadx .api .plugins .pass .impl .OrderedJadxPassInfo ;
107import jadx .api .plugins .pass .types .JadxDecompilePass ;
@@ -65,7 +62,7 @@ private void processField(FieldNode field) {
6562 return ;
6663 }
6764 // static final field with literal value encoded in the class file (no <clinit>).
68- String constStr = readConstantStringValue (field );
65+ String constStr = FieldConstants . readStringValue (field );
6966 if (constStr != null ) {
7067 annotateField (field , constStr , false );
7168 }
@@ -125,7 +122,7 @@ private static String extractStringFromArg(FieldNode contextField, InsnArg arg)
125122 }
126123 if (argInsn != null && argInsn .getType () == InsnType .SGET ) {
127124 FieldNode refField = resolveFieldFromSget (contextField , (IndexInsnNode ) argInsn );
128- return refField != null ? readConstantStringValue (refField ) : null ;
125+ return refField != null ? FieldConstants . readStringValue (refField ) : null ;
129126 }
130127 return null ;
131128 }
@@ -171,7 +168,7 @@ private boolean annotateFromSgetReference(FieldNode consumingField, IndexInsnNod
171168 if (refField == null ) {
172169 return false ;
173170 }
174- String str = readConstantStringValue (refField );
171+ String str = FieldConstants . readStringValue (refField );
175172 if (str == null || !annotateField (consumingField , str , isBase64Call )) {
176173 return false ;
177174 }
@@ -190,15 +187,6 @@ private static FieldNode resolveFieldFromSget(FieldNode contextField, IndexInsnN
190187 return declCls != null ? declCls .searchField (refFieldInfo ) : null ;
191188 }
192189
193- private static String readConstantStringValue (FieldNode field ) {
194- EncodedValue cv = field .get (JadxAttrType .CONSTANT_VALUE );
195- if (cv == null || cv .getType () != EncodedType .ENCODED_STRING ) {
196- return null ;
197- }
198- Object val = cv .getValue ();
199- return val instanceof String ? (String ) val : null ;
200- }
201-
202190 private static InsnNode resolveArgInsn (InsnArg arg ) {
203191 if (arg instanceof InsnWrapArg ) {
204192 return ((InsnWrapArg ) arg ).getWrapInsn ();
0 commit comments