I’m not sure whether this intended behaviour or not, but here it is anyway.

The idea is to have a function return the size of a List regardless of the type of objects inside:

function sizeOfList(l : List<Entity>) : Int {
var i : Int := 0;
for(k : Entity in l){
	i := i + 1;
}
return i;
}

This passes by Eclipse plugin just fine. When attempting to build it results in the following error:

invoke-webdslc-compile:

 [echo] Building application
 [echo] webdslc arguments: 
 [echo] --servlet -i ../calendar.app --session-timeout 120            --test  --enable-caching 1
 [echo] Java options: -ss4m -Xmx1024m
 [echo] Classpath: /opt/eclipse_webdsl/plugins/webdsl.editor_1.0.0.201003171455/include/webdsl.jar
 [java] [ Main | info ] stage 1: parsing calendar.app : [user/system] = [3.07s/0.00s]
 [java] [ Main | info ] stage 2: importing modules    : [user/system] = [5.75s/0.00s]
 [java] [ Main | info ] stage 3: typechecking         : [user/system] = [1.78s/0.00s]
 [java] [ Main | info ] stage 4: model-to-model       : [user/system] = [7.47s/0.00s]
 [java] [ Main | info ] stage 5: access control
 ...
 [java] [ Main | info ] stage 6: renaming identifiers : [user/system] = [0.07s/0.00s]
 [java] [ Main | info ] stage 7: performing analysis  : [user/system] = [0.19s/0.00s]
 [java] [ Main | info ] stage 8: Generation analysis  : [user/system] = [0.01s/0.00s]
 [java] [ Main | info ] stage 9: code generation      : [user/system] = [14.33s/0.00s]
 [java] [ Main | info ] stage 10: writing files       : [user/system] = [0.97s/0.00s]
 [echo] Now compiling generated Java code

compile:

[javac] Compiling 266 source files to /home/vladvergu/workspace_webdsl/calendar/.servletapp/bin/WEB-INF/classes
[javac] /home/vladvergu/workspace_webdsl/calendar/.servletapp/src-generated/calendar/beans/notesViewPage_body_Template.java:1434: sizeOfList_(org.hibernate.Session,org.webdsl.lang.Environment,java.util.List<org.webdsl.WebDSLEntity>,java.io.PrintWriter) in calendar.functions.sizeOfList_ cannot be applied to (org.hibernate.Session,org.webdsl.lang.Environment,java.util.List<calendar.domain.Note>,java.io.PrintWriter)
[javac]     notesViewPage_numNotes1 = calendar.functions.sizeOfList_.sizeOfList_(hibSession, env, notesViewPage_ev1.setupForPropertyEvents(hibSession, out).getNotes(), out);
[javac]                                                             ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
Submitted by Vlad Vergu on 18 March 2010 at 23:04

On 18 March 2010 at 23:22 Vlad Vergu commented:

nevermind, i’m being stupid:

List.length

Log in to post comments