Table of Contents Previous Section
Java Programming Pitfalls
When debugging Java code, watch out for the following tricky spots:
- You can't define multiple constructors or overloaded methods for the classes WOApplication, WOSession, WOComponent, or any other class that originates as an Objective-C class. For example, the following code causes your application to crash:
public class MyComponent extends WOComponent {
public void myMethod() { .... }
//WRONG! Overloaded method causes runtime error.
public void myMethod(int anInt) { ... }
}
// From a component's Java file.
((Session)session()).verify();
By definition, session returns a WOSession object. Because WOSession does not define a method named verify, your code won't compile unless you cast the return value of session to your WOSession subclass.
Table of Contents Next Section