bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #39048] Bad method call resolution?


From: Matthieu Vachon
Subject: [Bug-kawa] [bug #39048] Bad method call resolution?
Date: Thu, 23 May 2013 03:48:53 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?39048>

                 Summary: Bad method call resolution?
                 Project: Kawa
            Submitted by: maoueh
            Submitted on: Thu 23 May 2013 03:48:52 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Assume the following interface:


package org.kawa.test.getterclash;

public interface Simple {
    public String getImageDescriptor();
}


And the following Kawa source file:


(module-name <org.kawa.test.getterclash>)
(module-compile-options main: #t)

(define (image-descriptor argument)
  (format "Ok with argument: ~a~%" argument))

(define (create-simple)
  (object (<org.kawa.test.getterclash.Simple>)
    ((getImageDescriptor)
     (image-descriptor "Should call define above, not getImageDescriptor"))))


(define (main)
  (let ((simple :: <org.kawa.test.getterclash.Simple> (create-simple)))
    (invoke simple 'getImageDescriptor)))

(main)


The problem here is that Kawa will call `getImageDescriptor` when seeing
`(image-descriptor "Should call define above, not getImageDescriptor")` inside
object method implementation. That will then cause a StackOverFlow at runtime
since method is calling itself. This can also be seen by the warning issued
mentioning `(image-descriptor argument)` is not used.

I check the documentation about that but did not see any places saying that
define without prefix `get-` will resolve to method `getXxxxYyyy`. 

If it's the case, I don't think this should be the behavior. Call should be
more explicit and only `get-image-descriptor` should have worked in my
opinion.

At least, even if we keep current mapping, since the called procedure as the
not same arity, it should not call class getter.

I attached my test case in a zip archive.

Regards,
Matt



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 23 May 2013 03:48:52 AM GMT  Name: getter-clash.zip  Size: 1kB   By:
maoueh

<http://savannah.gnu.org/bugs/download.php?file_id=28143>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39048>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]