com.sun.javafx.collections 在 Java 9

com.sun.javafx.collections in Java 9

我需要重新编译java应用程序,写在Java8上。应用程序使用com.sun.javafx.collections.ObservableListWrapperclass,但是编译java9时出现错误:

Error:(3, 22) java: package com.sun.javafx.collections is not visible
  (package com.sun.javafx.collections is declared in module javafx.base,     which does not export it to the unnamed module)

我可以用哪个 class 代替 ObservableListWrapper?或者如何绕过这个问题?

自 Java9 以来,大多数 com.sun.* APIs are unsupported, JDK-internal APIs and they might go away at any time. Also as described in the noteworthy column -

您应该计划改为使用 javafx.collections.FXCollections

因为 Java 8: ModifiableObservableListBase.

使用暴露 class

这应该可以满足您的所有需求。