Changeset 14092 in josm for trunk/test/unit/org/openstreetmap/josm/TestUtils.java
- Timestamp:
- 2018-08-05T20:53:19+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r14081 r14092 179 179 */ 180 180 public static Object getPrivateField(Object obj, String fieldName) throws ReflectiveOperationException { 181 Field f = obj.getClass().getDeclaredField(fieldName); 181 return getPrivateField(obj.getClass(), obj, fieldName); 182 } 183 184 /** 185 * Returns a private field value. 186 * @param cls object class 187 * @param obj object 188 * @param fieldName private field name 189 * @return private field value 190 * @throws ReflectiveOperationException if a reflection operation error occurs 191 */ 192 public static Object getPrivateField(Class<?> cls, Object obj, String fieldName) throws ReflectiveOperationException { 193 Field f = cls.getDeclaredField(fieldName); 182 194 AccessController.doPrivileged((PrivilegedAction<Void>) () -> { 183 195 f.setAccessible(true);
Note:
See TracChangeset
for help on using the changeset viewer.