1
scala 2.11 + JavaFX 프로젝트를 2.12.0-RC1로 업데이트하면 코드가 Java @FXML
annotation을 집중적으로 사용합니다. FXMLLoader.load
을 실행하는 동안주석 정보가 scala 2.12 trait에서 손실 됨
trait MainController {
@FXML def onRun(event: ActionEvent) {
val script = currentEngine.executeScript("editor.getValue()").toString
runScript(script)
}
}
<MenuItem mnemonicParsing="false" onAction="#onRun" text="Run">
<accelerator>
<KeyCodeCombination alt="UP" code="R" control="UP" meta="UP" shift="UP" shortcut="DOWN"/>
</accelerator>
</MenuItem>
는 런타임시이 오류가 발생합니다 :
javafx.fxml.LoadException: Error resolving onAction='#onRun', either the event handler is not in the Namespace or there is an error in the script.
가 @FXML
주석 정보를 컴파일하는 동안 손실 된 것으로 보인다