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

Clean up raw type warnings in public API of JavaBeanObjectPropertyBuilder

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • javafx
    • None
    • source, binary, behavioral
    • minimal
    • Fully compatible.
    • Java API

      Summary

      Update public methods which are part of public API in JavaBeanObjectPropertyBuilder missing with generic parameters.

      Problem

      Raw types result in warnings in the JavaFX code base and could cause issues when manual casting is needed to conform to the correct type.

      Solution

      Use generic parameters to allow the compiler to validate the actual types and remove the need for casting.

      Specification

      diff --git a/modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanObjectPropertyBuilder.java b/modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanObjectPropertyBuilder.java
      index 62da2ac507..ced01f1253 100644
      --- a/modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanObjectPropertyBuilder.java
      +++ b/modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanObjectPropertyBuilder.java
      @@ -71,7 +71,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            *
            * @return the new {@code JavaBeanObjectPropertyBuilder}
            */
      -    public static JavaBeanObjectPropertyBuilder create() {
      +    public static <T> JavaBeanObjectPropertyBuilder<T> create() {
               return new JavaBeanObjectPropertyBuilder<>();
           }
      
      @@ -93,7 +93,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param name the name of the property
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder name(String name) {
      +    public JavaBeanObjectPropertyBuilder<T> name(String name) {
               helper.name(name);
               return this;
           }
      @@ -104,7 +104,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param bean the Java Bean instance
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder bean(Object bean) {
      +    public JavaBeanObjectPropertyBuilder<T> bean(Object bean) {
               helper.bean(bean);
               return this;
           }
      @@ -117,7 +117,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param beanClass the Java Bean class
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder beanClass(Class<?> beanClass) {
      +    public JavaBeanObjectPropertyBuilder<T> beanClass(Class<?> beanClass) {
               helper.beanClass(beanClass);
               return this;
           }
      @@ -129,7 +129,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param getter the alternative name of the getter
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder getter(String getter) {
      +    public JavaBeanObjectPropertyBuilder<T> getter(String getter) {
               helper.getterName(getter);
               return this;
           }
      @@ -141,7 +141,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param setter the alternative name of the setter
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder setter(String setter) {
      +    public JavaBeanObjectPropertyBuilder<T> setter(String setter) {
               helper.setterName(setter);
               return this;
           }
      @@ -153,7 +153,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param getter the getter
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder getter(Method getter) {
      +    public JavaBeanObjectPropertyBuilder<T> getter(Method getter) {
               helper.getter(getter);
               return this;
           }
      @@ -165,7 +165,7 @@ public final class JavaBeanObjectPropertyBuilder<T> {
            * @param setter the setter
            * @return a reference to this builder to enable method chaining
            */
      -    public JavaBeanObjectPropertyBuilder setter(Method setter) {
      +    public JavaBeanObjectPropertyBuilder<T> setter(Method setter) {
               helper.setter(setter);
               return this;
           }

            jhendrikx John Hendrikx
            jhendrikx John Hendrikx
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: