From 0fc78f9e1cbe2d7084a18398eeeff1c3a5aa0abf Mon Sep 17 00:00:00 2001 From: Csaba Kozak Date: Fri, 7 Jul 2017 15:38:21 +0200 Subject: [PATCH] Use normal R class even when validating with R2 The final resource values will not be the same as the compile-time values, so we have to use the R class in the generated code, even if the user set to use the R2 class in annotation parameters. Follow-up fix for: https://github.com/androidannotations/androidannotations/pull/2022 --- .../org/androidannotations/internal/rclass/RInnerClass.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/rclass/RInnerClass.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/rclass/RInnerClass.java index b1dc0fea18..0f9d0d018c 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/rclass/RInnerClass.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/rclass/RInnerClass.java @@ -129,6 +129,10 @@ public static JFieldRef extractIdStaticRef(AndroidAnnotationsEnvironment environ String rClassQualifiedName = rInnerClassName.substring(0, innerClassSuffix); String innerClassSimpleName = rInnerClassName.substring(innerClassSuffix + 1); + if (rClassQualifiedName.endsWith("R2")) { + rClassQualifiedName = rClassQualifiedName.substring(0, rClassQualifiedName.length() - 1); + } + JDirectClass rClass = (JDirectClass) environment.getJClass(rClassQualifiedName); AbstractJClass innerClass = null;