comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqnet@earthlink.net>
Subject: JGNAT and Null references
Date: Thu, 01 Mar 2001 17:23:31 GMT
Date: 2001-03-01T17:23:31+00:00	[thread overview]
Message-ID: <3A9E77D4.D40FEAA@earthlink.net> (raw)

Let me just plow right into an annotated example here, rather than
trying to explain it first...

The Java class javax.swing.JTabbedPane provides a method called addTab
that looks like this:

public void addTab(String title,
                   Icon icon,
                   Component component,
                   String tip)

When this class is run through JGNAT's jvm2ada, the Ada equivalent of
that method is:

   procedure addTab (This : access Typ; 
                     P1_String : access java.lang.String.Typ'Class; 
                     P2_Icon : access javax.swing.Icon.Typ'Class; 
                     P3_Component : access java.awt.Component.Typ'Class; 
                     P4_String : access java.lang.String.Typ'Class);

Okay, so far so good.

In Java, if I don't have an icon to accompany this tab pane, I can just
supply that parameter with a null:

   jtp.addTab("My title", null, a_component, "a_tool_tip");

Attempting this in Ada:

   AddTab(Jtp, +"My title", null, A_Component, +"a_tool_tip");

generates an error when compiled:

   null cannot be of an anonymous access type

which is perfectly correct since that P2_Icon parameter requires a
pointer to , or the "'access of" an actual object.

Buuuuuut, I don't have, or want to pass, an Icon to display with the
tab, and specifying "null" is how I would indicate that in Java.  What
do I provide as a "null argument" in JGNAT?  I was hoping to find some
sort of predefined "null_reference" constant, analogous to
System.Null_Address, but no such luck.

Thanks much,

Marc A. Criley



             reply	other threads:[~2001-03-01 17:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-01 17:23 Marc A. Criley [this message]
2001-03-01 18:10 ` JGNAT and Null references James Rogers
2001-03-02 19:27 ` Stephen Leake
2001-03-03 21:17   ` Marc A. Criley
2001-03-04  2:46     ` Randy Brukardt
2001-03-05 13:05       ` Marc A. Criley
2001-03-05 16:28         ` tmoran
2001-03-06  0:57           ` Marc A. Criley
2001-03-05 18:11         ` Randy Brukardt
2001-03-05 20:44         ` Florian Weimer
2001-03-07 16:02       ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox