bug-kawa
[Top][All Lists]
Advanced

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

[Bug-kawa] [bug #39060] ClassFormatException (Absent Code attribute)


From: Matthieu Vachon
Subject: [Bug-kawa] [bug #39060] ClassFormatException (Absent Code attribute)
Date: Fri, 24 May 2013 02:40:33 +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/?39060>

                 Summary: ClassFormatException (Absent Code attribute)
                 Project: Kawa
            Submitted by: maoueh
            Submitted on: Fri 24 May 2013 02:40:32 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I hit the same kind of issue then bug report SAM-conversion Bug #36911
<https://savannah.gnu.org/bugs/?36911> but with the `(define-simple-class)`
syntax. Maybe related to the issue, maybe not.

The problem on my side was that I was not exporting the class and was not
using in the source file neither (it was loaded at runtime by Eclipse).

So, with the following code example:


(module-name <org.kawa.test.codeattribute>)
(module-export <PublicClass> <PublicInterface>)

(define-simple-class <PublicInterface> () interface: #t
  ((setup (argument :: <String>)) :: <void>
   #!abstract))

(define-simple-class <PublicClass> (<Object>))

(define-simple-class <PrivateClass> (<PublicInterface>)
  ((setup (argument :: <java.lang.String>)) :: <void>
   (format (current-output-port) "Argument was: ~a~%" argument)))


The bytecode produced for class <PrivateClass> (at
org/kawa/test/PrivateClass.class) is:


/ Compiled from code-attribute.scm (version 1.5 : 49.0, super bit)
public class org.kawa.test.PrivateClass implements
org.kawa.test.PublicInterface {
  
  // Method descriptor #8 (Ljava/lang/String;)V
  public void setup(java.lang.String arg0);
  
  // Method descriptor #10 ()V
  public PrivateClass();
}


This then produce the `ClassFormatException` because the method has no body. 

If the `<PrivateClass>` is used in the source file or exported, it works
correctly. It's fairly easy to workaround the issue by exporting it, which
might be the intended use for this. 

But in my opinion, even if the class is not exported, its bytecode should be
the correct one. Maybe with a warning if possible.

What do you think?

Regards,
Matt



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 24 May 2013 02:40:32 AM GMT  Name: code-attribute.scm  Size: 783B  
By: maoueh

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

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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