From ef500d6f0de0f014a4ffa4081a95aa93f6a76d85 Mon Sep 17 00:00:00 2001 From: "adv.katkov" Date: Sun, 19 May 2019 17:26:58 +0700 Subject: [PATCH] Rename MvpView reference in code generation file ViewState. Parameter of the interface method any MvpView object cannot be passed if reference name of the parameter is "view". I added prefix "_" before the name of the object reference MvpView in the generated class ViewState. Sample project with implemented error: https://github.com/katkoff/MoxyCodeGenerateSample Fix #123 --- .../mvp/compiler/viewstate/ViewStateClassGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moxy-compiler/src/main/java/com/arellomobile/mvp/compiler/viewstate/ViewStateClassGenerator.java b/moxy-compiler/src/main/java/com/arellomobile/mvp/compiler/viewstate/ViewStateClassGenerator.java index 266f7b70..f4d71bc9 100644 --- a/moxy-compiler/src/main/java/com/arellomobile/mvp/compiler/viewstate/ViewStateClassGenerator.java +++ b/moxy-compiler/src/main/java/com/arellomobile/mvp/compiler/viewstate/ViewStateClassGenerator.java @@ -93,8 +93,8 @@ private MethodSpec generateMethod(ViewMethod method, TypeName viewTypeName, Type .addStatement("return") .endControlFlow() .addCode("\n") - .beginControlFlow("for ($T view : mViews)", viewTypeName) - .addStatement("view.$L($L)", method.getName(), method.getArgumentsString()) + .beginControlFlow("for ($T _view : mViews)", viewTypeName) + .addStatement("_view.$L($L)", method.getName(), method.getArgumentsString()) .endControlFlow() .addCode("\n") .addStatement("mViewCommands.afterApply($L)", commandFieldName)