Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Inter-type problems

Title: Message
All,
 
Ignore this request, I got it working now.  Thanks Ron for your help.
 
Thanks,

Ron DiFrango

 

-----Original Message-----
From: DiFrango, Ron
Sent: Wednesday, August 27, 2003 1:05 PM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] Inter-type problems

Ron,
 
That cleared most of the problems up, but I still got the following:
 
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone\risk\domain\DomainPropertiesAspect.aj:25 multiple bindings0, BindingTypePattern
(com.capitalone.risk.domain.AccountProperties, 0)
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone\risk\domain\DomainPropertiesAspect.aj:25 multiple bindings0, BindingTypePattern
(com.capitalone.risk.domain.AccountProperties, 0)

     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone\risk\domain\DomainPropertiesAspect.aj:29 multiple bindings0, BindingTypePattern
(com.capitalone.raui.app.icp.ContactPartyModel, 0)

     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalone\risk\domain\DomainPropertiesAspect.aj:29 multiple bindings0, BindingTypePattern
(com.capitalone.raui.app.icp.ContactPartyModel, 0)
 

Thanks,

 

Ron DiFrango

-----Original Message-----
From: Ron Bodkin [mailto:rbodkin@xxxxxxxxxxx]
Sent: Wednesday, August 27, 2003 11:10 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Inter-type problems

Ron,
 
One of the changes in AspectJ 1.1 is that inter-type declarations are only supported on simple types, not type patterns. See http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/README-11.html#SINGLE_INTERCLASS_TARGET
 
Try replacing DomainProperties+ with DomainProperties in your declarations (e.g., public boolean DomainProperties.listenersZapped = false;)
 
Even in AspectJ 1.0.x, writing an inter-type declaration on Type+ is redundant: if you define a member on Type, any subtype will also have the same member.
 
Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895
 
 
------------Original Message-------------
From: "DiFrango, Ron" <ron.difrango@xxxxxxxxxxxxxx>
To: "'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
Date: Wed, Aug-27-2003 5:45 AM
Subject: [aspectj-users] Inter-type problems
All,
 
I am trying to upgrade from 1.0.6 of aspectj to 1.1 and I ran into some compile problems with an inter-type aspect that we created.  The aspect code is as follows:
 
public aspect DomainPropertiesAspect {
   
    // define a point cut in the set account method of IncidentProperties
    pointcut IncidentPropertiesPointcut(AccountProperties ap) :
     call(public void IncidentProperties.setAccount(AccountProperties))
     && args(ap);
 
    // define a point cut in the set account method of ContactPartyModel
    pointcut contactPartyPointcut(ContactPartyModel cpm) : target(cpm) && call(void setAccount(AccountProperties));
   
    // apply the advise to remove all the listeners from an account when the next account
    // is retrieved.
    before(AccountProperties ap) : IncidentPropertiesPointcut(ap) && args(ap) {
      ap.removeAllListeners();
    }
   
    before(ContactPartyModel cpm) : contactPartyPointcut(cpm) && args(cpm) {
      cpm.getAccount().removeAllListeners();
    }
   
    // Add a boolean field to all instances of DomainProperties
    public boolean DomainProperties+.listenersZapped = false;
 
    // Add a method to recursively remove DomainProperty listeners from any
    // instance of DomainProperties
 
    public void DomainProperties+.removeAllListeners(){
     // to prevent the same object from being called twice.
        if(listenersZapped){
            return;
        }
        try{
            this.getAllChangeListeners().clear();
            this.listenersZapped = true;
 
     // get all fields defined in this class.  For each field that is an
     // instance of DomainProperties call the remove all listeners method.
            Field[] allFields = this.getClass().getDeclaredFields();
            if(allFields.length == 0) {
                return;
            } // if
            for(int i=0;i<allFields.length;i++) {
                Object theObject = allFields[i].get(this);
                if(theObject == null){
                    return;
                }
                if(theObject.getClass().isArray()){
                    for(int a = 0;a<Array.getLength(theObject);a++){
                        Object arrayObject = Array.get(theObject,a);
                        if(theObject instanceof DomainProperties){
                            callRemove(theObject);
                        } else {
                            break;
                        } // if
                    } // for
                } else if(theObject instanceof DomainProperties){
                    callRemove(theObject);
                } else if(theObject instanceof Collection){
                    Collection aCollection = (Collection) theObject;
                    Iterator iter = aCollection.iterator();
                    while(iter.hasNext()){
                        Object collectionObject = iter.next();
                        if(collectionObject instanceof DomainProperties){
                            callRemove(collectionObject);
                        } else {
                            break;
                        } // if
                    } // while
                } // if/else if
            } // for
        } catch(Exception e){
        } // try
       
    } // method
 
    // utility method to cast from Object to DomainProperties and call removeAllListeners
    private void DomainProperties+.callRemove(Object theObject){
        DomainProperties value = (DomainProperties) theObject;
        value.removeAllListeners();
    }
 
}
 
The error I get is the following:
 
     [echo] Compiling all java classes.
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:26 ap cannot be resolved
     [iajc] ap.removeAllListeners();
     [iajc] ^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:30 cpm cannot be resolved
     [iajc] cpm.getAccount().removeAllListeners();
     [iajc] ^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:34 Duplicate field DomainPropertiesAspec
.DomainProperties
     [iajc] public boolean DomainProperties+.listenersZapped = false;
     [iajc]                ^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:34 Syntax error on token "+", ";", "," e
pected
     [iajc] public boolean DomainProperties+.listenersZapped = false;
     [iajc]                                ^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:39 Duplicate field DomainPropertiesAspec
.DomainProperties
     [iajc] public void DomainProperties+.removeAllListeners(){
     [iajc]             ^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:39 Return type for the method is missing
     [iajc] public void DomainProperties+.removeAllListeners(){
     [iajc]                               ^^^^^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:41 listenersZapped cannot be resolved
     [iajc] if(listenersZapped){
     [iajc]    ^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:45 The method getAllChangeListeners() is
undefined for the type DomainPropertiesAspect
     [iajc] this.getAllChangeListeners().clear();
     [iajc]      ^^^^^^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:46 listenersZapped cannot be resolved or
is not a field
     [iajc] this.listenersZapped = true;
     [iajc] ^^^^^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:63 The method callRemove(Object) is unde
ined for the type DomainPropertiesAspect
     [iajc] callRemove(theObject);
     [iajc] ^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:69 The method callRemove(Object) is unde
ined for the type DomainPropertiesAspect
     [iajc] callRemove(theObject);
     [iajc] ^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:76 The method callRemove(Object) is unde
ined for the type DomainPropertiesAspect
     [iajc] callRemove(collectionObject);
     [iajc] ^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:89 Duplicate field DomainPropertiesAspec
.DomainProperties
     [iajc] private void DomainProperties+.callRemove(Object theObject){
     [iajc]              ^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:89 Return type for the method is missing
     [iajc] private void DomainProperties+.callRemove(Object theObject){
     [iajc]                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     [iajc] C:\view$\rdifrang_aspectjUpgrade_NT\discovery\dev\src\com\capitalon
\risk\domain\DomainPropertiesAspect.aj:91 The method removeAllListeners() is un
efined for the type DomainProperties
     [iajc] value.removeAllListeners();
     [iajc]       ^^^^^^^^^^^^^^^^^^
 
Thanks,

Ron DiFrango

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.


Back to the top