Community
Participate
Working Groups
Created attachment 178738 [details] Related code Applying the Java discoverer on attached class source leads up to a non attached EObject exception when saving to XMI.
Created attachment 178739 [details] Stack trace
A similar issue with javadoc occurs when invoking "java discoverer" on MoDisco "oegm.java.discoverer" sources project.
Moving to P1 because this blocks the java discoverer usage.
I think I have found the reason for this bug. The comment is attached to an element, but then later removed by this statement in CommentsManager#jdtLocationSearch: // we have to clear javadoc comments that have been already // linked to the element element.getComments().clear(); I don't understand the reason for this statement. Could someone with more knowledge on the Java discoverer investigate this?
Created attachment 181088 [details] patch Anyway, here is a patch that fixes the problem, by removing only javadoc comments as the comment suggests, and putting back removed comments in the unhandled comments list.
Looking back to the code, i remember that javadoc instances are already attached in JdtVisitor to elements before CommentsManager invocation, and i understand that they may need some relocalization -> remove from elements and putting them in localCommentList seems logical. I agree with the patch.
Thank you for your review. I committed the patch in revision 3333.
A test failed with this modification. I removed the "localCommentList.add(javadoc);" and it passes all the tests. I also added a test for this bug.
The patch has been successfully integrated.