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

No value present error #399

Closed
tasomaniac opened this issue Feb 23, 2022 · 3 comments · Fixed by #400
Closed

No value present error #399

tasomaniac opened this issue Feb 23, 2022 · 3 comments · Fixed by #400
Labels
bug Something isn't working

Comments

@tasomaniac
Copy link
Contributor

I tried the plugin in a project and getting this error. Unfortunately I cannot provide a sample project but I hope the stacktrace will be helpful. Please let me know if you would like to have more details. Thanks.

Caused by: java.util.NoSuchElementException: No value present
        at modulecheck.parsing.java.JavaFile$parsed$2.invoke(JavaFile.kt:77)
        at modulecheck.parsing.java.JavaFile$parsed$2.invoke(JavaFile.kt:47)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at modulecheck.parsing.java.JavaFile.getParsed(JavaFile.kt:47)
        at modulecheck.parsing.java.JavaFile.access$getParsed(JavaFile.kt:34)
        at modulecheck.parsing.java.JavaFile$imports$2.invoke(JavaFile.kt:89)
        at modulecheck.parsing.java.JavaFile$imports$2.invoke(JavaFile.kt:88)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at modulecheck.parsing.java.JavaFile.getImports(JavaFile.kt:88)
        at modulecheck.api.context.Imports$Key.invoke(Imports.kt:43)
        at modulecheck.api.context.Imports$Key.invoke(Imports.kt:34)
        at modulecheck.parsing.ProjectContextImpl.get(ProjectContext.kt:40)
        at modulecheck.api.RealAndroidMcProject.get(RealAndroidMcProject.kt:42)
        at modulecheck.api.context.ImportsKt.getImports(Imports.kt:58)
        at modulecheck.api.context.ImportsKt.importsForSourceSetName(Imports.kt:60)
        at modulecheck.core.internal.UsesKt.usesInConfig(uses.kt:51)
        at modulecheck.core.internal.UsesKt.uses(uses.kt:35)
        at modulecheck.core.rule.InheritedDependencyRule.check(InheritedDependencyRule.kt:37)
        at modulecheck.gradle.task.ModuleCheckAllTask.evaluate(ModuleCheckAllTask.kt:37)
        at modulecheck.core.ModuleCheckRunner.run-IoAF18A(ModuleCheckRunner.kt:56)
        at modulecheck.gradle.task.ModuleCheckTask.run(ModuleCheckTask.kt:80)
@RBusarow RBusarow added the bug Something isn't working label Feb 24, 2022
RBusarow added a commit that referenced this issue Feb 24, 2022
@RBusarow
Copy link
Member

Thanks for the report!

I was able to come up with a simple reproducer thanks to the stacktrace. The fix is here: #400.

This is happening because your project has a .java file without a package declaration, and that case wasn't handled properly in my java parsing.

I've published a new snapshot with the fix. If you would like to try version 0.11.4-SNAPSHOT, this bug won't cause you any more problems.

I hope to be releasing 0.11.4 pretty soon.

@kodiakhq kodiakhq bot closed this as completed in #400 Feb 24, 2022
kodiakhq bot pushed a commit that referenced this issue Feb 24, 2022
@tasomaniac
Copy link
Contributor Author

Awesome. I will check and report if this fixes it.

@tasomaniac
Copy link
Contributor Author

Yes, this is fixed. Thanks a lot

RBusarow added a commit that referenced this issue Feb 24, 2022
* main:
  add snapshots badge to README and website home
  remove the `Components` singleton
  correct the task name in the banner diagram
  add `moduleCheckAuto` to main README
  add project dictionary
  remove the -auto versions of the depths and graphs tasks
  correct the tasks listed in the "next" version of the docs
  Add SNAPSHOT info to README (#401)
  support .java files without package declaration fixes #399
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants