Eclipse ide を使用して、次のコード スニペットから予期しない結果が得られます。
class Example(String s = "init") {
shared String a() => "Func 1";
shared String b = "Attr 1";
shared String c(Integer i) { return "Func 2"; }
}
shared
void run() {
// 1.
print("getAttributes: " + `Example`.getAttributes().string);
print("getMethods: " + `Example`.getMethods().string);
// prints: []
// i.e. doesnt print any attribute or method
// 2.
value e = Example()
type(e); // error
e.type(); // error, should be replaced by the ide with the above version.
}
広告 1.) 結果として得られるもの:
getAttributes: []
getMethods: []
属性またはメソッドを含むリストを期待していました。
広告 2.) ドキュメントは次のように述べています。
「type() 関数は、指定されたインスタンスの閉じた型を返します。インスタンス化できるのはクラスのみであるため、これは ClassModel のみです。...」
しかし、type() 関数やメタ プログラミングに関連するその他の関数が見つかりません。つまり、ツールチップが表示されず、代わりに実行時 (!) エラーが表示されます。
Exception in thread "main" com.redhat.ceylon.compiler.java.language.UnresolvedCompilationError: method or attribute does not exist: 'type' in type 'Example'
では、バッククォート `Example`.... に相当する関数はどこにあるのでしょうか?