bugKawa - Bugs: bug #52390, kawa 3.0 anonymous class...

 
 

bug #52390: kawa 3.0 anonymous class instantiation in map issue

Submitted by:  None
Submitted on:  Fri 10 Nov 2017 10:01:25 PM UTC  
 
Category: Type declaration and inferenceSeverity: 3 - Normal
Item Group: Unexpected resultStatus: Confirmed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 10 Nov 2017 11:04:59 PM UTC, comment #1:

It is definitely supposed to create only one subclass - classes are generally generated at compile-time (or load-time if you think of the actual Class object, not during execution.

The problem is how 'map' is inlined to a loop. The bug is that there is only one variable for 'prefix', and each instance shares the same 'prefix'.

Here is a work-around:

(let ((v (map (lambda (prefix0)
(object (java.lang.Object)
(prefix prefix0)
((my-method value) (string-append prefix "-" (number->string value)))))
(list "ALPHA" "BETA" "GAMMA"))))
....

New bugs should probably be reported on the gitlab bug-tracker.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Fri 10 Nov 2017 10:01:25 PM UTC, original submission:

The following code:

(let ((v (map (lambda (prefix)
(object (java.lang.Object)
((my-method value) (string-append prefix "-" (number->string value)))))
(list "ALPHA" "BETA" "GAMMA"))))
(display (format "~a ~a ~a : test-map\n"
((car v):my-method 100)
((cadr v):my-method 200)
((caddr v):my-method 300))))

gives different results with kawa-2.4 (expected):

ALPHA-100 BETA-200 GAMMA-300 : test-map

and kawa-3.0 (unexpected):

GAMMA-100 GAMMA-200 GAMMA-300 : test-map

It seems it's creating only one subclass, instantiating three times from that, rather than create three subclasses, instantiating from each one.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 10 Nov 2017 11:04:59 PM UTCbothnerStatusNone=>Confirmed
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup1