[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Generics and Abstract Pointcut

thanks for confirming code style worked, that enabled me to quickly
determine the problem. it is fixed now and will be in a dev build
shortly.

Andy

On 30 June 2011 04:51, Andre Dantas Rocha <andre.dantas.rocha@xxxxxxxxx> wrote:
> Thanks Andy,
>
> The problem still occurs in version 1.6.11 but using aspect code style it
> works fine.
>
> I've created a bug for this issue:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=350800
>
> Cheers,
>
> Andre
>
>
>
> On Thu, Jun 30, 2011 at 1:41 PM, Andy Clement <andrew.clement@xxxxxxxxx>
> wrote:
>>
>> An NPE from the compiler indicates a bug, not that you are doing
>> something wrong (want to raise a bugzilla?
>> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ ).  But
>> you may be able to work around the problem.
>>
>> > It seems ok to me but when I try to compile it I receive the error below
>> > (aspectj 1.6.10, aspectjweaver 1.6.1).
>>
>> Not quite sure what you mean here, are you really combining AspectJ
>> 1.6.10 and a 1.6.1 weaver?  I would recommend trying with everything
>> at 1.6.11 in case the issue has already been fixed (1.6.11 included a
>> few generics related fixes for Spring Data).  You could also try
>> writing your aspect in code style rather than annotation style - but
>> this would just be a possible workaround, basically you've hit a
>> compiler issue and it needs fixing.
>>
>> cheers
>> Andy.
>>
>> On 29 June 2011 18:19, Andre Dantas Rocha <andre.dantas.rocha@xxxxxxxxx>
>> wrote:
>> > Hi all,
>> >
>> > I've been struggling to create a very simple interceptor aspect using
>> > generics and abstract pointcuts. The code is below:
>> >
>> > // A simple class using generics
>> > public abstract class AbstractAdapter<T extends Serializable> {
>> >    protected abstract T execute(T message);
>> > }
>> >
>> > // The concrete class to be intercepted
>> > public class Adapter extends AbstractAdapter<String> {
>> >    @Override
>> >     public String execute(String message) {
>> >       return message;
>> >     }
>> > }
>> >
>> > // The abstract aspect using generics
>> > @Aspect
>> > public abstract class AbstractProbingAspect<T> {
>> >    @Pointcut("")
>> >    protected abstract void adapterMethodExecution();
>> >
>> >    @Around("adapterMethodExecution()")
>> >    public Object around(ProceedingJoinPoint thisJoinPoint) throws
>> > Throwable
>> > {
>> >       return thisJoinPoint.proceed();
>> >    }
>> >
>> >    protected abstract String extractFunctionName(T command);
>> > }
>> >
>> > // The concrete aspect
>> > @Aspect
>> > public class ProbingAspect extends AbstractProbingAspect<String> {
>> >    @Pointcut("execution(String test.aop.Adapter.execute(String))")
>> >    protected void adapterMethodExecution() {};
>> >
>> >    @Override
>> >    protected String extractFunctionName(String command) {
>> >       return String.valueOf(command);
>> >    }
>> > }
>> >
>> > It seems ok to me but when I try to compile it I receive the error below
>> > (aspectj 1.6.10, aspectjweaver 1.6.1). Any ideas about what I'm doing
>> > wrong?
>> >
>> > Thanks in advance,
>> >
>> > Andre
>> >
>> > [INFO] --- aspectj-maven-plugin:1.3.1:compile (default) @ test-aop ---
>> > [ERROR] Internal compiler error
>> > java.lang.NullPointerException
>> >    at
>> >
>> > org.aspectj.weaver.ResolvedPointcutDefinition.parameterizedWith(ResolvedPointcutDefinition.java:121)
>> >    at
>> >
>> > org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(ReferenceType.java:783)
>> >    at
>> >
>> > org.aspectj.weaver.ResolvedType.getExposedPointcuts(ResolvedType.java:2317)
>> >    at
>> >
>> > org.aspectj.weaver.ResolvedType.getExposedPointcuts(ResolvedType.java:2310)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.checkPointcutDeclarations(EclipseSourceType.java:462)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.resolvePointcutDeclarations(AjLookupEnvironment.java:489)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindings(AjLookupEnvironment.java:279)
>> >    at
>> >
>> > org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:616)
>> >    at
>> >
>> > org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:357)
>> >    at
>> >
>> > org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:371)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1021)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:268)
>> >    at
>> >
>> > org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:181)
>> >    at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
>> >    at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
>> >    at org.aspectj.tools.ajc.Main.run(Main.java:371)
>> >    at org.aspectj.tools.ajc.Main.runMain(Main.java:248)
>> >    at
>> >
>> > org.codehaus.mojo.aspectj.AbstractAjcCompiler.execute(AbstractAjcCompiler.java:370)
>> >    at
>> >
>> > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>> >    at
>> >
>> > org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>> >    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>> >    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>> >    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>> >    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>> >    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >    at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >    at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >    at java.lang.reflect.Method.invoke(Method.java:592)
>> >    at
>> >
>> > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>> >    at
>> >
>> > org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>> >    at
>> >
>> > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>> >    at
>> >
>> > org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>> >
>> >
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>> >
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>