GithubHelp home page GithubHelp logo

ceylon-model's Introduction

ceylon-model's People

Contributors

bjansen avatar chochos avatar fromage avatar gavinking avatar lucaswerkmeister avatar quintesse avatar tombentley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ceylon-model's Issues

bug in TypePrinter

TypePrinter renders the type Tuple<Nothing,Nothing,Empty & Tuple<Nothing,Nothing,Empty>> as Nothing[2].

Documentation

Is there any documentation available? Examples and typical scenarios in which this library would be useful would be great.

tuple type utility function optimizations

A while back, @FroMage did some optimization work for some utility functions for interrogating tuple types in Util. I disabled them for now because they were still based on recursion instead of while. We need to confirm that these optimizations are sill relevant—that they still help—and if so put them back in, after removing the use of recursion.

Module.resourceByPath() not working for paths containing spaces

I get the following error when calling module.resourceBypath() on a module located in a folder containing spaces:

java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in path at index 43: classpath:/Users/bastien/Dev/workspace/with spaces/modules/my/pkg/1.0.0/my.pkg-1.0.0.car!my/pkg/foo.txt
    at com.redhat.ceylon.model.loader.impl.reflect.CachedTOCJars$CachedTOCJar.getContentUri(CachedTOCJars.java:130)
    at com.redhat.ceylon.model.loader.impl.reflect.CachedTOCJars.getContentUri(CachedTOCJars.java:258)
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModelLoader.getContentUri(RuntimeModelLoader.java:85)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl.resourceByPath(ModuleImpl.java:142)
    at my.pkg.test_.test(test.ceylon:2)
    at my.pkg.test_.main(test.ceylon)

Steps to reproduce:

  • create a Ceylon project in a folder containing a space
  • create a module with the following code in run.ceylon:
shared void run() {
    if (exists res = `module`.resourceByPath("foo.txt")) {
        print(res.textContent());
    }
}
  • add foo.txt in resource/my/module
  • run the toplevel function

Exception on unoptimized reified Tuple

The example in eclipse-archived/ceylon-sdk#441 fails with the stack trace below.

ceylon run: possible undecidability: typechecker detected possible nontermination and aborted algorithm
com.redhat.ceylon.model.typechecker.model.DecidabilityException: possible undecidability: typechecker detected possible nontermination and aborted algorithm
    at com.redhat.ceylon.model.typechecker.model.Type.checkDepth(Type.java:1653)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:178)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:452)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:208)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyTuple(Type.java:462)
    at com.redhat.ceylon.model.typechecker.model.Type.isExactlyInternal(Type.java:337)
    at com.redhat.ceylon.model.typechecker.model.Type.isTypeArgumentListAssignable(Type.java:789)
    at com.redhat.ceylon.model.typechecker.model.Type.isSubtypeOfInternal(Type.java:697)
    at com.redhat.ceylon.model.typechecker.model.Type.isSubtypeOfInternal(Type.java:691)
    at com.redhat.ceylon.model.typechecker.model.Type.isSubtypeOf(Type.java:549)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor.is(TypeDescriptor.java:1361)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.isReified(Metamodel.java:346)
    at com.redhat.ceylon.compiler.java.Util.isReified(Util.java:63)
    at ceylon.promise.Deferred$promise_.foobar$priv$(Deferred.ceylon:159)
    at ceylon.promise.Deferred$promise_.map$canonical$(Deferred.ceylon:92)
    at ceylon.promise.Deferred$promise_.map(Deferred.ceylon:52)
    at ceylon.promise.Conjunction.map$canonical$(Conjunction.ceylon:58)
    at ceylon.promise.Conjunction.map(Conjunction.ceylon:57)
    at ceylon.promise.Completion$impl.completed$canonical$(Completion.ceylon:29)
    at ceylon.promise.Completion$impl.completed(Completion.ceylon:28)
    at ceylon.promise.Conjunction.completed$canonical$(Conjunction.ceylon)
    at ceylon.promise.Conjunction.completed(Conjunction.ceylon)
    at simple.run_.run(run.ceylon:13)
    at simple.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.jboss.modules.Module.run(Module.java:312)
    at org.jboss.modules.Main.main(Main.java:460)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:55)
    at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:32)

Support Java nullability annotations

Several frameworks have attempted to improve on Java’s nullability support by introducing annotations for something being @Nullable or @NotNull/@NonNull/@Nonnull. We should recognize these annotations, and warn or error if:

  • a Java @Nullable value (method return type, or field) is assigned to a Ceylon non-optional value or a Java @NotNull, or
  • a Ceylon optional value or a Java @Nullable value is assigned to a Java @NotNull value (method parameter, setter parameter, or field).

Behavior on unannotated elements should not change. Some frameworks define only one annotation because the other is the default, but we can’t detect that.

Test cases / examples: https://gist.github.com/lucaswerkmeister/07556232a9bd060dd593

Annotations to support (suggestion, potentially incomplete; list from Kotlin):

Alternatively, we could assume that any annotation named @Nullable, @NotNull, @NonNull, @Nonnull has this meaning. I think that’s probably a reasonable assumption.

ModelResolutionException: Failed to load declaration

I'm not sure if it belongs here, but this code ...

import ceylon.language.meta.declaration {
    ClassDeclaration,
    FunctionDeclaration
}
import ceylon.language.meta {
    type
}

shared class A {
    shared new() {}    
    shared void b() {}
}

shared void test() {    
    [FunctionDeclaration, ClassDeclaration?] cd = [`function A.b`, `class A`];
    type(cd);    
}

