Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.5.4
-
None
-
None
-
None
Description
in following snipped the required parameter is not enforced at all:
import groovy.transform.CompileStatic import groovy.transform.NamedParam import groovy.transform.NamedParams @CompileStatic class Tester { String text String color static Tester note(String text, String color) { return new Tester(text: text, color: color) } } @CompileStatic class TesterBuilder { static Tester note( @NamedParams([ @NamedParam(value = 'text', type = String, required = true), @NamedParam(value = 'color', type = String) ]) Map<String, String> params ) { return Tester.note(params.text, params.color) } } @CompileStatic Tester useBuilder() { return TesterBuilder.note(color: 'blue') } useBuilder()