ComponentResultKey (ResolvedComponentResult result) { if (is46rBetter) { try { ResolvedVariantResult variant = reflectiveCall(result, "getVariant", ResolvedVariantResult.class); return new AttributesBasedKey(result.getId(), variant.getAttributes()); } catch (Exception e) { myProject.getLogger().lifecycle("Error getting variant", e); } } return new ComponentIdKey(result.getId()); }