mirror of
https://github.com/github/codeql.git
synced 2026-01-08 12:10:22 +01:00
13 lines
325 B
Java
13 lines
325 B
Java
Object getField(Object obj, String name) throws NoSuchFieldError {
|
|
Class clazz = obj.getClass();
|
|
while (clazz != null) {
|
|
for (Field f : clazz.getDeclaredFields()) {
|
|
if (f.getName().equals(name)) {
|
|
f.setAccessible(true);
|
|
return f.get(obj);
|
|
}
|
|
}
|
|
}
|
|
throw new NoSuchFieldError(name);
|
|
}
|