cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 158 forks source link

Compilation of "new java.awt.Color(0)" fails with error "[ts] Cannot find name 'java'" #701

Open AlexGeller1 opened 3 years ago

AlexGeller1 commented 3 years ago

Steps to reproduce:

$unzip jsweet-quickstart-master.zip
$cd jsweet-quickstart-master
#patch src/main/java/quickstart/QuickStart.java
$cat src/main/java/quickstart/QuickStart.java
package quickstart;
public class QuickStart {
    public static void main(String[] args) {
        new java.awt.Color(0);
    }
}
$mvn generate-sources
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.jsweet:jsweet-quickstart:jar:3.2.0-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.jsweet:jsweet-quickstart:${jsweet.transpiler.version}, /home/alex/jsweet-bugs/bug2/pom.xml, line 6, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] --------------------< org.jsweet:jsweet-quickstart >--------------------
[INFO] Building JSweet quick start 3.2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from jsweet-plugins-release: https://repository.jsweet.org/artifactory/plugins-release-local/org/jsweet/jsweet-maven-plugin/3.2.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.jsweet:jsweet-maven-plugin:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-release (https://repository.jsweet.org/artifactory/plugins-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Failure to transfer org.jsweet:jsweet-maven-plugin:3.2.0-SNAPSHOT/maven-metadata.xml from https://repository.jsweet.org/artifactory/plugins-release-local was cached in the local repository, resolution will not be reattempted until the update interval of jsweet-plugins-release has elapsed or updates are forced. Original error: Could not transfer metadata org.jsweet:jsweet-maven-plugin:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-release (https://repository.jsweet.org/artifactory/plugins-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[INFO] 
[INFO] --- jsweet-maven-plugin:3.2.0-SNAPSHOT:jsweet (generate-js) @ jsweet-quickstart ---
Downloading from jsweet-plugins-release: https://repository.jsweet.org/artifactory/plugins-release-local/org/jsweet/jsweet-transpiler/3.2.0-SNAPSHOT/maven-metadata.xml
Downloading from jsweet-external: https://repository.jsweet.org/artifactory/ext-release-local/org/jsweet/jsweet-transpiler/3.2.0-SNAPSHOT/maven-metadata.xml
Downloading from jsweet-release: https://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/jsweet-transpiler/3.2.0-SNAPSHOT/maven-metadata.xml
Downloading from jsweet-plugins-snapshots: https://repository.jsweet.org/artifactory/plugins-snapshot-local/org/jsweet/jsweet-transpiler/3.2.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-release (https://repository.jsweet.org/artifactory/plugins-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-snapshots (https://repository.jsweet.org/artifactory/plugins-snapshot-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-release (https://repository.jsweet.org/artifactory/libs-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-external (https://repository.jsweet.org/artifactory/ext-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Failure to transfer org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from https://repository.jsweet.org/artifactory/plugins-release-local was cached in the local repository, resolution will not be reattempted until the update interval of jsweet-plugins-release has elapsed or updates are forced. Original error: Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-release (https://repository.jsweet.org/artifactory/plugins-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Failure to transfer org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from https://repository.jsweet.org/artifactory/plugins-snapshot-local was cached in the local repository, resolution will not be reattempted until the update interval of jsweet-plugins-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-plugins-snapshots (https://repository.jsweet.org/artifactory/plugins-snapshot-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Failure to transfer org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from https://repository.jsweet.org/artifactory/libs-release-local was cached in the local repository, resolution will not be reattempted until the update interval of jsweet-release has elapsed or updates are forced. Original error: Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-release (https://repository.jsweet.org/artifactory/libs-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[WARNING] Failure to transfer org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from https://repository.jsweet.org/artifactory/ext-release-local was cached in the local repository, resolution will not be reattempted until the update interval of jsweet-external has elapsed or updates are forced. Original error: Could not transfer metadata org.jsweet:jsweet-transpiler:3.2.0-SNAPSHOT/maven-metadata.xml from/to jsweet-external (https://repository.jsweet.org/artifactory/ext-release-local): Certificate for <repository.jsweet.org> doesn't match any of the subject alternative names: [platform.dlite.io, www.dlite.io]
[INFO] maven version: 3.6.0
[INFO] JSweet transpiler version 3.2.0-SNAPSHOT (build date: 2021-07-28 14:35:21)
[INFO] dependencies=[Dependency {groupId=org.jsweet, artifactId=jsweet-core, version=6.3.0, type=jar}, Dependency {groupId=org.jsweet.candies, artifactId=jquery, version=1.10.0-20170726, type=jar}]
[INFO] candies detection: add project dependency Dependency {groupId=org.jsweet, artifactId=jsweet-core, version=6.3.0, type=jar} => org.jsweet:jsweet-core:jar:6.3.0:compile
[INFO] candies detection: add project dependency Dependency {groupId=org.jsweet.candies, artifactId=jquery, version=1.10.0-20170726, type=jar} => org.jsweet.candies:jquery:jar:1.10.0-20170726:compile
[INFO] all candies artifacts: [org.jsweet.candies:jquery:jar:1.10.0-20170726:compile (1; enabled), org.jsweet:jsweet-core:jar:6.3.0:compile (1; enabled)]
[INFO] candies jars: [/home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar, /home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar]
[INFO] classpath from maven: /home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar:/home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar
[INFO] jsOut: /home/alex/jsweet-bugs/bug2/target/js
[INFO] bundle: null
[INFO] tsOut: /home/alex/jsweet-bugs/bug2/target/ts
[INFO] tsOnly: null
[INFO] tsserver: true
[INFO] declarations: null
[INFO] ignoreDefinitions: null
[INFO] declarationOutDir: null
[INFO] candiesJsOutDir: /home/alex/jsweet-bugs/bug2/webapp/candies
[INFO] ecmaTargetVersion: ES6
[INFO] moduleKind: none
[INFO] sourceMap: null
[INFO] sourceRoot: null
[INFO] compileSourceRootsOverridenull
[INFO] verbose: true
[INFO] veryVerbose: null
[INFO] jdkHome: /usr/lib/jvm/java-11-openjdk-amd64
[INFO] factoryClassName: null
[INFO] ignoredProblems: null
[INFO] javaCompilerExtraOptions: null
[INFO] extraSystemPath: null
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:423 - no configuration file found at /home/alex/jsweet-bugs/bug2/jsweetconfig.json
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:528 - creating transpiler version 3.2.0-SNAPSHOT (build date: 2021-07-28 14:35:21)
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:530 - current dir: /home/alex/jsweet-bugs/bug2/.
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:531 - base directory: /home/alex/jsweet-bugs/bug2
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:532 - working directory: /home/alex/jsweet-bugs/bug2/.jsweet
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:533 - tsOut: /home/alex/jsweet-bugs/bug2/target/ts - /home/alex/jsweet-bugs/bug2/target/ts
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:534 - jsOut: /home/alex/jsweet-bugs/bug2/target/js - /home/alex/jsweet-bugs/bug2/target/js
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:535 - candyJsOut: /home/alex/jsweet-bugs/bug2/webapp/candies
2021-09-20 09:28:46.046 INFO  JSweetTranspiler:536 - factory: org.jsweet.transpiler.JSweetFactory@4eb166a1
2021-09-20 09:28:46.046 DEBUG JSweetTranspiler:537 - compile classpath: /home/alex/jsweet-bugs/bug2/jsweet_extension:/home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar:/home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar
2021-09-20 09:28:46.046 DEBUG JSweetTranspiler:538 - runtime classpath: /usr/share/maven/boot/plexus-classworlds-2.x.jar
2021-09-20 09:28:46.046 DEBUG JSweetTranspiler:539 - extension directory: /home/alex/jsweet-bugs/bug2/jsweet_extension
2021-09-20 09:28:46.046 INFO  CandyProcessor:123 - candies processor classpath: /home/alex/jsweet-bugs/bug2/jsweet_extension:/home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar:/home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar
2021-09-20 09:28:46.046 INFO  CandyProcessor:141 - extracted candies directory: /home/alex/jsweet-bugs/bug2/webapp/candies
[INFO] source includes: {}
[INFO] source excludes: {}
[INFO] sources paths: [/home/alex/jsweet-bugs/bug2/src/main/java]
[INFO] sources paths from resources: [/home/alex/jsweet-bugs/bug2/src/main/java]
[INFO] sourceFiles=[/home/alex/jsweet-bugs/bug2/src/main/java/quickstart/QuickStart.java]
2021-09-20 09:28:46.046 DEBUG ProcessUtil:67 - extra path: 
2021-09-20 09:28:46.046 INFO  ProcessUtil:138 - cannot find tsc - searching in /home/alex/.jsweet.v3-node_modules
2021-09-20 09:28:46.046 INFO  CandyProcessor:226 - 2 candies found in classpath
2021-09-20 09:28:46.046 INFO  CandyProcessor:163 - candies are up to date
2021-09-20 09:28:46.046 DEBUG JavaCompilationComponents:106 - charset: UTF-8
2021-09-20 09:28:46.046 DEBUG JavaCompilationComponents:107 - strict mode: false
2021-09-20 09:28:47.047 INFO  JavaCompilationComponents:122 - creating JavaCompiler task with options: JavaCompilerOptions: [--module-path, /home/alex/jsweet-bugs/bug2/jsweet_extension:/home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar:/home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar, -cp, /home/alex/jsweet-bugs/bug2/jsweet_extension:/home/alex/.m2/repository/org/jsweet/candies/jquery/1.10.0-20170726/jquery-1.10.0-20170726.jar:/home/alex/.m2/repository/org/jsweet/jsweet-core/6.3.0/jsweet-core-6.3.0.jar, -Xlint:path, -encoding, UTF-8]
2021-09-20 09:28:47.047 INFO  JSweetTranspiler:960 - scanning /home/alex/jsweet-bugs/bug2/src/main/java/quickstart/QuickStart.java...
2021-09-20 09:28:48.048 INFO  JSweetTranspiler:986 - output file: quickstart/QuickStart.ts
2021-09-20 09:28:48.048 INFO  JSweetTranspiler:1011 - created /home/alex/jsweet-bugs/bug2/target/ts/quickstart/QuickStart.ts
2021-09-20 09:28:48.048 INFO  JSweetTranspiler:865 - ts2js on org.jsweet.transpiler.TypeScript2JavaScriptWithTsserverTranspiler@4342c13 sourceFiles=1
2021-09-20 09:28:48.048 DEBUG TypeScript2JavaScriptWithTsserverTranspiler:48 - ts2js with tsserver: [/home/alex/jsweet-bugs/bug2/target/ts/quickstart/QuickStart.ts, /home/alex/jsweet-bugs/bug2/.jsweet/candies/typings/META-INF/resources/typings/jquery/1.10.0-20170726/bundle.d.ts]
2021-09-20 09:28:48.048 INFO  TypeScript2JavaScriptWithTsserverTranspiler:76 - launching tsserver compilation : 
compilerOptions=ts.cmd.tsc.CompilerOptions@566e142 
sourcesFilePaths=[/home/alex/jsweet-bugs/bug2/target/ts/quickstart/QuickStart.ts, /home/alex/jsweet-bugs/bug2/.jsweet/candies/typings/META-INF/resources/typings/jquery/1.10.0-20170726/bundle.d.ts]
2021-09-20 09:28:48.048 INFO  TypeScript2JavaScriptWithTsserverTranspiler:174 - creating TypeScriptServiceClient
2021-09-20 09:28:48.048 DEBUG TypeScript2JavaScriptWithTsserverTranspiler:79 - tsserver client built
2021-09-20 09:28:48.048 INFO  TypeScript2JavaScriptWithTsserverTranspiler:84 - open external project: /home/alex/jsweet-bugs/bug2/target/ts
2021-09-20 09:28:48.048 DEBUG TypeScript2JavaScriptWithTsserverTranspiler:90 - tsserver project opened: /home/alex/jsweet-bugs/bug2/target/ts
2021-09-20 09:28:56.056 INFO  TypeScript2JavaScriptWithTsserverTranspiler:108 - tsserver project compiled: /home/alex/jsweet-bugs/bug2/target/ts
2021-09-20 09:29:01.001 ERROR TypeScript2JavaScriptWithTsserverTranspiler:121 - TypeScript error: [ts] Cannot find name 'java'. at /home/alex/jsweet-bugs/bug2/target/ts/quickstart/QuickStart.ts(5)
2021-09-20 09:29:01.001 ERROR output:55 - [ts] Cannot find name 'java'. at /home/alex/jsweet-bugs/bug2/src/main/java/quickstart/QuickStart.java(5)
2021-09-20 09:29:01.001 INFO  JSweetTranspiler:849 - transpilation process finished in 14650 ms 
> java2ts: 1274.914142ms
> ts2js: 13229.559653ms

