Skip to content

Conversation

Markoutte
Copy link
Collaborator

Description

In some cases Class#getPackage can return null. This should fix these cases.

Type of Change

  • Minor bug fix (non-breaking small changes)

Checklist (remove irrelevant options):

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • Tests that prove my change is effective
  • All tests pass locally with my changes

@Markoutte Markoutte requested a review from dtim July 18, 2022 10:26
Copy link
Collaborator

@dtim dtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but it would be nice to have some comments as the logic becomes not so clear as before.

private fun isAccessible(member: Member, packageName: String?): Boolean {
return isPublic(member.modifiers) ||
(isPackagePrivate(member.modifiers) && member.declaringClass.`package`.name == packageName)
(packageName != null && isPackagePrivate(member.modifiers) && member.declaringClass.`package`?.name == packageName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a comment to explain why the check for packageName != null is here.

@Markoutte Markoutte merged commit 80e37a2 into main Jul 18, 2022
@Markoutte Markoutte deleted the pelevin/fix_possible_def_package_npe branch July 18, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants