GWT compiler doesn't create symbolMaps in the right place - gwt

I recently integrated gwt-log into my GWT and Maven based project mostly because of it's ability to automatically deobfuscate client side stack traces on the server. To make this possible gwt-log needs a so called symbol-map which maps all of the obfuscated symbol names to the original Java symbol names. The GWT compiler is capable of generating these symbol maps but for some reason they are saved to a strange location, eg.:
target/project-name-1.0-SNAPSHOT/project-name/.junit_symbolMaps/0F9FD6EF6A1BC63EA834AC33C7ED13F3.symbolMap
According to the GWT Maven Plugin Documentation the GWT compiler has a "-deploy" parameter which determines where to create files like that and which per default points to "WEB-INF/deploy". But even if I manually set this parameter to the correct location the compiler still creates the symbol-maps in the wrong folder.
I even downloaded the GWT Maven Plugin sources and added some log output to find out whether or not the "-deploy" parameter is passed correctly to the compiler but all seems fine.
Has anybody experienced a similar behavior?
Thanks!
Michael

Disable JUnit GWT Module.
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/552a9578a76587ae#

Related

Output folder of the Kotlin compiler in Eclipse

The Jetbrains Kotlin compiler in Eclipse outputs to a hidden folder inside the Eclipse compiler plugin. This hidden folder is then made available through the Eclipse Kotlin classpath container.
In bndtools we need a normal file system folder since bnd can run both from the file system as well as in Eclipse. Since the folder is a linked resource there is no known way to translate it outside Eclipse.
Anybody knows how to tell the Kotlin compiler to just output it in the bin folder?
Currently, this is not possible in the Kotlin Eclipse plugin.
To make it possible that Kotlin code can be used from Java, Kotlin plugin produce so-called lightweight class files to this folder. These class files do not contain bodies for methods and they are stored in memory.
Actual class files, that are used to run an application, are being built only before launch and they are produced to the default output folder. For now, we cannot produce class files on each save reasonably fast as there is no incremental compilation in the plugin yet:
Feel free to upvote for this issue.
From the short analysis of the code of Kotlin plugin, it looks like the proper method is KotlinCompiler.compileKotlinFiles. It is being called in two contexts:
KotlinBuilder.build — this is the one called on the project build; it makes a call stack trick (or rather a hack...) to check if being called from the LaunchConfigurationDelegate, and depending on the results, either compiles whole project (via its own private fun compileKotlinFiles), or just makes stubs in memory.
KotlinCompilerUtils.compileWholeProject — this is in fact being called from 1.; nice static method, perfect for abuse until the problem is correctly solved in the plugin. :)
So, I'd use the method from 2. wrapped in a similar way as compileKotlinFiles from file in 1.

Debugging GWT's JavaScript in Intellij

When I debug GWT's client code from Intellij, debugger shows variable names as they are in compiled JavaScript and not as they were named in Java:
When I move mouse over some variable I get ReferenceError:
I thought it is the task of source maps to convert between js and java names.
Have I configured something incorrectly or is it just the current state of source maps?
It appears do be a known GWT issue. Our developers are working with GWT team to support it in IDEA 15. You can track the progress here.
You can already try IDEA 15 EAP where it should partially work (not for all cases).

Anatomy of Menu

