| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public Class<?> getType(ELContext context, Object base, Object property) { |
| 141 | Objects.requireNonNull(context); |
| 142 | |
| 143 | if (base instanceof ELClass && property instanceof String name) { |
| 144 | context.setPropertyResolved(base, property); |
| 145 | |
| 146 | Class<?> clazz = ((ELClass) base).getKlass(); |
| 147 | Exception exception = null; |
| 148 | try { |
| 149 | Field field = clazz.getField(name); |
| 150 | int modifiers = field.getModifiers(); |
| 151 | if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Util.canAccess(null, field)) { |
| 152 | // Resolver is read-only so returns null for resolved fields |
| 153 | return null; |
| 154 | } |
| 155 | } catch (IllegalArgumentException | NoSuchFieldException | SecurityException e) { |
| 156 | exception = e; |
| 157 | } |
| 158 | String msg = Util.message(context, "staticFieldELResolver.notFound", name, clazz.getName()); |
| 159 | if (exception == null) { |
| 160 | throw new PropertyNotFoundException(msg); |
| 161 | } else { |
| 162 | throw new PropertyNotFoundException(msg, exception); |
| 163 | } |
| 164 | } |
| 165 | return null; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | @Override |