Bug 577631

Summary: Android R8 class which use @Around Hook, App crash when runtime
Product: [Tools] AspectJ Reporter: Jay Jay <visa8000>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: blocker    
Priority: P3    
Version: 1.9.7   
Target Milestone: ---   
Hardware: Other   
OS: Android   
Whiteboard:
Attachments:
Description Flags
source file none

Description Jay Jay CLA 2021-12-06 01:26:23 EST
Created attachment 287626 [details]
source file

java.lang.VerifyError: Verifier rejected class com.example.aspectj.DeviceId: void com.example.aspectj.DeviceId.<init>() failed to verify: void com.example.aspectj.DeviceId.<init>(): [0x24] register v0 has type Precise Reference: java.lang.Class but expected Precise Reference: com.example.aspectj.DeviceId (declaration of 'com.example.aspectj.DeviceId' appears in /data/app/com.example.demo-R-5nAjwx4HN7hMtINZHtPA==/base.apk)



DeviceId.java -> android R8 complie -> R8 DeviceId.class -> Aspectj AroundHook.java -> Aspectj DeviceId.class


The Aspect DeviceId.class is Error !!!




please decompile Aspectj DeviceId.class
Comment 1 Jay Jay CLA 2021-12-06 01:31:19 EST
Decompile aspectj DeviceId.class


public DeviceId() {
        if (DeviceId.uuid == null) {
            final Class<DeviceId> ajc$this = DeviceId.class;
            synchronized (ajc$this) {
                if (DeviceId.uuid == null) {
                    try {
                        final byte[] bytes = "9774d56d682e549c".getBytes("utf-8");
                        final JoinPoint jp = Factory.makeJP(DeviceId.ajc$tjp_0, (Object)ajc$this, (Object)null, (Object)bytes);
                        DeviceId.uuid = (UUID)nameUUIDFromBytes_aroundBody1$advice((DeviceId)ajc$this, bytes, jp, AroundHook.aspectOf(), (ProceedingJoinPoint)jp);
                        System.out.println(DeviceId.uuid);
                    }
                    catch (UnsupportedEncodingException cause) {
                        throw new RuntimeException(cause);
                    }
                }
            }
        }
    }
Comment 2 Jay Jay CLA 2021-12-06 01:36:12 EST
ajc$this is Class, Not an Object !!!