Hi Paul,

wouldn't it be possible to implement the default parameter now with
default methods?

On 05.01.21 05:39, Paul King wrote:
You could potentially use a trait?

trait MyTrait {
     abstract myFunction(String parameter1 = "1234")
}

class MyClass implements MyTrait {
     def myFunction(String parameter1) {
         parameter1.reverse()
     }
}

assert new MyClass().myFunction() == '4321'


On Tue, Jan 5, 2021 at 1:22 PM Saravanan Palanichamy <chava...@gmail.com
<mailto:chava...@gmail.com>> wrote:

    Hello

    Are there plans to support default parameters in interface methods

    interface MyClass {
         def myFunction(String parameter1 = "1234")
    }

    the error I get is Cannot specify default value for method parameter
    inside an interface

    regards
    Saravanan


Reply via email to