Jump to: navigation, search


Due to 365455 and 365437 you can run into problems when attempting to inject into private methods if you have certain Optional Error compiler preferences set.

If you have compiler settings (or project specific compiler settings) configured to treat "Unused private members" as "Errors" you will need to make the following adjustments to the compiler settings:

  • Make sure "Treat above errors like fatal compiler errors (make compiled code not executable)" IS NOT checked.
  • Make sure "Enable '@SuppressWarnings' annotations" IS checked.
  • Make sure "Suppress optional errors with '@SuppressWarnings'" IS checked.
  • Add a @SuppressWarnings("unused") annotation to each private @Injected method you declare

When (if) both compiler bugs are fixed, none of these setting changes will be required, and private methods annotated with @Inject will not require a separate SuppressWarnings annotation.

Feel free to comment on the noted defects if this capability would be useful to you. If you do not wish to do any of the above, you could simply make your handler methods "package private" or protected. (You could even make them public, but I would recommend against it)