Hello,
this is a know limitation/issue: if fglcomp sees
C.create() where
C is a class name, then the compiler assumes this is a call to the constructor.
#4gl
LET x = C.create()
acts like
//java
x = new(C);
This implies: it is not possible to call a static Java method named create from 4gl.
Unfortunately: there is no workaround. There is now way to fix without breaking any existing code.
Decades after the 1sh implementation of "call java from 4gl" I am asking myself, why we have used the name
create. We should have used the name
new. The symbol
new is a reserved word in Java, a method can not be named
new. Too late.
The compiler should raise a warning if a java class implements a method named
create "conflicting" withe a constructor.
The compiler could 1st) lookup for a constructor - for backward compatibility - next lookup for a method. This would still fail if both, constructor and method exist.
Rene