Problem registering two times block extension AsciidoctorJ
Posted by
asotobu on
Oct 28, 2013; 10:13pm
URL: https://discuss.asciidoctor.org/Problem-registering-two-times-block-extension-AsciidoctorJ-tp898.html
Hi Dan,
do you remember the problem we had with Block extensions and config method which should be static?
http://discuss.asciidoctor.org/Extension-API-in-Java-almost-done-but-I-need-some-help-td637.htmlThe solution was to create an static Map inside Block processor. And it works fine, until I tried to register two block processors. Because the map of block processor is static, the second extension also receives the parameters of first extension, which makes application crashes. This happens because when Map is converted to RubyHash it is reassigned to that static variable, and the second time a class cast exception is thrown because we expect a native Map but we found a JRuby Hash.
So do you think that removing in the static block the content of config var for each processor is safe? (I think it works correctly but it is a bit ugly solution making developers to remove something at start) Maybe we must think another way to integrate better block extensions with AsciidoctorJ? Changing Ruby part?
WDYT? Do you want I try something?