Coder Social home page Coder Social logo

dagger-intellij-plugin's Introduction

Dagger IntelliJ Plugin

Dagger can provide a class objects without needing to know how they are constructed. The Dagger IntelliJ plugin helps demystify this behavior and creates visual connections between a @Inject object and the @Provides method that creates it.

inject->provide

Download

Download the plugin jar and select "Install Plugin From Disk" in IntelliJ's plugin preferences.

License

Copyright 2013 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

dagger-intellij-plugin's People

Contributors

aleckazakova avatar holmes avatar jakewharton avatar kingargyle avatar rjuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dagger-intellij-plugin's Issues

IntelliJ throws an exception about Dagger plugin

I'm running into a non-user-experience-breaking list of exceptions with the dagger plugin.
It should be noted that I was able to see the little "๐Ÿ—ก" icons (and also the different orientation variations of it) in the gutter and was able to navigate to the beans.

However, I believe this error message may be useful to the project.

System Info:
IntelliJ IDEA 2018.1.4 (Ultimate Edition)
Build #IU-181.5087.20, built on May 16, 2018
JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.12.6

Stacktrace:

Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
Details: Current thread: Thread[ApplicationImpl pooled thread 13,4,Idea Thread Group] 1468698127
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0 2018.1.4#IU-181.5087.20 IDEA, eap:false, os:Mac OS X 10.12.6, java-version:JetBrains s.r.o 1.8.0_152-release-1136-b39,6,Idea Thread Group] 1973847948
java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1055)
	at com.intellij.psi.impl.file.impl.FileManagerImpl.findDirectory(FileManagerImpl.java:371)
	at com.intellij.psi.impl.PsiManagerImpl.findDirectory(PsiManagerImpl.java:196)
	at com.intellij.psi.impl.source.PsiFileImpl.getContainingDirectory(PsiFileImpl.java:466)
	at com.intellij.psi.impl.source.PsiFileImpl.getParent(PsiFileImpl.java:453)
	at com.intellij.psi.impl.source.PsiFileImpl.getParent(PsiFileImpl.java:67)
	at com.squareup.ideaplugin.dagger.PsiConsultantImpl.findField(PsiConsultantImpl.java:123)
	at com.squareup.ideaplugin.dagger.Decider$ProvidesMethodDecider.shouldShow(Decider.java:38)
	at com.squareup.ideaplugin.dagger.ShowUsagesAction$10.process(ShowUsagesAction.java:403)
	at com.squareup.ideaplugin.dagger.ShowUsagesAction$10.process(ShowUsagesAction.java:391)
	at com.intellij.find.findUsages.FindUsagesManager.lambda$null$6(FindUsagesManager.java:359)
	at com.intellij.util.CommonProcessors$UniqueProcessor.process(CommonProcessors.java:122)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processTextOccurrences$25(PsiSearchHelperImpl.java:1013)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processUsagesInNonJavaFiles$12(PsiSearchHelperImpl.java:520)
	at com.intellij.psi.impl.search.LowLevelSearchUtil.processTextOccurrences(LowLevelSearchUtil.java:263)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.processUsagesInNonJavaFiles(PsiSearchHelperImpl.java:515)
	at com.intellij.psi.impl.search.PsiSearchHelperImpl.processTextOccurrences(PsiSearchHelperImpl.java:1010)
	at com.intellij.find.findUsages.FindUsagesHelper.processUsagesInText(FindUsagesHelper.java:62)
	at com.intellij.find.findUsages.JavaFindUsagesHelper.processElementUsages(JavaFindUsagesHelper.java:208)
	at com.intellij.find.findUsages.JavaFindUsagesHandler.processElementUsages(JavaFindUsagesHandler.java:246)
	at com.intellij.find.findUsages.FindUsagesManager.lambda$createUsageSearcher$9(FindUsagesManager.java:370)
	at com.intellij.find.findUsages.FindUsagesManager$1.run(FindUsagesManager.java:294)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Intellij build 12.1.3 produce unsupported exception

PluginException: com/squareup/ideaplugin/dagger/DaggerProjectHandler : Unsupported major.minor version 51.0 [Plugin: com.squareup.ideaplugin.dagger]: com/squareup/ideaplugin/dagger/DaggerProjectHandler : Unsupported major.minor version 51.0 [Plugin: com.squareup.ideaplugin.dagger]
PluginException: com/squareup/ideaplugin/dagger/DaggerLineMarkerProvider : Unsupported major.minor version 51.0 [Plugin: com.squareup.ideaplugin.dagger]: com/squareup/ideaplugin/dagger/DaggerLineMarkerProvider : Unsupported major.minor version 51.0 [Plugin: com.squareup.ideaplugin.dagger]

Im using dagger 1.0.0

Include a special icon for overrides bindings

When viewing the bindings corresponding to an injection, it's not obvious which ones are the production ones (which you usually want) and which ones are the test/dev ones (which you don't).

Dagger knows this via the overrides=true option on the declaring module. Production code usually doesn't set this; test code usually does.

We should either add an icon or split the list into two parts, with production stuff up top and "test" stuff below.

cd9c4cc6-b86d-11e2-957e-5622729f5655

cc @swankjesse

Question: Multi module support

Is it planned - or possible at all - to support multi-module projects?
Currently, when I click on the dagger-icon of an @Inject annotated method in a child module, it won't find the related @Provides method (when both classes are in the same module, it works).

Please update build

Can you update build? Current build doesn't work on IntelliJ Community Edition 2016.1 cause this bug -> #19

Plugin doesn't work with Android Studio 0.5.1

I get this error when klicking on one of the icons.

com.intellij.find.findUsages.FindUsagesManager.startProcessUsages(Lcom/intellij/find/findUsages/FindUsagesHandler;Lcom/intellij/usages/UsageInfoToUsageConverter$TargetElementsDescriptor;Lcom/intellij/util/Processor;Lcom/intellij/find/findUsages/FindUsagesOptions;Ljava/lang/Runnable;)Lcom/intellij/openapi/progress/ProgressIndicator;: com.intellij.find.findUsages.FindUsagesManager.startProcessUsages(Lcom/intellij/find/findUsages/FindUsagesHandler;Lcom/intellij/usages/UsageInfoToUsageConverter$TargetElementsDescriptor;Lcom/intellij/util/Processor;Lcom/intellij/find/findUsages/FindUsagesOptions;Ljava/lang/Runnable;)Lcom/intellij/openapi/progress/ProgressIndicator;
java.lang.NoSuchMethodError: com.intellij.find.findUsages.FindUsagesManager.startProcessUsages(Lcom/intellij/find/findUsages/FindUsagesHandler;Lcom/intellij/usages/UsageInfoToUsageConverter$TargetElementsDescriptor;Lcom/intellij/util/Processor;Lcom/intellij/find/findUsages/FindUsagesOptions;Ljava/lang/Runnable;)Lcom/intellij/openapi/progress/ProgressIndicator;
    at com.squareup.ideaplugin.dagger.ShowUsagesAction.showElementUsages(ShowUsagesAction.java:428)
    at com.squareup.ideaplugin.dagger.ShowUsagesAction.startFindUsages(ShowUsagesAction.java:276)
    at com.squareup.ideaplugin.dagger.handler.ConstructorInjectToProvidesHandler.showUsages(ConstructorInjectToProvidesHandler.java:48)
    at com.squareup.ideaplugin.dagger.handler.ConstructorInjectToProvidesHandler.navigate(ConstructorInjectToProvidesHandler.java:36)
    at com.intellij.codeInsight.daemon.LineMarkerInfo$NavigateAction.actionPerformed(LineMarkerInfo.java:123)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.mouseReleased(EditorGutterComponentImpl.java:1230)
    at com.intellij.openapi.editor.impl.EditorImpl.processMouseReleased(EditorImpl.java:3986)
    at com.intellij.openapi.editor.impl.EditorImpl.access$10900(EditorImpl.java:135)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter$2.run(EditorImpl.java:5541)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:124)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.runMouseReleasedCommand(EditorImpl.java:5544)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mouseReleased(EditorImpl.java:5437)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:696)
    at java.awt.EventQueue$4.run(EventQueue.java:694)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:520)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Work with Dagger2

Hi, it seems that this plugin can not work with Dagger2 . Have you plan to support it?

Detect module injection

Asume you have @Inject annotation over class constructor
The plugin shows other classes where that class is injected, but doesn't show any injection into module.

For example, this class is only injected to module mapping:

     class ProfileCountriesFacade implements ProfileFacade {

        private final ProfileService profileService;
        private final CountriesService countriesService;

        @Inject
        ProfileCountriesFacade(ProfileService profileService,
                               CountriesService countriesService) {
            this.profileService = profileService;
            this.countriesService = countriesService;
        }
    }

picture to show view

declared mapping in module:

@Module
public class ProfileFacadeModule {
    @Provides
    ProfileFacade provideProfileCountriesFacade(ProfileCountriesFacade profileFacade) {
        return profileFacade;
    }
}

Using IntelliJ Community Edition 2016.1 NoClassDef Error Occurs

It appears an expected class by the plugin has been removed in Intellij Community Edition 2016.1.

com/intellij/ui/JBTableWithHintProvider
java.lang.NoClassDefFoundError: com/intellij/ui/JBTableWithHintProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:261)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:257)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:226)
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:119)
at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:73)
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:62)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.squareup.ideaplugin.dagger.ShowUsagesAction.showElementUsages(ShowUsagesAction.java:322)
at com.squareup.ideaplugin.dagger.ShowUsagesAction.startFindUsages(ShowUsagesAction.java:275)
at com.squareup.ideaplugin.dagger.handler.FieldInjectToProvidesHandler.navigate(FieldInjectToProvidesHandler.java:31)
at com.intellij.codeInsight.daemon.NavigateAction.actionPerformed(NavigateAction.java:56)
at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.performAction(EditorGutterComponentImpl.java:1592)
at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.mouseReleased(EditorGutterComponentImpl.java:1555)
at com.intellij.openapi.editor.impl.EditorImpl.processMouseReleased(EditorImpl.java:4325)
at com.intellij.openapi.editor.impl.EditorImpl.access$12500(EditorImpl.java:125)
at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter$2.run(EditorImpl.java:5952)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.runMouseReleasedCommand(EditorImpl.java:5956)
at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mouseReleased(EditorImpl.java:5836)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: com.intellij.ui.JBTableWithHintProvider PluginClassLoader[com.squareup.ideaplugin.dagger, 1.0.5]
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 57 more

Kotlin support

Are there any plans to support Kotlin programming language?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.