Package org.teavm.classlib.impl

Source Code of org.teavm.classlib.impl.JCLPlugin

/*
*  Copyright 2014 Alexey Andreev.
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package org.teavm.classlib.impl;

import java.util.ServiceLoader;
import org.teavm.classlib.impl.unicode.CLDRReader;
import org.teavm.model.MethodReference;
import org.teavm.vm.spi.TeaVMHost;
import org.teavm.vm.spi.TeaVMPlugin;

/**
*
* @author Alexey Andreev
*/
public class JCLPlugin implements TeaVMPlugin {
    @Override
    public void install(TeaVMHost host) {
        host.add(new EnumDependencySupport());
        host.add(new EnumTransformer());
        host.add(new ClassLookupDependencySupport());
        host.add(new NewInstanceDependencySupport());
        host.add(new ObjectEnrichRenderer());
        ServiceLoaderSupport serviceLoaderSupp = new ServiceLoaderSupport(host.getClassLoader());
        host.add(serviceLoaderSupp);
        MethodReference loadServicesMethod = new MethodReference(ServiceLoader.class, "loadServices",
                Class.class, Object[].class);
        host.add(loadServicesMethod, serviceLoaderSupp);
        JavacSupport javacSupport = new JavacSupport();
        host.add(javacSupport);

        host.registerService(CLDRReader.class, new CLDRReader(host.getProperties(), host.getClassLoader()));
    }
}
TOP

Related Classes of org.teavm.classlib.impl.JCLPlugin

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.