160 questions
1
vote
0
answers
33
views
Kotlin: Obfuscated Callable Expects 2 Arguments but 1 Provided (DefaultConstructorMarker Issue)
I’m encountering an issue in Kotlin when obfuscation is enabled, specifically when calling a function dynamically using KFunction.callBy. The code works fine in a non-obfuscated environment but fails ...
0
votes
0
answers
28
views
ReflectionClass::newInstanceArgs when class constructor has Class ...$class declaration
I'm trying to invoke public ReflectionClass::newInstanceArgs(array $args = []): ?object method on class which has the following constructor:
public function __construct(Option ...$options) {
...
0
votes
1
answer
124
views
Reflections: `reflections.get(SubTypes.of(...).asClass())` does not work when resources are from an external jar
I'm currently running Spring Boot 3.2.1 with Java 17, with Gradle 8.4 as a build tool and using Reflections 0.10.2 (latest version as of writing). Our project is a multi-module project, but for ...
1
vote
1
answer
79
views
Apache POI: get zoom level by using reflection
I want to get the current zoom level of the target sheet. By checking the docs of Apache POI, there's no getter method for the zoom level. I thought of invoking the similar methods of setting the zoom ...
-1
votes
1
answer
113
views
Get type of a generic parameter in SpringBoot with reflection
I have a spring project with several classes "IceCream", "Chocolate" that implements an interface "FoodInterface".
FoodInterface:
public interface FoodInterface{
...
-1
votes
2
answers
197
views
How to check if a class is capable of implementing an interface at runtime in Java (JDK 17)
I need to determine whether a class is capable of implementing an interface when it does not explicitly implement that interface. I would like to determine this at runtime, I am using reflections to ...
0
votes
1
answer
685
views
Alternative supporting jakarta to `org.reflections:reflections` for finding annotated Methods
I am currently migrating to spring-boot 3. We use "org.reflections:reflections:0.10.2" in order to get all the classes in a package that contain a specific annotation (eg. RequestMapping.
...
0
votes
1
answer
95
views
Use reflection to set the return type of a private method
I've been tasked with writing unit tests for poorly authored legacy code.
The code that I should write tests for can't get changed in any way whatsoever. It's READ-ONLY.(Company policy, don't touch ...
-1
votes
1
answer
140
views
do a mock on Mocked object in Junit5
I am trying to write a test case in JUNIT5.
I want to do unit test on the below class
Class Service{
@Autowired
ObjectHolder objectHolder;
UtilityServiceDTOMapper<T> serviceDTOMapper = ...
-1
votes
1
answer
28
views
getSubTypesOf returning anonymous types defined in tests
The problem I am facing is the same as described in this github issue: getSubTypesOf returning anonymous types defined in tests
The thread seems to have ended with only a couple of responses and ...
0
votes
0
answers
41
views
In Java: How do I retrieve filenames of specific resources at runtime from within jar?
This is what my project structure looks like:
structure
I need to search through a specific subdirectory of the resource's folder for a file that starts with the substring orientation. If I have the ...
0
votes
1
answer
1k
views
Deprecated Reflection constructor
I am running sonar cloud through my Java code and it has some deprecated constructors. I managed to update most of them, but not this one:
import org.reflections.util.ClasspathHelper;
private static ...
0
votes
0
answers
287
views
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 ...
0
votes
2
answers
71
views
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 ...
0
votes
0
answers
37
views
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 ...