對於以下代碼,我收到編譯器錯誤「Getter getLength_inch未關聯到任何字段」。 getLength_inch僅僅是一個實用的方法...Getter未關聯到任何字段
import io.realm.RealmObject;
public class Measurement extends RealmObject {
private float length_mm;
public void setLength_mm(float c){length_mm = c;}
public float getLength_mm() { return length_mm;}
public float getLength_inch() { return length_mm * 0.0394f;}
}
似乎RealmObject的任何後代不能執行任何東西比什麼是相關於它的其他領域。這是正確的還是有一些方法來註釋此方法,以便您的處理器忽略它?
感謝
此限制將取消0.88,但在此之前,上述情況屬實。 –
目前,我最終使用_ @ Ignore_註釋添加了屬性_length_inch_。不夠優雅,無緣無故地使用記憶,但那會帶我到0.88結束。謝謝 –