[ERROR] transpilation failed
org.apache.maven.plugin.MojoFailureException: transpilation failed with 1 error(s) and 0 warning(s)

=========================================
TRANSPILATION ERRORS SUMMARY:
* /home/alex/jsweet-bugs/bug2/src/main/java/quickstart/QuickStart.java(5,36)[ts] Cannot find name 'java'.

=========================================
    at org.jsweet.AbstractJSweetMojo.transpile (AbstractJSweetMojo.java:701)
    at org.jsweet.JSweetMojo.execute (JSweetMojo.java:43)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  19.439 s
[INFO] Finished at: 2021-09-20T09:29:01+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jsweet:jsweet-maven-plugin:3.2.0-SNAPSHOT:jsweet (generate-js) on project jsweet-quickstart: transpilation failed: transpilation failed with 1 error(s) and 0 warning(s)
[ERROR] 
[ERROR] =========================================
[ERROR] TRANSPILATION ERRORS SUMMARY:
[ERROR] * /home/alex/jsweet-bugs/bug2/src/main/java/quickstart/QuickStart.java(5,36)[ts] Cannot find name 'java'.
[ERROR] 
[ERROR] 
[ERROR] =========================================
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
dispose client - process=ts.nodejs.NodejsProcess@7f66334
lgrignon commented 3 years ago

