Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [reflection]

Reflection is the ability of a program to observe and/or modify its structure and/or behavior at runtime. Reflection is dependent on the supporting programming language - please tag the programming language being used when using this tag.

0 votes
2 answers
20 views

Default constructible class expected, but only parametrised constructor is meaningful

I have this hard requirement that one of my classes, ClassX is instantiated in a reflective manner by a third party module Modul3P, calling ClassX's default constructor. Then, Modul3P calls one of the ...
wojas's user avatar
  • 141
0 votes
0 answers
62 views

How to get all ILogger<whatever> types?

As I google, I am running across answers on how to get all derived types of a generic class. But what I really want is just all the variations of a generic class. The problem is that we are logging ...
BVernon's user avatar
  • 3,597
1 vote
0 answers
33 views

How can I get the class of a companion object as a constant?

I'm working with a Scala 2 project. I have the following code: package com.myproject.commands; object MyCommand { def execute(args: Map[String, String]) = { //do some validations... ...
Luiggi Mendoza's user avatar
1 vote
1 answer
54 views

Scala 3 reflection: collect all members that are singleton objects

I have a method in Scala 2 that uses reflection. It doesn't work in Scala 3, and I would like to reimplement it so it works for Scala 3. (I will no longer need it for Scala 2 anymore, so it need not ...
kes's user avatar
  • 6,113
0 votes
0 answers
22 views

check if given object implements certain generic interface; type argument(s) NOT known [duplicate]

I have some object. I want to check at runtime if it is an IReadOnlyCollection<T> of any T, i.e. I cannot specify that T in my check. So it should return true for e.g. IReadOnlyCollection<...
Kjara's user avatar
  • 2,794
-1 votes
0 answers
41 views

Rust cdylib websocket fatal runtime error: global allocator may not use TLS

I'm writing rust dll, cdylib which supposed to start new thread and connect to websocket using tokio::tungstenite i load dll reflectivly into rust program using https://github.com/indygreg/rs-memory-...
Griffin1212's user avatar
0 votes
0 answers
19 views

Getting "Bad IL format" when loading exe file

I'm trying to explore .NET 8.0 exe file. When I try to load it with Assembly.LoadFrom or Assembly.LoadFile I'm getting Bad IL format. The format of the file '<file_path>.exe' is invalid. But if ...
Yola's user avatar
  • 18.9k
-1 votes
0 answers
32 views

Is it possible to use Reflection along with @Autowired annotation to access to fields of a private class?

I am writing tests for a project and I want to access to private field of a class that otherwise should not be accessed. The reason behind this is that I don't want to fill the database with ...
enanas's user avatar
  • 35
2 votes
1 answer
30 views

Get all properties with a custom attribute for external assembly

Topics I've read: How to get a list of properties with a given attribute? Reflection - get attribute name and value on property I created an external assembly(Class Library) and I defined a class and ...
DooDoo's user avatar
  • 13.3k
1 vote
2 answers
39 views

C# reflection: Get static method with multiple generic overloads [duplicate]

How we can get a method such as Tuple.Create that has multiple generic overloads through reflection and use it with our custom generic type arguments? usecase: the generic type arguments are known ...
Mansoor Omrani's user avatar
-1 votes
1 answer
58 views

The parameterized type of argument was missing in bridge method [duplicate]

class A { public void doit(List<String> args) { } public static class C extends A { } public static void main(String[] args) throws Exception { Method m = C.class....
Jacky Wang's user avatar
  • 3,460
0 votes
1 answer
51 views

How get attributes of function into this function?

When i get the attributes of my function. If i getName(), i've a path as name Base\Service\Client\filters .. How i can only get filters as name ? #[filters(['email', 'emailVerified', 'enabled', '...
M.btm's user avatar
  • 1
0 votes
0 answers
33 views

How to test a custom decorator with a validation pipe in Nest.js?

I've found this GitHub issue comment that has an interesting workaround for accessing a custom decorator through reflection, but the problem is that I'm trying to use it to test my use case which ...
sebasaenz's user avatar
  • 1,937
0 votes
0 answers
45 views

Alternative For Type.IsSerializable

We used in an application if (!value!.GetType().IsSerializable) return; In the meantime the IsSerializable property is obsolete (Formatter-based serialization is obsolete and should not be used.)....
mburm's user avatar
  • 1,493
2 votes
0 answers
143 views

Modelmapper - Automatic mapping (STRICT Strategy)

[INFO] I've created a sandbox repository to simplify your experience, so you can clone and test it fast. https://github.com/ImKumin/AutomaticMapping How can I automatically map models like the ones ...
Kumin's user avatar
  • 140

15 30 50 per page
1
2 3 4 5
1674