[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Adding getter/setter using AspectJ
|
On 15/07/2011 03:36, Andy Clement wrote:
Perhaps if we ran lombok though a similar jarjar run (to change its
references from jdt names to our package names), it would produce a
version more compatible with AspectJ.
Thanks for your detailed response Andy. I don't think anyone has really
looked into what is causing this issue:
https://groups.google.com/forum/#!topic/project-lombok/ZkLsTZVSgD4
<https://groups.google.com/forum/#%21topic/project-lombok/ZkLsTZVSgD4>
some APT thing should be possible but I haven't tried it recently (I
remember working on getting APT to behave for some early Spring Roo
prototype, but in the end they didn't use it).
Exactly the approach I was thinking about using. Generate ITDs Just
like Roo but triggered by APT.
Hmm, actually, I changed my mind there - if you ITD'd a new field
with one of these new annotations on (e.g. the one to create get/set)
then the weaver would need updating to create them -
Do you mean the weaver would need to be triggered to process the new IDTs?
What would setField(String name, Object value) do? something like:
if (name.equals("foo")) {
this.foo=value;
} else if (name.equals("bar")) {
this.bar=value;
}...
AspectJ can be extended to do things like that, but we'd need a
compelling use case and justification that it fits into an Aspect
Oriented Programming language.
Understood - its not very AOP.
If one purpose is just faster than reflective invocation, perhaps
MethodHandles in Java7 will go some way to making it more efficient
Great tip, thanks Andy. I had not come across those but it looks like
they will solve the problem as you suggest.
Cheers!