MCPcopy Create free account
hub / github.com/antlr/codebuff / tryGetField

Method tryGetField

output/java8/1.4.16/ObjectModelAdaptor.java:142–159  ·  view source on GitHub ↗
(Class<?> clazz, String fieldName)

Source from the content-addressed store, hash-verified

140 }
141
142 protected static Field tryGetField(Class<?> clazz, String fieldName) {
143 try {
144 Field field = clazz.getField(fieldName);
145 if ( field!=null ) {
146 field.setAccessible(true);
147 }
148 return field;
149 }
150 catch (NoSuchFieldException ex) {
151
152
153 }
154 catch (SecurityException ex) {
155
156
157 }
158 return null;
159 }
160
161 protected Object throwNoSuchProperty(Class<?> clazz, String propertyName, Exception cause) {
162 throw new STNoSuchPropertyException(cause, null, clazz.getName()+"."+propertyName);

Callers 1

findMemberMethod · 0.95

Calls 2

getFieldMethod · 0.45
setAccessibleMethod · 0.45

Tested by

no test coverage detected