Announcement Announcement Module
Collapse
No announcement yet.
Compiler error for aspectj static method in base class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compiler error for aspectj static method in base class

    Hi
    I have a base class entity with two drive class for single table. In base class there are some static finder method that is related to the database. So I created a finder aspect for that. It works fine from eclipse but when I run it from roo or maven then I got compiler error-

    Base class-
    Code:
    @RooEntity(versionField = "", table = "T_P")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE);
    @DiscriminatorColumn(name="CLASS_TYPE_DISCRIMINATOR", discriminatorType=DiscriminatorType.INTEGER);
    @DiscriminatorValue("0");
    public class Purchase{
    
    }
    Finder aspect for purchase with generic static method
    Compiler error code
    Code:
    aspect Purchase_Finder{
    public static <U extends Purchase> Long Purchase.countPurchases(Class<U> type) {
    
    }
    Sub class-
    Code:
    @Entity
    @DiscriminatorValue(value="1");
    public ContentPurchase extend Purchase{
    }
    Test case for content purchase

    Code:
    @ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml")
    @RunWith(SpringJUnit4ClassRunner.class)
    @Transactional
    public class ContentPurchaseTest {
           @Test
    	public void countContentTest(){
    		Long contentCount = ContentPurchase .countPurchases(ContentPurchase .class);
    		Assert.assertNotNull(contentCount );
    		Assert.assertTrue(contentCount >0);
    	}
    
    }
    When I run this test case from eclipse then it works fine. But when I run it through roo or maven I get the following error-

    ContentPurchaseTest .java: The method countPurchases(Class<ContentPurchase >) is ambiguous for the type ContentPurchase

    One more things- If I move those static method from aspectj to java class then it works fine both eclipse and roo.
    Working code -
    Code:
    public class Purchase{
    //moving code from asject
    public static <U extends Purchase> Long countPurchases(Class<U> type) {
    }
    
    aspect Purchase_Finder{
    
    }
    I have also other method that are common for sub class are working fine from eclipse project but neither roo nor maven.




    Regards
    Mamun

  • #2
    Any one???

    Comment

    Working...
    X