[fpc-devel] New FPC target: JVM

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Aug 20 23:26:11 CEST 2011


On 20 Aug 2011, at 22:07, Jonas Maebe wrote:

> No, I have not created any gui test programs.

There's also the problem mentioned at http://wiki.freepascal.org/FPC_JVM/Language#Using_JDK_functionality :

"The javapp utility cannot handle circular references involving nested classes, because they cannot be expressed in Pascal. There is one such circular reference in the standard JDK, between java.awt.Window and java.awt.Dialog. This is currently worked around declaring java.awt.Dialog as a formal class, which means that none of its methods, fields or nested classes are available."

Dialogs are generally fairly common in GUI programs...

The problem is that the following circular dependency: java.awt.Dialog is a subclass of java.awt.Window and hence java.awt.Window has to be declared first. However, java.awt.Window has a field (modalExclusionType) whose type is java.awt.Dialog.ModalExclusionType (i.e., a nested class of java.awt.Dialog, so java.awt.Dialog has to be declared first).

Normally, issues of this second kind are resolved by creating a forward declaration of the involed class (type JADialog.ModalExclusionType = class;), but you can't do that for nested classes outside their enclosing class. I could extend the javapp utility to enable specifying also nested classes as formal classes so that you'd only lose the definition for java.awt.Dialog.ModalExclusionType rather than for all of java.awt.Dialog, but that still would only partially work around the basic problem.


Jonas


More information about the fpc-devel mailing list