Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314581

Add 'final' keyword to public property methods in controls

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • jfx22
    • javafx
    • None
    • source, binary
    • low
    • This change adds 'final' keyword to certain methods, thus breaking binary and source compatibility in customer code that fails to adhere to Control design contract.
    • Java API
    • JDK

    Description

      Summary

      Adding missing final keyword to the property accessor methods in the Control hierarchy.

      Problem

      By design, accessor methods for properties in the Control hierarchy are declared final. In some cases, the final keyword is missing, thus enabling the subclass to override behavior and break the behavior in unexpected ways.

      Solution

      Add missing final keyword.

      Specification

      javafx/scene/control/ChoiceBox.java
      -    public ObjectProperty<StringConverter<T>> converterProperty() { return converter; }
      +    public final ObjectProperty<StringConverter<T>> converterProperty() { return converter; }
      
      -    public ObjectProperty<T> valueProperty() { return value; }
      +    public final ObjectProperty<T> valueProperty() { return value; }
      
      javafx/scene/control/ComboBox.java 
      -    public ObjectProperty<ObservableList<T>> itemsProperty() { return items; }
      +    public final ObjectProperty<ObservableList<T>> itemsProperty() { return items; }
      
      -    public ObjectProperty<StringConverter<T>> converterProperty() { return converter; }
      +    public final ObjectProperty<StringConverter<T>> converterProperty() { return converter; }
      
      -    public ObjectProperty<Callback<ListView<T>, ListCell<T>>> cellFactoryProperty() { return cellFactory; }
      +    public final ObjectProperty<Callback<ListView<T>, ListCell<T>>> cellFactoryProperty() { return cellFactory; }
      
      -    public ObjectProperty<ListCell<T>> buttonCellProperty() { return buttonCell; }
      +    public final ObjectProperty<ListCell<T>> buttonCellProperty() { return buttonCell; }
      
      javafx/scene/control/ComboBoxBase.java
      -    public ObjectProperty<T> valueProperty() { return value; }
      +    public final ObjectProperty<T> valueProperty() { return value; }
      
       -    public BooleanProperty editableProperty() { return editable; }
      +    public final BooleanProperty editableProperty() { return editable; }
      
      -    public ReadOnlyBooleanProperty showingProperty() { return showingPropertyImpl().getReadOnlyProperty(); }
      +    public final ReadOnlyBooleanProperty showingProperty() { return showingPropertyImpl().getReadOnlyProperty(); }
      
      -    public BooleanProperty armedProperty() { return armed; }
      +    public final BooleanProperty armedProperty() { return armed; }
      
      javafx/scene/control/Label.java
      -    public ObjectProperty<Node> labelForProperty() {
      +    public final ObjectProperty<Node> labelForProperty() {
      
      scene/control/ListView.java
      -    public void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      +    public final void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      
      -    public EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      +    public final EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      
      -    public ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      +    public final ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      
      javafx/scene/control/TableView.java
      -    public void setOnSort(EventHandler<SortEvent<TableView<S>>> value) {
      +    public final void setOnSort(EventHandler<SortEvent<TableView<S>>> value) {
      
      -    public EventHandler<SortEvent<TableView<S>>> getOnSort() {
      +    public final EventHandler<SortEvent<TableView<S>>> getOnSort() {
      
      -    public ObjectProperty<EventHandler<SortEvent<TableView<S>>>> onSortProperty() {
      +    public final ObjectProperty<EventHandler<SortEvent<TableView<S>>>> onSortProperty() {
      
      -    public void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      +    public final void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      
      -    public EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      +    public final EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      
      -    public ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      +    public final ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      
      -    public void setOnScrollToColumn(EventHandler<ScrollToEvent<TableColumn<S, ?>>> value) {
      +    public final void setOnScrollToColumn(EventHandler<ScrollToEvent<TableColumn<S, ?>>> value) {
      
      -    public EventHandler<ScrollToEvent<TableColumn<S, ?>>> getOnScrollToColumn() {
      +    public final EventHandler<ScrollToEvent<TableColumn<S, ?>>> getOnScrollToColumn() {
      
      -    public ObjectProperty<EventHandler<ScrollToEvent<TableColumn<S, ?>>>> onScrollToColumnProperty() {
      +    public final ObjectProperty<EventHandler<ScrollToEvent<TableColumn<S, ?>>>> onScrollToColumnProperty() {
      
      javafx/scene/control/TreeTableView.java
      -    public void setOnSort(EventHandler<SortEvent<TreeTableView<S>>> value) {
      +    public final void setOnSort(EventHandler<SortEvent<TreeTableView<S>>> value) {
      
      -    public EventHandler<SortEvent<TreeTableView<S>>> getOnSort() {
      +    public final EventHandler<SortEvent<TreeTableView<S>>> getOnSort() {
      
      -    public ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> onSortProperty() {
      +    public final ObjectProperty<EventHandler<SortEvent<TreeTableView<S>>>> onSortProperty() {
      
      -    public void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      +    public final void setOnScrollTo(EventHandler<ScrollToEvent<Integer>> value) {
      
      -    public EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      +    public final EventHandler<ScrollToEvent<Integer>> getOnScrollTo() {
      
      -    public ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      +    public final ObjectProperty<EventHandler<ScrollToEvent<Integer>>> onScrollToProperty() {
      
      -    public void setOnScrollToColumn(EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>> value) {
      +    public final void setOnScrollToColumn(EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>> value) {
      
      -    public EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>> getOnScrollToColumn() {
      +    public final EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>> getOnScrollToColumn() {
      
      -    public ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>>> onScrollToColumnProperty() {
      +    public final ObjectProperty<EventHandler<ScrollToEvent<TreeTableColumn<S, ?>>>> onScrollToColumnProperty() {

      Attachments

        Issue Links

          Activity

            People

              angorya Andy Goryachev
              angorya Andy Goryachev
              Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: