Skip to content
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

Deprecate StandardPlugin.init in favor of initialize method taking implicit Context #20330

Merged
merged 4 commits into from
May 8, 2024

Conversation

WojciechMazur
Copy link
Contributor

@WojciechMazur WojciechMazur commented May 3, 2024

Resolves #20185

We do deprecate StandardPlugin.init in favour of StandardPlugin.initialize method tak takes additional Context parameter - it would e.g. allow to use reporting mechanism when parsing compiler plugin options.
The old method is no longer abstract - returns empty list of phases instead. New method by default does delegate initialization to old variant to keep source compatibility.

Introduces changes to akka/akka fork used in Community Build: dotty-staging/akka#1 and dotty-staging/akka#2

@WojciechMazur WojciechMazur requested a review from sjrd May 3, 2024 13:45
@@ -50,7 +51,19 @@ trait StandardPlugin extends Plugin {
* @param options commandline options to the plugin.
* @return a list of phases to be added to the phase plan
*/
def init(options: List[String]): List[PluginPhase]
@deprecated("`init` does not allow to access `Context`, use `initialize` instead.", since = "3.5.0")
def init(options: List[String]): List[PluginPhase] = Nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should keep it abstract? Otherwise, somebody might forget to override one of the variants. Would still make sense, as most of compiler plugins don't use context yet, so new variant can be treated as extended, advanced variant

@WojciechMazur WojciechMazur force-pushed the plugins/init-with-context branch from 413abc1 to ceda47f Compare May 7, 2024 12:37
@WojciechMazur WojciechMazur added the needs-minor-release This PR cannot be merged until the next minor release label May 7, 2024
@WojciechMazur WojciechMazur merged commit 1276034 into scala:main May 8, 2024
19 checks passed
@WojciechMazur WojciechMazur deleted the plugins/init-with-context branch May 8, 2024 12:57
Kordyjan pushed a commit that referenced this pull request May 10, 2024
…g implicit Context (#20330)

We do deprecate `StandardPlugin.init` in favour of
`StandardPlugin.initialize` method tak takes additional `Context`
parameter - it would e.g. allow to use reporting mechanism when parsing
compiler plugin options.
Introduces changes to akka/akka fork used in Community Build

[Cherry-picked 1276034]
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler plugins API: init method should have access to Context
3 participants