jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ichiro Furusato <ichiro.furus...@gmail.com>
Subject Re: WikiPlugin.execute() and generics
Date Sun, 04 Nov 2012 20:39:16 GMT
Hi Juan Pablo,

Given that the package name of all plugins is required to change from
to org.apache.wiki, anyone with existing plugins is going to have to
fix and recompile them
for compatibility anyway, so it's a good time to force generics into the API.

I'm not sure why you'd suggest

   public String execute( WikiContext context, Map<K,V> params )
         throws PluginException;

as the method signature, as I believe we'd want to constrain K to
String and V to any
Object, so I'd advocate for Map<String,Object> myself (and all of my
plugins would
conform with that simple change). Perhaps you have a reasons I don't understand.

I've taken over the CeryleWikiPlugin set and while I'm not going to
commit to upgrading
the entire set, I'm willing to release most of them, depending on my
time constraints.
Some of rather obscure, but a number are pretty handy (such as the user tagging



On Mon, Nov 5, 2012 at 8:31 AM, Juan Pablo Santos Rodríguez
<juanpablo.santos@gmail.com> wrote:
> Hi Ichiro,
> in fact, PluginManager#parseArgs builds a HashMap<String, Object> but
> returns an
> ungenerified Map, most probably because this way binary compatibility with
> older,
> ungenerified plugins is ensured. Besides, as the plugin system hasn't had
> any issues
> since a long long time, the focus had been put elsewhere.
> But yes, aside from the compatibility issue, constraining to <String,
> Object> makes
> sense to me, as most probably this is how the Map is used by everyone
> (anyone not
> doing this way please correct me).
> hmm right now I'm thinking that WikiPlugin's signature could be changed to
> something like:
> public interface WikiPlugin <K, V> {
>     public String execute( WikiContext context, Map<K,V> params ) throws
> PluginException;
> }
> so you could override the Map types on your plugins. Makes sense?
> br,
> juan pablo
> On Sat, Nov 3, 2012 at 10:23 AM, Ichiro Furusato
> <ichiro.furusato@gmail.com>wrote:
>> Hi,
>> In looking at the 2.9.0 code I note that it doesn't use generics in a
>> number of
>> rather key places, such as WikiPlugin.execute(), so I'm guessing it hasn't
>> been updated in a few years (at least in that regard), perhaps due to the
>> somewhat longstanding status of the project going into Apache, or for
>> legacy-
>> compatibility reasons.
>> Could someone please fill me in as to any particular reason why the Map
>> argument couldn't be constrained to <String,String> or <String,Object>?
>> I've
>> got quite a few plugins that are now incompatible with a generics-less
>> WikiPlugin API, i.e.,
>>         public String execute( WikiContext context, Map<String,Object>
>> params ) throws PluginException;
>> ...and rather than remove all my generics I'm wondering if it'd be possible
>> to update the API. Yes, I know that is a brash assumption.
>> Thanks much,
>> Ichiro

View raw message