Bug 222054

Summary: no detailed checks for nevermatching pointcuts
Product: [Tools] AspectJ Reporter: Thomas <bolbit>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Thomas CLA 2008-03-10 10:15:28 EDT
During the evaluation of the aspectBench compiler (abc) [1] i collide with the following issue:

I compiled AJHotDrawg [2] with ajc and the abc.

The abc throws the following error:

---------------------------------------------
abc:
     [java] abc started on Sun Mar 09 20:53:43 GMT 2008
     [java] /home/thomas/workspace/java/abc-head/../abc-head-ajhotdraw/AJHotDraw/src/aspects/org/jhotdraw/ccconcerns/commands/undo/DeleteCommandUndo.aj:56:
     [java] Invalid application of around advice from aspect
     [java] org.jhotdraw.ccconcerns.commands.undo.UndoRedoActivity
     [java]
(/home/thomas/workspace/java/abc-head/../abc-head-ajhotdraw/AJHotDraw/src/aspects/org/jhotdraw/ccconcerns/commands/undo/UndoRedoActivity.aj,
     [java] line 138) : Can't apply around advice with non-object
non-void return type
     [java] to a void shadow (shadow type: void; advice return
type: boolean)
     [java] setRedoable(true);
     [java] ^---------------^
     [java]
     [java] 1 error.
     [java] Java Result: 5 
---------------------------------------------

The indicated pointcut looks like:
---------------------------------------------
pointcut callUndoableSetRedoable(Undoable undoable, boolean newIsRedoable) : 
		call(void Undoable.setRedoable(boolean)) &&
		args(newIsRedoable) &&
		target(undoable) &&
		if(false); //just to have no match for now

	boolean around(Undoable undoable, boolean newIsRedoable) : callUndoableSetRedoable(undoable, newIsRedoable) {
		return proceed(undoable, newIsRedoable);
	}

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

The ajc compiles this source without errors. But as you can see the pointcut identifies calls to void methods but the advice return boolean.

My guess is that the compiler does no detailed check as it notices that the pointcut will never match as it include if(false). After I comment the if(false) out also the ajc throws errors during the compilation.

Is this issue known?

[1] http://abc.comlab.ox.ac.uk/introduction
[2] http://ajhotdraw.sourceforge.net/