-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generator] Cache static final field values.
- Loading branch information
Showing
11 changed files
with
242 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ts/Unit-Tests/CodeGeneratorExpectedResults/JavaInterop1/WriteCachedReferenceTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Java.Interop.JniTypeSignature ("java/code/MyClass", GenerateJavaPeer=false)] | ||
public partial class MyClass { | ||
private static java.code.Example? _field_cache; | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
public static java.code.Example? field { | ||
get { | ||
if (_field_cache != null) return (java.code.Example)_field_cache; | ||
|
||
const string __id = "field.Ljava/code/Example;"; | ||
|
||
var __v = _members.StaticFields.GetObjectValue (__id); | ||
return (java.code.Example?)(_field_cache = global::Java.Interop.JniEnvironment.Runtime.ValueManager.GetValue<java.code.Example? >(ref __v, JniObjectReferenceOptions.Copy)); | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new JniPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
protected MyClass (ref JniObjectReference reference, JniObjectReferenceOptions options) : base (ref reference, options) | ||
{ | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...-Tests/Unit-Tests/CodeGeneratorExpectedResults/JavaInterop1/WriteCachedValueTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Java.Interop.JniTypeSignature ("java/code/MyClass", GenerateJavaPeer=false)] | ||
public partial class MyClass { | ||
private static int? _field_cache; | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
public static int field { | ||
get { | ||
if (_field_cache != null) return (int)_field_cache; | ||
|
||
const string __id = "field.I"; | ||
|
||
var __v = _members.StaticFields.GetInt32Value (__id); | ||
return (int)(_field_cache = __v); | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new JniPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
protected MyClass (ref JniObjectReference reference, JniObjectReferenceOptions options) : base (ref reference, options) | ||
{ | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...t-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteCachedReferenceTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] | ||
public partial class MyClass { | ||
private static java.code.Example? _field_cache; | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
[Register ("field")] | ||
public static java.code.Example? field { | ||
get { | ||
if (_field_cache != null) return (java.code.Example)_field_cache; | ||
|
||
const string __id = "field.Ljava/code/Example;"; | ||
|
||
var __v = _members.StaticFields.GetObjectValue (__id); | ||
return (java.code.Example?)(_field_cache = global::Java.Lang.Object.GetObject<java.code.Example> (__v.Handle, JniHandleOwnership.TransferLocalRef)); | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new XAPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
internal static IntPtr class_ref { | ||
get { return _members.JniPeerType.PeerReference.Handle; } | ||
} | ||
|
||
protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) | ||
{ | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
.../Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteCachedValueTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] | ||
public partial class MyClass { | ||
private static int? _field_cache; | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
[Register ("field")] | ||
public static int field { | ||
get { | ||
if (_field_cache != null) return (int)_field_cache; | ||
|
||
const string __id = "field.I"; | ||
|
||
var __v = _members.StaticFields.GetInt32Value (__id); | ||
return (int)(_field_cache = __v); | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new XAPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
internal static IntPtr class_ref { | ||
get { return _members.JniPeerType.PeerReference.Handle; } | ||
} | ||
|
||
protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) | ||
{ | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
.../Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteCachedReferenceTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] | ||
public partial class MyClass { | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
[Register ("field")] | ||
public static java.code.Example field { | ||
get { | ||
const string __id = "field.Ljava/code/Example;"; | ||
|
||
var __v = _members.StaticFields.GetObjectValue (__id); | ||
return global::Java.Lang.Object.GetObject<java.code.Example> (__v.Handle, JniHandleOwnership.TransferLocalRef); | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new XAPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
internal static IntPtr class_ref { | ||
get { return _members.JniPeerType.PeerReference.Handle; } | ||
} | ||
|
||
protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) | ||
{ | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...ests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteCachedValueTypeField.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" | ||
[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] | ||
public partial class MyClass { | ||
|
||
// Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" | ||
[Register ("field")] | ||
public static int field { | ||
get { | ||
const string __id = "field.I"; | ||
|
||
var __v = _members.StaticFields.GetInt32Value (__id); | ||
return __v; | ||
} | ||
} | ||
|
||
static readonly JniPeerMembers _members = new XAPeerMembers ("java/code/MyClass", typeof (MyClass)); | ||
|
||
internal static IntPtr class_ref { | ||
get { return _members.JniPeerType.PeerReference.Handle; } | ||
} | ||
|
||
protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) | ||
{ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters