[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] The constructor DeprecatedMethodLogger() is not visible when testing my aspect


Typically you donât instantiate aspects like that, their lifecycle is managed more internally to the aspect and can vary depending on the per-scope. (The default scope being singleton)

If you want an instance of an aspect, youâd call:

DeprecatedMethodLogger.aspectOf()

and this will give you the singleton instance for your aspect.

Andy


On Dec 21, 2017, at 5:58 AM, Mikael Petterson <mikaelpetterson@xxxxxxxxxxx> wrote:

Hi,

I am using aspectj 1.8.10 and we experience the following Eclipse:

In my test I have:

public class DeprecatedMethodLoggerTest {

    private boolean debug = true;
    private DeprecatedMethodLogger deprecatedMethodLogger;

    @Before
    public void setup() {
        deprecatedMethodLogger = new DeprecatedMethodLogger();
    }

}

My aspect looks something along the lines:

aspect DeprecatedMethodLogger {
       
    //Instantiated once so we can get information here that only needs to be fetched once.
    public DeprecatedMethodLogger() {
        addLifeHandling();

    }

}

Both classes are in the same package.

Then Eclipse 4.6.3 complains about the following:

The constructor DeprecatedMethodLogger() is not visible DeprecatedMethodLoggerTest.java 

What could be the reasons for this error message? Does the aspect have to be public?

Any hints?

br,

//mike


 
 
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users