Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): module logDeprecation() linker error #12259

Merged
merged 5 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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