Skip to content
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

Using own Java libraries with jsweet #738

Open
Krzysztof-Dziardziel opened this issue Sep 8, 2022 · 2 comments
Open

Using own Java libraries with jsweet #738

Krzysztof-Dziardziel opened this issue Sep 8, 2022 · 2 comments

Comments

@Krzysztof-Dziardziel
Copy link

Hey,

Whenever I try to use JSweet with a code that uses another Java library, I'm getting errors:

[ERROR] Failed to execute goal org.jsweet:jsweet-maven-plugin:3.1.0:jsweet (generate-js) on project malana: transpilation failed: transpilation failed with 346 error(s) and 0 warning(s)
[ERROR]
[ERROR] =========================================
[ERROR] TRANSPILATION ERRORS SUMMARY:
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Interface.java(19,12)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Interface.java(20,29)[ts] Cannot find namespace 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Interface.java(20,43)[ts] Cannot find name 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(43,31)[ts] Property 'bhavani' does not exist on type 'typeof <organization-name>'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(156,31)[ts] Cannot find namespace 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(156,45)[ts] Cannot find name 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(158,9)[ts] Cannot find namespace 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Cannot find namespace 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Cannot find name 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Cannot find namespace 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Namespace 'com.<organization-name>' has no exported member 'yuga'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Property 'yuga' does not exist on type 'typeof <organization-name>'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/controller/Controller.java(229,6)[ts] Cannot find name 'org'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Response.java(6,13)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Response.java(6,13)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Response.java(6,13)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/MalanaSeed.java(5,37)[ts] Namespace 'com.<organization-name>' has no exported member 'bhavani'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Finalise.java(10,13)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Finalise.java(38,12)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/Finalise.java(42,29)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/ParserAnalytics.java(41,40)[ts] Property 'join' does not exist on type 'typeof StringHelper'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/types/ValueMap.java(13,34)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(21,34)[ts] Property 'File' does not exist on type 'typeof io'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(25,35)[ts] Namespace 'java.io' has no exported member 'File'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(30,38)[ts] Property 'FileInputStream' does not exist on type 'typeof io'. Did you mean 'FilterInputStream'?
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(81,6)[ts] Property 'File' does not exist on type 'typeof io'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(84,35)[ts] Namespace 'java.lang' has no exported member 'ClassLoader'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/Helper.java(84,35)[ts] Property 'getClassLoader' does not exist on type 'Class<any>'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(21,40)[ts] Namespace 'com.<organization-name>' has no exported member 'commons'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(64,90)[ts] Property 'bhavani' does not exist on type 'typeof <organization-name>'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(89,43)[ts] Namespace 'java.util' has no exported member 'regex'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(89,59)[ts] Property 'regex' does not exist on type 'typeof util'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(90,37)[ts] Namespace 'java.util' has no exported member 'regex'.
[ERROR] * .../src/main/java/com/<organization-name>/malana/compiler/lex/Regex.java(98,47)[ts] Namespace 'com.<organization-name>' has no exported member 'yuga'.

Could anyone point me on how should I change the libraries so I can use them? Seems like I need to create a candy (?), but I have no idea on where to start as I don't have much experience in Java (JS background here!).

I would very appreciate any suggestions :)

@lgrignon
Copy link
Collaborator

Hello @Krzysztof-Dziardziel,

Did you read those pieces of documentation:
Generating JSweet candies from existing TypeScript definitions

And
Packaging a JSweet jar (candy)

?

You have a quick start in it :) I hope it still works though 🤞

That would be good that you read a bit about Maven because you are going to need it 😄
In addition, basic usage skills are enough to use JSweet https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

@tonychunxizhu
Copy link

Hey @Krzysztof-Dziardziel, as @lgrignon mentioned, if you want to use a 3rd-party lib in your jsweet project, you have to make a candy for this lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants