bugKawa - Bugs: bug #32223, Subclassing without default...

 
 

bug #32223: Subclassing without default constructor

Submitter:  Helmut Eller <ellerh>
Submitted:  Mon 24 Jan 2011 11:24:35 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
   

Mon 24 Jan 2011 09:57:50 PM UTC, comment #3: 

I checked in various changes to get a more friendly response on this error.

Per Bothner <bothner>
Group administrator
Mon 24 Jan 2011 05:48:53 PM UTC, comment #2: 

I only realized my mistake after submission.
I think the only thing that needs fixing
is the confusing error message.


Helmut Eller <ellerh>
Mon 24 Jan 2011 04:55:59 PM UTC, comment #1: 

Kawa isn't realizing that the Foo in the invoke-special is foo.Foo.  Replacing it by the following seems to work:

   (invoke-static foo.Foo (this) '*init* i))

So, should Kawa recognize Foo as foo.Foo here?  Maybe, but if not at least it should complain if it doesn't recognize the typename.  So improving the diagnostics is needed anyway, since we get the same confusing failure on a typo.

Per Bothner <bothner>
Group administrator
Mon 24 Jan 2011 11:24:35 AM UTC, original submission:  

With this Java class:

package foo;
public class Foo {
    public Foo (int i) { }
}

And this Scheme class:

(define-simple-class bar (foo.Foo)
  ((*init* (i int))
   (invoke-special Foo (this) '*init* i)))

Note that Foo is in a non-default package. 
I get this error:

> kawa --version -C y.scm
Kawa 1.11 (revision 0:6882M)
Copyright (C) 2009 Per Bothner
(compiling y.scm to y)
y.scm:4: internal error while compiling y.scm
java.lang.Error: passing Uninitialized<bar> as parameter
        at gnu.bytecode.CodeAttr.emitInvokeMethod(CodeAttr.java:1491)
        at gnu.bytecode.CodeAttr.emitInvokeVirtual(CodeAttr.java:1538)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:394)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:111)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:142)
        at gnu.expr.LambdaExp.compileBody(LambdaExp.java:1619)
        at gnu.expr.ClassExp.compileMembers(ClassExp.java:569)
        at gnu.expr.ClassInitializer.<init>(ClassInitializer.java:16)
        at gnu.expr.ClassExp.compileSetField(ClassExp.java:806)
        at gnu.expr.SetExp.compile(SetExp.java:167)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:142)
        at gnu.expr.LambdaExp.compileBody(LambdaExp.java:1619)
        at gnu.expr.Compilation.generateBytecode(Compilation.java:2015)
        at gnu.expr.Compilation.process(Compilation.java:1893)
        at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:305)
        at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:290)
        at kawa.repl.compileFiles(repl.java:783)
        at kawa.repl.processArgs(repl.java:412)
        at kawa.repl.main(repl.java:827)
[Exit 255]


Helmut Eller <ellerh>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 ellerh (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
    2011-01-24 bothner StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2011-01-24 bothner StatusNone Confirmed
        Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-0329.
    Corresponding source code