From 2967f61fb5cf439096dcd6c68de0fb7c1241248f Mon Sep 17 00:00:00 2001 From: Adrian Rivero Date: Fri, 15 Feb 2019 00:59:12 +0100 Subject: [PATCH] Solves bug on generated code by @RootContext annotation when used on a single method. --- .../internal/core/handler/RootContextHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/core/handler/RootContextHandler.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/core/handler/RootContextHandler.java index 8d88438ab1..5c2b3b77b9 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/core/handler/RootContextHandler.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/core/handler/RootContextHandler.java @@ -83,13 +83,13 @@ public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, EBeanHo } else { AbstractJClass extendingContextClass = getEnvironment().getJClass(typeQualifiedName); - JConditional cond = getInvocationBlock(holder)._if(holder.getContextRef()._instanceof(extendingContextClass)); - cond._then().add(fieldRef.assign(cast(extendingContextClass, holder.getContextRef()))); + JConditional cond = targetBlock._if(contextRef._instanceof(extendingContextClass)); + cond._then().add(fieldRef.assign(cast(extendingContextClass, contextRef))); JInvocation warningInvoke = getClasses().LOG.staticInvoke("w"); warningInvoke.arg(logTagForClassHolder(holder)); - warningInvoke.arg(lit("Due to Context class ").plus(holder.getContextRef().invoke("getClass").invoke("getSimpleName")) - .plus(lit(", the @RootContext " + extendingContextClass.name() + " won't be populated"))); + warningInvoke.arg( + lit("Due to Context class ").plus(contextRef.invoke("getClass").invoke("getSimpleName")).plus(lit(", the @RootContext " + extendingContextClass.name() + " won't be populated"))); cond._else().add(warningInvoke); } }