Search in sources :

Example 6 with ReflectionClass

use of org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass in project ceylon by eclipse.

the class Metamodel method getJavaClass.

public static java.lang.Class<?> getJavaClass(org.eclipse.ceylon.model.typechecker.model.Module module) {
    if (module.isJava() || module.isDefaultModule()) {
        // Java modules don't have module descriptor classes
        return null;
    }
    String className = module.getNameAsString() + "." + NamingBase.MODULE_DESCRIPTOR_CLASS_NAME;
    ReflectionClass classMirror = classMirror(module, className);
    return classMirror.klass;
}
Also used : ReflectionClass(org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass)

Example 7 with ReflectionClass

use of org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass in project ceylon by eclipse.

the class Metamodel method getJavaClass.

public static java.lang.Class<?> getJavaClass(org.eclipse.ceylon.model.typechecker.model.Package pkg) {
    String className = ((LazyPackage) pkg).getNameAsString() + "." + NamingBase.PACKAGE_DESCRIPTOR_CLASS_NAME;
    ReflectionClass classMirror = (ReflectionClass) moduleManager.getModelLoader().lookupClassMirror(pkg.getModule(), className);
    return classMirror != null ? classMirror.klass : null;
}
Also used : LazyPackage(org.eclipse.ceylon.model.loader.model.LazyPackage) ReflectionClass(org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass)

Example 8 with ReflectionClass

use of org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass in project ceylon by eclipse.

the class RuntimeModelLoader method lazyLoadModule.

@Override
public void lazyLoadModule(Module module) {
    if (isDynamicMetamodel()) {
        if (loadCompiledModule(module)) {
            String pkgName = module.getNameAsString();
            ClassMirror moduleClass = findModuleClass(module, pkgName);
            Class<?> klass = ((ReflectionClass) moduleClass).klass;
            String path = klass.getProtectionDomain().getCodeSource().getLocation().getPath();
            Unit u = new Unit();
            // FIXME: find path name?
            u.setFilename(path);
            u.setFullPath(path);
            module.setUnit(u);
        }
    }
}
Also used : ReflectionClass(org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass) Unit(org.eclipse.ceylon.model.typechecker.model.Unit) ClassMirror(org.eclipse.ceylon.model.loader.mirror.ClassMirror)

Aggregations

ReflectionClass (org.eclipse.ceylon.model.loader.impl.reflect.mirror.ReflectionClass)8 LazyValue (org.eclipse.ceylon.model.loader.model.LazyValue)3 StorageException (ceylon.language.meta.model.StorageException)2 Method (java.lang.reflect.Method)2 Metamodel (org.eclipse.ceylon.compiler.java.runtime.metamodel.Metamodel)2 TypeDescriptor (org.eclipse.ceylon.compiler.java.runtime.model.TypeDescriptor)2 JavaBeanValue (org.eclipse.ceylon.model.loader.model.JavaBeanValue)2 Field (java.lang.reflect.Field)1 Ignore (org.eclipse.ceylon.compiler.java.metadata.Ignore)1 ModelResolutionException (org.eclipse.ceylon.model.loader.ModelResolutionException)1 ClassMirror (org.eclipse.ceylon.model.loader.mirror.ClassMirror)1 FieldValue (org.eclipse.ceylon.model.loader.model.FieldValue)1 FunctionOrValueInterface (org.eclipse.ceylon.model.loader.model.FunctionOrValueInterface)1 LazyClass (org.eclipse.ceylon.model.loader.model.LazyClass)1 LazyFunction (org.eclipse.ceylon.model.loader.model.LazyFunction)1 LazyInterface (org.eclipse.ceylon.model.loader.model.LazyInterface)1 LazyModule (org.eclipse.ceylon.model.loader.model.LazyModule)1 LazyPackage (org.eclipse.ceylon.model.loader.model.LazyPackage)1 Class (org.eclipse.ceylon.model.typechecker.model.Class)1 ClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ClassOrInterface)1