bugKawa - Bugs: bug #39060, ClassFormatException (Absent Code...

 
 

bug #39060: ClassFormatException (Absent Code attribute)

Submitter:  Matthieu Vachon <maoueh>
Submitted:  Fri 24 May 2013 02:40:32 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 30 Jun 2013 07:11:47 PM UTC, comment #1: 

Fix and testcase checked in - thanks.  This fix was to "always" call CompileMembers - even for unused/private classes.

Per Bothner <bothner>
Group administrator
Fri 24 May 2013 02:40:32 AM UTC, original submission:  

I hit the same kind of issue then bug report SAM-conversion Bug #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

Matthieu Vachon <maoueh>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #28155:  code-attribute.scm added by maoueh (783B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by maoueh (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-30 bothner StatusNone Fixed
        Assigned toNone bothner
        Open/ClosedOpen Closed
    2013-05-24 maoueh Attached File- Added code-attribute.scm, #28155

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code