Community
Participate
Working Groups
We have an intermittent issue that results in an exception of type java.lang.ClassFormatError: Duplicate field name&signature in class file. We are using the aspectj-maven-plugin to weave our dependencies, but I've investigated the issue and found there is a bug in the core aspect J library. Having debugged the issue I have found that when types are ejected from the expendableMap in org.aspectj.weaver.World then the duplicate field error tends to occur. As a workaround for now I have patched org.aspectj.weaver.World to use a regular HashMap (which prevents the issue from occurring): final Map<String, ResolvedType> expendableMap = Collections .synchronizedMap(new HashMap<String, ResolvedType>()); I can provide further information on request.
Hi Michael - I'd like to get to the root of the problem rather than tweak the expendableMap like that. Can you tell what is being duplicated in what type and how your aspects relate to that? (If I can recreate it I can fix it pretty quick but if you can't share code with me I understand). We can switch over to my email if it is easier to share that way
Yes, definitely - the HashMap approach was just a workaround used by us to avoid this issue. I'm going to put some examples and log traces together and send you them in email. Thanks.
sounds great!
Hi! I'd like to enquiry whether you got an email, @AndrewClement, and you could find out whether it's a valid issue, it it's already fixed. Can it be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=565336 and therefore already solved? Thanks a lot!
@Gabor I don't think I got an email but it was a while ago. You may be right with that issue you linked to - have you tried a 1.9.7 AspectJ snapshot to see if it is addressed? There are some 1.9.7 snapshots here that include the latest JDT: https://aspectj.dev/maven/org/aspectj/
Thanks for the quick response. Due to time constraints I have to publish the changes we made, but in the mean time I will try to reproduce the issue. The problem is that it was an intermittent problem, and the problematic file does not exist any more. Thus making sure the issue is gone will need some time, but I will update this ticket when I am done.
Created attachment 286397 [details] Patch where the WeakHashMap in World.java has been replaced with HashMap Hi Andrew, I'm uploading the version with our changes. Although, I know you won't accept this as it's rather a workaround, but would it be enough to comply with the legal requirements, or could you please guide where I have to publish our version? Much appreciated!
Created attachment 286411 [details] Patch file where the WeakHashMap in World.java has been replaced with HashMap