comp.lang.ada
 help / color / mirror / Atom feed
* Bizarre JGNAT things
@ 2001-03-31 22:13 gary_the_fox
  2001-04-01 17:40 ` Andrzej Lewandowski
  0 siblings, 1 reply; 5+ messages in thread
From: gary_the_fox @ 2001-03-31 22:13 UTC (permalink / raw)


Hello!

I've encountered an extremely strange behavior of JGNAT 1.1p, so I'll be very
grateful for any clues about its meaning.
In fact, when compiling an ADS file automatically generated by jvm2ada, I get
error messages like "lang" is not declared in "java" (the same for "io") each
time the compiler encounters identifiers like "java.io.String.Ref". or
"java.io.Serializable". The "with" statements for packages and "with type"
statements don't cause any error messages. The same errors are reported also
when I replace auto-generated "with type" statements by equivalent "with"
ones and turn extensions mode off.
The most bizarre thing is that happens to two files only -
com-sun-java-swing-plaf-motif-MotifLookAndFeel.ads and
com-sun-java-swing-plaf-windows-WindowsLookAndFeel.ads. All other files,
including ones with almost identical structure, compile OK, in the same
directory, with the same settings. The extremely similar
javax-swing-plaf-metal-MetalLookAndFeel.ads compiles OK also.

Do I do anything wrong?

TIA Gary


 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net



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

* Re: Bizarre JGNAT things
  2001-03-31 22:13 Bizarre JGNAT things gary_the_fox
@ 2001-04-01 17:40 ` Andrzej Lewandowski
  2001-04-02 12:40   ` Marc A. Criley
  0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Lewandowski @ 2001-04-01 17:40 UTC (permalink / raw)



<gary_the_fox@richmond.com> wrote in message news:9a5kqt$cnu$1@news.netmar.com...
> Hello!
 > The most bizarre thing is that happens to two files only -
> com-sun-java-swing-plaf-motif-MotifLookAndFeel.ads and
> com-sun-java-swing-plaf-windows-WindowsLookAndFeel.ads. All other files,
> including ones with almost identical structure, compile OK, in the same
> directory, with the same settings. The extremely similar
> javax-swing-plaf-metal-MetalLookAndFeel.ads compiles OK also.
>
> Do I do anything wrong?
>

Yes. Wrong is that you are using JGNAT. I gave up after many
attempts.

A.L.







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

* Re: Bizarre JGNAT things
  2001-04-01 17:40 ` Andrzej Lewandowski
@ 2001-04-02 12:40   ` Marc A. Criley
  2001-04-05  3:49     ` gary_the_fox
  0 siblings, 1 reply; 5+ messages in thread
From: Marc A. Criley @ 2001-04-02 12:40 UTC (permalink / raw)


Andrzej Lewandowski wrote:
> 
> <gary_the_fox@richmond.com> wrote in message news:9a5kqt$cnu$1@news.netmar.com...
> > Hello!
>  > The most bizarre thing is that happens to two files only -
> > com-sun-java-swing-plaf-motif-MotifLookAndFeel.ads and
> > com-sun-java-swing-plaf-windows-WindowsLookAndFeel.ads. All other files,
> > including ones with almost identical structure, compile OK, in the same
> > directory, with the same settings. The extremely similar
> > javax-swing-plaf-metal-MetalLookAndFeel.ads compiles OK also.
> >
> > Do I do anything wrong?
> >
> 
> Yes. Wrong is that you are using JGNAT. I gave up after many
> attempts.
> 

Curious.

I've got tables, trees, pop up menus, socket communications, and so on,
all written using JGNAT and working quite nicely.  Granted, I would like
to see a a post-1.1p release that hopefully smoothed some of the
product's rough edges, but I find it quite usable.

There's one critical aspect of JGNAT that a prospective user _must_
understand.  If one tries to write code with JGNAT using the same
"style" one does when writing typical Ada programs, that will likely
work only if you're writing "isolated" code, meaning, little or no
interaction with the JDK class library.

If you're going to interface to JDK classes, as I've been doing, one
must understand _and_conform_ (at least to some extent) with the Java
approach.  The JDK is heavily based on inheritance and implementing
interfaces, therefore your JGNAT compiled Ada code also has to employ
inheritance and polymorphism much more than is typically required of Ada
programs.

My approach has been to write the core code using the standard Ada
idioms, and then adapting to the Java way around the fringes.  This is
in contrast to writing all the code in a Java idiom, and employing "with
type" and coding up my own interfaces and such.  I just leave that
latter stuff to jvm2ada.

Marc A. Criley



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

* Re: Bizarre JGNAT things
  2001-04-02 12:40   ` Marc A. Criley
@ 2001-04-05  3:49     ` gary_the_fox
  2001-04-05 20:34       ` Robert A Duff
  0 siblings, 1 reply; 5+ messages in thread
From: gary_the_fox @ 2001-04-05  3:49 UTC (permalink / raw)


Hello!
Sure, I agree with all you say:-).
However, the things I've described in the original are most likely a small bug
in JGNAT. The problem is that if the compiler seemingly behaves erroneously
if the compilation unit uses a package named, for instance, X and its own
package name is of the form P1.P2.....X....P. For instance, the units that
couldn't be compiled were child of COM.SUN.JAVA package and used JAVA top-
level package. If I moved the code into a package that is not a child package
of P1...JAVA, everything was OK. Since after the analysis of RM I've found no
indication that this is illegal in Ada, it looks like a bug (Please, correct
me if I'm wrong).

Thanks

Gary

>Andrzej Lewandowski wrote:
>> 
>> <gary_the_fox@richmond.com> wrote in message
news:9a5kqt$cnu$1@news.netmar.com...
>> > Hello!
>>  > The most bizarre thing is that happens to two files only -
>> > com-sun-java-swing-plaf-motif-MotifLookAndFeel.ads and
>> > com-sun-java-swing-plaf-windows-WindowsLookAndFeel.ads. All other files,
>> > including ones with almost identical structure, compile OK, in the same
>> > directory, with the same settings. The extremely similar
>> > javax-swing-plaf-metal-MetalLookAndFeel.ads compiles OK also.
>> >
>> > Do I do anything wrong?
>> >
>> 
>> Yes. Wrong is that you are using JGNAT. I gave up after many
>> attempts.
>> 
>
>Curious.
>
>I've got tables, trees, pop up menus, socket communications, and so on,
>all written using JGNAT and working quite nicely.  Granted, I would like
>to see a a post-1.1p release that hopefully smoothed some of the
>product's rough edges, but I find it quite usable.
>
>There's one critical aspect of JGNAT that a prospective user _must_
>understand.  If one tries to write code with JGNAT using the same
>"style" one does when writing typical Ada programs, that will likely
>work only if you're writing "isolated" code, meaning, little or no
>interaction with the JDK class library.
>
>If you're going to interface to JDK classes, as I've been doing, one
>must understand _and_conform_ (at least to some extent) with the Java
>approach.  The JDK is heavily based on inheritance and implementing
>interfaces, therefore your JGNAT compiled Ada code also has to employ
>inheritance and polymorphism much more than is typically required of Ada
>programs.
>
>My approach has been to write the core code using the standard Ada
>idioms, and then adapting to the Java way around the fringes.  This is
>in contrast to writing all the code in a Java idiom, and employing "with
>type" and coding up my own interfaces and such.  I just leave that
>latter stuff to jvm2ada.
>
>Marc A. Criley


 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net



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

* Re: Bizarre JGNAT things
  2001-04-05  3:49     ` gary_the_fox
@ 2001-04-05 20:34       ` Robert A Duff
  0 siblings, 0 replies; 5+ messages in thread
From: Robert A Duff @ 2001-04-05 20:34 UTC (permalink / raw)


gary_the_fox@richmond.com writes:

> 
> Hello!
> Sure, I agree with all you say:-).
> However, the things I've described in the original are most likely a small bug
> in JGNAT. The problem is that if the compiler seemingly behaves erroneously
> if the compilation unit uses a package named, for instance, X and its own
> package name is of the form P1.P2.....X....P. For instance, the units that
> couldn't be compiled were child of COM.SUN.JAVA package and used JAVA top-
> level package. If I moved the code into a package that is not a child package
> of P1...JAVA, everything was OK. Since after the analysis of RM I've found no
> indication that this is illegal in Ada, it looks like a bug (Please, correct
> me if I'm wrong).

You would have to post the exact code to be sure.

But it sounds like you were hiding something called Java with another
name Java.

- Bob



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

end of thread, other threads:[~2001-04-05 20:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-31 22:13 Bizarre JGNAT things gary_the_fox
2001-04-01 17:40 ` Andrzej Lewandowski
2001-04-02 12:40   ` Marc A. Criley
2001-04-05  3:49     ` gary_the_fox
2001-04-05 20:34       ` Robert A Duff

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