MCPcopy Index your code
hub / github.com/beanshell/beanshell / resolveExpectedJavaField

Method resolveExpectedJavaField

src/bsh/Reflect.java:305–325  ·  view source on GitHub ↗
(Class clas, String fieldName, boolean staticOnly)

Source from the content-addressed store, hash-verified

303 to change related signatures and code.
304 */
305 protected static Field resolveExpectedJavaField(Class clas, String fieldName, boolean staticOnly) throws UtilEvalError, ReflectError {
306 Field field;
307 try {
308 if (Capabilities.haveAccessibility()) {
309 field = findAccessibleField(clas, fieldName);
310 } else {
311 // Class getField() finds only public fields
312 field = clas.getField(fieldName);
313 }
314 } catch (NoSuchFieldException e) {
315 throw new ReflectError("No such field: " + fieldName, e);
316 } catch (SecurityException e) {
317 throw new UtilTargetError("Security Exception while searching fields of: " + clas, e);
318 }
319
320 if (staticOnly && !Modifier.isStatic(field.getModifiers())) {
321 throw new UtilEvalError("Can't reach instance field: " + fieldName + " from static context: " + clas.getName());
322 }
323
324 return field;
325 }
326
327
328 /**

Callers 4

getLHSStaticFieldMethod · 0.95
getLHSObjectFieldMethod · 0.95
getFieldValueMethod · 0.95
resolveJavaFieldMethod · 0.95

Calls 5

haveAccessibilityMethod · 0.95
findAccessibleFieldMethod · 0.95
isStaticMethod · 0.45
getModifiersMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected