Hi Dscho,<br><br>I implemented a fix yesterday:<br> <a href="http://dev.imagejdev.org/trac/imagej/ticket/543">http://dev.imagejdev.org/trac/imagej/ticket/543</a><br> <a href="http://dev.imagejdev.org/trac/imagej/changeset/2957">http://dev.imagejdev.org/trac/imagej/changeset/2957</a><br>
<br>It simply flags the parameter as "resolved," meaning it will not appear in the input dialog.<br><br>I also added a warning message if a final parameter is detected:<br> <a href="http://dev.imagejdev.org/trac/imagej/changeset/2958">http://dev.imagejdev.org/trac/imagej/changeset/2958</a><br>
<br>However, we could be stricter and throw an exception instead, as you suggest. What do you think?<br><br>Regards,<br>Curtis<br><br><div class="gmail_quote">On Thu, May 26, 2011 at 2:35 AM, Johannes Schindelin <span dir="ltr"><<a href="mailto:Johannes.Schindelin@gmx.de">Johannes.Schindelin@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<div><div></div><div class="h5"><br>
On Wed, 25 May 2011, Grant B. Harris wrote:<br>
<br>
> On 5/25/2011 2:53 AM, Johannes Schindelin wrote:<br>
> > Can we have some check when the class is parsed to make sure that<br>
> > @Parameter fields are not final?<br>
> ><br>
> Johannes,<br>
> Ya, I was thinking the same thing. We can add a check using<br>
> Field.getModifiers() and not add an input widget if the field is final. I've<br>
> filed a ticket for it.<br>
<br>
</div></div>Maybe this is already half the solution?<br>
<br>
-- snipsnap --<br>
diff --git a/core/plugin/src/main/java/imagej/plugin/PluginModuleInfo.java b/core/plugin/src/main/java/imagej/plugin/PluginModuleInfo.java<br>
index d520260..bd6d988 100644<br>
--- a/core/plugin/src/main/java/imagej/plugin/PluginModuleInfo.java<br>
+++ b/core/plugin/src/main/java/imagej/plugin/PluginModuleInfo.java<br>
@@ -165,6 +165,8 @@ public class PluginModuleInfo<T extends BasePlugin> implements ModuleInfo {<br>
if (param == null) continue; // not a parameter<br>
<br>
final String name = f.getName();<br>
+ if (Modifier.isFinal(f.getModifiers()))<br>
+ throw new RuntimeException("Invalid 'final' parameter: " + name);<br>
if (presets.containsKey(name)) {<br>
// assign preset value to field, and exclude from the list of inputs<br>
PluginModule.setValue(f, plugin, presets.get(name));<br>
</blockquote></div><br>