Bug 354683 - ant weaving ITDs defined in a jar fails with hierarchy of intertyped interfaces
Summary: ant weaving ITDs defined in a jar fails with hierarchy of intertyped interfaces
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 21:55 EDT by Yuriy CLA
Modified: 2014-06-26 09:47 EDT (History)
2 users (show)

See Also:


Attachments
complete test setup with 2 projects (1.65 KB, application/octet-stream)
2011-08-12 22:10 EDT, Yuriy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuriy CLA 2011-08-12 21:55:04 EDT
Build Identifier: 120110613-1736

The problem was distilled to the barest essentials - the tarball is attached.

I have 2 projects - one a library that defines 2 interfaces and the aspects for their inter-type implementations.

lib_project has the following:
-------------------------------------------------------------
public interface CommonData {void getData();}
public interface CommonDataImpl extends CommonData {}
public aspect CommonDataImplementation {
     public void CommonDataImpl.getData() {}
}

public interface DerivedCommonDataInterface extends CommonData {
    void getDerivedData();
}
public interface DerivedCommonDataInterfaceImpl 
               extends DerivedCommonDataInterface, CommonDataImpl {}

public aspect DerivedCommonDataInterfaceImplementation {
    public void DerivedCommonDataInterfaceImpl.getDerivedData() {}
}
------------------------------------------------------------------------

NOTE: - one interface extends another and so does its implementation (required for failure to occur)

the main_project has this:
------------------------------------------------------------------------
public abstract class AbstractBaseClass <T extends Whatever> 
        implements DerivedCommonDataInterfaceImpl {}

public class DerivedClass extends AbstractBaseClass {}
---------------------------------------------------------

NOTE: the base AbstractBaseClass has to have a type parameter the derived class does not matter for failure on command line - eclipse has a problem regardless

The hierarchies shown here are the minimal conditions to reproduce the problem.

Also note that if all of these were in the same project iajc would build the project just fine, having both source trees in the same eclipse project also works OK, however when lib_project.jar is added to build path and aspect path of the main_project then the same problem occurs in eclipse.

----------------------------------------------------------------
the bugs below may be related (found while searching for possibly reported earlier but do not seem the same)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=125062 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336654

Reproducible: Always

Steps to Reproduce:
1.run ant on the attached test project
Comment 1 Yuriy CLA 2011-08-12 22:10:18 EDT
Created attachment 201452 [details]
complete test setup with 2 projects

complete test setup with 2 projects 
and a build.sh that builds both

 - however aspectj* jars are linked and not included to save size
Comment 2 Andrew Clement CLA 2011-08-16 17:00:02 EDT
Thanks for the testcode, but you didn't mention what the error was? (or what version of AspectJ you are using?)

If I run your build.sh with Aspectj 1.6.11, I get this:


compile:
     [iajc] error at public class DerivedClass extends AbstractBaseClass {}
     [iajc]              ^^^^^^^^^^^
     [iajc] /Users/aclement/Downloads/pr354683/iajc_test/main_project/java/main/DerivedClass.java:3:0::0 The type DerivedClass must implement the inherited abstract method CommonData.getData()
     [iajc] MessageHolder:  (12 info)  (1 error) 
     [iajc] [error   0]: error at public class DerivedClass extends AbstractBaseClass {}
     [iajc]              ^^^^^^^^^^^
     [iajc] /Users/aclement/Downloads/pr354683/iajc_test/main_project/java/main/DerivedClass.java:3:0::0 The type DerivedClass must implement the inherited abstract method CommonData.getData()


is that the error you mean?

If I change that version to 1.6.12.m1 it works with no errors.  How old is the AJDT you are using?  I thought any recent AJDTs already included 1.6.12 snapshots.
Comment 3 Yuriy CLA 2011-08-16 21:42:18 EDT
Andy, 
That is precisely the error. I was using 1.6.12.M1 and still had the problem but after your comment I have downloaded the (so far) latest aspectj-DEVELOPMENT-20110728170325.jar and it did fix the test project.
It did help with my real project as well - but I think there is another issue of a similar nature - one of my ITD implemented interfaces would not compile until I made some changes. I will definitely create a distilled version of it, just not now - I am running very late with my deliverables as it is.

in short - it looks better to me when the ITDs are not applied directly to 
a regular interface (AKA type) but to an impl-only marker as in:
public interface DoThings {
 void doThings();
 public interface OneKindOfImpl extends DoThings{};
 public static aspect Implem {
     public DoThings.OneKindOfImpl.doThings() { }
 }
}

so to move forward I had to ITD the DoThings direcly not the OneKindOfImpl.

I can live with that for now and as soon as I am able I will create a test project.
I am sorry I can't do more right now.
Comment 4 Andrew Clement CLA 2011-08-17 12:35:16 EDT
thanks for the update.  What you are trying to do should work fine.

> I was using 1.6.12.M1 and still had the problem
> but after your comment I have downloaded the (so far) latest
> aspectj-DEVELOPMENT-20110728170325.jar and it did fix the test project.

Yep, you are right.  Looks like I installed a dev build over my 1.6.12.M1 so thought M1 was fixing it.  There is going to be an M2 very shortly.
Comment 5 Bruno Cartaxo CLA 2014-06-26 09:47:30 EDT
Any update about this bug?

I'm facing the same problem described by Yuriy so, apperantly this bug still persists after 3 years, once we are at June of 2014.