eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

Nullpointer when setting value through metamodel #7455

Open Voiteh opened 5 years ago

Voiteh commented 5 years ago

Unit test

class TestClass(){
    shared late String attr;
}
shared test void checkMemberSet(){
    value test=TestClass();
    value val=`value TestClass.attr`;
    val.memberSet(test, "bleh");
}
java.lang.NullPointerException
    at java.lang.Class.searchMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl.initSetter(ValueImpl.java:235)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl.initField(ValueImpl.java:137)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.ValueImpl.<init>(ValueImpl.java:76)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.AttributeImpl.bindTo(AttributeImpl.java:66)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.AttributeImpl.bindTo(AttributeImpl.java:20)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.MemberImpl.$call$(MemberImpl.java:51)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.MemberImpl.$call$(MemberImpl.java:12)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.bind(Metamodel.java:1907)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.AttributeImpl.bind(AttributeImpl.java:136)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ValueDeclarationImpl.memberSet(ValueDeclarationImpl.java:247)
    at test.herd.depin.engine.ceylon.checkMemberSet_.checkMemberSet(MemberSetError.ceylon:16)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.FunctionImpl.$call$(FunctionImpl.java:304)
    at com.redhat.ceylon.compiler.java.Util.apply(Util.java:1629)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.apply(Metamodel.java:1891)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.FunctionImpl.apply(FunctionImpl.java:456)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.FunctionDeclarationImpl.invoke(FunctionDeclarationImpl.java:282)
    at ceylon.test.engine.DefaultTestExecutor.invokeFunction$priv$(DefaultTestExecutor.ceylon:318)
    at ceylon.test.engine.DefaultTestExecutor.access$100(DefaultTestExecutor.ceylon:37)
    at ceylon.test.engine.DefaultTestExecutor$6.$call$(DefaultTestExecutor.ceylon:268)
    at ceylon.test.engine.DefaultTestExecutor$4.$call$(DefaultTestExecutor.ceylon:234)
    at ceylon.test.engine.DefaultTestExecutor$5.$call$(DefaultTestExecutor.ceylon:240)
    at ceylon.test.engine.DefaultTestExecutor$3.$call$(DefaultTestExecutor.ceylon:212)
    at ceylon.test.engine.DefaultTestExecutor.executeVariant$priv$(DefaultTestExecutor.ceylon:94)
    at ceylon.test.engine.DefaultTestExecutor.execute(DefaultTestExecutor.ceylon:57)
    at ceylon.test.engine.DefaultTestRunner$9$1$1$1.$call$(DefaultTestRunner.ceylon:99)
    at ceylon.test.engine.spi.TaskExecutor.executionLoop(TestExecutionContext.ceylon:127)
    at ceylon.test.engine.spi.TaskExecutor.execute$canonical$(TestExecutionContext.ceylon:121)
    at ceylon.test.engine.spi.TaskExecutor.execute(TestExecutionContext.ceylon:110)
    at ceylon.test.engine.spi.TestExecutionContext.execute$canonical$(TestExecutionContext.ceylon:71)
    at ceylon.test.engine.spi.TestExecutionContext.execute(TestExecutionContext.ceylon:70)
    at ceylon.test.engine.DefaultTestRunner.runInternal$priv$(DefaultTestRunner.ceylon:94)
    at ceylon.test.engine.DefaultTestRunner.run(DefaultTestRunner.ceylon:58)
    at ceylon.test.engine.internal.Runner.runTests$priv$(Runner.ceylon:104)
    at ceylon.test.engine.internal.Runner.run(Runner.ceylon:36)
    at ceylon.test.runTestTool_.runTestTool(tool.ceylon:8)
    at ceylon.test.runTestTool_.main(tool.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:68)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.modules.Module.run(Module.java:308)
    at org.jboss.modules.Main.main(Main.java:487)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:367)
    at ceylon.modules.bootstrap.CeylonTestTool.run(CeylonTestTool.java:127)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:24)