package ex;

import java.lang.reflect.Field;

public class RFI_Sample {

    public void accessSingleField() throws Exception {

        String s = "Hello";

        Field f = String.class.getDeclaredField("value");
        f.setAccessible(true);

        byte[] data = (byte[]) f.get(s);
        data[1] = 'a';

        System.out.println(s);
    }
}

@@ -6,16 +6,59 @@
 ge ex;%0A%0A
+import java.lang.reflect.AccessibleObject;%0A
 import j
@@ -349,16 +349,412 @@
 = 'a';%0A%0A
+        System.out.println(s);%0A    %7D%0A%0A    public void accessMultipleFields() throws Exception %7B%0A        String s = %22Hello%22;%0A%0A        Field f = String.class.getDeclaredField(%22value%22);%0A        Field g = String.class.getDeclaredField(%22hash%22);%0A        AccessibleObject.setAccessible(new Field%5B%5D %7B f, g %7D, true);%0A%0A        byte%5B%5D data = (byte%5B%5D) f.get(s);%0A        data%5B1%5D = 'a';%0A%0A        g.set(s, 0);%0A%0A
         

add test for array form of setAccessible