Skip to content

Just scan class files. not MANIFEST.MF, LICENSE or any .java #99

Closed
vaadin/flow
#11300

Description

@stbischof

Desktop (please complete the following information):

  • Vaadin Plugin version: 17.0.1

Describe the bug
ReflectionsClassFinder should only scan class files. at the moment there is to much useless log output

To Reproduce
.gradle clean build --debug

Expected behavior
just scan class files

org.reflections.ReflectionsException: could not create class object from file META-INF/MANIFEST.MF
        at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:32)
        at org.reflections.Reflections.scan(Reflections.java:253)
        at org.reflections.Reflections.scan(Reflections.java:202)
        at org.reflections.Reflections.<init>(Reflections.java:123)
        at com.vaadin.gradle.ReflectionsClassFinder.<init>(ReflectionsClassFinder.kt:43)
        at com.vaadin.gradle.VaadinUtilsKt.getClassFinder(VaadinUtils.kt:63)
        at com.vaadin.gradle.VaadinUtilsKt.createNodeTasksBuilder(VaadinUtils.kt:157)
        at com.vaadin.gradle.VaadinPrepareFrontendTask.vaadinPrepareFrontend(VaadinPrepareFrontendTask.kt:89)
        at jdk.internal.reflect.GeneratedMethodAccessor624.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
...
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.reflections.ReflectionsException: could not create class file from MANIFEST.MF
        at org.reflections.adapters.JavassistAdapter.getOfCreateClassObject(JavassistAdapter.java:102)
        at org.reflections.adapters.JavassistAdapter.getOfCreateClassObject(JavassistAdapter.java:24)
        at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:30)
        ... 108 more

Activity

  1. self-assigned this
    on Dec 17, 2020
  2. mvysny commented on Dec 17, 2020

    @mvysny
    Member

    Thank you, reproduced on github.com/vaadin/base-starter-gradle v14; simply run ./gradlew --debug.

  3. mvysny commented on Dec 17, 2020

    @mvysny
    Member

    The bug is present in the ReflectionsClassFinder: it doesn't configure the Reflections library properly to only process .class files. That class comes from Vaadin 14 and so the bug is present upstream. However, the same bug can not be reproduced with Maven plugin even if running with -X (probably slf4j is missing on classpath and thus the Reflections library logs nothing). That leads me to believe that upstream will not fix this issue.

    The ReflectionsClassFinder has been copied out of Vaadin for Gradle plugin 0.17+ anyways; proposed solution is to copy out the class for Gradle plugin 0.14 and patch it locally.

  4. added a commit that references this issue on Dec 17, 2020
    ef60b06
  5. mvysny commented on Dec 17, 2020

    @mvysny
    Member

    Thank you, the fix will now be present in a future release of both 14.x (0.14.4.4 or higher) and master (0.18.0.2 or higher).

  6. mvysny commented on Mar 17, 2021

    @mvysny
    Member

    The fix is to configure ConfigurationBuilder to only consider *.class files as follows:

    setInputsFilter { it!!.endsWith(".class") && !it.endsWith("module-info.class") } // only scan .class files: https://github.com/vaadin/vaadin-gradle-plugin/issues/99
    

    Reopening since the new Vaadin 20 plugin will have the same issue.

  7. reopened this on Mar 17, 2021
  8. mvysny commented on Mar 17, 2021

    @mvysny
    Member

    Reported upstream as vaadin/flow#10304

  9. added
    blocked by upstreamSomething needs to be fixed first in the depending libraries
    on Mar 17, 2021
  10. added a commit that references this issue on Mar 17, 2021
  11. mvysny commented on Jun 2, 2021

    @mvysny
    Member

    Upstream bug has been fixed in Vaadin 20; however it has not been fixed in Vaadin 14. Therefore I'm leaving this ticket open.

  12. added a commit that references this issue on Jun 22, 2021
    f0f9bd4
  13. added a commit that references this issue on Jun 23, 2021
    058d765
  14. added a commit that references this issue on Jun 23, 2021
    200b7a1
  15. added a commit that references this issue on Jun 23, 2021
    9c6e83b
  16. vaadin-bot commented on Jun 28, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 21.0.0.alpha8. For prerelease versions, it will be included in its final version.

  17. vaadin-bot commented on Jul 5, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 20.0.4. For prerelease versions, it will be included in its final version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions