Android IDE (AIDE) Support Forum

EnumSet.of version with varargs doesn't work

But any method with an Enum vararg I write works. Where is the problem here?

Try to encapsulate the args:

EnumSet<test> es = EnumSet.of(new test[] {test.A, test.B, test.C});

I am doing that right after the error line with enArray, but the parameters are EnumSet.of(E first, E… rest) and it works but the point of varargs is that it should do that for you, that is also the reason using this overloaded of() version should be slower. However either of the tested methods, defined either as other(test first, test… rest) or other(test… args) works fine. And the first has identical parameters to the of method. Something is not right, encapsulating the args is just a workaround.

Edit: just to reiterate, encapsulating the args in an array of your own making only works for the (E first, E… rest) and you must specify a single enum value and an array, since there is no overloaded version with only the varargs, like this EnumSet.of(E… args), this doesnt exist and therefore even as a workaround is weaksauce.