@@ -0,0 +1,2024 @@
+/*%0A   Copyright 2020 Volker Berlin (i-net software)%0A%0A   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A   you may not use this file except in compliance with the License.%0A   You may obtain a copy of the License at%0A%0A       http://www.apache.org/licenses/LICENSE-2.0%0A%0A   Unless required by applicable law or agreed to in writing, software%0A   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A   See the License for the specific language governing permissions and%0A   limitations under the License.%0A%0A*/%0Apackage de.inetsoftware.jwebassembly.module;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0A%0Aimport javax.annotation.Nullable;%0A%0Aimport de.inetsoftware.classparser.ClassFile;%0Aimport de.inetsoftware.classparser.WeakValueCache;%0A%0A/**%0A * Cache and manager for the loaded ClassFiles%0A * %0A * @author Volker Berlin%0A */%0Apublic class ClassFileLoader %7B%0A%0A    private final WeakValueCache%3CString, ClassFile%3E CACHE = new WeakValueCache%3C%3E();%0A%0A    private final ClassLoader                       loader;%0A%0A    /**%0A     * Create a new instance%0A     * %0A     * @param loader%0A     *            the classloader to find the *.class files%0A     */%0A    public ClassFileLoader( ClassLoader loader ) %7B%0A        this.loader = loader;%0A    %7D%0A%0A    /**%0A     * Get the ClassFile from cache or load it.%0A     * %0A     * @param className%0A     *            the class name%0A     * @return the ClassFile or null%0A     * @throws IOException%0A     *             If any I/O error occur%0A     */%0A    @Nullable%0A    public ClassFile get( String className ) throws IOException %7B%0A        ClassFile classFile = CACHE.get( className );%0A        if( classFile != null ) %7B%0A            return classFile;%0A        %7D%0A        InputStream stream = loader.getResourceAsStream( className + %22.class%22 );%0A        if( stream != null ) %7B%0A            classFile = new ClassFile( stream );%0A            CACHE.put( className, classFile );%0A        %7D%0A        return classFile;%0A    %7D%0A%0A%7D%0A

change the static ClassFile cache to an instance cache