Questions tagged [reflections]

For questions about the Java Reflections library (org.reflections.reflections) by ronmamo, which performs Java runtime metadata analysis, in the spirit of Scannotations.

Official GitHub Repository: https://github.com/ronmamo/reflections

155 questions
0
votes
0 answers

Reflections could not get type for name java.security.interfaces.EdECPrivateKey from any class loader

We are getting this exception in the logs related to Reflections where a file is not available on the classpath. We are not able to find the appropriate maven depdendency to be added for this class to be availabe. Please note that we are using…
sahil gupta
  • 2,339
  • 12
  • 14
0
votes
2 answers

Unit test that all invocations of a method pass a serializable argument

I use the Hazelcast library in my project. It's executor service has this method: void executeOnAllMembers(@Nonnull Runnable command); This can fail at runtime if it is passed a command that does not implement Serializable. I want to write a unit…
whistling_marmot
  • 3,561
  • 3
  • 25
  • 39
0
votes
0 answers

Java take Object array of dynamic size and convert it to individual parameters

I'm over-engineering a photo project right now and trying to make it really easy to add more images with filters to a collage of images. I have a 2D array of all the pictures, a 2D array of all the methods to call, and a 3D array of Objects. I went…
Creepabob
  • 9
  • 1
0
votes
1 answer

How to find all sub classes of java.lang.Throwable in the JVM?

I want to find all sub classes of java.lang.Throwable in the JVM. The classes may or may not have been already loaded in the JVM. I have read the similar question How do you find all subclasses of a given class in Java?, and I think org.reflections…
Bourbon_7
  • 161
  • 7
0
votes
3 answers

Awaiting a reflected method where the return type is only known at runtime

I have a bunch of classes that include an async method ExecuteAsync(). These classes return different types. I need to invoke the ExecuteAsync() method by reflection. I know, from many other questions on SO, that if I knew the return type, I could…
Stuart Hemming
  • 1,553
  • 2
  • 21
  • 44
0
votes
1 answer

how to prevent thinkorswim's illegal reflective access to java.lang.Classloader.user_paths (2022 - Azul Zulu JDK 11)

I see many illegal reflective access related questions. As of recent ThinkOrSwim has finally implemented that JAVA 11 (the Azul Zulu openJDK 11) be used to launch thinkorswim. It has been warning this day would come. I have "updated" my java version…
0
votes
1 answer

When using Reflections on a class containing Scanner.next() I get "invalid constant type 18" error

Below is the switch statement for reference but if narrowed it down to coming from the calls to s.next() After some digging ive found that this error normally comes from using something from too low a language level (below 7) Is that the issue in…
0
votes
0 answers

How to scan target/test-classes with archunit or reflections in a multi-module application?

I am writing a test to check all test names, but it looks for reflection in the wrong places public void namingTestMethodTest(JavaClasses classes) { methods().that().areAnnotatedWith(Test.class) …
fenixs
  • 1
0
votes
1 answer

Spring ReflectionUtils for Generic Classes

I'm Using Spring RefectionUtils to set a field named "type" for the Generic Class GenericServiceImpl: The GenericServiceImpl is an implementation of the interface GenericService public interface GenericService{ } public class…
Mohamed Aoutir
  • 613
  • 3
  • 11
  • 22
0
votes
2 answers

How to use Java Reflections for the "current" application?

The documentation for Reflections gives the first line on how to use Reflections: Reflections reflections = new Reflections("com.my.project"); Except i don't know the name of the package. This is a piece of library code that should just be able to…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
0
votes
0 answers

How do you get Java reflections to look for multiple levels of annotation

I'm trying to get multiple levels of annotation in one go. I find it kind of hard to explain in words, so let's consider the following example. @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Controller public @interface…
0
votes
1 answer

reflections.io Version 0.10.2 looking for a class works in IDE but not when running it as jar

Old way of using Reflections doesnt find classes when run from commandline (java -jar myapp.jar) anymore, despite being documented as still supported: var reflections = new Reflections("com.package", Scanners.TypesAnnotated,…
J Asgarov
  • 2,526
  • 1
  • 8
  • 18
0
votes
0 answers

Allow annotations only on classes that inherit or implement parent class

I'm trying to create annotations that are only allowed on certain classes that implement an interface. Currently, I'm trying to do this to use the Reflections library and loop over all classes with the annotation. This results in a Set>.…
0
votes
0 answers

Setting Object Properties using Reflection and Annotation in Java

I have these 4 classes - Component.java -> which will be annotated using custom annotation, Properties.java -> the annotation class Utilities.java -> class where the annotation is used AnnotationProcessor.java -> where the annotation logic using…
0
votes
1 answer

Java specify custom properties on Fields/Methods

I have a huge class with 500 members. Each member will have properties whether it can be Filled/Edited based on business logic . public class Person{ public String firstName; //500 more Fields below } And similarly other 500 fields . Consumer of…
kcp
  • 33
  • 1
  • 7