-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script variables not recognised when compiler config added (regression) #1555
Comments
Can you describe your config script a bit (or include the whole thing)? Are you setting a script base class? |
Thanks for following up! And apologies that's an obvious thing to ask. The config script is super simple, the only thing it does is set a script base class. I've reproduced the issue in an isolated project now, so it is like this:
And the base class itself is just a dummy one (the problem is what happens to things NOT in the base class, rather than any functionality it provides itself):
I've bundled these into a zip file: I've found it's always a bit dicey when you put the base class for the compiler into the same project as the code being compiled, but it does reproduce the problem here as long as I ensure it got compiled first and then modify the script afterwards. Another thing I should have mentioned is that I'm using two different versions of Eclipse here. The older one is Eclipse-2022-12 while the newer one is Eclipse-2023-12. Let me know any other useful info I could provide. |
I think I resolved this : closely reading the documentation for script base classes I can see that in fact you're not supposed to override the It's an odd thing that somehow this subtle mistake on my part worked in earlier versions but caused problems later on. I'll leave this open in case you want to comment or feel like it's still worth addressing in some manner, but I think happy to call this my mistake. Thanks for the consideration and sorry for the noise - hopefully helps someone in the future having this documented here. |
You are allowed to overload the The fix for GROOVY-8096 mas also be the cause: a51a8c0 |
In the past I could add a compiler configuration in the Groovy Compiler section of the project settings, and this would allow me to add type safe methods to my script, while also allowing for dynamic variables to be defined and work with type inferencing features.
In newer versions, when I define a custom compile config, I still get my custom type safe methods working, but scripts seem to lose the ability for dynamic variables to be defined : they are marked with an underline in the editor and autocomplete on their methods and properties no longer works.
Here are pictures of the two versions behaviour side by side:
If I remove the compiler configuration from the new version then its behaviour is the same as the old version. Only when I set a custom compiler configuration, now I get the problematic behaviour.
Apologies it is a bit complicated to create a complete reproducible test scenario for this, but let me know if you can't reproduce and I will take a shot at setting up a complete example.
The text was updated successfully, but these errors were encountered: