Returns the initial expression for given field. @return value expression or null @since 5.0.0
(final Field field)
| 402 | * @since 5.0.0 |
| 403 | */ |
| 404 | protected Expression getValue(final Field field) { |
| 405 | int modifiers = field.getModifiers(); |
| 406 | // TODO: read ConstantValue from field attributes |
| 407 | if (Modifier.isFinal(modifiers) && Modifier.isStatic(modifiers) |
| 408 | && (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) |
| 409 | && (field.getType().isPrimitive() || field.getType().equals(String.class))) { |
| 410 | try { |
| 411 | return new ConstantExpression(field.get(null), true); |
| 412 | } catch (ReflectiveOperationException | LinkageError e) { |
| 413 | } |
| 414 | } |
| 415 | return null; |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Synthetic parameters such as those added for inner class constructors may |
no test coverage detected