이 코드의 잘못된 점은 무엇입니까?Ceylon은 튜플에 일부 함수를 적용 할 수 없습니까?
value x = [[1, Color(0)]];
//Exception thrown here
value y = x.map(([Integer, Color] elem) => "``elem[0]`` -> ``elem[1]``");
... 마지막 줄이로 대체 할 수있다 :
value y = { for(elem in x) "``elem[0]`` -> ``elem[1]``" };
... 나는이 잘 실행해야합니다 생각하지만, 두 경우 모두 내가이 오류를 얻을 :
Ceylon run: java.awt.Color cannot be cast to com.redhat.ceylon.compiler.java.
runtime.model.ReifiedType
java.lang.ClassCastException: java.awt.Color cannot be cast to com.redhat.ceylon.compiler.java.runtime.model.ReifiedType
at ceylon.language.Tuple.$getElementType(Tuple.java:286)
at ceylon.language.Tuple.$getUnionOfAllType(Tuple.java:279)
at ceylon.language.Tuple.$getType(Tuple.java:266)
at ceylon.language.Tuple.$getType$(Tuple.java:257)
at ceylon.language.Tuple.$getElementType(Tuple.java:287)
at ceylon.language.Tuple.$getUnionOfAllType(Tuple.java:279)
at ceylon.language.Tuple.$getReifiedElement$(Tuple.java:102)
at ceylon.language.ArraySequence.map(ArraySequence.java:612)
at firstModule.run_.run(run.ceylon:11)
at firstModule.run_.main(run.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:61)
at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:51)
at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:89)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:141)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:126)
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:270)
at org.jboss.modules.Main.main(Main.java:294)
at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:208)
at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:343)
at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:283)
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.run(Launcher.java:89)
at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:21)
을
반복 가능한 구문을 사용합니다. 값 x = [[1, 색상 (0)]];'대신에 값 x = {[1, 색상 (0)]};을 사용하여 문제를 해결하지만 여전히 . – Renato
실론 전용 코드로 시도한이 문제는 사라집니다 ... Java interop 문제가있는 것 같습니다 (색상이 java.awt.Color를 참조합니다). – Renato