0 Replies Latest reply on Jun 8, 2012 8:30 AM by susanin

    How can I instrument access only to a specific array




      I have a class which has one field of an array type, e.g.

      class Pojo {

           int[] ids = new int[100];




      I'd like to replace only accesses to this specific array by means of Javassist.


      From what I see so far in the replaceArrayAccess API, one can only replace access to all arrays of a certain type, e.g. to all int arrays. Does it mean that there is no way to instrument only access to a sepecific array? Is there some sort of a technical limitation related to this?


      What can be workarounds or approaches to instrument only something specific? Or may be instrument all accesses but determine at runtime if this is something specific being accessed (how this can be done effectively?) and reacting differently only in this case?