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-7-bit X-Received: by 10.224.219.146 with SMTP id hu18mr2796698qab.3.1364062164912; Sat, 23 Mar 2013 11:09:24 -0700 (PDT) X-Received: by 10.49.75.66 with SMTP id a2mr405093qew.21.1364062164879; Sat, 23 Mar 2013 11:09:24 -0700 (PDT) Path: k8ni11100qas.0!nntp.google.com!ca1no3648311qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 23 Mar 2013 11:09:24 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada/JVM: cannot import abstract subprogram From: Shark8 Injection-Date: Sat, 23 Mar 2013 18:09:24 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-03-23T11:09:24-07:00 List-Id: On Saturday, March 23, 2013 8:53:07 AM UTC-6, John B. Matthews wrote: >=20 > In Java, it's possible to instantiate an anonymous subclass of an=20 > abstract class [1], but it's a compile-time error to instantiate an=20 > abstract class directly [2]. >=20 > Absent first-hand experience with jvm2ada, might this represent a way=20 > to enforce a similar compile-time restriction on an Ada client that=20 > 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 abs= tract type in Ada. -- The problem is that jvm2ada is "helpfully" transliter= ating 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 thi= ng 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 th= e -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* clas= s-file.} So now I'm stumped on some other errors, namely: "must override interface o= peration 'WindowOpened' at java-awt-event-windowlistener.ads:38" {and relat= ed}. 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.ada= core.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 g= enerated in attempting to get everything working. ** Er, so why does the jvm2ada program for GNAT 2012 not generate interface= types?