(final Class<?> innerClass, final Object object)
| 1360 | } |
| 1361 | |
| 1362 | private Object getOuterReference(final Class<?> innerClass, final Object object) { |
| 1363 | Object outer = null; |
| 1364 | // non-static inner class may have outer class reference available in this$0 field |
| 1365 | if (!(object instanceof Class) && (innerClass.getModifiers() & Opcodes.ACC_STATIC) == 0) { |
| 1366 | try { |
| 1367 | innerClass.getDeclaredField("this$0"); |
| 1368 | outer = getAttribute(object,"this$0"); |
| 1369 | if (outer instanceof GeneratedClosure) { |
| 1370 | outer = ((Closure<?>) outer).getThisObject(); // skip closure(s) |
| 1371 | } |
| 1372 | } catch (NoSuchFieldException ignored) { |
| 1373 | // an AIC is non-static but may not have this$0 |
| 1374 | } catch (Throwable t) { |
| 1375 | throw new GroovyRuntimeException(t); |
| 1376 | } |
| 1377 | } |
| 1378 | if (outer == null) { |
| 1379 | outer = getNonClosureOuter(innerClass); |
| 1380 | } |
| 1381 | return outer; |
| 1382 | } |
| 1383 | |
| 1384 | /** |
| 1385 | * @since 6.0.0 |
no test coverage detected