Skip to content

Commit

Permalink
fix(android): module logDeprecation() linker error
Browse files Browse the repository at this point in the history
Fixes TIMOB-28161
  • Loading branch information
jquick-axway authored and sgtcoolguy committed Nov 23, 2020
1 parent b3fcabb commit 6e025c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Expand Up @@ -110,6 +110,7 @@ public class KrollJSONGenerator extends AbstractProcessor
protected String jarJsonPackageName;
protected String jarJsonFileName;
protected String jsonFilePath;
protected boolean isTitaniumSdk = true;
protected boolean initialized = false;
private boolean hasPropertiesChanged = true;

Expand Down Expand Up @@ -189,6 +190,7 @@ protected void initialize()
if ((stringValue != null) && !stringValue.isEmpty()) {
this.jsonFilePath = stringValue;
}
isTitaniumSdk = (processingEnv.getOptions().get(OPTION_TI_BINDINGS_JSON_FILE_PATH_NAME) == null);

// If we're set up to generate a JSON file within a JAR,
// then attempt to read our previously generated JSON file if it exists.
Expand Down Expand Up @@ -327,6 +329,7 @@ public boolean visit(AnnotationMirror annotation, Object arg)
proxyProperties.put("superProxyClassName", superTypeName);
}

proxyProperties.put("isTitaniumSdk", isTitaniumSdk);
proxyProperties.put("isModule", isModule);
proxyProperties.put("packageName", packageName);
proxyProperties.put("proxyClassName", proxyClassName);
Expand Down
Expand Up @@ -278,10 +278,20 @@ void ${className}::${method.apiName}(const FunctionCallbackInfo<Value>& args)

<#if method.args?size == 0 && name[0..2] == "get" && isDynamic>
<#assign propertyName = name[3]?lower_case + name[4..]>
Proxy::logDeprecation(isolate, "Getter method deprecated, please use \"obj.${propertyName};\" or \"obj['${propertyName}'];\" instead.");
const char *deprecationMessage = "Getter method deprecated, please use \"obj.${propertyName};\" or \"obj['${propertyName}'];\" instead.";
<#if isTitaniumSdk>
Proxy::logDeprecation(isolate, deprecationMessage);
<#else>
LOGW(TAG, deprecationMessage);
</#if>
<#elseif method.args?size == 1 && name[0..2] == "set" && isDynamic>
<#assign propertyName = name[3]?lower_case + name[4..]>
Proxy::logDeprecation(isolate, "Setter method deprecated, please use \"obj.${propertyName} = val;\" or \"obj['${propertyName}'] = val;\" instead.");
const char *deprecationMessage = "Setter method deprecated, please use \"obj.${propertyName} = val;\" or \"obj['${propertyName}'] = val;\" instead.";
<#if isTitaniumSdk>
Proxy::logDeprecation(isolate, deprecationMessage);
<#else>
LOGW(TAG, deprecationMessage);
</#if>
</#if>

jobject javaProxy = proxy->getJavaObject();
Expand Down

0 comments on commit 6e025c5

Please sign in to comment.