を生成しませんScalaのコード以下のように生成されたクラスファイル逆コンパイルScalaの主なコンストラクタがここでフィールド
class Dog(name:String, age:Int) {
println("Dog is created!")
def sayHello() = println(s"My name is $name, I am $age years old")
}
です。
import scala.Predef.;
import scala.StringContext;
import scala.reflect.ScalaSignature;
import scala.runtime.BoxesRunTime;
@ScalaSignature(bytes="\006\001=2A!\001\002\001\023\t\031Ai\\4\013\005\r!\021\001C2iCB$XM\035\034\013\005\0251\021!B6d[2\004(\"A\004\002\007\r|Wn\001\001\024\005\001Q\001CA\006\017\033\005a!\"A\007\002\013M\034\027\r\\1\n\005=a!AB!osJ+g\r\003\005\022\001\t\005\t\025!\003\023\003\021q\027-\\3\021\005MQbB\001\013\031!\t)B\"D\001\027\025\t9\002\"\001\004=e>|GOP\005\00331\ta\001\025:fI\0264\027BA\016\035\005\031\031FO]5oO*\021\021\004\004\005\t=\001\021\t\021)A\005?\005\031\021mZ3\021\005-\001\023BA\021\r\005\rIe\016\036\005\006G\001!\t\001J\001\007y%t\027\016\036 \025\007\025:\003\006\005\002'\0015\t!\001C\003\022E\001\007!\003C\003\037E\001\007q\004C\003+\001\021\0051&\001\005tCfDU\r\0347p)\005a\003CA\006.\023\tqCB\001\003V]&$\b")
public class Dog
{
private final String name;
public Dog(String name, int age)
{
Predef..MODULE$.println("Dog is created!");
}
public void sayHello()
{
Predef..MODULE$.println(new StringContext(Predef..MODULE$.wrapRefArray((Object[])new String[] { "My name is ", ", I am ", " years old" })).s(Predef..MODULE$.genericWrapArray(new Object[] { this.name, BoxesRunTime.boxToInteger(this.age) })));
}
}
フィールド「名前」のみがありますが、「年齢」フィールドはありません。どうして?
あなたのIDEは 'this.age'を解決できますか? –
あなたはどのように逆コンパイルしましたか? – marios
なぜ「デコンパイル済み」のものを見ていますか? –