Skip to content

Commit

Permalink
[J2KT] Cover non-public methods in nativekttypes readable.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699198716
  • Loading branch information
Googler authored and copybara-github committed Nov 22, 2024
1 parent d0e9c47 commit 92281f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void memberAccess() {
topLevel.instanceField = "foo";
Object fooStaticField = topLevel.staticField;
topLevel.staticField = "foo";
// TODO(b/380317304): Uncomment when fixed.
// topLevel.nonPublicField = 0;
int i1 = topLevel.fieldToRename;
int i2 = topLevel.methodToRename();
int i3 = topLevel.getMethodAsProperty();
Expand All @@ -43,6 +45,8 @@ public void memberAccess() {
boolean i6 = topLevel.isFieldToRename;
boolean i7 = topLevel.isMethodAsProperty();
int i8 = topLevel.getstartingmethodAsProperty();
// TODO(b/380317304): Uncomment when fixed.
// topLevel.nonPublicMethod();

NativeTopLevel.Nested<String> nested = new NativeTopLevel.Nested<>("foo");
String nestedInstanceMethod = nested.instanceMethod("foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public Inner(I i) {}
@KtName("renamedField")
public int fieldToRename;

int nonPublicField;

@KtName("renamedMethod")
public native int methodToRename();

Expand Down Expand Up @@ -75,5 +77,7 @@ public NativeTopLevel(O o) {}

public native O instanceMethod(O o);

native void nonPublicMethod();

public static native <S> S staticMethod(S s);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public KInner(I i) {}
public static Object staticField;
public int renamedField;

int nonPublicField;

public int renamedMethod() {
return 0;
}
Expand Down Expand Up @@ -90,6 +92,8 @@ public O instanceMethod(O o) {
return o;
}

void nonPublicMethod() {}

public static <S> S staticMethod(S s) {
return s;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ open class KTopLevel<O> {
@ObjCName("renamedField_")
var renamedField: Int = 0

@JvmField
internal var nonPublicField_pp_nativekttypes_nativekt: Int = 0

@ObjCName("renamedMethod")
open fun renamedMethod(): Int {
return 0
Expand Down Expand Up @@ -95,6 +98,8 @@ open class KTopLevel<O> {
return o
}

internal open fun nonPublicMethod_pp_nativekttypes_nativekt() {}

@ObjCName("J2ktNativekttypesNativektKTopLevelCompanion", exact = true)
companion object {
@JvmField
Expand Down

0 comments on commit 92281f9

Please sign in to comment.