OGP
OGP

Reputation: 972

Java method called with reflection only. Annotate?

I have a bunch of classes named Process0, Process1, Process2 etc. inherited from a base class Process. Every child class includes the same static method. Future implementations may add more "ProcessNN".

I have to iterate all classes and call the same method from every class for specific data. It happened this static method is never called directly, only with reflection.

How can I mark/annotate this method in every class to remove warnings over "never used method" and preserve it from automatic code optimization?

Thanks.

Upvotes: 4

Views: 915

Answers (1)

abernardi597
abernardi597

Reputation: 123

You can add the @SuppressWarnings("unused") annotation to suppress compiler (and most IDE) warnings.

Upvotes: 4

Related Questions