-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lombok should run flawlessly as agent in ecj environment. Lombok as AP in ecj is broken. #285
Comments
👤 reinierz 🕗 May 29, 2011 at 04:38 UTC public <X> X[] toArray(X[] foo) {} <-- this won't compile in ecj if lombok is on the classpath, even if there are no lombok annotations anywhere in the project. As a fix, make lombok detect whether its on ecj or eclipse when running as an agent, so that lombok can still be used with ecj via a -javaagent VM parameter. |
👤 reinierz 🕗 Jun 06, 2011 at 18:14 UTC Actions to be taken for this one: Test in ecj Test in GWT Test with play-lombok plugin (https://github.com/aaronfreeman/play-lombok) This should now work by passing -javaagent:lombok.jar=ECJ on the command line (-cp lombok.jar does nothing special anymore). |
👤 reinierz 🕗 Jun 06, 2011 at 20:17 UTC Latest edge now works in ecj. Next up: Does it work in gwt and play-lombok? |
👤 reinierz 🕗 Jun 06, 2011 at 22:59 UTC Stephan Habermann reports it works in GWT! |
👤 rgransberger@gmx.de 🕗 Jun 07, 2011 at 18:29 UTC Doesn't work with Maven Tycho, by using it with MAVEN_OPTS=-javaagent:lombok-edge.jar=ECJ Problem initializing lombok
java:3716) |
👤 reinierz 🕗 Jun 07, 2011 at 22:05 UTC Try adding -Xbootclasspath/p:lombok-edge.jar |
👤 rgransberger@gmx.de 🕗 Jun 08, 2011 at 05:54 UTC The problem is, that the jdt.core classes and lombok are not in the same classloader. When lombok is used as agent it's loaded by the AppClassLoader, as you can see, and not by the OSGI ClassLoader. That's why it doesn't have access to the jdt.core classes. But you gave me the right clue. It works when using In some places lombok patches the classloader to be able to access the jdt.core classes. Is this also possible for this scenario? It would be better not to have jdt.core on the bootclasspath. |
👤 reinierz 🕗 Jun 13, 2011 at 20:13 UTC Weird; lombok triggers on stuff inside that very jar so this works out fine in eclipse. Adding org.eclipse.jdt.jar to all OSGI ClassLoaders is a bit of a machine gun that might have drastic side-effects. We'd also have to detect that we're running in Tycho as doing that to eclipse definitely strikes me as a very bad idea. Where is that org.eclipse.jdt jar coming from? Tycho, or your own eclipse install (i.e. unrelated to tycho itself)? We could at least detect that this happened and produce an error message telling you add that to the VM parameter. |
👤 marcel.bruch 🕗 Jan 03, 2012 at 07:46 UTC What's the current state of integration into Tycho? Does it work with 0.10.6? |
👤 matthew.painter@import.io 🕗 Dec 05, 2012 at 16:18 UTC Hi guys, Any news on this? Desperate to use lombok with tycho without having to delombok! Matt |
👤 r.spilker 🕗 Dec 06, 2012 at 10:13 UTC Sorry, no, we didn't have time to investigate this any further yet. |
👤 michielwerk 🕗 Dec 05, 2013 at 14:04 UTC Exactly one year further, is there any progress on this issue? We also like to use Lombok in our Tycho project! :-) |
👤 matthew.painter@import.io 🕗 Dec 07, 2013 at 21:34 UTC We got Lombok working with Tycho and maven. Ill find out how and post back :) |
👤 matthew.painter@import.io 🕗 Dec 09, 2013 at 12:02 UTC To get it to work we had to set maven options like this, similar to the above - which is a hack, but it works. export MAVEN_OPTS="$maven_opts -Djava.io.tmpdir=.maven/tmp -Xmx1g -javaagent:${this_script_dir}/../build-jars/lombok_0.11.8.jar=ECJ -Xbootclasspath/p:${this_script_dir}/../build-jars/lombok_0.11.8.jar:${this_script_dir}/../build-jars/org.eclipse.jdt.core-3.8.2.v20120814-155456.jar" Let me know if this helps :) |
👤 michielwerk 🕗 Dec 10, 2013 at 16:17 UTC Hi Matthew, thanks a lot for your solution! It is a workaround, however we prefer an official solution. We are still considering if we want this workaround in our production code. Again, thanks a lot. Michiel |
👤 matthew.painter@import.io 🕗 Dec 10, 2013 at 17:30 UTC You only need it to compile - it doesn't need to touch production. |
👤 michielwerk 🕗 Dec 11, 2013 at 16:15 UTC It does touch your continuous integration environment, which consists of several products. We like to keep this one 'hack' free too. However we are still considering. Thx, M |
End of migration |
I worked on getting Tycho to compile with the lombok agent yesterday and it seems to work when not loading the classes directly but from the ClassLoaders of the objects which are passed in like this (not optimal at the moment, just a POC):
The other methods without return types work but this one still gives me a ClassNotFoundException because of the return type 'TypeBinding'.
@rzwitserloot Any idea how to work around this?
|
@rgra That doesn't appear to add up; as far as I know, j.l.Class's 'cast' method either does nothing whatsoever, or, it throws a ClassCastException, depending on whether the passed object is a subtype of the type represented by the j.l.C instance. Well, that, and it makes javac compile the code versus complaining that the types don't align, just like an actual cast-via-normal-java-syntax ( I don't see how that would possibly make any difference. I assume you were thinking of adding the reflection based cast ( I just don't yet see how this could possibly fix it. Perhaps the best next step is to file a new bug issue with a self contained test case along the lines of 'download tycho from here, run this example project, watch it not work', so we have a playground to get to the bottom of this issue. |
Sorry I was a bit unclear. The code in
This is why I'm trying to get rid of the return type here Then add this to the ASM generated code along the lines of |
D'oh, no, that was clear, I was just having a dumb moment. Yeah, that makes sense. I'm on it. |
@rzwitserloot You can import this in Eclipse and activate the target from the target plugin to make it compile in eclipse. Go to this dir and find the product for your platform and start it: Switch to the lombok branch and add |
@rgra okay, lombok.patcher is now at version 0.32 with support for this. I've updated the wrapreturnvalues test in lombok.patcher to show off the new cast functionality. I've also pushed a commit on lombok itself to update to this new 0.32 version of lombok.patcher. Let me know if there's anything more that's needed :) |
@rzwitserloot Thank you. |
@rzwitserloot Is there a performance reason that transplant() is not used all the time in EclipsePatcher? |
- Changed Patching for Tycho - Added Tycho test cases
A working version is now committed. There are three testcase which fail for
ExtensionMethodPlain does not work in Tycho because the used jdt-ecj version is newer. The
|
Hi @rzwitserloot. Are you still interested in merging this at some point? |
Apologies for letting this one fall by the wayside. @rgra I've used your work in 6503177 linked above as the blueprint, but there were a bunch of things going on there that I wasn't sure about, so I solved the problem in a somewhat different way:
I ran into problems with the tycho-example project; it doesn't work on java14 (still using unpack200 which is gone at this point), but it seems to do allright on java11. With the current edge release I end up at:
Which is weird, because surely adoptopenjdk11 is a 1.6 compliant VM. However, this is far fewer errors than before this fix, so I'm hoping it's fixed. Can you test the current edge for me? NB: A lot of your commit involves adding a test for tycho to the build, which is a good idea, but I want to investigate that a little further. On my system, a simple |
Hi @rzwitserloot. Thanks for picking this up again. I tried the edge release, it doesn't work :-( Java 11 is funny. It shows the "Annotation processing" message when an "argument type mismatch" is happening when applying You can see the full error with I still think it is necessary to let the original class loader load the classes like I did. But your design is clearer. If you want to attach a debugger after starting Maven: I was just testing MethodHandles hoping they might be faster, but didn't get to do the comparison yet. Actually I'm not sure what I did with the tests there ;) |
I've done this and I have no idea what I'm doing, so I need some help:
and then to give it a try:
This causes the following nasty things to occur:
Bizarrely, this does not occur if I omit Nevertheless, this error doesn't seem to stop the build. We then eventually get to...
which isn't the error I had before. Is this lombok's doing, or is something else wrong? A way I can cycle a test in a second or two instead of 45 would help a lot. |
@Rawi01 Thank you so much for making it work in the official releases. Just tested it with the newest lombok. No need for patching this part myself anymore. Yeah 🥇 |
Sorry for bumping this old thread, but I couldn't find any working instructions. What is the suggested way to get Lombok working with current Tycho versions? @rgra @rzwitserloot |
@bllngr I think the =TYCHO can be omitted. |
Migrated from Google Code (issue 212)
The text was updated successfully, but these errors were encountered: