Bug 310043 - unhelpful 'can't override final' messages coming out.
Summary: unhelpful 'can't override final' messages coming out.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.6.9M2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-21 18:55 EDT by Andrew Clement CLA
Modified: 2010-05-13 13:48 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 Andrew Clement CLA 2010-04-21 18:55:34 EDT
A maven project consists of both regular source and test source and a ton of ITDs.

One of the ITDs declares a final implementation of equals/hashcode on some set of target types.  This works fine when the source is built.

Later the testcode is built.  Some references in the testcode cause the source types to be pulled in - these types go through the createBinaryTypeFrom() logic (in AjLookupEnvironment) - which attempts to reapply the ITDs - these look to 'clash' with those already in the target type and the message comes out
Comment 1 Andrew Clement CLA 2010-04-21 19:18:23 EDT
this is because of the check at the statr of ResolvedType.checkLegalOverride() which checks whether the parent is final.  If it is then it just fails immediately.  The problem is how do we recognize that the reason the method is there is because the ITD put it there earlier...
Comment 2 Andrew Clement CLA 2010-04-21 19:29:14 EDT
there is code to handle this case (binarytypebinding seeing an ITD for the second time) but it only works *if* the ITD is on the exact type.  Where the ITD is on an interface and the binarytypebinding is for a type that is the top most implementor, that logic doesn't execute.
Comment 3 Andrew Clement CLA 2010-04-21 22:25:22 EDT
fixed.  the detection logic for whether it is an ITD clash is duplicated in the checkLegalOverride code