Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'android.app.Activity.onCreate' not recognized as an initializer in test code #19

Closed
ZacSweers opened this issue Sep 16, 2017 · 5 comments
Assignees

Comments

@ZacSweers
Copy link
Contributor

Repro case in uber/AutoDispose#85 in AutoDisposeTestActivity

@lazaroclapp
Copy link
Collaborator

Hi,

Currently, initializers are passed to Null Away through the -XepOpt:NullAway:KnownInitializers= configuration flag, see https://github.com/uber/NullAway/wiki/Configuration . That said, I am adding the Android lifecycle initializers as code-level defaults as we speak, since that makes Null Away more broadly useful for most projects out of the box. For the current release, please use the config option.

@ZacSweers
Copy link
Contributor Author

ZacSweers commented Sep 16, 2017

To be clear, this is a bug report, as the wiki states that this case is already supported - https://github.com/uber/NullAway/wiki/Error-Messages. If these aren't actually implemented yet, we should probably say so in the wiki :)

@lazaroclapp lazaroclapp self-assigned this Sep 16, 2017
lazaroclapp added a commit that referenced this issue Sep 16, 2017
- One can pass the full name of initializer annotations with
  `-XepOpt:NullAway:CustomInitializerAnnotations. These will
  be acknowledged, as well as any annotation with @Initializer
  as its simple name.
- Provide sane defaults for this option and for
  `-XepOpt:NullAway:KnownInitializers=`, to match what we say
  in the wiki.
- Make org.junit.Before and org.junit.BeforeClass default initializer
  annotations.
- This fixes issues #18 and #19.
@lazaroclapp
Copy link
Collaborator

Oh, right, I see what happened there. That documentation was copied from our internal wiki and is currently true for our internal configuration, not a default install of Null Away. But, well, it should be. So lets treat this as a proper bug and fix the code rather than the wiki :)

lazaroclapp added a commit that referenced this issue Sep 16, 2017
- One can pass the full name of initializer annotations with
  `-XepOpt:NullAway:CustomInitializerAnnotations. These will
  be acknowledged, as well as any annotation with @Initializer
  as its simple name.
- Provide sane defaults for this option and for
  `-XepOpt:NullAway:KnownInitializers=`, to match what we say
  in the wiki.
- Make org.junit.Before and org.junit.BeforeClass default initializer
  annotations.
- This fixes issues #18 and #19.
@lazaroclapp
Copy link
Collaborator

Fixed on master. Is the workaround viable until the next release?

@ZacSweers
Copy link
Contributor Author

Yeah no rush, it was just in a test so I've suppressed it for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants