()
| 241 | } |
| 242 | |
| 243 | public <T> Prop<T> type() { |
| 244 | |
| 245 | Prop on = this; |
| 246 | if (!isCanon()) { |
| 247 | Prop<T> already = (Prop<T>) findCanon(); |
| 248 | if (already == null) { |
| 249 | toCanon(); |
| 250 | on.setCanon(); |
| 251 | } else { |
| 252 | on = already; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | Class c = _getCallerClass(2); |
| 257 | |
| 258 | on.definedInClass = c; |
| 259 | |
| 260 | Field f = null; |
| 261 | try { |
| 262 | f = c.getField(name); |
| 263 | } catch (NoSuchFieldException e) { |
| 264 | |
| 265 | try { |
| 266 | f = c.getField("_" + name); |
| 267 | } catch (NoSuchFieldException e3) { |
| 268 | if (name.startsWith("_")) try { |
| 269 | f = c.getField(name.substring(1)); |
| 270 | } catch (NoSuchFieldException e1) { |
| 271 | if (name.startsWith("__")) try { |
| 272 | f = c.getField(name.substring(1)); |
| 273 | } catch (NoSuchFieldException e2) { |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | } |
| 278 | |
| 279 | |
| 280 | } |
| 281 | if (f == null) { |
| 282 | throw new IllegalStateException(" cannot type a Dict.Prop<T> that we can't find. Name is :" + name + " class is :" + c); |
| 283 | } |
| 284 | |
| 285 | on.typeInformation = Conversions.linearize(f.getGenericType()); |
| 286 | |
| 287 | on.typeInformation.remove(0); |
| 288 | |
| 289 | |
| 290 | return (Prop<T>) on; |
| 291 | } |
| 292 | |
| 293 | private Class _getCallerClass(int i) { |
| 294 | return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk(x -> { |
no test coverage detected