Skip to main content

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

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


Back to the top