Script Editor FAQs
Why is there an Incorrect Package Declaration Message in the Script Editor?
Warning introduced in version 7.1.0
In version 7.1.0, we introduced a warning message to the Script Editor to flag invalid/missing package declarations in script files. The message stated these invalid/missing package declarations wouldn't be supported from version 9.0.0 onwards. However, this is no longer the case. We will not do anything that breaks existing usage in future releases.
You will see a warning message (shown below) if you create, or have previously created, a script file under a directory without specifying a valid package declaration, something that we encourage in our best practices guide. This warning displays in Script Editor or when adding a script file to a feature configuration screen.
There is an additional bug that validates the last imported class in a script rather than the actual package declaration. This bug is due to be fixed in version 7.5.0.
Why we introduced a warning message
We recommended you use correct package declarations to prevent class name conflicts where you may have two files with the same name in different packages. For example, if you had foo/bar/file.groovy and abc/pqr/file.groovy without the package declaration, both would be loaded as file.class. Suppose you have the same named script in two different directories, and you don't have correct package declarations and import them into another script. In that case, you can get non-deterministic behaviour regarding which script is imported.
Warning to be updated in an upcoming release
We are in the process of updating the warning to an information message, as we will not remove support for invalid/missing package declarations from version 9.0.0. We suggest you use packages correctly for new scripts/classes, but there is no requirement to fix existing scripts, unless you want to. In the meantime we are looking at what tools we can provide, so it's easier to update existing scripts.
How do you get rid of this message?
When is the issue object available by default in the script editor?
The issue object is available in the following contexts:
- Post-functions
- Listeners (as
event.issue)Note: The issue binding variable is only available for events that contain a single issue object. This means only issue events (excluding issue link events). - Behaviours (as
underlyingIssue)Note: Not available on the Create screen. - Scripted Fields
You will have to declare a specific issue object in the following contexts:
- Script Console
- Mail Handler