@Extension is used to mark implementations of Extension points for Jenkins. Jenkins itself creates instances of the extensions and attaches them to the right extension point instance. How the extension instances are created depends on where the annotation is placed.
The javadoc of @Extension lists the possible usage options.
If your plugin was written following the old manual registration mechanism, there might be a pitfall:
- The "recommended" setup is @Extension on the class (e.g. your plugin descriptor class), and don't create a singleton instance.
- If you DO have a singleton instance, then @Extension must on that and not on the class. Otherwise Jenkins uses one instance of the descriptor and your code uses a different instance.
See also this thread in the mailing list for details.