From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2656 invoked by alias); 23 Feb 2014 22:05:47 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 2645 invoked by uid 89); 23 Feb 2014 22:05:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f174.google.com Received: from mail-ob0-f174.google.com (HELO mail-ob0-f174.google.com) (209.85.214.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 23 Feb 2014 22:05:45 +0000 Received: by mail-ob0-f174.google.com with SMTP id uy5so6472261obc.19 for ; Sun, 23 Feb 2014 14:05:44 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.150.134 with SMTP id ui6mr18962038oeb.62.1393193143954; Sun, 23 Feb 2014 14:05:43 -0800 (PST) Received: by 10.76.88.103 with HTTP; Sun, 23 Feb 2014 14:05:43 -0800 (PST) In-Reply-To: References: <530A49BD.1030809@bothner.com> Date: Sun, 23 Feb 2014 22:05:00 -0000 Message-ID: Subject: Fwd: @Override notations for member functions (e.g. onCreate on Android) From: Marius Kjeldahl To: kawa@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2014-q1/txt/msg00068.txt.bz2 I mistankenly sent this message to Per directly; reposting to list (where it was supposed to go anyway): ---------- Forwarded message ---------- From: Marius Kjeldahl Date: Sun, Feb 23, 2014 at 10:31 PM Subject: Re: @Override notations for member functions (e.g. onCreate on Android) To: Per Bothner Thanks, that works (even if it is not really supported yet as you say). Let me share why I'm bothering you with this. I'm working on a set of tutorials, both for myself and anybody else who wants to write Android apps (and possibly even iOS apps, using RoboVM) using Kawa instead of Java. So my first test is simply to write the Android version of "hello world" in Kawa. But instead of doing it elegantly (like Per in his "view construction" tutorial) I am doing it more or less line-by-line so people can understand how it translates. With the proper understanding in place, moving on to something elegant is probably a lot easier. So I've created a gist here that seems to compile, but with a warning: https://gist.github.com/mariusk/9177506 The compiler output is: (compiling KawaActivity.scm to net.kjeldahl.kawatest) KawaActivity.scm:15:26: warning - no accessible method 'add' in android.widget.LinearLayout It seems to compile fine, but is there any way to get rid of that warning when constructing the LinearLayout? I realize it's related to "magic" of setting properties, but from the warning I am not sure if it actually found the right "setOrientation" or not. If it did find it, it really should shut up, right? Thanks, Marius K. On Sun, Feb 23, 2014 at 8:19 PM, Per Bothner wrote: > On 02/23/2014 05:18 AM, Marius Kjeldahl wrote: >> >> I can't seem to get them working, like in the following example: >> >> (define-simple-class MainActivity (android.app.Activity) >> ((onCreate (savedInstanceState :: android.os.Bundle)) (@Override) >> (invoke-special android.app.Activity (this) 'onCreate >> savedInstanceState) >> ...) >> >> Are @Override notation supported at all, and if so, how can I use them >> on member functions like onCreate? > > > You need to either write: (@java.lang.Override) or add a: > (define-alias Override java.lang.Override) > > Kawa does not automatically "import" java.lang.*. This could > be changed of course. > > Note that Kawa currently doesn't check @Override annotations, > and since it has @Retention(SOURCE) it is just ignored. > > Making Kawa check @Override annotation seems a worthwhile change. > -- > --Per Bothner > per@bothner.com http://per.bothner.com/