Autocompletion of AspectJ not working in eclipse with spring roo 2 project

I created a Spring Roo project using spring-roo-2.0.0.RC2 and imported it into eclipse. The project starts up and works fine, but when I try to access some methods from the roo generated aspectJ-files I get an compile error. The methods can not be accessed and don't even show up in the autocompletion of eclipse.For the compiler the methods do not exists...

eg I have an entity "Burst", that I want to persist. Therefore I would like to use some of the setters that can be found in the Burst_Roo_JavaBean.aj an set some values. But setters/getters can not be accessed. This is a general problem and I don't know why it does not work.

I am using eclipse oxygen with STS plugin and AJDT. AspectJ-Tooling and JDT weaving is enabled on the Project. Eclipse的软件 I tried using the STS bundle too, but there is the same problem.

Fist I thought it would be a general problem with my eclipse intallation. But I created a spring roo 1 project (spring-roo-1.3.2.RELEASE) and imported it into eclipse. Everything works fine on this one and I can make use of the methods in the roo generated aspectsJ-files. Spring Roo v1 shows the same behaviour.

It seems to be a smilar Problem to this: Autocompletion in Eclipse for Roo project but cleaning and updating does not help.

Is this some version messup in the project?

Please help, I have no idea how to fix this...

Edit: I found out, that I can use methods from the .aj-files, but just within the classes that the .aj-files were created for. eg I have a domain "Burst". I can create a method in there and use the methods that are provided via the .aj-files like "getVersion()" and all the other methods. But when I create a class "MyClass" in the same package, I have no Access to the methods from the .aj-files.

突发域我的课

Update (added code): I chose the pictures because I thought it would be clearer where and how the compile error is. The code is just a simple domain and the getVersion() method was not written by me. It exists within the aspect file of the Burst_Roo_JavaBean.aj. I'll add this too...

Burst domain:

package de.larv.overseer.domain;
import java.time.LocalDateTime;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;

import org.springframework.roo.addon.javabean.annotations.RooEquals;
import org.springframework.roo.addon.javabean.annotations.RooJavaBean;
import org.springframework.roo.addon.javabean.annotations.RooToString;
import org.springframework.roo.addon.jpa.annotations.entity.RooJpaEntity;

@RooJavaBean
@RooToString
@RooJpaEntity
@RooEquals(isJpaEntity = true)
public class Burst {

    public void method() {
        Burst b = new Burst();
        b.getVersion();
    }
    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Version
    private Integer version;

    private String pool;

}

Burst_Roo_JavaBean.aj

// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).

package de.larv.overseer.domain;

import de.larv.overseer.domain.Burst;
import java.time.LocalDateTime;

privileged aspect Burst_Roo_JavaBean {

    /**
     * TODO Auto-generated method documentation
     * 
     * @return Long
     */
    public Long Burst.getId() {
        return this.id;
    }

    /**
     * TODO Auto-generated method documentation
     * 
     * @param id
     */
    public void Burst.setId(Long id) {
        this.id = id;
    }

    /**
     * TODO Auto-generated method documentation
     * 
     * @return Integer
     */
    public Integer Burst.getVersion() {
        return this.version;
    }

    /**
     * TODO Auto-generated method documentation
     * 
     * @param version
     */
    public void Burst.setVersion(Integer version) {
        this.version = version;
    }

    /**
     * TODO Auto-generated method documentation
     * 
     * @return String
     */
    public String Burst.getPool() {
        return this.pool;
    }

    /**
     * TODO Auto-generated method documentation
     * 
     * @param pool
     */
    public void Burst.setPool(String pool) {
        this.pool = pool;
    }

}

MyClass (compile error):

package de.larv.overseer.domain;

public class MyClass {
    public void method() {
        Burst b = new Burst();
        b.getVersion();
    }
}
链接地址: http://www.djcxy.com/p/25418.html

上一篇: 在OpenCV中使用自定义相机(通过GStreamer)

下一篇: AspectJ的Autocompletion不能在eclipse中与spring roo 2项目一起工作