converter-page icon indicating copy to clipboard operation
converter-page copied to clipboard

Default methods are incorrectly translated

Open jarble opened this issue 2 years ago • 0 comments

I tried to translate a Java interface with a default method to Rust:

public interface Example {
    default int example(int a1) {
        return a1;
    }
}

But the converter's output has a syntax error: the method starts with fn default example.

pub trait Example {
    fn default  example(&self,  a1: i32) -> i32  {
        return a1;
    }
} 

If I remove the default keyword, it no longer has a syntax error.

pub trait Example {
    fn  example(&self,  a1: i32) -> i32  {
        return a1;
    }
} 

jarble avatar Jul 16 '21 13:07 jarble