Menu

#62 ask statement has problems with lists

current_CVS_Version
open
backend (29)
8
2003-09-09
2003-09-09
No

The following script should run:
script moveMethod {
ask("Choose a class", classes, c);
if(c != null )
console("You choose class " +c.fullName);

}

However, it does not. Here is what i get:

de.fzi.injectj.model.exception.MNUException:
Scriptline: 3, Scriptcolumn: 9, Scriptvalue:
'ask("Choose a class",classes,c);'
Scriptline: 3, Scriptcolumn: 9, Scriptvalue:
'ask("Choose a class",classes,c);'
Global function ask(StringType,ListType,NullType)
unknown (illegal parameters)
at
de.fzi.injectj.model.GlobalFunctions.execute(GlobalFunctions.java:281)
at
de.fzi.injectj.model.engine.Environment.invokeGlobalFunction(Environment.java:402)
at
de.fzi.injectj.model.engine.ExpressionResolver.resolveVariableExpression(ExpressionResolver.java:127)
at
de.fzi.injectj.model.engine.StatementListExecutor.executeVariableUsage(StatementListExecutor.java:170)
at
de.fzi.injectj.model.engine.StatementListExecutor.start(StatementListExecutor.java:99)
at de.fzi.injectj.backend.Project.weave(Project.java:1015)
at
de.fzi.injectj.backend.Project.startWeaving(Project.java:916)
at
de.fzi.injectj.frontend.swing.PnlFinal$6.run(PnlFinal.java:314)

The problem seems to be that the third parameter to the
ask operation is expected to be a string (rather than
any variable that will hold the result object of ask).
Since in the above case 'c' is not initialized (it is
not even declared anyway), it is interpreted as
instance of NullType. Thus, there is no matching global
function.

Also, list handling of the ask machinery seems to be
messed up. If I replace in the above script c with a
string, I get the ask dialog, however, without the list
of classes I wanted to choose from and which I provided
as second parameter.

Discussion


Log in to post a comment.