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

Unable to find the JavaAccess call #1262

Closed
heyuxiang1996 opened this issue Mar 8, 2024 · 8 comments
Closed

Unable to find the JavaAccess call #1262

heyuxiang1996 opened this issue Mar 8, 2024 · 8 comments

Comments

@heyuxiang1996
Copy link

When opening this class file with jadx, it will be found that hasNextNotification has been called, but the corresponding call cannot be found with archunit
HistoryLoader.json
Changing the JSON file suffix to "class" is the corresponding class file

@heyuxiang1996
Copy link
Author

Perhaps it's because the jar package I converted using APK does not conform to the basic format of the jar package?

@heyuxiang1996
Copy link
Author

Does it mean that only archunit can scan the freshest compiled class or jar package files?

@hankem
Copy link
Member

hankem commented Mar 8, 2024

The class file import currently only considers files whose name ends with .class – also when importing class files from a jar.

Why would the byte code of com.android.settings.notification.history.HistoryLoader end up in a HistoryLoader.json file?

@heyuxiang1996
Copy link
Author

The class file import currently only considers files whose name ends with .class – also when importing class files from a jar.

Why would the byte code of com.android.settings.notification.history.HistoryLoader end up in a HistoryLoader.json file?

Github does not allow uploading class files, so I changed the suffix to upload

@heyuxiang1996
Copy link
Author

This class file is part of the jar package

@heyuxiang1996
Copy link
Author

HistoryLoader.json
This class file is the same as the previous class file opened with jadx, but scanning with the getAccessesFromSelf() method of archunit is completely different

@heyuxiang1996
Copy link
Author

Perhaps the jar package converted using APK is not compliant, I just want to confirm this issue 🙈

@hankem
Copy link
Member

hankem commented Mar 12, 2024

Sorry for my initial confusion about the .json file!

ArchUnit 0.23.1 would have found
JavaMethodCall{origin=JavaMethod{com.android.settings.notification.history.HistoryLoader.lambda$load$2(com.android.settings.notification.history.HistoryLoader$OnHistoryLoaderListener)}, target=target{android.app.NotificationHistory.hasNextNotification()}, lineNumber=17}

but #889 tries to map accesses by synthetic methods such as this one from your HistoryLoader.class:

  private void lambda$load$2(com.android.settings.notification.history.HistoryLoader$OnHistoryLoaderListener);
    descriptor: (Lcom/android/settings/notification/history/HistoryLoader$OnHistoryLoaderListener;)V
    flags: (0x1002) ACC_PRIVATE, ACC_SYNTHETIC

Since ArchUnit 1.0.0, importing your HistoryLoader.class gives a warning similar to this:

WARN com.tngtech.archunit.core.importer.ClassFileImportRecord - Could not find matching origin for synthetic method RawAccessRecord{origin=CodeUnit{name='lambda$load$2', descriptor=(Lcom/android/settings/notification/history/HistoryLoader$OnHistoryLoaderListener;)V, declaringClassName='com.android.settings.notification.history.HistoryLoader'}, target=TargetInfo{owner='android.app.NotificationHistory', name='hasNextNotification', desc='()Z'}, lineNumber=24, declaredInLambda=false}

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