Skip to content

Commit

Permalink
Merge pull request #1753 from KronicDeth/1634
Browse files Browse the repository at this point in the history
Get ProjectImportProvider builder in doGetBuilder instead of constructor
  • Loading branch information
KronicDeth committed Apr 11, 2020
2 parents e797933 + ba86c57 commit 7123285
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@
* `QuotableImpl.quote`
* [#1745](https://github.com/KronicDeth/intellij-elixir/pull/1745) - [@KronciDeth](https://github.com/KronicDeth)
* Fix tests for IDEA 2020.1.
* [#1753](https://github.com/KronicDeth/intellij-elixir/pull/1753) - [@KronciDeth](https://github.com/KronicDeth)
* Get `ProjectImportProvider` builder in `doGetBuilder` instead of constructor.

Fixes use of deprecated constructor dependency injection that is incompatible with dynamic, injectable plugins in 2020.1.

```
com.intellij.diagnostic.PluginException: getComponentAdapterOfType is
used to get org.elixir_lang.mix.project._import.Builder(
requestorClass=org.elixir_lang.mix.project._import.Provider,
requestorConstructor=protected org.elixir_lang.mix.project._import.Provider(org.elixir_lang.mix.project._import.Builder)
).
Probably constructor should be marked as NonInjectable. [Plugin: org.elixir_lang]
```

## v11.5.0
### Enhancements
Expand Down
12 changes: 12 additions & 0 deletions resources/META-INF/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ <h1>v11.5.1</h1>
</ul>
</li>
<li>Fix tests for IDEA 2020.1.</li>
<li>
<p>Get <code>ProjectImportProvider</code> builder in <code>doGetBuilder</code> instead of constructor.</p>
<p>Fixes use of deprecated constructor dependency injection that is incompatible with dynamic, injectable plugins in 2020.1.</p>
<pre><code>com.intellij.diagnostic.PluginException: getComponentAdapterOfType is
used to get org.elixir_lang.mix.project._import.Builder(
requestorClass=org.elixir_lang.mix.project._import.Provider,
requestorConstructor=protected org.elixir_lang.mix.project._import.Provider(org.elixir_lang.mix.project._import.Builder)
).

Probably constructor should be marked as NonInjectable. [Plugin: org.elixir_lang]
</code></pre>
</li>
</ul>
</li>
</ul>
Expand Down
13 changes: 6 additions & 7 deletions src/org/elixir_lang/mix/project/_import/Provider.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@
import com.intellij.ide.util.projectWizard.ProjectJdkForModuleStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.projectImport.ProjectImportBuilder;
import com.intellij.projectImport.ProjectImportProvider;
import org.elixir_lang.mix.project._import.step.Root;
import org.elixir_lang.mix.project._import.step.SelectOtpApps;
import org.elixir_lang.sdk.elixir.Type;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Created by zyuyou on 15/7/1.
*/
public class Provider extends ProjectImportProvider {
protected Provider(@NotNull Builder builder) {
super(builder);
}

@Override
public ModuleWizardStep[] createSteps(@NotNull WizardContext context){
return new ModuleWizardStep[]{
Expand All @@ -28,6 +22,11 @@ public ModuleWizardStep[] createSteps(@NotNull WizardContext context){
};
}

@Override
protected ProjectImportBuilder doGetBuilder() {
return ProjectImportBuilder.EXTENSIONS_POINT_NAME.findExtensionOrFail(Builder.class);
}

@Override
protected boolean canImportFromFile(VirtualFile file) {
// todo: import project from file(mix.exs)
Expand Down

0 comments on commit 7123285

Please sign in to comment.