[FIXED] What does the parameter [CII[CIII in indexOf() method signify? I am using the the following non-SDK interfaces Ljava/lang/String;->indexOf([CII[CIII)I

Issue

I have a Android project which is using indexOf().
Then while surfing through Android developers forum, I came across the restricted API that is blocked in API level 28.

So can anyone help me out in briefing what is the full meaning of this
API "Ljava/lang/String;->indexOf([CII[CIII)I" being blocked and what actually is the
parameter "indexOf([CII[CIII)I"

Ref link: https://developer.android.com/about/versions/12/non-sdk-12#list-changes

Thanks

Solution

The string:

Ljava/lang/String;->indexOf([CII[CIII)I

appears to be composed of the JVM’s internal ("binary") type name and a method signature.

  1. Ljava/lang/String; is the internal name of the type java.lang.String

  2. indexOf([CII[CIII)I denotes a method with this signature:

    int indexOf(char[], int, int, char[], int, int, int)
    
  3. The -> in this context means the classes method.

So in context, Ljava/lang/String;->indexOf([CII[CIII)I is saying that the String.indexOf method with that particular signature is blocked.

(This is most likely referring to an internal overload of the String.indexOf methods that ordinary application code should never be using in the first place. You won’t see it in the javadocs, but if you will most likely find it if you look at the Android source code … for some versions of Android.)

For more information on the "binary" representation of type names and method signatures, see the JVM Specification sections §4.3.3 and §4.3.4

Answered By – Stephen C

Answer Checked By – Dawn Plyler (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published