2626import org .springframework .javapoet .ClassName ;
2727import org .springframework .javapoet .CodeBlock ;
2828import org .springframework .javapoet .MethodSpec ;
29+ import org .springframework .javapoet .ParameterSpec ;
2930import org .springframework .javapoet .TypeName ;
3031import org .springframework .util .Assert ;
3132
@@ -51,7 +52,7 @@ public DefaultMethodReference(MethodSpec method, @Nullable ClassName declaringCl
5152
5253 @ Override
5354 public CodeBlock toCodeBlock () {
54- String methodName = this .method .name ;
55+ String methodName = this .method .name () ;
5556 if (isStatic ()) {
5657 Assert .state (this .declaringClass != null , "Static method reference must define a declaring class" );
5758 return CodeBlock .of ("$T::$L" , this .declaringClass , methodName );
@@ -65,7 +66,7 @@ public CodeBlock toCodeBlock() {
6566 public CodeBlock toInvokeCodeBlock (ArgumentCodeGenerator argumentCodeGenerator ,
6667 @ Nullable ClassName targetClassName ) {
6768
68- String methodName = this .method .name ;
69+ String methodName = this .method .name () ;
6970 CodeBlock .Builder code = CodeBlock .builder ();
7071 if (isStatic ()) {
7172 Assert .state (this .declaringClass != null , "Static method reference must define a declaring class" );
@@ -96,8 +97,8 @@ public CodeBlock toInvokeCodeBlock(ArgumentCodeGenerator argumentCodeGenerator,
9697 */
9798 protected void addArguments (CodeBlock .Builder code , ArgumentCodeGenerator argumentCodeGenerator ) {
9899 List <CodeBlock > arguments = new ArrayList <>();
99- TypeName [] argumentTypes = this .method .parameters .stream ()
100- .map (parameter -> parameter . type ).toArray (TypeName []::new );
100+ TypeName [] argumentTypes = this .method .parameters () .stream ()
101+ .map (ParameterSpec :: type ).toArray (TypeName []::new );
101102 for (int i = 0 ; i < argumentTypes .length ; i ++) {
102103 TypeName argumentType = argumentTypes [i ];
103104 CodeBlock argumentCode = argumentCodeGenerator .generateCode (argumentType );
@@ -115,12 +116,12 @@ protected CodeBlock instantiateDeclaringClass(ClassName declaringClass) {
115116 }
116117
117118 private boolean isStatic () {
118- return this .method .modifiers .contains (Modifier .STATIC );
119+ return this .method .modifiers () .contains (Modifier .STATIC );
119120 }
120121
121122 @ Override
122123 public String toString () {
123- String methodName = this .method .name ;
124+ String methodName = this .method .name () ;
124125 if (isStatic ()) {
125126 return this .declaringClass + "::" + methodName ;
126127 }
0 commit comments