Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metamodel lookup for non-local top-level object throws NPE #629

Closed
akberc opened this issue Feb 10, 2015 · 2 comments
Closed

Metamodel lookup for non-local top-level object throws NPE #629

akberc opened this issue Feb 10, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@akberc
Copy link
Member

akberc commented Feb 10, 2015

Not sure whether it belongs in the language or compiler module. Given the following in a module:

object obj {
    shared String version = `obj`.declaration.containingModule.version;
}

shared void run() {
    print(obj.version);   
}

Error stack:

ceylon run: null
java.lang.NullPointerException
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getProducedType(Metamodel.java:245)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.checkReifiedTypeArgument(Metamodel.java:1405)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeValue.apply(FreeValue.java:95)
    at test.obj_.<init>(run.ceylon:3)
    at test.obj_.<clinit>(run.ceylon:3)
    at test.run_.run(run.ceylon:8)
    at test.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
@gavinking gavinking added the BUG label Feb 10, 2015
@gavinking gavinking added this to the 1.2 milestone Feb 10, 2015
@tombentley tombentley self-assigned this Mar 19, 2015
tombentley added a commit to ceylon/ceylon-compiler that referenced this issue Mar 19, 2015
tombentley added a commit to ceylon/ceylon-compiler that referenced this issue Mar 19, 2015
@tombentley
Copy link
Member

This was a compiler bug. The value of the object was computed eagerly in a static block which occurs before the initialization of the $TypeDescriptor$, thus the $TypeDescriptor$ is null at the point obj is instantiated.

Thanks for reporting.

@akberc
Copy link
Member Author

akberc commented Apr 4, 2015

Thank you for fixing. This was just a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants