Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] weaver has problems with serializable generics

mmm, have you tried switching the interface around?

 public class MyList<E> implements Serializable, List<E>
  {

or applying the serializable through a declare parents aspect?

Just a couple of long shots ;)

Andy.

On 11/07/07, Peter Panec <peter.panec@xxxxxxxxxxxxx> wrote:
I used 1.5.3, but not the lastest dev build. I'll try it on that before
filing a bug.

Any ideas on a workaround? Even if it gets fixed in a developer build, I
can't use a
developer build in our production system.

- Peter

Andy Clement wrote:
> I would say an illegalstateexception from inside the weaver is an
> AspectJ bug, nothing you are doing wrong.  Are you on the latest dev
> build of AspectJ? (just in case it is already fixed).  I would
> recommend raising a bugzilla entry for it.
>
> Andy.
>
> On 11/07/07, Peter Panec <peter.panec@xxxxxxxxxxxxx> wrote:
>> The weaver throws an IllegalStateException when I have a generic type
>> that implements Serializable. An example would be:
>>
>>    public class MyList<E> implements List<E>, Serializable
>>     {
>>        ...
>>     }
>>
>> The problem occurs when the weaver is handling an advice of the form:
>>
>>     @AfterReturning(pointcut="execution(public List
>> com.mitratech.*.get*())", returning="rlist")
>>     public void afterReturningListMethod (List rlist)
>>     {
>>         //do something or nothing
>>     }
>>
>> The weaver throws the following error:
>>
>> abort ABORT -- (IllegalStateException) Can't ask to parameterize a
>> member of non-generic type: com.mitratech.MyList  kind(raw)
>> Can't ask to parameterize a member of non-generic type:
>> com.mitratech.MyList  kind(raw)
>> java.lang.IllegalStateException: Can't ask to parameterize a member of
>> non-generic type: com.mitratech.MyList  kind(raw)
>>     at
>> org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:612)
>>
>>     at
>> org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:597)
>>
>>     at
>> org.aspectj.weaver.ReferenceType.getDeclaredFields(ReferenceType.java:377)
>>
>>     at
>> org.aspectj.weaver.bcel.LazyClassGen.hasSerialVersionUIDField(LazyClassGen.java:315)
>>
>>     at
>> org.aspectj.weaver.bcel.LazyClassGen.<init>(LazyClassGen.java:280)
>>     at
>> org.aspectj.weaver.bcel.BcelObjectType.getLazyClassGen(BcelObjectType.java:460)
>>
>>     at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1568)
>>     ...
>>
>> I'm wondering if there is a bug here. The reason I say this is that I
>> tried in on the Java source code for generic collections. Sure enough,
>> the weaver had problems with the Java generic ArrayList. Note the
>> problem only occurs when I run it on the source code; the weaver does
>> not have problems with the compiled ArrayList in rt.jar.
>>
>> I have pinpointed the problem to the presence of the Serializable
>> interface in the implements clause. If I remove Serializable from the
>> declaration of MyList above, as well as from the Java ArrayList class,
>> the weaver is happy.
>>
>> I tried using Externalizable instead of Serializable, but to no avail. I
>> really need my class to be serialized and I can't think of any
>> workaround. Any help on this matter would be appreciated.
>>
>> Thanks.
>>
>> - Peter
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
> .
>

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top