@Test public void testLeakedManagedReferenceUnknownStack() { final StackTraceElement[] unknown = new StackTraceElement[0]; caller.referenceLeaked(reference, unknown); assertEquals(1, internalErrors.get()); assertEquals("reference foo leaked at: <unknown>", errorMessage); }
@Override public void referenceLeaked(final Object reference, final StackTraceElement[] stack) { final String s = stack.length > 0 ? "\n" + formatStack(Arrays.stream(stack), " ") : " <unknown>"; internalError(String.format("reference %s leaked at:%s", reference, s), null); }
DirectCaller implements Caller { @Override public void referenceLeaked(final Object reference, final StackTraceElement[] stack) { final String s = stack.length > 0 ? "\n" + formatStack(Arrays.stream(stack), " ") : " <unknown>"; internalError(String.format("reference %s leaked at:%s", reference, s), null); } }
DirectCaller implements Caller { @Override public void referenceLeaked(final Object reference, final StackTraceElement[] stack) { final String s = stack.length > 0 ? "\n" + formatStack(Arrays.stream(stack), " ") : " <unknown>"; internalError(String.format("reference %s leaked at:%s", reference, s), null); }  }
DirectCaller implements Caller { @Override public void referenceLeaked(final Object reference, final StackTraceElement[] stack) { final String s = stack.length > 0 ? "\n" + formatStack(Arrays.stream(stack), " ") : " <unknown>"; internalError(String.format("reference %s leaked at:%s", reference, s), null); }  @Override void execute(final Runnable runnable); @Override void referenceLeaked(final Object reference, final StackTraceElement[] stack); }
DirectCaller implements Caller { @Override public void referenceLeaked(final Object reference, final StackTraceElement[] stack) { final String s = stack.length > 0 ? "\n" + formatStack(Arrays.stream(stack), " ") : " <unknown>"; internalError(String.format("reference %s leaked at:%s", reference, s), null); }  @Override void execute(final Runnable runnable); @Override void referenceLeaked(final Object reference, final StackTraceElement[] stack);  }