comp.lang.ada
 help / color / mirror / Atom feed
* JGNAT and Null references
@ 2001-03-01 17:23 Marc A. Criley
  2001-03-01 18:10 ` James Rogers
  2001-03-02 19:27 ` Stephen Leake
  0 siblings, 2 replies; 11+ messages in thread
From: Marc A. Criley @ 2001-03-01 17:23 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-03-07 16:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-01 17:23 JGNAT and Null references Marc A. Criley
2001-03-01 18:10 ` 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

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