Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

predicate is not usable by but exposed to JavaScript. #210

Closed
wowoName opened this issue Aug 31, 2023 · 3 comments
Closed

predicate is not usable by but exposed to JavaScript. #210

wowoName opened this issue Aug 31, 2023 · 3 comments

Comments

@wowoName
Copy link

Type of parameter 'predicate' in 'RowResult[] DataTable.Select(Predicate predicate)' is not usable by but exposed to JavaScript.

public RowResult[] Select(Predicate predicate){
return rows.stream().filter(predicate).toArray(RowResult[]::new);
}

@rluble
Copy link
Collaborator

rluble commented Aug 31, 2023

That seems correct, the class java.util.Predicate is opaque to JavaScript (it is not marked @JsType nor has any @JsMethod)

I assume the the class DataTable is either marked @JsType or its method Select(Predicate) is declared as @JsMethod and that is why the warning is emitted. The method is declared to be callable directly from user written JavaScript code but takes a parameter that is opaque.

Difficult to tell with certainty since it is an incomplete snippet.

@rluble
Copy link
Collaborator

rluble commented Aug 31, 2023

Closing the issue as WAI.

@rluble rluble closed this as completed Aug 31, 2023
@wowoName
Copy link
Author

wowoName commented Sep 1, 2023

thanks!
This is my code:
@jstype(isNative = true,namespace = JsPackage.GLOBAL)
public class DataTable {

@JsMethod
public native  RowResult[] Select(Predicate<RowResult> predicate);

}。
I am trying to rewrite the DataTable class in js as an overridden java class. So the above problem occurred when I was packing. (When I typed the complete java code, I found that the size of the package was too large, almost 90M, so I rewrote some java classes in js to reduce the size of the package). If the current issue does not work out well, is there any way to reduce the package size (currently my configured compilationLevel: SIMPLE_OPTIMIZATIONS).
thanks~

@google google locked and limited conversation to collaborators Sep 1, 2023
@rluble rluble converted this issue into discussion #211 Sep 1, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants