eed3si9n / jarjar-abrams

an experimental Scala extension of Jar Jar Links
27 stars 21 forks source link

Cannot shade traits containg fields #32

Open AlessandroPatti opened 1 year ago

AlessandroPatti commented 1 year ago

Shading traits that contain fields causes AbstractMethodError when tring to instantiate a class that extends it. Shading the following trait

package com.jarjar
trait ScalaTrait { val a = 1 }

and then extending it and instantiating the class surfaces the issue:

class ExtendedTrait extends shaded.com.jarjar.ScalaTrait
new ExtendedTrait

The ExtendedTrait class implements shaded$com$jarjar$ScalaTrait$_setter_$a_$eq(int) (name constructed from the symbols in the scala signature of ScalaTrait), but the abstract getter method name was not updated during shading in ScalaTrait, so com$jarjar$ScalaTrait$_setter_$a_$eq(int) remains unimplemented.