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 <[email protected]> 
> 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
> [email protected] <mailto:[email protected]>
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to