ozlerhakan/poiji

Potential IAE with 4.1.1 due to deprecation fix

DManstrator opened this issue · 3 comments

In commit ca30938, Constructor#isAccessible was replaced by Constructor#canAccess(null). From what I've seen within the source code, this could raise an IllegalArgumentException since null is treated as an invalid value.

I honestly don't know what else could be used but I wanted to point it out.

Thank you for contributing to Poiji! Feel free to create a PR If you want to contribute directly :)

Hi @DManstrator , I was aware of that case. I was thinking that this unlikely happens to have IAE while debugging the code.

I looked at the source code again and searched for example usages. The examples also use null as the param and by looking closely, the method can also throw for non-null usages. And the JavaDocs explain the following:

if this reflected object is a static member or constructor and the given {@code obj} is non-{@code null}

So I guess it is correct in this case, sorry for the inconveniences.