Coder Social home page Coder Social logo

madrapps / dagger-plugin Goto Github PK

View Code? Open in Web Editor NEW
30.0 4.0 9.0 1 MB

Plugin that supports easy usage of Dagger 2 library in IntelliJ iDEA or Android Studio

License: Apache License 2.0

Kotlin 75.08% Java 24.92%
kotlin intellij-plugin android-studio-plugin dagger dagger-plugin android intellij android-studio java dependency-injection

dagger-plugin's People

Contributors

cemeyer2 avatar thsaravana 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

Watchers

 avatar  avatar  avatar  avatar

dagger-plugin's Issues

Bindings (Objects) in the Dagger Tool window

Visualize the Bindings as Tree in the Dagger Tool window. The graph should flow as below:

|> AppComponent // root component with one method that creates a CoffeeMaker
||||> CoffeeMaker // _the CoffeeMaker class with @Inject with params Heater/Pump _
||||>||||> Heater // the Provides method in the Module which produces the Heater
||||>||||> Pump // the Binds method in Module that binds a Thermosiphon
||||>||||>||||> Thermosiphon the Thermosiphon class with @Inject with param Heater
||||>||||>||||>||||> Heater the Provides method in the Module which produces the Heater

  1. Note that we only show Production Java/Kotlin sources here (not the Dagger modules) except for the root component
  2. Clicking on Component should show the @component interface in the Editor.
  3. Clicking on Other nodes should take us to the place where the Object is created for these.

Component graph is not complete

In our app, we have several Dagger components, and our main one declares them as a dependency.

I only see the child components in the graph, but no the main one GlovoAppComponent:

Log:

2020-08-13 12:11:57,682 [  61100]   INFO -                         STDOUT - Dagger Plugin : Processor - taskManager:com.intellij.tasks.impl.TaskManagerImpl@2d02a3a4 
2020-08-13 12:11:57,687 [  61105]   INFO -                         STDOUT - Dagger Plugin : Processor - Start background task 
2020-08-13 12:11:57,688 [  61106]   INFO -                         STDOUT - Dagger Plugin : Processor - Running background task 
2020-08-13 12:11:57,866 [  61284]   INFO -                         STDOUT - Dagger Plugin : Processor - Compiling .[8].[230]. 
2020-08-13 12:11:58,421 [  61839]   INFO -                         STDOUT - Dagger Plugin : Processor - Compile success? true 
2020-08-13 12:11:58,627 [  62045]   INFO -                         STDOUT - Dagger Plugin : Processor - Compiling .[1866].[623]. 
2020-08-13 12:12:03,065 [  66483]   INFO -                         STDOUT - Dagger Plugin : ------------------------------------------------------------ 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : RootComponent - glovoapp.di.GlovoAppComponent 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : ComponentNodes - 159 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : ------------------------------------------------------------ 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT -  
2020-08-13 12:12:03,082 [  66500]   INFO -                         STDOUT - Dagger Plugin : Exception Handled 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR - java.lang.RuntimeException: kotlin.KotlinNullPointerException 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.main.Main.compile(Main.java:553) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor.compile(Processor.kt:111) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor.access$compile(Processor.kt:37) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor$process$task$1.run(Processor.kt:74) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:932) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:434) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressRunner.lambda$null$3(ProgressRunner.java:233) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:233) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.lang.Thread.run(Thread.java:748) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR - Caused by: kotlin.KotlinNullPointerException 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.createNode(SpiPlugin.kt:140) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.access$createNode(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addNodes$1.accept(SpiPlugin.kt:99) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addNodes$1.accept(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at java.util.Optional.ifPresent(Optional.java:159) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addNodes(SpiPlugin.kt:98) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addNodes(SpiPlugin.kt:115) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.access$addNodes(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addBindings$1.run(SpiPlugin.kt:63) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:869) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addBindings(SpiPlugin.kt:56) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.visitGraph(SpiPlugin.kt:50) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.runPlugins(BindingGraphValidator.java:100) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.visitPlugins(BindingGraphValidator.java:90) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.isValid(BindingGraphValidator.java:64) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.isValid(ComponentProcessingStep.java:254) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.processRootComponent(ComponentProcessingStep.java:151) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:131) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:62) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:51) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.google.common.collect.RegularImmutableMap.forEach(RegularImmutableMap.java:185) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:48) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:124) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:62) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.statistics.DaggerStatisticsCollectingProcessingStep.process(DaggerStatisticsCollectingProcessingStep.java:52) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:802) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:713) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1043) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1184) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) 
2020-08-13 12:12:03,085 [  66503]   INFO -                         STDERR -     at com.sun.tools.javac.main.Main.compile(Main.java:523) 
2020-08-13 12:12:03,085 [  66503]   INFO -                         STDERR -     ... 18 more 

Not working on multi-module project

On my multi-module maven project:
on the dagger panel, always say Nothing to show.
after clicking Refresh button, showing Analysing dagger dependencies for a while, but no other outcome.
Android Studio: 4.2.2

Status?

Is this project still active/are there plans to revive it? There are open PRs and issues several months old.

Thanks for your effort, but it would be good to know if we should consider it as abandoned, in favour of other plugins or perhaps forking this.

Validation for PrivateClass in @Inject

If the class is private and if a field or method is annotated with @Inject then show the error with message: "Dagger does not support injection into private classes"

Dagger window not displaying bindings

I have a maven project using dagger. I can see and use the dagger binding navigation in the margins of my code, but the Dagger window doesn't show any bindings.

I tried multiple things:

  • do a normal clean/install build with maven (using a run configuration);
  • build with IntelliJ itself (the hammer button);
  • generate sources with IntelliJ itself;
  • Enable/disable the "Generate Graph on Every Build" in the Dagger window with all the above;
  • Click the refresh button in the Dagger window;
  • Downgrading to Dagger 2.31 with all of the above.

None of these worked.

Versions:

  • IntelliJ: 2021.1.3
  • Maven: 3.6.3
  • Dagger: 2.38.1
  • Dagger IntelliJ Plugin: 0.3.2021.1.1

Plugin freezes IntelliJ completely while analyzing dependency graph of my project

IntelliJ freezes if I attempt to analyze dependency graph of my project.

I dunno if this is due to dependency cycles in my project being solved by using Lazy or if something else goes wrong.

Steps to reproduce (Linux):

  • git clone https://github.com/plan-player-analytics/Plan.git
  • cd Plan
  • idea.sh Plan
  • Wait for the project to open
  • Hit refresh on the Dagger plugin panel
  • The UI freezes and the process needs to be killed

Update Dagger plugin to support Intellij IDEA 2021.1

Got the following error when I updated Intellij:

Plugin 'Dagger' (version '0.3.2020.3.3') is not compatible with the current version of the IDE, because it requires build 203.* or older but the current build is IU-211.6693.111

Getting "Dagger does not support injection into private fields" when Dagger is not in the classpath

I have the Dagger plugin installed in IntelliJ, for projects which use Dagger.

I have another project which uses Spring. In one of my files, which uses Spring injection, using the javax.inject.Inject annotation, IntelliJ gives the following error on all private fields which are annotated with @Inject.

Dagger does not support injection into private fields

When Dagger is on in the classpath, then the Dagger plugin should not be active.

Hilt integration

Great plugin you got there! I have one issue - in new project, based directly on Hilt, the Dagger window is empty:
image

I don't see any errors, projects build and runs just fine.

Tried on Android Studio 4.0.1 with Hilt 2.28.3-alpha

IntelliJ Ultimate 2020.3.2 java.lang.NoSuchMethodError

IntelliJ Ultimate 2020.3.2
Kotlin 203-1.4.30-release-IJ7148.5

I get an error when dagger tries to analyze my code. Please let me know what other information I could provide!

java.lang.NoSuchMethodError: 'boolean org.jetbrains.kotlin.asJava.classes.UltraLightAnnotationsKt.isPrivateOrParameterInPrivateMethod(com.intellij.psi.PsiModifierListOwner)'
	at com.madrapps.dagger.validation.ProblemKt.validatePrivateMethod(Problem.kt:27)
	at com.madrapps.dagger.validation.ProvidesProblem.validateMethod(ProvidesProblem.kt:32)
	at com.madrapps.dagger.validation.ProvidesProblem.isError(ProvidesProblem.kt:19)
	at com.madrapps.dagger.validation.ValidationAnnotator.annotate(ValidationAnnotator.kt:25)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:136)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:116)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:336)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:269)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:295)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:298)
	at com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.lambda$analyze$1(HighlightVisitorImpl.java:211)
	at com.intellij.codeInsight.daemon.impl.analysis.RefCountHolder.analyze(RefCountHolder.java:370)
	at com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.analyze(HighlightVisitorImpl.java:210)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:298)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:298)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:96)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:298)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:266)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:212)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1137)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:172)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Support for bazel

Hi,
I am trying to use this plugin with a bazel project on intellij and nothing shows up. Just wondering if you had any plans to support bazel projects in intellij

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.