[Bug]: Inconsistent parent for CtTypeReferenceImpl
in CtRecordComponentImpl
which points to a CtMethodImpl
#5868
Labels
CtTypeReferenceImpl
in CtRecordComponentImpl
which points to a CtMethodImpl
#5868
Describe the bug
When visiting all elements (keeping track of the parents) in the model, one encounters an element (I guess it is the Type of the Record Field) where its parent doesn't match the one that was kept track of.
It scans the elements like this:
and for some reason the
CtTypeReferenceImpl#getParent
does not point toCtRecordComponentImpl
, but to aCtMethodImpl
.For some reason the
![image](https://private-user-images.githubusercontent.com/24826124/342637459-f6008598-7e12-4951-942f-de04cba0b3c7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3ODI2MjYsIm5iZiI6MTcyNDc4MjMyNiwicGF0aCI6Ii8yNDgyNjEyNC8zNDI2Mzc0NTktZjYwMDg1OTgtN2UxMi00OTUxLTk0MmYtZGUwNGNiYTBiM2M3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDE4MTIwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY2OWUwODFkY2Y5MGYwYjVjODVkZDQ1MWQ4MjhiMjM3OGFlMDI1ZGY1YTAxMzY3YjgyM2VkZGNjYjk3ZTViYjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.epCvRmXV7Rt1kHNpwfpSaRzm74qxcWObhJmCr8xmPqQ)
CtMethodImpl
has the same reference to the type as theCtRecordComponentImpl
, butCtFieldImpl
has a distinct one:This is likely the result of a missing clone somewhere in the code?
![image](https://private-user-images.githubusercontent.com/24826124/342634596-22d2818a-0039-4392-b2bd-5d6927b20d31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3ODI2MjYsIm5iZiI6MTcyNDc4MjMyNiwicGF0aCI6Ii8yNDgyNjEyNC8zNDI2MzQ1OTYtMjJkMjgxOGEtMDAzOS00MzkyLWIyYmQtNWQ2OTI3YjIwZDMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDE4MTIwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUzY2RlOGQ2NWYwMDE2NjgxMTRjN2JhNzc4NTJmMGE5MzM4NTZmOGVkYmEyZTU5MThmZDBlZGUxMWYxNGU4ODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.R1QArOmJclXcd7LfeO5aUYvVHh9SppxATkRI44munEY)
My guess is that it is this line in the
CtRecordComponentImpl
:Source code you are trying to analyze/transform
Source code for your Spoon processing
Actual output
Expected output
Spoon Version
11.0.0
JVM Version
openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Zulu21.32+17-CA (build 21.0.2+13-LTS, mixed mode, sharing)
What operating system are you using?
Windows 11
The text was updated successfully, but these errors were encountered: