comp.lang.ada
 help / color / mirror / Atom feed
From: Blady <p.p11@orange.fr>
Subject: Re: Ada/JVM: cannot import abstract subprogram
Date: Tue, 02 Apr 2013 22:10:48 +0200
Date: 2013-04-02T22:10:48+02:00	[thread overview]
Message-ID: <kjfdt8$r2e$1@shakotay.alphanet.ch> (raw)
In-Reply-To: <b9decf56-3529-47a9-a9ac-40b21f6b042d@googlegroups.com>

Hello, a patch has to be applied on source code from JVM-GNAT.
See:
http://blady.pagesperso-orange.fr/telechargements/jgnat/jvm-gnat-gpl-2011.diff

These changes have been initiated by Stephe Leake (http://www.stephe- 
leake.org/) but they no longer seem to be on his web site.

You can have also a look on my web site page:
http://blady.pagesperso-orange.fr/alpha.html

On Mac OS X Intel, all seems to be fine but not with Applet, I've got an 
error: java.lang.ClassNotFoundException: Applet

Not fixed since then.

HTH, Pascal.

Le 23/03/13 19:09, Shark8 a �crit :
> On Saturday, March 23, 2013 8:53:07 AM UTC-6, John B. Matthews wrote:
>>
>> In Java, it's possible to instantiate an anonymous subclass of an
>> abstract class [1], but it's a compile-time error to instantiate an
>> abstract class directly [2].
>>
>> Absent first-hand experience with jvm2ada, might this represent a way
>> to enforce a similar compile-time restriction on an Ada client that
>> tries to import an abstract parent, rather than a concrete subclass?
>
> No. It's the same sort of error to try to create an instantiation of an abstract type in Ada. -- The problem is that jvm2ada is "helpfully" transliterating the the class-structure for the Java API... but taking no account of whether or not a subprogram spec already translated is abstract or not, OR that the jvm-gnat compiler is unable to say "ah, 'abstract' is the same thing in Ada and in Java, so the 'import' should be of no effect."
>
> I went with the heavy-handed/inelegant method of trying to compile [with the -k switch] and then commenting out the import pragmas which were flagged as errors. {A poor solution but one that allows me to generate a good* class-file.}
>
> So now I'm stumped on some other errors, namely: "must override interface operation 'WindowOpened' at java-awt-event-windowlistener.ads:38" {and related}. This is kind of odd, because Ada 2005 got the Java-style interfaces ** and the reason for the [new] error seems to be interfaces: http://docs.adacore.com/gnatvm-docs/jgnat_ug.html#Using-Java-Interfaces
>
> * Oddly the compilation neglects an 'adainit' function; in order to use Ada.Text_IO.Put/Put_Line I have to import it from a different class that was generated in attempting to get everything working.
>
> ** Er, so why does the jvm2ada program for GNAT 2012 not generate interface types?
>




  reply	other threads:[~2013-04-02 20:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 19:56 Ada/JVM: cannot import abstract subprogram Shark8
2013-03-23 14:53 ` John B. Matthews
2013-03-23 18:09   ` Shark8
2013-04-02 20:10     ` Blady [this message]
2013-04-03 12:05       ` Stephen Leake
replies disabled

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