[project lombok] Playing with adding new lombok annotation

709 views
Skip to first unread message

Franz Allan Valencia See

unread,
Apr 23, 2010, 3:55:49 AM4/23/10
to Project Lombok
Good day,

I'm trying to create a simple @Hello field annotation that would create a `public String hello<FieldName>() { return "hello " + <fieldName> }`. 

First, I created an implementation of JavacAnnotationHandler<Hello>, and that worked (I can produce the desired method at it behaves as expected when I run on command line (maven)). However, when I created an implementation of EclipseAnnotationHandler<Hello>, I can no longer start my eclipse with my built lombok.jar. My Eclipse complains about :

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.IllegalArgumentException: The decisionWrapper method must either return 'boolean' or return 'void'.
at lombok.patcher.scripts.ExitFromMethodEarlyScript.<init>(ExitFromMethodEarlyScript.java:58)
at lombok.patcher.scripts.ScriptBuilder$ExitEarlyBuilder.build(ScriptBuilder.java:151)
at lombok.eclipse.agent.EclipsePatcher.patchAvoidReparsingGeneratedCode(EclipsePatcher.java:170)
at lombok.eclipse.agent.EclipsePatcher.registerPatchScripts(EclipsePatcher.java:59)
at lombok.eclipse.agent.EclipsePatcher.runAgent(EclipsePatcher.java:48)
at lombok.core.Agent.runAgents(Agent.java:56)
at lombok.core.Agent.premain(Agent.java:43)
... 6 more

Then when I added more details to that exception, I got this :

Caused by: java.lang.IllegalArgumentException: The decisionWrapper method must either return 'boolean' or return 'void'. decisionWrapper methodDescriptor is ()L(Ljava/lang/Object;)Z;. Class: lombok/eclipse/agent/PatchFixes. MethodName: checkBit24. Parameter Types: []. Return Type: (Ljava/lang/Object;)Z. 

Any ideas why?

PS: I've attached my java files if anybody's interested in taking a look at them :-)

Thanks,
--
Franz Allan Valencia See | Java Software Engineer
fran...@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see

--
You received this message because you are subscribed to the Google
Groups group for http://projectlombok.org/
 
To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-lombo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-lombok?hl=en
Hello.java
HandleHello.java
HandleHello.java

Reinier Zwitserloot

unread,
Apr 23, 2010, 4:21:43 PM4/23/10
to Project Lombok
Wow, that's _really_ weird. It's definitely not your handlers, it must
be some weird interaction or incompatibility in the way you're
building a custom version of lombok.jar.

Could you do me a favour and try to create yourself a vanilla
lombok.jar without your changes and see if this happens too or not?
Just to be sure that it's not your code but some weirdness in either
the buildscript or our code? Thanks!

On Apr 23, 9:55 am, Franz Allan Valencia See <franz....@gmail.com>
wrote:
> Good day,
>
> I'm trying to create a simple @Hello field annotation that would create a
> `public String hello<FieldName>() { return "hello " + <fieldName> }`.
>
> First, I created an implementation of JavacAnnotationHandler<Hello>, and
> that worked (I can produce the desired method at it behaves as expected when
> I run on command line (maven)). However, when I created an implementation
> of EclipseAnnotationHandler<Hello>, I can no longer start my eclipse with my
> built lombok.jar. My Eclipse complains about :
>
> Exception in thread "main" java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 9)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationIm pl.java:323)
> at
> sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationI mpl.java:338)
> Caused by: java.lang.IllegalArgumentException: The decisionWrapper method
> must either return 'boolean' or return 'void'.
> at
> lombok.patcher.scripts.ExitFromMethodEarlyScript.<init>(ExitFromMethodEarly Script.java:58)
> at
> lombok.patcher.scripts.ScriptBuilder$ExitEarlyBuilder.build(ScriptBuilder.j ava:151)
> at
> lombok.eclipse.agent.EclipsePatcher.patchAvoidReparsingGeneratedCode(Eclips ePatcher.java:170)
> at
> lombok.eclipse.agent.EclipsePatcher.registerPatchScripts(EclipsePatcher.jav a:59)
> at lombok.eclipse.agent.EclipsePatcher.runAgent(EclipsePatcher.java:48)
> at lombok.core.Agent.runAgents(Agent.java:56)
> at lombok.core.Agent.premain(Agent.java:43)
> ... 6 more
>
> Then when I added more details to that exception, I got this :
>
> Caused by: java.lang.IllegalArgumentException: The decisionWrapper method
> must either return 'boolean' or return 'void'. decisionWrapper
> methodDescriptor is ()L(Ljava/lang/Object;)Z;. Class:
> lombok/eclipse/agent/PatchFixes. MethodName: checkBit24. Parameter Types:
> []. Return Type: (Ljava/lang/Object;)Z.
>
> Any ideas why?
>
> PS: I've attached my java files if anybody's interested in taking a look at
> them :-)
>
> Thanks,
> --
> Franz Allan Valencia See | Java Software Engineer
> franz....@gmail.com
> LinkedIn:http://www.linkedin.com/in/franzsee
> Twitter:http://www.twitter.com/franz_see
>
> --
> You received this message because you are subscribed to the Google
> Groups group forhttp://projectlombok.org/
>
> To post to this group, send email to project...@googlegroups.com
> To unsubscribe from this group, send email to
> project-lombo...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/project-lombok?hl=en
>
>  Hello.java
> < 1KViewDownload
>
>  HandleHello.java
> 5KViewDownload
>
>  HandleHello.java
> 3KViewDownload

Franz Allan Valencia See

unread,
Apr 24, 2010, 5:09:37 AM4/24/10
to project...@googlegroups.com
Hmm..you're right. The one from the maven repo works well with my eclipse. But the one I built (without my changes except for updating the 'lombok.patcher.fileurl' and 'lombok.patcher.fileloc' properties) is not working.

Ant Version: 
Apache Ant version 1.7.1 compiled on June 27 2008
Java Version : 
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
OS:
Linux see 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC 2010 x86_64 GNU/Linux
Eclipse Version:
Eclipse Galileo (build id : 20090621-0832)

What could be the problem?

Thanks,
-- 
Franz Allan Valencia See | Java Software Engineer 

Reinier Zwitserloot

unread,
Apr 24, 2010, 6:43:42 AM4/24/10
to Project Lombok
I think I may know the issue - I've been updating lombok.patcher
project in a way that isn't compatible with lombok hailbunny. That's
my mistake, obviously. I'll see if I can fix that tomorrow.

On Apr 24, 11:09 am, Franz Allan Valencia See <franz....@gmail.com>
wrote:
> Hmm..you're right. The one from the maven repo works well with my eclipse.
> But the one I built (without my changes except for updating the
> 'lombok.patcher.fileurl' and 'lombok.patcher.fileloc' properties) is not
> working.
>
> Ant Version:
>
> Apache Ant version 1.7.1 compiled on June 27 2008
>
> Java Version :
>
> java version "1.6.0_16"
> Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
>
> OS:
>
> Linux see 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC 2010
> x86_64 GNU/Linux
>
> Eclipse Version:
>
> Eclipse Galileo (build id : 20090621-0832)
>
> What could be the problem?
>
> Thanks,
> --
> Franz Allan Valencia See | Java Software Engineer
> <http://www.twitter.com/franz_see>
> > > project-lombo...@googlegroups.com<project-lombok%2Bunsubscribe@go oglegroups.com>
> > > For more options, visit this group athttp://
> > groups.google.com/group/project-lombok?hl=en
>
> > >  Hello.java
> > > < 1KViewDownload
>
> > >  HandleHello.java
> > > 5KViewDownload
>
> > >  HandleHello.java
> > > 3KViewDownload
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups group forhttp://projectlombok.org/
>
> > To post to this group, send email to project...@googlegroups.com
> > To unsubscribe from this group, send email to
> > project-lombo...@googlegroups.com<project-lombok%2Bunsubscribe@go oglegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/project-lombok?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups group forhttp://projectlombok.org/
>
> To post to this group, send email to project...@googlegroups.com
> To unsubscribe from this group, send email to
> project-lombo...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/project-lombok?hl=en

Franz Allan Valencia See

unread,
Apr 24, 2010, 7:15:21 AM4/24/10
to project...@googlegroups.com
Cool. Thanks :) No hurries though. 

Btw, what revision in lombok.patcher should I revert to to have the compatible version? :)

Thanks,

-- 
Franz Allan Valencia See | Java Software Engineer 

Reinier Zwitserloot

unread,
Apr 25, 2010, 7:56:07 AM4/25/10
to Project Lombok
Try a git pull on lombok itself, I think everything should be back to
working order. Alternatively check the changelog timestamps on
lombok.patcher. The last one BEFORE the multi-month gap.

On Apr 24, 1:15 pm, Franz Allan Valencia See <franz....@gmail.com>
wrote:
> Cool. Thanks :) No hurries though.
>
> Btw, what revision in lombok.patcher should I revert to to have the
> compatible version? :)
>
> Thanks,
>
> --
> Franz Allan Valencia See | Java Software Engineer

Franz Allan Valencia See

unread,
Apr 27, 2010, 8:47:23 AM4/27/10
to project...@googlegroups.com
Thanks, the fresh checkout of your HEAD is now working great with my eclipse. 

Thanks again :-)

-- 
Franz Allan Valencia See | Java Software Engineer 
Reply all
Reply to author
Forward
0 new messages