@Test public void the_class_name_in_stack_traces_gives_a_hint_of_who_generated_the_proxy_class() { PrintStream printStream = SynchronizedPrintStream.create(new NullOutputStream(), Charset.defaultCharset(), lock); assertThat(printStream.getClass().getName(), startsWith(SynchronizedPrintStream.class.getName())); }
public static PrintStream create(OutputStream out, Charset charset, Object sharedLock) { Enhancer e = new Enhancer(); e.setSuperclass(PrintStream.class); e.setCallback(new SynchronizedMethodInterceptor(sharedLock)); e.setNamingPolicy(new PrefixOverridingNamingPolicy(SynchronizedPrintStream.class.getName())); e.setUseFactory(false); return (PrintStream) e.create( new Class[]{OutputStream.class, boolean.class, String.class}, new Object[]{out, false, charset.name()} ); }
SynchronizedPrintStream { public static PrintStream create(OutputStream out, Charset charset, Object sharedLock) { Enhancer e = new Enhancer(); e.setSuperclass(PrintStream.class); e.setCallback(new SynchronizedMethodInterceptor(sharedLock)); e.setNamingPolicy(new PrefixOverridingNamingPolicy(SynchronizedPrintStream.class.getName())); e.setUseFactory(false); return (PrintStream) e.create( new Class[]{OutputStream.class, boolean.class, String.class}, new Object[]{out, false, charset.name()} ); } }
SynchronizedPrintStream { public static PrintStream create(OutputStream out, Charset charset, Object sharedLock) { Enhancer e = new Enhancer(); e.setSuperclass(PrintStream.class); e.setCallback(new SynchronizedMethodInterceptor(sharedLock)); e.setNamingPolicy(new PrefixOverridingNamingPolicy(SynchronizedPrintStream.class.getName())); e.setUseFactory(false); return (PrintStream) e.create( new Class[]{OutputStream.class, boolean.class, String.class}, new Object[]{out, false, charset.name()} ); }  }
SynchronizedPrintStream { public static PrintStream create(OutputStream out, Charset charset, Object sharedLock) { Enhancer e = new Enhancer(); e.setSuperclass(PrintStream.class); e.setCallback(new SynchronizedMethodInterceptor(sharedLock)); e.setNamingPolicy(new PrefixOverridingNamingPolicy(SynchronizedPrintStream.class.getName())); e.setUseFactory(false); return (PrintStream) e.create( new Class[]{OutputStream.class, boolean.class, String.class}, new Object[]{out, false, charset.name()} ); }  static PrintStream create(OutputStream out, Charset charset, Object sharedLock); }
SynchronizedPrintStream { public static PrintStream create(OutputStream out, Charset charset, Object sharedLock) { Enhancer e = new Enhancer(); e.setSuperclass(PrintStream.class); e.setCallback(new SynchronizedMethodInterceptor(sharedLock)); e.setNamingPolicy(new PrefixOverridingNamingPolicy(SynchronizedPrintStream.class.getName())); e.setUseFactory(false); return (PrintStream) e.create( new Class[]{OutputStream.class, boolean.class, String.class}, new Object[]{out, false, charset.name()} ); }  static PrintStream create(OutputStream out, Charset charset, Object sharedLock);  }