Open AlexGeller1 opened 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 :)
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".
"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
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/.
I am not sure it's deployed on artifactory. I suspect it's not even up to date with JSweet 3 and J4TS 2
If you make it work, I can deploy it on the artifactory
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?
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"
@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
Steps to reproduce: