Bug 50939 - Introduction members on Interface not transparent in Java - even removes the method from the interface
Summary: Introduction members on Interface not transparent in Java - even removes the ...
Status: RESOLVED DUPLICATE of bug 43972
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.2   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-30 05:00 EST by Casier Koen CLA
Modified: 2004-01-30 12:54 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casier Koen CLA 2004-01-30 05:00:19 EST
In the project I work, I have some existing interfaces which have similar 
implementations in Java. Implementing this interfaces is thus very simple using 
AspectJ attaching the implementations to the Interface.

something like the following:
---------------------------------------

public interface SomeInterface {
    public void someMethod();
}

          --------------

public class SomeImplementingClass {}

          --------------

public aspect SomeAspect {

    declare parents: SomeImplementingClass implements SomeInterface;

    public void SomeInterface.someMethod(){
        System.out.println("Test");
    }

}

--------------------------------------------------

When I do this everything works fine within the project.

1    public static void main(String[] args) {
2		SomeImplementingClass object = new SomeImplementingClass();
3        object.someMethod();
4        SomeInterface object2 = new SomeImplementingClass();
5        object2.someMethod();
6    }

works alright.

After building the project into a jar-file for release, I'm not able to use the 
methods in a pure java-project (error on line 3 and line 5). This means that 
the interface-methods dissappear and the introduced methods cannot be found.
When I use an AspectJ-project everything works fine. 

But: I want to be able to use the library in a pure Java-way. Having to work 
with AspectJ raises different problems:
1 - not all the users of the library are familiar with aspectJ
2 - The building-proces using aspectj in eclipse (or another IDE) takes more 
time
3 - I want it to be transparent to the user

I noticed a difference with this example in my project:
- I can use the introduced methods in the different classes (I don't know how 
I've done this), but I cannot see them with an auto-complete request in 
eclipse, but consider this an normal AJDT-problem to be fixed in the next 
release.
but still the interface-methods dissappear! (giving a compile-error)

I found a workaround in order to preserve the interfaces:
Creating an extending interface on which the methods can be introduced. This 
works, but I don't think this is a vaild solution for the future (it introduces 
a lot of overhead, and makes the code less readable)


I've checked the existing bug-reports and searched the user-mailing-list, and 
found nothing about this problem. However it is always possible that I've made 
a mistake and in that case I would be very grateful when I would receive a 
quick explanation of the error.

I would be very grateful if you'd keep me updated, since I would like to 
release a new version of my project very soon now.

Koen
Comment 1 Jim Hugunin CLA 2004-01-30 12:54:11 EST
This sounds exactly like the referenced bug.  Please reopen if not.  This is 
fixed in the current tree.  You can get the sources out of cvs and do your own 
build to get the fixed compiler right now.  We also should be announcing in 
the near future a public download place where you can download the last good 
build (the last build that passed the test suite).  This will let people give 
us better feedback on the road to the 1.2 release.

*** This bug has been marked as a duplicate of 43972 ***