Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Strange Pointcut Method Conflict Errors

It appears that the null pointer issue becomes more visible  with
today's build of AJDT 1.3.0 (a full trace and new dialog box), it
appears to be this issue:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=110927

Shawn


On Wed, 2005-09-28 at 14:15 -0700, Shawn Potter wrote:
> This is an update:
> 
> I located a class that extends ArrayList and I confirmed that it was the
> class generating the 3] and 4] errors. I added an exclusion statement to
> the declaration for that class, like the following example:
> 
> public aspect MyConcernIntertype extends MyConcernImpl {
>     
>     declare parents: (foundation..* 
>                        && !foundation.aspect..*
>                        && !foundation..*LogMessages
>                        && !foundation.utility.CustomArrayList
>                        ) 
>                        implements MyConcern;
> }
> 
> However, the situation is not better, its worse.
> 
> The addition of the exclusion for CustomArrayList creates a null-pointer
> exception in the aspectj compilation AND I now get more enum based
> classes conflicting via the expression ("can't use declare parents to
> make enum type foundation.xyz implement an interface
> MyConcernIntertype.aj").
> 
> It now considers the statement of
> 
> foundation..*
> 
> as directly targeting additional enum classes
> 
> A colleague suggested I use the AJDT trace viewer to find out what is
> happening and it does not give me any additional information.
> 
> still looking for a solution...
> 
> Shawn Potter
> 
> 
> 
> On Wed, 2005-09-28 at 10:49 -0700, Shawn Potter wrote:
> > Hello,
> > 
> > I have a scenario where I am getting conflicts on classes not targeted
> > by my "pointcut" declaration:
> > 
> > Environment: AJDT 1.3 under Eclipse 3.1 using Java 5
> > 
> > I am using the following pattern for defining my concerns:
> > 
> > 1. A java interface defining the methods I want for the API (e.g.
> > MyConcern.java).
> > 
> > 2. An abstract aspect implementing the methods for the concern with no
> > pointcut	declarations (e.g. MyConcernImpl.aj).
> > 
> > 3. A concrete aspect extending the abstract aspect with a pointcut
> > "declare" defined. (e.g. MyConcernIntertype.aj).
> > 
> > I have done this with three concerns, two work fine but the third is
> > giving me trouble around the implementation of:
> > 
> >     public boolean equals(Object obj);
> >     public int hashCode();
> > 
> > The definition of my concrete aspects are all the same (with appropriate
> > interface/class names for each, here is the basic pattern):
> > 
> >     declare parents: (foundation..* 
> >             && !foundation.aspect..*) 
> >             implements MyConcern; 
> > 
> > I want to crosscut this concern into all the foundation classes, which
> > is handled by  the foundation..*; I exclude the actual concerns by
> > excluding the package they are in (foundation.aspect).
> > 
> > For two of the concerns this works perfectly fine. For the one that
> > provides an implementation for equals and hashCode, I get the following
> > errors on the abstract aspect that provides the implementation of these
> > two methods:
> > 
> > 
> > 1]
> > inter-type declaration from foundation.aspect.MyConcernImpl conflicts
> > with existing member: boolean
> > java.lang.Enum<foundation.component.communication.LogMessages>.equals(java.lang.Object)	MyConcernImpl.aj
> > 
> > 2]
> > inter-type declaration from foundation.aspect.MyConcernImpl conflicts
> > with existing member: int
> > java.lang.Enum<foundation.component.communication.LogMessages>.hashCode()	MyConcernImpl.aj
> > 
> > 3]
> > inter-type declaration from foundation.aspect.MyConcernImpl conflicts
> > with existing member: boolean
> > java.util.AbstractList<E>.equals(java.lang.Object)	MyConcernImpl.aj
> > 
> > 4]
> > inter-type declaration from foundation.aspect.MyConcernImpl conflicts
> > with existing member: int java.util.AbstractList<E>.hashCode()
> > MyConcernImpl.aj
> > 
> > The errors 1] and 2] involve a class that is an enum. My understanding
> > is that enums are excluded from intertype modifications and will only
> > produce an error if directly named as part of the joinpoint. 
> > 
> > I think this error occurs because the enum class
> > foundation.component.communication.LogMessages implements an interface
> > foundation.log.LogMessages. This interface is a list member of the
> > "declared on" list provided in the AJDT context menu for the
> > declaration.
> > 
> > I have fixed this issue by including the an exclusion for LogMessages
> > with:
> > 
> >                        && !foundation..*LogMessages
> > 
> > I still find this a strange conflict but this fix is satisfactory.
> > 
> > For the errors 3] and 4] I am at a complete loss as to why
> > java.util.AbstractList is being targeted for a joinpoint for the
> > intertype methods... I tried the following addition to the pattern
> > matching experession but it did not resolve the issue.
> > 
> >                        && !java.util.AbstractList
> > 
> > Any ideas on how I can track this conflict down to something concrete
> > would be appreciated.
> > 
> > I have searched through the foundation classes for something that
> > extends AbstractList (or subclasses of AbstractList) but have not found
> > anything... is this the only way I can get into this kind of conflict?
> > 
> > Thanks,
> > 
> > Shawn Potter
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top