Commit f29210d5 authored by sheldonneuberger's avatar sheldonneuberger Committed by Xianwen Chen

Rename destroy() to __destroy() (#365)

* rename destroy to __destroy

* update generated-src in test-suite

* use _djinni_destroy

* _djinni_private_destroy
parent 2ab4b4e4
...@@ -180,12 +180,12 @@ class JavaGenerator(spec: Spec) extends Generator(spec) { ...@@ -180,12 +180,12 @@ class JavaGenerator(spec: Spec) extends Generator(spec) {
} }
w.wl w.wl
w.wl("private native void nativeDestroy(long nativeRef);") w.wl("private native void nativeDestroy(long nativeRef);")
w.wl("public void destroy()").braced { w.wl("public void _djinni_private_destroy()").braced {
w.wl("boolean destroyed = this.destroyed.getAndSet(true);") w.wl("boolean destroyed = this.destroyed.getAndSet(true);")
w.wl("if (!destroyed) nativeDestroy(this.nativeRef);") w.wl("if (!destroyed) nativeDestroy(this.nativeRef);")
} }
w.wl("protected void finalize() throws java.lang.Throwable").braced { w.wl("protected void finalize() throws java.lang.Throwable").braced {
w.wl("destroy();") w.wl("_djinni_private_destroy();")
w.wl("super.finalize();") w.wl("super.finalize();")
} }
for (m <- i.methods if !m.static) { // Static methods not in CppProxy for (m <- i.methods if !m.static) { // Static methods not in CppProxy
......
...@@ -25,14 +25,14 @@ public abstract class Conflict { ...@@ -25,14 +25,14 @@ public abstract class Conflict {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
} }
......
...@@ -26,14 +26,14 @@ public abstract class ConflictUser { ...@@ -26,14 +26,14 @@ public abstract class ConflictUser {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -86,14 +86,14 @@ public abstract class ConstantsInterface { ...@@ -86,14 +86,14 @@ public abstract class ConstantsInterface {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -25,14 +25,14 @@ public abstract class CppException { ...@@ -25,14 +25,14 @@ public abstract class CppException {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -38,14 +38,14 @@ public abstract class EnumUsageInterface { ...@@ -38,14 +38,14 @@ public abstract class EnumUsageInterface {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -20,14 +20,14 @@ public abstract class ExternInterface1 { ...@@ -20,14 +20,14 @@ public abstract class ExternInterface1 {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -33,14 +33,14 @@ public abstract class FlagRoundtrip { ...@@ -33,14 +33,14 @@ public abstract class FlagRoundtrip {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
} }
......
...@@ -28,14 +28,14 @@ public abstract class InterfaceUsingExtendedRecord { ...@@ -28,14 +28,14 @@ public abstract class InterfaceUsingExtendedRecord {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -33,14 +33,14 @@ public abstract class ListenerCaller { ...@@ -33,14 +33,14 @@ public abstract class ListenerCaller {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -26,14 +26,14 @@ public abstract class ReturnOne { ...@@ -26,14 +26,14 @@ public abstract class ReturnOne {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -26,14 +26,14 @@ public abstract class ReturnTwo { ...@@ -26,14 +26,14 @@ public abstract class ReturnTwo {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -32,14 +32,14 @@ public abstract class ReverseClientInterface { ...@@ -32,14 +32,14 @@ public abstract class ReverseClientInterface {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -79,14 +79,14 @@ public abstract class TestDuration { ...@@ -79,14 +79,14 @@ public abstract class TestDuration {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
} }
......
...@@ -94,14 +94,14 @@ public abstract class TestHelpers { ...@@ -94,14 +94,14 @@ public abstract class TestHelpers {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
} }
......
...@@ -23,14 +23,14 @@ public abstract class UserToken { ...@@ -23,14 +23,14 @@ public abstract class UserToken {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -34,14 +34,14 @@ public abstract class UsesSingleLanguageListeners { ...@@ -34,14 +34,14 @@ public abstract class UsesSingleLanguageListeners {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -31,14 +31,14 @@ public abstract class VarnameInterface { ...@@ -31,14 +31,14 @@ public abstract class VarnameInterface {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
......
...@@ -30,14 +30,14 @@ public abstract class WcharTestHelpers { ...@@ -30,14 +30,14 @@ public abstract class WcharTestHelpers {
} }
private native void nativeDestroy(long nativeRef); private native void nativeDestroy(long nativeRef);
public void destroy() public void _djinni_private_destroy()
{ {
boolean destroyed = this.destroyed.getAndSet(true); boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef); if (!destroyed) nativeDestroy(this.nativeRef);
} }
protected void finalize() throws java.lang.Throwable protected void finalize() throws java.lang.Throwable
{ {
destroy(); _djinni_private_destroy();
super.finalize(); super.finalize();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment