Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Error in accessing private methods from a "privileged" aspect

Hi Irum,

 

The following code does compile for me, so I'm surprised the workaround didn't work for you. If you define the aspect inside package a, then the bug doesn't appear to occur (although that might be unworkable too)

 

package a;

public class ITD {
    private void returnNothing(Object a) {
    }
}

 

package b;

import a.*;

privileged aspect B {
  public void ITD.newFun() {
      this.returnNothing("a");
  }

}

 

Ron Bodkin

Chief Technology Officer

New Aspects of Software

o: (415) 824-4690

m: (415) 509-2895

 

 

------------Original Message------------

From: Irum Godil <softwarengineer2003@xxxxxxxxx>

To: aspectj-users@xxxxxxxxxxx

Date: Thu, Jun-17-2004 7:46 AM

Subject: Re: [aspectj-users] Error in accessing private methods from a "privileged" aspect

Hi Ron,
Thank you for your response and for logging the bug. However, I am not very clear on your workaround. Are you saying that inside my aspect B I use the following (see the highlighted line). If so, I tried that and I still get the same problem.
 

package b;

import a.*;

privileged aspect B {

 

public void newA(Object a) {

}

public void A.newFun() {

this.returnNothing(new String("a"));

}

}

 

If you mean that I should define "returnNothing" inside of class B, then that will not really work for me. Because in the actual piece of code where I am having this problem, I need returnNothing to be visible in class A so other pieces of code not using the aspect can use it as well.

 

Is there any other workaround?

thanks.


Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:

Hi Irum,

 

This is compiler bug, which I have now reported. It appears to occur only when you have types in different packages and are passing an argument with a type conversion. Fortunately, I found that you can workaround it using this.returnNothing() in your inter-type declaration. I have reported it as a bug (#67578 - see https://bugs..eclipse.org/bugs/show_bug.cgi?id=67578)

 

I also found a closely related bug that crashes the compiler (bug #67579).

 

Ron Bodkin

Chief Technology Officer

New Aspects of Software

o: (415) 824-4690

m: (415) 509-2895

 

 

------------Original Message------------

From: Irum Godil <softwarengineer2003@xxxxxxxxx>

To: aspectj-users@xxxxxxxxxxx

Date: Wed, Jun-16-2004 7:30 PM

Subject: [aspectj-users] Error in accessing private methods from a "privileged" aspect

Hi,
I am seeing a strange scenario and I will really appreciate your help in the matter. Basically, I have an aspect and a class. The class has a private method and I want to access that method in the aspect. I have imported the class' package and I declare my aspect to be "privileged" as well. But I keep getting the error:
 
Error   The method returnNothing(Object) from the type A is not visible B.java Test/b 

Following is the code for it:
 

package a;

public class A {

private void returnNothing(Object a) {

}

}

 

package b;

import a.*;

privileged aspect B {

public void A..newFun() {

returnNothing(new String("a"));

}

}

I am not sure why is it not visible when I have declared my package to be privileged and also imported the package. Any help will be appreciated.


Thanks.

 


Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.


Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

Back to the top