<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: migrating from 3.0.5 to 3.0.6

### Steps to reproduce this issue

https://github.com/XenoAmess/metasploit-java-external-module/runs/5522599197?check_suite_focus=true

https://github.com/XenoAmess/metasploit-java-external-module/pull/65

### Expected Behavior

DO NOT DELETE EXISTED API WITHIN SAME MAJOR VERSION

PLEASE JUST FOLLOW SEMVER

### Actual Behavior

compile failure.

if (file.getKind() == Kind.CLASS && file.getName().startsWith(packageName)) {
                        files.add(file);
                    }
                }
                files.addAll(classLoader.files());
            } else if (location == StandardLocation.SOURCE_PATH && kinds.contains(JavaFileObject.Kind.SOURCE)) {
                for (JavaFileObject file : fileObjects.values()) {
                    if (file.getKind() == Kind.SOURCE && file.getName().startsWith(packageName)) {
                        files.add(file);
                    }
                }
            }
            for (JavaFileObject file : result) {
                files.add(file);
            }
            return files;
        }
    }
    private static final class ClassLoaderImpl extends ClassLoader {
        private final Map<String, JavaFileObject> classes = new HashMap<String, JavaFileObject>();
        ClassLoaderImpl(final ClassLoader parentClassLoader) {
            super(parentClassLoader);
        }
        Collection<JavaFileObject> files() {
            return Collections.unmodifiableCollection(classes.values());
        }
        @Override
        protected Class<?> findClass(final String qualifiedClassName) throws ClassNotFoundException {
            JavaFileObject file = classes.get(qualifiedClassName);
            if (file != null) {