Skip to main content

Home/ Web2.0/ Group items matching "jdojo" in title, tags, annotations or url

Group items matching
in title, tags, annotations or url

Sort By: Relevance | Date Filter: All | Bookmarks | Topics Simple Middle
Hendy Irawan

JDojo < Main < TWiki - 0 views

    The idea of JDojo is to bring JavaScript and Dojo to Java. To achieve this, JDojo provides Java stubs for existing Dojo and JavaScript types a compiler participant to the Eclipse Java compiler that emits JavaScript files for each Java file compiled The programmer does not program against the Java JDK classes, but against Dojo and JavaScript stubs that JDojo provides. The compiler participant only allows a subset of the existing JDK classes and also limits the Java language constructs that can be used. To support important features that exist in JavaScript but are not available in Java, JDojo provides Java annotations that the programmer can use to instruct the compiler how to translate code. While the compiler still produces class files, what is of interest is the JavaScript code. Only the generated JavaScript code is executable, the Java code is not. Contrary to Java-JavaScript cross compilers, JDojo does not add anything on top of the JavaScript and Dojo types. JDojo programmers program against the DOM, Dojo widget and other existing Dojo classes the same way as they would do it when programming JavaScript. Therefore, the Java code a JDojo programmer writes looks very similar to the JavaScript code he would have written. However, the programmer now can take advantage of a typed programming environment and benefit from the Eclipse Java Tooling. The translator produces JavaScript that looks as similar as possible to the Java code (without the types), and matches what a JavaScript programmer would have written. This is important when executing and debugging the generated JavaScript; it is still easy to understand the JavaScript code and map a bug back to the Java code. JDojo also fits nicely in the existing Jazz web bundles. JDojo code is placed in a new Java source folder, while the generated JavaScript is inserted in 'resources' folder that also holds existing JavaScript code. To use existing JavaScript code in JDojo, 'Stub' classes can be added, containing only th
1 - 1 of 1
Showing 20 items per page