From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6a77bfa7132ac95c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII X-Received: by 10.180.188.52 with SMTP id fx20mr1269073wic.3.1365343205920; Sun, 07 Apr 2013 07:00:05 -0700 (PDT) Path: p18ni42886wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.n-ix.net!news.hufnagl.info!fu-berlin.de!news.imp.ch!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail From: Blady Newsgroups: comp.lang.ada Subject: Re: Ada/JVM: cannot import abstract subprogram Date: Tue, 02 Apr 2013 22:10:48 +0200 Organization: Posted through ALPHANET (http://www.alphanet.ch/) Sender: blady@anantes-557-1-146-161.w2-1.abo.wanadoo.fr Message-ID: References: NNTP-Posting-Host: anantes-557-1-146-161.w2-1.abo.wanadoo.fr Mime-Version: 1.0 X-Trace: shakotay.alphanet.ch 1364933352 27726 2.1.161.161 (2 Apr 2013 20:09:12 GMT) X-Complaints-To: usenet@alphanet.ch NNTP-Posting-Date: Tue, 2 Apr 2013 20:09:12 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: 2013-04-02T22:10:48+02:00 List-Id: 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? >