Reflections VS ClassGraph

Compare Reflections vs ClassGraph and see what are their differences.

Reflections

Java runtime metadata analysis (by ronmamo)

ClassGraph

An uber-fast parallelized Java classpath scanner and module scanner. (by classgraph)
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured
Reflections ClassGraph
2 3
4,744 2,841
0.3% 1.3%
0.0 8.7
10 months ago 5 months ago
Java Java
Do What The F*ck You Want To Public License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

Reflections

Posts with mentions or reviews of Reflections. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-07-03.
  • Is it possible to obtain all the built-in classes via reflection?
    1 project | /r/javahelp | 23 Jul 2022
    You could use the Reflections library(https://github.com/ronmamo/reflections) to do that within a specific package to do what you want(example taken from the Github repository)
  • Get list of objects/classes/interfaces under a package
    2 projects | /r/androiddev | 3 Jul 2021
    I'm building an app with Jetpack Compose in Kotlin, and I would like to get a list of material icons from the package androidx.compose.material.icons. I think scanning the package and get the list of objects would be good enough, so I have tried using classgraph and reflections but both of them return an empty list even when I scanned with no filters i.e just input the package name (I followed their sample code). I hope someone who has done this before can show me the correct approach to this issue, thanks a lot

ClassGraph

Posts with mentions or reviews of ClassGraph. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-12.
  • reflection and instantiation in java
    1 project | /r/learnprogramming | 21 Dec 2021
    If you provide more detail, I can probably give you a better answer. You should also checkout ClassGraph. It has tons of functions that can make usage of Reflection a whole lot easier.
  • Custom Annotation Scanning with Spring Boot
    2 projects | /r/learnjava | 12 Oct 2021
    There are libraries like classgraph that can be used in java applications that do not use spring framework. If your application do not use spring framework or spring boot, you can refer to the classgraph library documentation and proceed.
  • Get list of objects/classes/interfaces under a package
    2 projects | /r/androiddev | 3 Jul 2021
    I'm building an app with Jetpack Compose in Kotlin, and I would like to get a list of material icons from the package androidx.compose.material.icons. I think scanning the package and get the list of objects would be good enough, so I have tried using classgraph and reflections but both of them return an empty list even when I scanned with no filters i.e just input the package name (I followed their sample code). I hope someone who has done this before can show me the correct approach to this issue, thanks a lot

What are some alternatives?

When comparing Reflections and ClassGraph you can also consider the following projects:

jOOR - jOOR - Fluent Reflection in Java jOOR is a very simple fluent API that gives access to your Java Class structures in a more intuitive way. The JDK's reflection APIs are hard and verbose to use. Other languages have much simpler constructs to access type meta information at runtime. Let us make Java reflection better.

ReflectASM - High performance Java reflection

platform - The Jakarta EE Platform project produces the Jakarta EE platform specification, which is an umbrella specification that aggregates all other Jakarta EE specifications.

Objenesis - Okay, it's pretty easy to instantiate objects in Java through standard reflection. However there are many cases where you need to go beyond what reflection provides. For example, if there's no public constructor, you want to bypass the constructor code, or set final fields. There are numerous clever (but fiddly) approaches to getting around this and this library provides a simple way to get at them. You will find the official site here.

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured

Did you know that Java is
the 8th most popular programming language
based on number of references?