Hello. If you want to use AWT with JSweet, you need to ship j4ts AND j4ts-awt-swing in your project. https://github.com/j4ts/j4ts-awt-swing/blob/master/src/main/java/java/awt/Color.java

Note: this library offers a minimal support but is far from comprehensive. Nevertheless, it's happily open for contributions :)

AlexGeller1 commented 3 years ago

Very good. We stumbled on the issue because we had our own, very thin, implementation of some of the classes around Graphics2D and with the latest version, that code collided with your code (I don't remember the exact error but apparently the compiler noticed that there were two version of some classes (mine and yours). Now, I am fine with using yours and I changed my code to subclass your classes where needed. Regarding contributions to Graphics2D one would have to make a fundamental decision on what to base the implementation, agree? Currently we are SVG based but a canvas based solution may have some advantages depending on the application type.

Something else. I tried to recompile just now after cleaning my ~/.jsweet* directories and I am getting the error "Failure to find org.jsweet:jsweet-maven-plugin:jar:3.2.0-SNAPSHOT".

lgrignon commented 3 years ago

"Regarding contributions to Graphics2D one would have to make a fundamental decision on what to base the implementation, agree? Currently we are SVG based but a canvas based solution may have some advantages depending on the application type."

Indeed, I think @renaudpawlak is the original author of j4ts-awt-swing, if you have any question on a design matter please feel free to ask here, we will be glad to answer it. AFAIK for now it uses canvas indeed, which seems a good solution. We could imagine having a different implementation for SVG, that would be interesting, but would require some work.

"Something else. I tried to recompile just now after cleaning my ~/.jsweet* directories and I am getting the error "Failure to find org.jsweet:jsweet-maven-plugin:jar:3.2.0-SNAPSHOT"." We faced an issue with artifactory yesterday but this is now fixed. Could you please try again? If failure persists, please try with release version 3.1.0?

Thanks

AlexGeller1 commented 3 years ago

Thanks, that fixed it!

If you want to use AWT with JSweet, you need to ship j4ts AND j4ts-awt-swing in your project.

In what repository do I find j4ts-awt-swing? I can't find neither in https://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/ nor in https://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/j4ts/.

lgrignon commented 3 years ago

I am not sure it's deployed on artifactory. I suspect it's not even up to date with JSweet 3 and J4TS 2

lgrignon commented 3 years ago

If you make it work, I can deploy it on the artifactory

AlexGeller1 commented 3 years ago

Hm, isn't there another way out of the problem? Let me just make sure that we are both clear on the problem. Our project compiled fine under 2.3.5-SNAPSHOT. Parts of the project are used with a standard Swing as well as in a Browser application. Some of those classes use awt classes like java.awt.Color. For jsweet we therefore wrote our, very lightweigt, version of those classes. When moving to version 3.1.0 of jsweet the compiler complained that these classes already exist in the system and so the project wouldn't compile anymore.

That is the situation.

Is there perhaps a way that we can make our project compile again? Perhaps there is some way to say that our version of java.awt.Color takes precedence at least until your version of it is in a workable state?

Actually we would prefer to use our version of the classes also as a long term solution since your canvas based solution is not suitable for us. I worry that your implementation might cause runtime problems when canvas based JavaScript code is executed and our application doesn't define any canvas. In the best case is just bloats the code. We would appreciate a solution that caters for both SVG and canvas. Shooting from the hip I would say that such a solution would starts from implementation agnostic abstract classes so that for example in Graphics2D there would be no canvas or DOM related code. That code would be in the implementation classes CanvasGraphics2D respectively SVGGraphics2D. Do you see a way how we can get the cow off the ice in a simple way?

AlexGeller1 commented 3 years ago

FYI, I registered issue 704 "Compilation of awt classes like java.awt.Color fail since upgrade to version 3.1.0" just now to be more precise on "the compiler complained when moving to version 3.1.0"

lgrignon commented 3 years ago

@AlexGeller1

We would appreciate a solution that caters for both SVG and canvas. Shooting from the hip I would say that such a solution would starts from implementation agnostic abstract classes so that for example in Graphics2D there would be no canvas or DOM related code. That code would be in the implementation classes CanvasGraphics2D respectively SVGGraphics2D. Do you see a way how we can get the cow off the ice in a simple way?

That seems, IMHO, one of the best options, but this would require some work and I won't have any time for this in the near future (I am not sure you would either?). I think the best for now would be to try to make your implementation pass with JSweet 3 on your project. Let's continue discussion in #704