private CompletableFuture getConstantPoolInfoAsync()

in src/main/java/com/jetbrains/jdi/ReferenceTypeImpl.java [1308:1338]


    private CompletableFuture<byte[]> getConstantPoolInfoAsync() {
        if (!vm.canGetConstantPool()) {
            return CompletableFuture.failedFuture(new UnsupportedOperationException());
        }
        if (constantPoolInfoGotten) {
            if (constantPoolBytesRef == null) {
                return CompletableFuture.completedFuture(null);
            }
            byte[] cpbytes = constantPoolBytesRef.get();
            if (cpbytes != null) {
                return CompletableFuture.completedFuture(cpbytes);
            }
        }

        return JDWP.ReferenceType.ConstantPool.processAsync(vm, this).handle((jdwpCPool, e) -> {
            if (e != null) {
                if (JDWPException.isOfType(e, JDWP.Error.ABSENT_INFORMATION)) {
                    constanPoolCount = 0;
                    constantPoolBytesRef = null;
                    constantPoolInfoGotten = true;
                    return null;
                }
                throw (RuntimeException)e;
            }
            constanPoolCount = jdwpCPool.count;
            byte[] cpbytes = jdwpCPool.bytes;
            constantPoolBytesRef = vm.createSoftReference(cpbytes);
            constantPoolInfoGotten = true;
            return cpbytes;
        });
    }