Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Can invoke introduced methods
Can invoke introduced methods [message #52563] Fri, 03 June 2005 04:06 Go to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
I'm looking at the cross reference for an class. It shows the method addListener(WorkingMemoryEventListener) as an aspect declaration (it was introduced onto the interface).

I'm also looking at the code:

public void testObjectAsserted() {
WorkingMemoryEventListener mockWorkingMemoryEventListener = ...
WorkingMemory wm = new ForTestWorkingMemory();
wm.addListener(mockWorkingMemoryEventListener);
~~~~~~~~~~~
}

Where the call to addListener is marked as undefined. There is an error marker in the file buffer, but not in the problems view.

If I try to autocomplete after "wm." I get the methods that are on the interface prior to any introdutions. If I try to autocomplete after "wm.a" I get things like "adviceexecution" and "after_returning". I don't see these with the first autocomplete. And I never see "addListener".

Then I run the test. Green bar! So I debug. Set a break at the second line, step and immediatly I'm out of the method. Appearantly returning normally. I put an exception block around everything. No exceptions.

Then as I start to add some code around the problem line, I see that the debug lines do not even come close to the actual lines. I made sure inlining was off, but no effect. When I look at the "wm" variable in the debugger, sure enough it has all the introductions.


[begin-crybady]
I have worst luck with adjt. Every project I try it on, I get only so far and hit a wall. Up until now, always the compiler. This time I'm not sure what the problem is. But lots of others do ok with adjt, no? Is it just that I'm using the latest build? Is it that different from the near release candidate for eclipse 3.0.x?
[end-crybaby]

-barry
Re: Can invoke introduced methods [message #52590 is a reply to message #52563] Fri, 03 June 2005 04:14 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Strangeness continues: Now I get errors in Problems view, but all the aspectj weaving messages are gone........
Re: Can invoke introduced methods [message #52615 is a reply to message #52590] Fri, 03 June 2005 04:19 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> Strangeness continues: Now I get errors in Problems view, but all the
> aspectj weaving messages are gone........

And it seems the reason is that nothing is getting weaved. All I did was restart eclipse (I have to do this often to get the cross-reference view to work again). No clue whats going on. I'll keep this thread uptodate as learn anything.
Re: Can invoke introduced methods [message #52642 is a reply to message #52615] Fri, 03 June 2005 04:22 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> Barry Kaplan wrote:
>
>> Strangeness continues: Now I get errors in Problems view, but all the
>> aspectj weaving messages are gone........
>
>
> And it seems the reason is that nothing is getting weaved. All I did was
> restart eclipse (I have to do this often to get the cross-reference view
> to work again). No clue whats going on. I'll keep this thread uptodate
> as learn anything.

Found the problem. I left the unit test with an error in it. This seems to prevent /any/ weaving from occuring. Is this the desgined behavior, or should I file a bug?
Re: Can invoke introduced methods [message #52669 is a reply to message #52563] Fri, 03 June 2005 04:24 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> If I try to autocomplete after "wm." I get the methods that are on the
> interface prior to any introdutions. If I try to autocomplete after
> "wm.a" I get things like "adviceexecution" and "after_returning".

Whoops. These are templates. Not a problem.
Re: Can invoke introduced methods [message #52723 is a reply to message #52563] Fri, 03 June 2005 08:24 Go to previous messageGo to next message
Sian January is currently offline Sian JanuaryFriend
Messages: 83
Registered: July 2009
Member
Barry Kaplan wrote:
> I'm looking at the cross reference for an class. It shows the method
> addListener(WorkingMemoryEventListener) as an aspect declaration (it was
> introduced onto the interface).
>
> I'm also looking at the code:
>
> public void testObjectAsserted() { WorkingMemoryEventListener
> mockWorkingMemoryEventListener = ...
> WorkingMemory wm = new ForTestWorkingMemory();
> wm.addListener(mockWorkingMemoryEventListener);
> ~~~~~~~~~~~
> }
>
> Where the call to addListener is marked as undefined. There is an error
> marker in the file buffer, but not in the problems view.
> If I try to autocomplete after "wm." I get the methods that are on the
> interface prior to any introdutions. If I try to autocomplete after
> "wm.a" I get things like "adviceexecution" and "after_returning". I
> don't see these with the first autocomplete. And I never see "addListener".
> Then I run the test. Green bar! So I debug. Set a break at the second
> line, step and immediatly I'm out of the method. Appearantly returning
> normally. I put an exception block around everything. No exceptions.
> Then as I start to add some code around the problem line, I see that the
> debug lines do not even come close to the actual lines. I made sure
> inlining was off, but no effect. When I look at the "wm" variable in the
> debugger, sure enough it has all the introductions.
>
>
> [begin-crybady]
> I have worst luck with adjt. Every project I try it on, I get only so
> far and hit a wall. Up until now, always the compiler. This time I'm not
> sure what the problem is. But lots of others do ok with adjt, no? Is it
> just that I'm using the latest build? Is it that different from the near
> release candidate for eclipse 3.0.x?
> [end-crybaby]
>
> -barry

Hi Barry,

The reason for the red squiggles is that the Java editor eager parser
does not know about the ITD method. In 1.2.0 RC1 and later you can use
the AspectJ editor and get correct eager parsing. Right click on the
file, then click 'Open With' > 'AspectJ/Java Editor'. If you need to do
this a lot it is also possible to set the AspectJ editor to be the
default for .java files in the preferences.

Thanks,

Sian
Re: Can invoke introduced methods [message #52750 is a reply to message #52642] Fri, 03 June 2005 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: clemas.uk.ibm.com

Barry Kaplan wrote:
> Barry Kaplan wrote:
>
>> Barry Kaplan wrote:
>>
>>> Strangeness continues: Now I get errors in Problems view, but all the
>>> aspectj weaving messages are gone........
>>
>>
>>
>> And it seems the reason is that nothing is getting weaved. All I did
>> was restart eclipse (I have to do this often to get the
>> cross-reference view to work again). No clue whats going on. I'll keep
>> this thread uptodate as learn anything.
>
>
> Found the problem. I left the unit test with an error in it. This seems
> to prevent /any/ weaving from occuring. Is this the desgined behavior,
> or should I file a bug?

Yes, the behavior is as designed. If you want to change this, then
there is an option 'proceed on error' that can be set on the command
line with '-proceedOnError' - I'm not sure where you can specify it in
the UI though, it is a JDT compiler option that we in AspectJ inherit.

Andy.
Re: Can invoke introduced methods [message #52777 is a reply to message #52750] Fri, 03 June 2005 16:13 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
>> Found the problem. I left the unit test with an error in it. This
>> seems to prevent /any/ weaving from occuring. Is this the desgined
>> behavior, or should I file a bug?
>
>
> Yes, the behavior is as designed. If you want to change this, then
> there is an option 'proceed on error' that can be set on the command
> line with '-proceedOnError' - I'm not sure where you can specify it in
> the UI though, it is a JDT compiler option that we in AspectJ inherit.

Thanks Andy. There is a place "Non standard compiler options" in the AspectJ page of the project properties. However, adding that option does not have any effect. I found several bugs related to this (https://bugs.eclipse.org/bugs/show_bug.cgi?id=75568, https://bugs.eclipse.org/bugs/show_bug.cgi?id=74245) which claim that it should work.

Maybe this is a regression bug. I'll play with it some more.
Re: Can invoke introduced methods [message #52804 is a reply to message #52723] Fri, 03 June 2005 16:19 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Sian January wrote:
> The reason for the red squiggles is that the Java editor eager parser
> does not know about the ITD method. In 1.2.0 RC1 and later you can use
> the AspectJ editor and get correct eager parsing. Right click on the
> file, then click 'Open With' > 'AspectJ/Java Editor'. If you need to do
> this a lot it is also possible to set the AspectJ editor to be the
> default for .java files in the preferences.

Thanks Sian. But I think I'm a bit confused now. This particular project is a reusable library (drools). I'm using aspectj internally to clean up some of the spagetti that has crept in as new features have been added. I want these introduced methods to be visible to clients of this library.

Is this only a problem within the same project, because the JDT has the source code on hand? But when other projects use the jar, they will see the introduced methods? (Well, I'll this presently.)

-barry
Re: Can invoke introduced methods [message #53135 is a reply to message #52777] Mon, 06 June 2005 07:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: clemas.uk.ibm.com

As its a standard JDT Compiler option, I was expecting it could be
specified in the standard JDT Compiler options (via a checkbox) rather
than you being required to put it in the AspectJ 'non standard compiler
options' - but I can't find anywhere that suggests it can be set for
JDT. I doubt we've tested specifying it as a non-standard option on the
AJ panel, so I wouldn't be completely surprised if there was a bug
there. I'm sure it *does* work if the compiler is invoked via the
command line, so it shouldnt be tough to fix, just a bit of option wiring.

Andy.

Barry Kaplan wrote:

>>> Found the problem. I left the unit test with an error in it. This
>>> seems to prevent /any/ weaving from occuring. Is this the desgined
>>> behavior, or should I file a bug?
>>
>>
>>
>> Yes, the behavior is as designed. If you want to change this, then
>> there is an option 'proceed on error' that can be set on the command
>> line with '-proceedOnError' - I'm not sure where you can specify it in
>> the UI though, it is a JDT compiler option that we in AspectJ inherit.
>
>
> Thanks Andy. There is a place "Non standard compiler options" in the
> AspectJ page of the project properties. However, adding that option does
> not have any effect. I found several bugs related to this
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=75568,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74245) which claim that it
> should work.
> Maybe this is a regression bug. I'll play with it some more.
Re: Can invoke introduced methods [message #53185 is a reply to message #53135] Mon, 06 June 2005 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hawkinsh.uk.ibm.com

Does this JDT option do what you're looking for?

Window > Preferences > Java > Compiler > Build Path > Abort builds when
build path errors occur
Re: Can invoke introduced methods [message #53211 is a reply to message #53185] Mon, 06 June 2005 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: clemas.uk.ibm.com

Helen Hawkins wrote:
> Does this JDT option do what you're looking for?
>
> Window > Preferences > Java > Compiler > Build Path > Abort builds when
> build path errors occur
>
>
>

Hmm, I thought that was more for project interdependency problems
preventing rebuilds? proceedOnError is used within a single project and
if specified means we continue to weave (as best we can) even if the
compiler reported problems. This is very useful for people that have
aspects containing declare warning/error statements, since weaving has
to occur for join points matching these statements to be reported.

Andy.
Re: Can invoke introduced methods [message #53262 is a reply to message #52804] Mon, 06 June 2005 09:20 Go to previous message
Sian January is currently offline Sian JanuaryFriend
Messages: 83
Registered: July 2009
Member
Barry Kaplan wrote:
> Sian January wrote:
>
>> The reason for the red squiggles is that the Java editor eager parser
>> does not know about the ITD method. In 1.2.0 RC1 and later you can
>> use the AspectJ editor and get correct eager parsing. Right click on
>> the file, then click 'Open With' > 'AspectJ/Java Editor'. If you need
>> to do this a lot it is also possible to set the AspectJ editor to be
>> the default for .java files in the preferences.
>
>
> Thanks Sian. But I think I'm a bit confused now. This particular project
> is a reusable library (drools). I'm using aspectj internally to clean up
> some of the spagetti that has crept in as new features have been added.
> I want these introduced methods to be visible to clients of this library.
>
> Is this only a problem within the same project, because the JDT has the
> source code on hand? But when other projects use the jar, they will see
> the introduced methods? (Well, I'll this presently.)
>
> -barry

Yes - if the files are in a JAR you should not see the same eager
parsing problem.

Sian
Re: Can invoke introduced methods [message #588501 is a reply to message #52563] Fri, 03 June 2005 04:14 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Strangeness continues: Now I get errors in Problems view, but all the aspectj weaving messages are gone........
Re: Can invoke introduced methods [message #588510 is a reply to message #52590] Fri, 03 June 2005 04:19 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> Strangeness continues: Now I get errors in Problems view, but all the
> aspectj weaving messages are gone........

And it seems the reason is that nothing is getting weaved. All I did was restart eclipse (I have to do this often to get the cross-reference view to work again). No clue whats going on. I'll keep this thread uptodate as learn anything.
Re: Can invoke introduced methods [message #588517 is a reply to message #52615] Fri, 03 June 2005 04:22 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> Barry Kaplan wrote:
>
>> Strangeness continues: Now I get errors in Problems view, but all the
>> aspectj weaving messages are gone........
>
>
> And it seems the reason is that nothing is getting weaved. All I did was
> restart eclipse (I have to do this often to get the cross-reference view
> to work again). No clue whats going on. I'll keep this thread uptodate
> as learn anything.

Found the problem. I left the unit test with an error in it. This seems to prevent /any/ weaving from occuring. Is this the desgined behavior, or should I file a bug?
Re: Can invoke introduced methods [message #588527 is a reply to message #52563] Fri, 03 June 2005 04:24 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> If I try to autocomplete after "wm." I get the methods that are on the
> interface prior to any introdutions. If I try to autocomplete after
> "wm.a" I get things like "adviceexecution" and "after_returning".

Whoops. These are templates. Not a problem.
Re: Can invoke introduced methods [message #588540 is a reply to message #52563] Fri, 03 June 2005 08:24 Go to previous message
Sian January is currently offline Sian JanuaryFriend
Messages: 83
Registered: July 2009
Member
Barry Kaplan wrote:
> I'm looking at the cross reference for an class. It shows the method
> addListener(WorkingMemoryEventListener) as an aspect declaration (it was
> introduced onto the interface).
>
> I'm also looking at the code:
>
> public void testObjectAsserted() { WorkingMemoryEventListener
> mockWorkingMemoryEventListener = ...
> WorkingMemory wm = new ForTestWorkingMemory();
> wm.addListener(mockWorkingMemoryEventListener);
> ~~~~~~~~~~~
> }
>
> Where the call to addListener is marked as undefined. There is an error
> marker in the file buffer, but not in the problems view.
> If I try to autocomplete after "wm." I get the methods that are on the
> interface prior to any introdutions. If I try to autocomplete after
> "wm.a" I get things like "adviceexecution" and "after_returning". I
> don't see these with the first autocomplete. And I never see "addListener".
> Then I run the test. Green bar! So I debug. Set a break at the second
> line, step and immediatly I'm out of the method. Appearantly returning
> normally. I put an exception block around everything. No exceptions.
> Then as I start to add some code around the problem line, I see that the
> debug lines do not even come close to the actual lines. I made sure
> inlining was off, but no effect. When I look at the "wm" variable in the
> debugger, sure enough it has all the introductions.
>
>
> [begin-crybady]
> I have worst luck with adjt. Every project I try it on, I get only so
> far and hit a wall. Up until now, always the compiler. This time I'm not
> sure what the problem is. But lots of others do ok with adjt, no? Is it
> just that I'm using the latest build? Is it that different from the near
> release candidate for eclipse 3.0.x?
> [end-crybaby]
>
> -barry

Hi Barry,

The reason for the red squiggles is that the Java editor eager parser
does not know about the ITD method. In 1.2.0 RC1 and later you can use
the AspectJ editor and get correct eager parsing. Right click on the
file, then click 'Open With' > 'AspectJ/Java Editor'. If you need to do
this a lot it is also possible to set the AspectJ editor to be the
default for .java files in the preferences.

Thanks,

Sian
Re: Can invoke introduced methods [message #588546 is a reply to message #52642] Fri, 03 June 2005 08:52 Go to previous message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
Barry Kaplan wrote:
> Barry Kaplan wrote:
>
>> Barry Kaplan wrote:
>>
>>> Strangeness continues: Now I get errors in Problems view, but all the
>>> aspectj weaving messages are gone........
>>
>>
>>
>> And it seems the reason is that nothing is getting weaved. All I did
>> was restart eclipse (I have to do this often to get the
>> cross-reference view to work again). No clue whats going on. I'll keep
>> this thread uptodate as learn anything.
>
>
> Found the problem. I left the unit test with an error in it. This seems
> to prevent /any/ weaving from occuring. Is this the desgined behavior,
> or should I file a bug?

Yes, the behavior is as designed. If you want to change this, then
there is an option 'proceed on error' that can be set on the command
line with '-proceedOnError' - I'm not sure where you can specify it in
the UI though, it is a JDT compiler option that we in AspectJ inherit.

Andy.
Re: Can invoke introduced methods [message #588553 is a reply to message #52750] Fri, 03 June 2005 16:13 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
>> Found the problem. I left the unit test with an error in it. This
>> seems to prevent /any/ weaving from occuring. Is this the desgined
>> behavior, or should I file a bug?
>
>
> Yes, the behavior is as designed. If you want to change this, then
> there is an option 'proceed on error' that can be set on the command
> line with '-proceedOnError' - I'm not sure where you can specify it in
> the UI though, it is a JDT compiler option that we in AspectJ inherit.

Thanks Andy. There is a place "Non standard compiler options" in the AspectJ page of the project properties. However, adding that option does not have any effect. I found several bugs related to this (https://bugs.eclipse.org/bugs/show_bug.cgi?id=75568, https://bugs.eclipse.org/bugs/show_bug.cgi?id=74245) which claim that it should work.

Maybe this is a regression bug. I'll play with it some more.
Re: Can invoke introduced methods [message #588558 is a reply to message #52723] Fri, 03 June 2005 16:19 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Sian January wrote:
> The reason for the red squiggles is that the Java editor eager parser
> does not know about the ITD method. In 1.2.0 RC1 and later you can use
> the AspectJ editor and get correct eager parsing. Right click on the
> file, then click 'Open With' > 'AspectJ/Java Editor'. If you need to do
> this a lot it is also possible to set the AspectJ editor to be the
> default for .java files in the preferences.

Thanks Sian. But I think I'm a bit confused now. This particular project is a reusable library (drools). I'm using aspectj internally to clean up some of the spagetti that has crept in as new features have been added. I want these introduced methods to be visible to clients of this library.

Is this only a problem within the same project, because the JDT has the source code on hand? But when other projects use the jar, they will see the introduced methods? (Well, I'll this presently.)

-barry
Re: Can invoke introduced methods [message #588662 is a reply to message #52777] Mon, 06 June 2005 07:27 Go to previous message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
As its a standard JDT Compiler option, I was expecting it could be
specified in the standard JDT Compiler options (via a checkbox) rather
than you being required to put it in the AspectJ 'non standard compiler
options' - but I can't find anywhere that suggests it can be set for
JDT. I doubt we've tested specifying it as a non-standard option on the
AJ panel, so I wouldn't be completely surprised if there was a bug
there. I'm sure it *does* work if the compiler is invoked via the
command line, so it shouldnt be tough to fix, just a bit of option wiring.

Andy.

Barry Kaplan wrote:

>>> Found the problem. I left the unit test with an error in it. This
>>> seems to prevent /any/ weaving from occuring. Is this the desgined
>>> behavior, or should I file a bug?
>>
>>
>>
>> Yes, the behavior is as designed. If you want to change this, then
>> there is an option 'proceed on error' that can be set on the command
>> line with '-proceedOnError' - I'm not sure where you can specify it in
>> the UI though, it is a JDT compiler option that we in AspectJ inherit.
>
>
> Thanks Andy. There is a place "Non standard compiler options" in the
> AspectJ page of the project properties. However, adding that option does
> not have any effect. I found several bugs related to this
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=75568,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74245) which claim that it
> should work.
> Maybe this is a regression bug. I'll play with it some more.
Re: Can invoke introduced methods [message #588690 is a reply to message #53135] Mon, 06 June 2005 08:26 Go to previous message
Eclipse UserFriend
Originally posted by: hawkinsh.uk.ibm.com

Does this JDT option do what you're looking for?

Window > Preferences > Java > Compiler > Build Path > Abort builds when
build path errors occur
Re: Can invoke introduced methods [message #588698 is a reply to message #53185] Mon, 06 June 2005 09:06 Go to previous message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
Helen Hawkins wrote:
> Does this JDT option do what you're looking for?
>
> Window > Preferences > Java > Compiler > Build Path > Abort builds when
> build path errors occur
>
>
>

Hmm, I thought that was more for project interdependency problems
preventing rebuilds? proceedOnError is used within a single project and
if specified means we continue to weave (as best we can) even if the
compiler reported problems. This is very useful for people that have
aspects containing declare warning/error statements, since weaving has
to occur for join points matching these statements to be reported.

Andy.
Re: Can invoke introduced methods [message #588707 is a reply to message #52804] Mon, 06 June 2005 09:20 Go to previous message
Sian January is currently offline Sian JanuaryFriend
Messages: 83
Registered: July 2009
Member
Barry Kaplan wrote:
> Sian January wrote:
>
>> The reason for the red squiggles is that the Java editor eager parser
>> does not know about the ITD method. In 1.2.0 RC1 and later you can
>> use the AspectJ editor and get correct eager parsing. Right click on
>> the file, then click 'Open With' > 'AspectJ/Java Editor'. If you need
>> to do this a lot it is also possible to set the AspectJ editor to be
>> the default for .java files in the preferences.
>
>
> Thanks Sian. But I think I'm a bit confused now. This particular project
> is a reusable library (drools). I'm using aspectj internally to clean up
> some of the spagetti that has crept in as new features have been added.
> I want these introduced methods to be visible to clients of this library.
>
> Is this only a problem within the same project, because the JDT has the
> source code on hand? But when other projects use the jar, they will see
> the introduced methods? (Well, I'll this presently.)
>
> -barry

Yes - if the files are in a JAR you should not see the same eager
parsing problem.

Sian
Previous Topic:beware when converting to aspectj project if you use multiple output paths
Next Topic:How to view multiple markers?
Goto Forum:
  


Current Time: Fri Apr 26 15:57:48 GMT 2024

Powered by FUDForum. Page generated in 0.06048 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top