Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
use super.reference in fromRef constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
HosseinYousefi committed Sep 20, 2023
1 parent 6af8ebd commit 55573a9
Show file tree
Hide file tree
Showing 36 changed files with 237 additions and 242 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup =
/// from: com.example.in_app_java.AndroidUtils
class AndroidUtils extends jni.JObject {
AndroidUtils.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref);
AndroidUtils.fromRef(super.reference) : super.fromRef();
static final _showToast = jniLookup<
ffi.NativeFunction<
Expand Down
3 changes: 1 addition & 2 deletions jni/lib/src/jarray.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ class JArray<E> extends JObject {
JArrayType(innerType);

/// Construct a new [JArray] with [reference] as its underlying reference.
JArray.fromRef(this.elementType, JArrayPtr reference)
: super.fromRef(reference);
JArray.fromRef(this.elementType, super.reference) : super.fromRef();

/// Creates a [JArray] of the given length from the given [type].
///
Expand Down
4 changes: 2 additions & 2 deletions jni/lib/src/jobject.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class JObject extends JReference {
static const JObjType<JObject> type = JObjectType();

/// Construct a new [JObject] with [reference] as its underlying reference.
JObject.fromRef(JObjectPtr reference) : super.fromRef(reference);
JObject.fromRef(super.reference) : super.fromRef();

JClass? _jClass;

Expand Down Expand Up @@ -351,7 +351,7 @@ class JObject extends JReference {
/// A high level wrapper over a JNI class reference.
class JClass extends JReference {
/// Construct a new [JClass] with [reference] as its underlying reference.
JClass.fromRef(JObjectPtr reference) : super.fromRef(reference);
JClass.fromRef(super.reference) : super.fromRef();

/// Get [JFieldIDPtr] of static field [fieldName] with [signature].
JFieldIDPtr getStaticFieldID(String fieldName, String signature) {
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jboolean.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class JBoolean extends JObject {
// ignore: overridden_fields
late final JObjType<JBoolean> $type = type;

JBoolean.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JBoolean.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JBooleanType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jbyte.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class JByte extends JNumber {
// ignore: overridden_fields
late final JObjType<JByte> $type = type;

JByte.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JByte.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JByteType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jcharacter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class JCharacter extends JObject {
// ignore: overridden_fields
late final JObjType<JCharacter> $type = type;

JCharacter.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JCharacter.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JCharacterType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jdouble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class JDouble extends JNumber {
// ignore: overridden_fields
late final JObjType<JDouble> $type = type;

JDouble.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JDouble.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JDoubleType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jfloat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class JFloat extends JNumber {
// ignore: overridden_fields
late final JObjType<JFloat> $type = type;

JFloat.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JFloat.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JFloatType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jinteger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class JInteger extends JNumber {
// ignore: overridden_fields
late final JObjType<JInteger> $type = type;

JInteger.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JInteger.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JIntegerType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jlong.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class JLong extends JNumber {
// ignore: overridden_fields
late final JObjType<JLong> $type = type;

JLong.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JLong.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JLongType();
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jnumber.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ class JNumber extends JObject {
// ignore: overridden_fields
late final JObjType<JNumber> $type = type;

JNumber.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JNumber.fromRef(super.reference) : super.fromRef();

static final _class = Jni.findJClass(r"java/lang/Number");

Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/lang/jshort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class JShort extends JNumber {
// ignore: overridden_fields
late final JObjType<JShort> $type = type;

JShort.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JShort.fromRef(super.reference) : super.fromRef();

/// The type which includes information such as the signature of this class.
static const type = JShortType();
Expand Down
3 changes: 1 addition & 2 deletions jni/lib/src/lang/jstring.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:jni/src/jreference.dart';

import '../jni.dart';
import '../jobject.dart';
import '../third_party/generated_bindings.dart';
import '../types.dart';

final class JStringType extends JObjType<JString> {
Expand Down Expand Up @@ -45,7 +44,7 @@ class JString extends JObject {
static const JObjType<JString> type = JStringType();

/// Construct a new [JString] with [reference] as its underlying reference.
JString.fromRef(JStringPtr reference) : super.fromRef(reference);
JString.fromRef(super.reference) : super.fromRef();

/// The number of Unicode characters in this Java string.
int get length => Jni.env.GetStringLength(reference);
Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/nio/jbuffer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class JBuffer extends JObject {
// ignore: overridden_fields
late final JObjType<JBuffer> $type = type;

JBuffer.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JBuffer.fromRef(super.reference) : super.fromRef();

static final _class = Jni.findJClass(r"java/nio/Buffer");

Expand Down
4 changes: 1 addition & 3 deletions jni/lib/src/nio/jbyte_buffer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ class JByteBuffer extends JBuffer {
// ignore: overridden_fields
late final JObjType<JByteBuffer> $type = type;

JByteBuffer.fromRef(
JObjectPtr ref,
) : super.fromRef(ref);
JByteBuffer.fromRef(super.reference) : super.fromRef();

static final _class = Jni.findJClass(r"java/nio/ByteBuffer");

Expand Down
4 changes: 2 additions & 2 deletions jni/lib/src/util/jiterator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class JIterator<$E extends JObject> extends JObject implements Iterator<$E> {

JIterator.fromRef(
this.E,
JObjectPtr ref,
) : super.fromRef(ref);
super.reference,
) : super.fromRef();

static final _class = Jni.findJClass(r"java/util/Iterator");

Expand Down
4 changes: 2 additions & 2 deletions jni/lib/src/util/jlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class JList<$E extends JObject> extends JObject with ListMixin<$E> {

JList.fromRef(
this.E,
JObjectPtr ref,
) : super.fromRef(ref);
super.reference,
) : super.fromRef();

static final _class = Jni.findJClass(r"java/util/List");

Expand Down
4 changes: 2 additions & 2 deletions jni/lib/src/util/jmap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class JMap<$K extends JObject, $V extends JObject> extends JObject
JMap.fromRef(
this.K,
this.V,
JObjectPtr ref,
) : super.fromRef(ref);
super.reference,
) : super.fromRef();

static final _class = Jni.findJClass(r"java/util/Map");

Expand Down
4 changes: 2 additions & 2 deletions jni/lib/src/util/jset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class JSet<$E extends JObject> extends JObject with SetMixin<$E> {

JSet.fromRef(
this.E,
JObjectPtr ref,
) : super.fromRef(ref);
super.reference,
) : super.fromRef();

static final _class = Jni.findJClass(r"java/util/Set");

Expand Down
Loading

0 comments on commit 55573a9

Please sign in to comment.