Sunday, June 18, 2023

GWT SDM Compile Extension

Hi everybody,

My setup where some GWT modules are running both standalone but also inside in iframes. If you add HTTPS to the mix, having to constantly edit bookmarklets is not fun.

So I created this little extension that you can find here: https://github.com/vasvir/gwt-sdm-compile

From the README:

This extension replaces the following bookmarklets:

  • Dev Mode On
  • Compile
  • Dev Mode Off

It works in Firefox and Chrome and it is Manifest V3 based.

The extension scans for all GWT modules in all frames (main window and iframes) but iframes with different origin do not work in Firefox currently.


The extension provides some rudimetary support to save the configuration so it can be reused for the specific module/protocol combination. This is useful when you have multiple GWT modules or HTTPS setups as described here https://vasvir.wordpress.com/2017/02/07/gwt-super-dev-mode-https-setup-in-7-steps/

Hope that you will find this useful.




--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAKbOjEztO%2BNdyhsNfx8s4upuSVmr40EvpXa528wkUYzktoGNHg%40mail.gmail.com.

Friday, June 16, 2023

Re: GWT compilation error with JDK 11

Thanks for your reply. Please see attached for the GWT lib specified in the java build path in Eclipse. I tried to compile it with JDK 8 and it didn't work either. 
The same project configuration in Eclipse worked in my old laptop, but not in my new laptop. The Eclipse in the new laptop is a copy of the Eclipse installed in the old laptop.

In addition, I also tried to  copy the "gwt-dev.jar" from the old laptop to the new one, but the compilation still gave me the following error.

Error: Could not find or load main class com.google.gwt.dev.Compiler

The project was compiled by using GWT->Compile option provided by the GWT Plugin installed in Eclipse.

Version: 2020-06 (4.16.0)
GWT Plugin version: 3.0

Your help is greatly appreciated!

thanks,
Jenny
On Friday, June 16, 2023 at 12:33:18 PM UTC-5 Colin Alworth wrote:
GWT 2.9 should support running on Java 11, both running on JDK 11 and compiling Java 11 sources.

Without other information, it sounds like there is a problem with your copy of gwt-dev.jar - the jar might be corrupt, or somehow not on your classpath?

Can you verify that the jar is present and correct, and share more specifics of how you are building?

On Thursday, June 15, 2023 at 6:00:43 PM UTC-5 jiny...@gmail.com wrote:
Hello,

I tried to compile our GWT 2.9 project with JDK 11, but encountered the following error:

Error: Could not find or load main class com.google.gwt.dev.Compiler

Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler

BTW, the Eclipse version is  Version: 2020-06 (4.16.0). 

Please help shed some lights on this issue.

thanks,
Jenny

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/78fbb2dc-9dc9-4cc5-bdbf-d96faa711534n%40googlegroups.com.

Re: Devmode compilation

Your stack trace stops just before where the issue is happening, but the GWT compiler believes that you are using code in an impossible way, and is forced to emit an error message to correctly compile out impossible code. Roughly, the "throw ClassCastException unless null" check means that there is some cast that must always fail - nothing ever implements the interface, or nothing ever calls the constructor. In draft mode, the compiler couldn't prove this, but when you were building for production, the compiler is confident that this is impossible.

What is likely happening is that you are doing an unchecked cast of some kind, possibly a native JS type to a @JsType-annotated interface that isn't marked as isNative=true or the like. In this scenario, the compiler knows that no native types could implement the interface, and since it sees no non-native types that implement it, there must be no such types, so any calls to the interface's methods are actually errors. Further, any code that would come after such a method call can never be called.

Look at the next frame up the stack trace, and see if you can tell what method call is being optimized out in this way. Probably you'll see that it either comes from a class or interface that can't be directly instantiated, but somehow (likely an unchecked cast) you have an instance of that type anyway.

As to correctness, this is a good check to have, as it removes impossible code, which _usually_ you don't want to have. Incorrect code can often lead to impossible code, but there are many reasonable cases where this check should be emitted, so it isnt necessarily wrong for a compiled application to have this.

On Friday, June 16, 2023 at 2:25:53 PM UTC-5 nikola wrote:
Some class cast exception...

Showing dialog with error2 Error: java.lang.ClassCastException
    at ClassCastException.createError (lw_ui-0.js:2052:10)
    at ClassCastException.initializeBackingError (lw_ui-0.js:2078:40)
    at ClassCastException.Throwable_0 (lw_ui-0.js:2017:8)
    at ClassCastException.Exception_0 (lw_ui-0.js:2095:15)
    at ClassCastException.RuntimeException_0 (lw_ui-0.js:16350:15)
    at new ClassCastException (lw_ui-0.js:217687:22)
    at checkCriticalType (lw_ui-0.js:225523:16)
    at throwClassCastExceptionUnlessNull (lw_ui-0.js:272:3)

It works with -draftCompile. What we are potentially losing having code compiled with -draftCompile? Is it safe to have it on production?

On Friday, June 16, 2023 at 7:36:50 PM UTC+2 Colin Alworth wrote:
Super Dev Mode skips many optimizations, both to decrease compile times and also to make incremental compilations possible - it isn't possible to make SDM behave the exact same as a production compile. One way you can get close is to specify -draftCompile (how you specify it may vary based on how you run the compiler) so that the production build skips many optimizations.

Can you elaborate on what the strange error is?

On Friday, June 16, 2023 at 11:32:37 AM UTC-5 nikola wrote:
Hello,

The code has passed in development mode but when it's deployed I got an strange error. Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting to have it equals

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9b14eb34-183d-49c6-bbb3-9748d41c514cn%40googlegroups.com.

Re: Devmode compilation

Some class cast exception...

Showing dialog with error2 Error: java.lang.ClassCastException
    at ClassCastException.createError (lw_ui-0.js:2052:10)
    at ClassCastException.initializeBackingError (lw_ui-0.js:2078:40)
    at ClassCastException.Throwable_0 (lw_ui-0.js:2017:8)
    at ClassCastException.Exception_0 (lw_ui-0.js:2095:15)
    at ClassCastException.RuntimeException_0 (lw_ui-0.js:16350:15)
    at new ClassCastException (lw_ui-0.js:217687:22)
    at checkCriticalType (lw_ui-0.js:225523:16)
    at throwClassCastExceptionUnlessNull (lw_ui-0.js:272:3)

It works with -draftCompile. What we are potentially losing having code compiled with -draftCompile? Is it safe to have it on production?

On Friday, June 16, 2023 at 7:36:50 PM UTC+2 Colin Alworth wrote:
Super Dev Mode skips many optimizations, both to decrease compile times and also to make incremental compilations possible - it isn't possible to make SDM behave the exact same as a production compile. One way you can get close is to specify -draftCompile (how you specify it may vary based on how you run the compiler) so that the production build skips many optimizations.

Can you elaborate on what the strange error is?

On Friday, June 16, 2023 at 11:32:37 AM UTC-5 nikola wrote:
Hello,

The code has passed in development mode but when it's deployed I got an strange error. Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting to have it equals

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/2bd6bf4a-df1f-4288-b5eb-41d309c37e11n%40googlegroups.com.

Re: GWT compilation error with JDK 11

GWT 2.9 should support running on Java 11, both running on JDK 11 and compiling Java 11 sources.

Without other information, it sounds like there is a problem with your copy of gwt-dev.jar - the jar might be corrupt, or somehow not on your classpath?

Can you verify that the jar is present and correct, and share more specifics of how you are building?

On Thursday, June 15, 2023 at 6:00:43 PM UTC-5 jiny...@gmail.com wrote:
Hello,

I tried to compile our GWT 2.9 project with JDK 11, but encountered the following error:

Error: Could not find or load main class com.google.gwt.dev.Compiler

Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler

BTW, the Eclipse version is  Version: 2020-06 (4.16.0). 

Please help shed some lights on this issue.

thanks,
Jenny

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/531a2b90-776a-4ed3-a797-8f9c5f4b5be5n%40googlegroups.com.

devmode compilation

Hello,

The code has passed in development mode but when it's deployed I got an strange error. Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting to have it equals?

The code has passed in development mode but when it's deployed I got an strange error.
Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting? (edited) 
The code has passed in development mode but when it's deployed I got an strange error.
Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting? (edited) 

The code has passed in development mode but when it's deployed I got an strange error.
Is there a difference in generated compiled code when deployed and code in development mode ?
And if true, where can I change that setting? (edited) 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/d71cdb28-596c-4a8c-806c-a4a969bf9d22n%40googlegroups.com.

Thursday, June 15, 2023

GWT compilation error with JDK 11

Hello,

I tried to compile our GWT 2.9 project with JDK 11, but encountered the following error:

Error: Could not find or load main class com.google.gwt.dev.Compiler

Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler

BTW, the Eclipse version is  Version: 2020-06 (4.16.0). 

Please help shed some lights on this issue.

thanks,
Jenny

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/1312f386-3a06-4b56-b87d-567cd48e24cfn%40googlegroups.com.