cause

ceylon run: Failed to load declaration [ReflectionClass: class com.redhat.
ceylon.compiler.java.runtime.metamodel.FreeClassWithConstructors]: Failed to
load methods in com.redhat.ceylon.compiler.java.runtime.metamodel.
FreeClassWithConstructors
com.redhat.ceylon.model.loader.ModelResolutionException: Failed to load declaration [ReflectionClass: class com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassWithConstructors]: Failed to load methods in com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassWithConstructors
    at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModelLoader$1.reportError(RuntimeModelLoader.java:209)
    at com.redhat.ceylon.model.typechecker.model.UnknownType.reportErrors(UnknownType.java:94)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorForProducedType(Metamodel.java:909)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorsForProducedTypes(Metamodel.java:948)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorForProducedType(Metamodel.java:870)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorsForProducedTypes(Metamodel.java:948)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorForProducedType(Metamodel.java:861)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorsForProducedTypes(Metamodel.java:948)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorForProducedType(Metamodel.java:870)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getTypeDescriptorForArguments(Metamodel.java:1250)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getAppliedMetamodel(Metamodel.java:634)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getAppliedMetamodel(Metamodel.java:367)
    at ceylon.language.meta.type_.type(type_.java:34)
    at bar.test_.test(test.ceylon:17)
    at bar.test_.main(test.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.jboss.modules.Module.run(Module.java:312)
    at org.jboss.modules.Main.main(Main.java:460)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:27)

Remove Declaration.getReference()

I don't know where the getReference() method of Declaration came from, or what its semantics are supposed to be, but it seems to be broken, producing ProducedTypes with missing type args.

The code that uses it almost all seems to by using it with TypedDeclarations, where it is just a proxy for getTypedReference(), so the existing code can just call that directly.

We need to remove this thing.

problem with assert and Proxy

Given:

import ceylon.interop.java {
    javaClassFromDeclaration
}
import ceylon.language.meta.model {
    Interface,
    Type
}

import java.lang {
    ObjectArray,
    JClass=Class
}
import java.lang.reflect {
    Proxy,
    InvocationHandler,
    JMethod=Method
}
import java.util.\ifunction {
    Predicate
}

shared void run() {
    Predicate<String> p = wrap(`Predicate<String>`, (String s) => s.empty);
    print("``p.test("")``, ``p.test("asdasd")``");
}

T wrap<T,out R,in A>(Type<T> t, R(A) fun) {
    assert (is Interface<T> i = `T`);
    value c = javaClassFromDeclaration(i.declaration);
    value a = ObjectArray<JClass<out Object>>(1);
    a.set(0, c);
    object handler satisfies InvocationHandler {
        shared actual Object? invoke(Object o, JMethod m, ObjectArray<Object> as) {
            assert (as.size==1, is A a = as.get(0));
            return fun(a) of Object?;
        }
    }
    assert (is T p = Proxy.newProxyInstance(c.classLoader, a, handler));
    return p;
}

I get:

ceylon run: Failed to resolve com.sun.proxy.$Proxy54
com.redhat.ceylon.model.loader.ModelResolutionException: Failed to resolve com.sun.proxy.$Proxy54
    at com.redhat.ceylon.model.loader.AbstractModelLoader.convertToDeclaration(AbstractModelLoader.java:1643)
    at com.redhat.ceylon.model.loader.AbstractModelLoader.convertToDeclaration(AbstractModelLoader.java:1602)
    at com.redhat.ceylon.model.loader.AbstractModelLoader.getDeclaration(AbstractModelLoader.java:4886)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toProducedType(TypeDescriptor.java:309)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.toType(TypeDescriptor.java:301)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getProducedType(Metamodel.java:378)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor.is(TypeDescriptor.java:1361)
    at com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor$Class.is(TypeDescriptor.java:263)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.isReified(Metamodel.java:344)
    at com.redhat.ceylon.compiler.java.Util.isReified(Util.java:63)
    at foo.wrap_.wrap(run.ceylon:38)

bug in coverage analysis

This should be accepted by the typechecker:

void fun<T>(T t) 
        given T satisfies Summable<Float> {
    Float float = t of Float;
}

Improve the way native headers models are reconstructed

In ceylon/ceylon-compiler#2356 we fixed the fact that native headers weren't reconstructed when loading the model but the heuristics aren't 100% correct (we assume anything native and shared has a header, which is true, but it ignores the fact that private elements may have headers too).

For a real fix we need to introduce some kind of marker annotation, let's say @NativeHeader, which we can put on native declarations so the mode loader knows that it should construct a header.

Use Maven

In my opinion it would be great to use maven for retrieve dependencies (include your jar of junit it is... an outdated practice) and make this library available on Maven Central. You can easily do that using OSSHR Nexus. Let me know if I can help.

TypeLexer + TypeParser need to learn defaulted parameters

Missing expected token: CLOSE_PAR, got: WORD[=] at CeylonAstType(RedHatType, ceylon.language::Anything(com.redhat.ceylon.compiler.typechecker.tree::Node, ceylon.ast.core::Node)=)

(This is uncommitted ceylon.ast WIP; I’ll add an independent test case later.)

Do you plan to create models from JARs or Java source code?

From a first look at the code it seems that you support building models through reflection but not from directly looking into jars without loading them? Am I wrong?

Reflection is bad for several reasons, the first one is that loading a class cause the static initializers to be executed and this is not necessarily what I would like to happen. Looking into a Jar would instead avoid these issues.

It would be also nice to build models directly from source code. It could be done starting from the output of JavaParser, for example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.