Community
Participate
Working Groups
Build Identifier: 20100617-1415 Hi all, following problem: I have one project with aspects and another one with pure java classes. If I use declare parents to advice all classes in a different project, there is no code completion for the additional field added per intertype dec. in the effected class. Following Code with "IAspIntertyping" only as marker interface(No declaration inside): ------------------------------------------------- package com.bugzilla.ajdt; public interface IAspIntertyping { } package com.bugzilla.ajdt; public aspect IntertypeAspect { declare parents : com.bugzilla.test.* implements IAspIntertyping; //Add a public field LOGGER to all effected classes: public BugLogger IAspIntertyping.LOGGER = new BugLogger(); public pointcut interfacePC() : get(public BugLogger *..*.LOGGER) && !within(com.bugzilla.ajdt.*); BugLogger around(): interfacePC() { //Some other implementation... BugLogger LOGGER = new BugLogger(); return LOGGER; } } The effected class: package com.bugzilla.test; public class SingleClass { public SingleClass() { LOGGER.debug("SingleClass"); //<-- No code completion here } } ---------------------------------------------------------------------------- - When i use the java-editor in Eclipse sometimes an Error is shown: LOGGER cannot be referenced... - When i use the aspectj/java editor no Error is shown, all advice markers still displayed, but also no code completion is working. In both cases the programm works correct. LOGGER.debug("...") is invoked each time. But without code complition is hard to develope software, when i cant see which methods are available, in this case LOGGER. (BugLogger.java) doesnt suggest debug(msg). Both projects are aspectj projects. Project "com.bugzilla.test" has added com.bugzilla.ajdt on its aspect path. So all aspects in ...adjt are woven in as they should in ...test. IF I advice a class in the same project where the aspects lie, then whole 'cc' is available...(But not applicable for huge projects) So maybe i got something wrong with those path-specific configuration stuff like aspect path, inpath, which project knows other... If not and my configs are correct, there is bug for cross-project aspects. regards Johannes I attach a Test-Project! Reproducible: Always
This is an AJDT bug.
This bug is a duplicate. Please see Bug 299830 for a workaround. *** This bug has been marked as a duplicate of bug 299830 ***
Hi Andrew, first thanks for the very fast reply! I have reopend this ticket because my problem is a bit different. So first: My 2 projects are both aspectj-projects, oner with aspects inside, the other one with only java files!!!!!!!! If I use the workaround example and convert the java-project also to an aspectj-project instead adding the nature in .project, then eclipse complains that .message -> "The field JavaClassInAJProject.message is not visible". Maybe you can explain this. But my problem is, if in my java-project I only change the nature, no ITD is done from Aspectj-project(ProA) into java-project(ProB). So in my example LOGGER is no more referenced and therefor I got an compile error. So in my thought, i have to convert my java-project into an aspectj-project. Now aspects form ProA are woven in ProB. To get this working i only do the converting and in ProB, I add to the aspect-path ProA. So the aspectj-project has no references to other projects, but the java-project(ProB) has a reference to the aspectj-project(ProA). Please correct me if I'm doing something wrong here. The main difference between the workaround and my problem is, that I'm not using an aspectj manipulated object (in the example "JavaClassInAJProject") in my java-project. What I do is, I ITD's an interface with a field called LOGGER. Than an aspect (called IntertypeAspect) will effect all classes/abstracts or other interfaces in the java-project by adding following code: declare parents : com.bugzilla.test.* implements IAspIntertyping; This 'declare parents' statement has only effects if my java-project has also converted into an aspectj project! Maybe you know a better way to achive that... So if I do it my way, eclipse does not complain and also no compilation errors exists. BUT IF I WANT TO ACCESS THE INTERTYPED FIELD (in my case LOGGER) no code completion works and also no javadoc informations are displayed. The wired thing is, if my effected class or interface in the java-project is a super class, than code completion works in the subclass, but in the superclass not. E.g.: Project Aspj -> With an aspect for ITD's other java-projects. Project Java (with aj convertion!): - SuperClassA is ITD from Project Aspj <--- here no code completion there - SubClassB extends SuperClassA <-- here code completion is working This is a confusing behavior and maybe you have a workaround for this bug, too? If I got something wrong with my path-settings please tell me that. If I explaind my problem to unexact, tell me that, I've got a small Test-Project I will attech that makes everthing clear! So thanks again! Johannes
Created attachment 178025 [details] Test-Project for not supported code completion
Thanks for the test project. I can see the issues you are describing. I don't know if I'll be able to get to this for 2.1.1.
I have a fix for the navigation and content assist issues in your sample projects. I need to do some more testing before committing. This should be able to make it into 2.1.1. The compilation error you have looks like it may be an aspectj bug. I forwarded it to the AspectJ team and they are looking at it now.
I created a few test cases to make sure that everything's working now. And it seems like there is at least one more AspectJ problem that is described in but 327057. I will commit the pieces that I have fixed. This will at least allow you to get content assist and navigation for ITDs across projects. * Declare annotation is still not working. * The spurious compile problem you describe is still not fixed. I am committing the fix on the 3.6 branch. Are you on 3.6 or 3.5?
I'm using 3.5 but if there is too much trouble getting the fix into 3.5, I'll use 3.6 in future. Thanks again for fixing the code-completion stuff, this was the main reason for the release-delay of my logging-framework. But now, juhu...