I'm trying to understand how a basic Lift 2.5 project works. I'm working from the lift_basic application template, and going over the SimplyLift tutorial. When following the tutorial I find that most things seem to work fine, but I'm struggling to understand the why. In particular:
Menu.i("Home") / "index" >> User.AddUserMenusAfter
When I look at the Lift API for Menu, no function i is listed for Menu, nor any function that seems to define /. (This may refer to a function on String, but the API for that seems to only reference / as operating on a token that follows; I'm not sure if i produces a String.) My basic question is; how do I determine what i() is doing, both here in the specific (what is Menu doing at this point in the process) and in general (when I come across a clearly-working function that is not mentioned in the API)?
As an aside, I'm currently using Eclipse as my IDE, with an sbt build that is actually compiling and loading the webapp locally. Eclipse doesn't seem to do a good job of inferring what objects/functions mean, since the build path does not contain the Lift libraries - they're loaded by sbt. Is it possible to make Eclipse aware of these without polluting the repo and maintaining the library configuration in two places?
i is defined in the companion object, not in the actual class. You can see the definition in the source here Menu.i or in the scaladoc:
/**
* A convenient way to define a Menu item that has the same name as its localized LinkText.
* <pre>Menu.i("Home") / "index"</pre> is short-hand for <pre>Menu("Home", S.loc("Home", Text("Home")) / "index"</pre>
*/
def i(nameAndLink: String): PreMenu = Menu.apply(nameAndLink, S.loc(nameAndLink, scala.xml.Text(nameAndLink)))
/ is defined as part of PreMenu and it allows you to specify where the menu loc gets served from.
If you are using eclipse, you can try the sbteclipse plugin which should help make eclipse aware of your dependencies.
about the second issue. Did you generate the project structure with SBT? Here's the full info: https://github.com/typesafehub/sbteclipse/
In short, I'd remove anything already-created from the folder and launched eclipse with-source=true After that "imported the project" into eclipse and see it just working.)

IJavaProject without Eclipse Environment in JDT

I have an exported Eclipse Java Project in my server and I want to be able to compile the project and use ASTParser with JDT.
I'm able to compile the project using BatchCompiler, however it runs on console and gives me PrintWriters instead of an array of problems and errors. Also I want to be able to use proposals in Eclipse and BatchCompiler didn't built for this purpose.
Therefore I tried to use ASTParser, it can be used with either char[] or ICompilationUnit. CompletionProposalCollector and org.eclipse.jdt.internal.compiler.Compiler.Compiler needs ICompilationUnit so I have to create an ICompilationUnit which only can be created by an IJavaProject (https://dl.dropboxusercontent.com/u/10773282/2012/eclipse_workspace.pdf) in order to be able to use these features.
It seems the only way to create IJavaProject is to use ResourcesPlugin.getWorkspace(), however it returns java.lang.IllegalStateException: Workspace is closed. on my computer and it seems the reason is that the program that I coded is not an Eclipse plug-in.
Is there any way to create IJavaProject without Eclipse environment?
From the comments, it looks like you are trying to do more than just parsing, you actually want to get some form of content assist.
I'm afraid that you're asking for too much. There is no simple way to get the power and flexibility of JDT outside of a running Eclipse instance (believe me, I've tried). There's no simple way, but if you are brave and strong willed, you can one of try following:
Run a headless Eclipse on your server that works on top of an actual workspace. This would be the easiest to implement, but would be the most resource intensive and least flexible way of doing things.
Use the jdt core jar, and create alternate implementations of the IResource hierarchy, and the parts of JFace that are used by the the parser and the CompletionEngine. This would likely be the most feature-rich way to go, but also the most brittle. I can't guarantee that this would work as you may need to create some very complex stubs for internal Eclipse non-API classes.
Avoid the CompletionEngine and the ASTParser entirely and just use the batch compiler. You would then need to provide an alternate implementation of org.eclipse.jdt.internal.compiler.env.INameEnvironment. This implementation would be able to find types, files, and compilation units in your actual project structure. You'd need to reimplement support for content assist, but this would most likely work reasonably well.
I am actually fairly interested in doing something like this (but I lack the time to do it). If you are seriously considering creating a headless JDT that can run on a server, feel free to ask for more information. I am quite familiar with JDT internals.
I've had a similar problem. Here is how to use ASTParser without Eclipse (it just needs the core JDT JAR on the classpath): http://blog.pdark.de/2010/11/05/using-eclipse-to-parse-java-code/

How do I get support for GPB in Eclipse?

I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc every time I make changes to the .proto files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto file is not on the path given by --proto-path, which it should be by all I can tell. Also, because I use ${build_files}, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke protoc (Protobuf compiler), than you may need no Eclipse plugin at all.
Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.