bugKawa - Bugs: bug #32010, Runtime java.lang.NoSuchFieldError

 
 

bug #32010: Runtime java.lang.NoSuchFieldError

Submitted by:  None
Submitted on:  Wed 29 Dec 2010 11:25:17 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Run-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 02 Jan 2011 07:14:44 PM UTC, comment #3:

I checked in changes to enable define-simple-class with the same name as a "module" name (which defaults to the source file name).
Please try it out.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Fri 31 Dec 2010 01:45:16 AM UTC, comment #2:

Renaming the scheme file worked. Thanks!

Anonymous
Thu 30 Dec 2010 04:29:26 AM UTC, comment #1:

The problem is because the Scheme source file hello.scm has the same name as the activity "hello". (Which is what the tutorial does ...) Kawa compiles a class named hello for the "module" (top-level) and it compile a class named hello for the activity. The Lit0 ends up in the former class - which then gets overwritten by the latter class. Ooops.

I'll try to work out a fix - since this is kind-of embarassing. Until then, a possible work-around (un-tested) might to use a different name for the activity and the Scheme file.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Wed 29 Dec 2010 11:25:17 PM UTC, original submission:

I ran the following code, compiled with kawa (options: --with-android --disable-xquery --disable-jemacs). It crashed with "java.lang.NoSuchFieldError: kawa.android.hello.Lit0." upon the invocation of button's onClickListener.

(require 'android-defs)

(activity hello
(on-create-view
(let* ((tv (android.widget.TextView (this)))
(button (android.widget.Button (this)))
(items '("Foo" "Bar" "Baz")))
(tv:setText "Hello!")
(button:setText "Bar!")
(button:setOnClickListener
(lambda (v)
(tv:setText (as java.lang.CharSequence (car items)))
#!null))
(android.widget.LinearLayout
(this)
orientation: android.widget.LinearLayout:VERTICAL
view: tv
view: (android.widget.TextView
(this) text: "Foo!")
view: button))))

I took a look at the dump of the compiled hello.class file, and there was in fact no Lit0 field defined.

I have attached the relevant .class files just in case they may prove useful for some reason.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #22318:  hello.class added by None (1KiB - application/java-vm)
file #22319:  hello$0.class added by None (1KiB - application/java-vm)
file #22320:  hello$frame.class added by None (505B - application/java-vm)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 02 Jan 2011 07:14:44 PM UTCbothnerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 30 Dec 2010 04:29:26 AM UTCbothnerStatusNone=>Confirmed
      Assigned toNone=>bothner
    Wed 29 Dec 2010 11:25:17 PM UTCNoneAttached File-=>Added hello.class, #22318
      Attached File-=>Added hello$0.class, #22319
      Attached File-=>Added hello$frame.class, #22320

    Back to the top


    Powered by Savane 3.1-cleanup1