spring-attic / spring-ide

Spring Development Environment for Eclipse
299 stars 126 forks source link

AOP pointcut validation bug. #217

Open JiinYuu opened 6 years ago

JiinYuu commented 6 years ago

My pointcus:

package com.chamc.boot.bpm.config;

import org.aspectj.lang.annotation.Pointcut;

import com.chamc.boot.bpm.model.param.AddSignParam;

public class Pointcuts {

    @Pointcut("execution(public * com.chamc.boot.bpm.controller.TaskController.addSign(..)) && args(param)")
    public void addSignTask(AddSignParam param) {}          

}

My advices:

 package com.chamc.boot.bpm.controller.advice;

import java.util.List;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.stereotype.Component;

import com.chamc.boot.bpm.controller.listener.AddSignListener;
import com.chamc.boot.bpm.model.param.AddSignParam;

@Aspect @Component
public class AddSignTaskAdivice implements InitializingBean {

    private @Autowired(required = false) List<AddSignListener> addSignListeners;

    @Before("com.chamc.boot.bpm.config.Pointcuts.addSignTask(param)")
    public void beforAddSign(AddSignParam param) {
        if(this.addSignListeners != null) {
            this.addSignListeners.forEach(l -> l.before(param));
        }
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        if(this.addSignListeners != null) {
            AnnotationAwareOrderComparator.sort(addSignListeners);
        }
    }

}

It always reminds me: image

But my application is working, and the AOP is working too. My sts info:

Version: 3.8.4.RELEASE Build Id: 201703310825 Platform: Eclipse Neon.3 (4.6.3)

martinlippert commented 6 years ago

@aclement

aclement commented 6 years ago

I've downloaded that release of STS and have been trying to recreate. Not having much luck though. I removed the spring stuff from the sample code above leaving just the aspects and it works without showing an error. If the error is only shown in the editor and not in the problems view then it is a cosmetic issue and just affects editor reconciling.

JiinYuu commented 6 years ago

@aclement thanks for your replay. I also wrote a sample program, I also wrote a sample program, the STS can normal tip AOP and advice, and so on. Like this: image image My previous problem with the program, now does not prompt the error, but also can't prompt AOP, advice, and so on like my sample program.I don't know what's going on, I just deleted the errors from the problems view. However, on my colleague's computer, the error is still prompted, and there are also errors in the problems view, like this: image image

It was so weird that I couldn't figure out what it was.

JiinYuu commented 6 years ago

@aclement It reminds me again: image image image

martinlippert commented 6 years ago

Can you attach or reference a ready-to-use sample project that we could use to reproduce this? That would be awesome.