Home Features Docs Blog Support GitHub

[SOLVED] Class.getDeclaredConstructors() not working (no constructors returned)


#1

We are using MOE 1.3.8.

You can reproduce the issue by creating a very simple class like this :

public class ConstructorFoo {
    private final int x;
    public ConstructorFoo(int x) {
        this.x = x;
    }
} 

And by trying to get its constructor like this :

    System.out.println("Constructors : " + Arrays.toString(ConstructorFoo.class.getDeclaredConstructors()));

It displays :

Constructors : []  

Is this a known issue ? Did we miss something ?


#2

Did you check your proguard config & log?


#3

Yes, that was the issue thank you. I really need to learn about Proguard, I’m totally ignorant in it. I just had to add -keep of the packages using reflection to solve the issue.