Closed heyuxiang1996 closed 5 months ago
Perhaps it's because the jar package I converted using APK does not conform to the basic format of the jar package?
Does it mean that only archunit can scan the freshest compiled class or jar package files?
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?
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 aHistoryLoader.json
file?
Github does not allow uploading class files, so I changed the suffix to upload
This class file is part of the jar package
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
Perhaps the jar package converted using APK is not compliant, I just want to confirm this issue 🙈
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 methodRawAccessRecord{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}
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