Making GWT 2.5 compiler use closure compiler - gwt

The release notes for GWT 2.5 say that the GWT compiler can optionally use the Closure compiler to provide additional JavaScript optimizations, does anyone know how to turn this optimization on?

The compile option is -XenableClosureCompiler. But I'm not sure if it already works with 2.5RC1.

Related

Swift: Turn on optimization or release mode for a single class

I have a class that takes 3 seconds to process data in Debug mode, but only takes 100ms in Release mode. There is obviously something wrong with it but all tests pass so I don't need any Debug features when using it.
Is there a way to make Xcode run the project in Debug mode but do all Release optimization for this single class?
The only workaround I can think of is to turn this into a framework with a release compile flag but that seems like a bit overkill.
The only workaround I can think of is to turn this into a framework with a release compile flag but that seems like a bit overkill.
This is the only stable way to do this at the moment (with Xcode 13). One more option is that you can try doing some timing measurements, it might be possible to rearrange your code so that even the debug codegen gives better results.
If this is throwaway code, you can try marking individual functions with the underscored attribute #_optimize(speed).
I'll repeat the disclaimer at the top of the doc:
WARNING: This information is provided primarily for compiler and standard library developers. Usage of these attributes outside of the Swift monorepo is STRONGLY DISCOURAGED.

Groovy Deprecated Methods and Eclipse - sort

I've got the following code which I wrote in groovy 1.8
someListOfLists.flatten().sort().unique()
I've moved over to groovy 2.3.x, and eclipse (using e4.4 GroovyEclipse plugin for Juno from snapshot release) is showing me the sort() method is now deprecated for sort(Collection<T> self), to which the advice is to use the sort(Iterable<T> self).
How do I now chain methods like this together to avoid the deprecation warnings?
My thinking was that as flatten() is returning an ArrayList (which is an Iterable) it should be fine. Also, I see doing
((Iterable) someListOfLists.flatten()).sort().unique()
removes the warning, but looks ugly.
So is this just eclipse not seeing that the correct sort will actually be used, or is there some other way to express my chain of methods?
The deprecation warnings are due to the fact that Eclipse is mapping Groovy methods to the mostly deprecated DefaultGroovyMethods class, which was just replaced by many separate other classes such as StringGroovyMethods, ResourceGroovyMethods etc.
It seems that in version 2.7.1 of the Groovy plugin, this was fixed... check your version of the plugin, maybe you just need to upgrade.
If that does not solve the problem, unfortunately, unless you can make the Groovy plugin change the methods mapping, you won't be able to get rid of the warnings, as far as I know. In IntelliJ I have the same problem.

Dynamic loading of a Scala compiler plugin

According to this post In order to create a Scala compiler plugin, one needs to compile the plugin into a jar, and then either specify the reference to the the jar as command line arguments, or place the jar in $SCALA_HOME/misc/scala-devel/plugins.
I need to call the compiler in runtime, with the scala compiler API (scala.tools.nsc).
Is it possible to Is it possible to the compiler plugin dynamically in runtime, before calling the compiler?
I am not entirely sure what you mean by loading it in runtime, but I assume you intend to also call the compiler at runtime then and supply it with that plugin.
In that case, yes this is possible. You can take a look at RunPlugin.scala from the alacs test suite for an example. The project's not really active anymore, but it provided compiler plugins for additional checks, which are also tested via a test suite involving the above class for runtime compilation with selected plugins.

Asserts removed in Cross-compiled code

are asserts removed in the resulting JavaScript of a GWT programm.
Regards,
Stefan
The GWT compiler removes them by default.
However there is a way to tell the compiler to keep them.
See here and here for more details.

Using a Scala library that is only available for an older Scala version

I am new to Scala. However, I a created a medium size program with Scala 2.9.0. Now I want to use an open source library which is only available for Scala 2.7.7.
Is it possible to use this 2.7.7 library in my Scala 2.9.0 program? How can I do it? I had already a look at sbt but did not really succeed. Has someone a hello world example for this?
It should be possible in principle using a custom classloader for the 2.7.7 jar and custom wrappers. But practically, since the library is open source, it's very likely that it would be less work to recompile it with 2.9 and make those changes which are required. (There usually aren't many.)
Typesafe has an early preview of a migration manager (http://typesafe.com/technology/migration-manager) which promises to report on and resolve binary incompatibilities. Apparently the early preview only report on incompatibilities, but it might be worth a shot.
The best approach would be to either use a maintained library or to update the code.
If you take the second option, compile the code with the flags -deprecation and -Xmigration.
This tells you what you need to change between versions.