Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
[headius @ cnutter:~/projects/jruby-rack] ◆ cat Foo.java public interface Foo { public Runnable getRunnable(); } [headius @ cnutter:~/projects/jruby-rack] ◆ cat FooEater.java public class FooEater { private Foo foo; public FooEater(Foo foo) { this.foo = foo; } public Runnable getRunnable() { return foo.getRunnable(); } } [headius @ cnutter:~/projects/jruby-rack] ◆ jruby -rjava -e "o = Object.new; def o.getRunnable; o = Object.new; def o.run; puts 'here'; end; end; t = java.lang.Thread.new(Java::FooEater.new(o).getRunnable); t.start; t.join" java/lang/Thread.java:349:in `init': java.lang.NullPointerException: null (NativeException) from java/lang/Thread.java:429:in `<init>' from sun/reflect/NativeConstructorAccessorImpl.java:-2:in `newInstance0' from sun/reflect/NativeConstructorAccessorImpl.java:39:in `newInstance' from sun/reflect/DelegatingConstructorAccessorImpl.java:27:in `newInstance' from java/lang/reflect/Constructor.java:513:in `newInstance' from org/jruby/javasupport/JavaConstructor.java:226:in `new_instance' from org/jruby/java/invokers/ConstructorInvoker.java:100:in `call' from org/jruby/java/invokers/ConstructorInvoker.java:180:in `call' ... 16 levels... from org/jruby/Main.java:214:in `run' from org/jruby/Main.java:100:in `run' from org/jruby/Main.java:84:in `main' Complete Java stackTrace java.lang.NullPointerException at java.lang.Thread.init(Thread.java:349) at java.lang.Thread.<init>(Thread.java:429) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.jruby.javasupport.JavaConstructor.new_instance(JavaConstructor.java:226) at org.jruby.java.invokers.ConstructorInvoker.call(ConstructorInvoker.java:100) at org.jruby.java.invokers.ConstructorInvoker.call(ConstructorInvoker.java:180) at org.jruby.RubyClass.finvoke(RubyClass.java:372) at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:288) at org.jruby.java.proxies.ConcreteJavaProxy$2.call(ConcreteJavaProxy.java:48) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:290) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:126) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:555) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:152) at org.jruby.java.proxies.ConcreteJavaProxy$ConcreteNewMethod.call(ConcreteJavaProxy.java:170) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:280) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:116) at ruby.__dash_e__.__file__(-e:1) at ruby.__dash_e__.__file__(-e) at ruby.__dash_e__.load(-e) at org.jruby.Ruby.runScript(Ruby.java:564) at org.jruby.Ruby.runNormally(Ruby.java:467) at org.jruby.Ruby.runFromMain(Ruby.java:340) at org.jruby.Main.run(Main.java:214) at org.jruby.Main.run(Main.java:100) at org.jruby.Main.main(Main.java:84)
This paste will be private.
From the Design Piracy series on my blog: