Bug 134383 - Error every second save when certain pointcut syntax is used
Summary: Error every second save when certain pointcut syntax is used
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.5.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-01 17:10 EST by Patrick Murphy CLA
Modified: 2006-05-18 06:25 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Murphy CLA 2006-04-01 17:10:43 EST
When I add a pointcut like: 

  pointcut methodCallsTo(): call(* tracing.*.*(..));

I get the below exception every _second_ save starting with the first.  The code
seems to work though. 

java.lang.RuntimeException
at org.aspectj.asm.AsmManager.verifyAssumption(AsmManager.java:748)
at org.aspectj.asm.AsmManager.removeSingleNode(AsmManager.java:684)
at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:646)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:249)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:163)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

RuntimeException thrown: Assertion is false
Comment 1 Helen Beeken CLA 2006-04-03 08:02:11 EDT
The route to the runtime exception seems to be the following:

- from the code that tries to remove sources that have no valid relationships we get hold of the IProgramElement and if it has kind "code" then we call removeSingleNode(ipe).
- in removeSingleNode(ipe) we first check whether ipe is non null (this isn't causing the RuntimeException)
- we then get the parent via ipe.getParent()
- we then get all the children via parent.getChildren()
- we then loop through all the children and see if any of these are equal to the ipe we called the method with
- if we find it then we remove the child, set deleteOK to be true and break out from the loop
- the final call is to verifyAssumption(deleteOK)

In the case of this bug, deleteOK was false and so we get the RuntimeException.

For future reference, in the latest code from HEAD:

AsmManager.java:748 - is now line 750
AsmManager.java:684 - is now line 686
AsmManager.java:646 - is now ine 648

I've not as yet though, been able to reproduce this bug, although I would imagine a full build (by pressing the build button or doing Project > Clean) will stop you getting the RuntimeException. Could you provide any more information about your project?
Comment 2 Andrew Clement CLA 2006-05-18 06:05:32 EDT
I believe I fixed this bug with the recent overhaul to the incremental structure model repair code - I wasn't trying to recreate this but it happened to me.

The problem occurred because of a cache entry that wasnt being cleared out - we were looking for a CODE node that needed deleting by walking the tree, we would find one and then attempt to delete it.  Unfortunately the walking code and the deletion code were working with different program element structures for the source file in question - although a new one had been built (which did not contain the code node on this compile), the old one was still reachable via a cache (handleMap in AspectJElementHierarchy I think it was) - so we'd walk the stale old one, find a node then attempt to remove it from the current model where it didnt exist - BANG.

As that build then fails, the next build is then full where no repairs are attempted, then the next build is incremental where this happens again - etc/etc - thats why it fails every second compile.

so... does this happen for you on the latest AJDT (1.4.0 stream) since that includes the fix.
Comment 3 Andrew Clement CLA 2006-05-18 06:25:46 EDT
Helen informs me we have a testcase in for this, so closing as that works!