apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
1.1k stars 345 forks source link

[Improvement] Remove warnings when compiling Gravitino #1809

Open justinmclean opened 10 months ago

justinmclean commented 10 months ago

What would you like to be improved?

Warning shows up when compiling Gravitino, adding -Xlint:unchecked gives this:

> Task :common:compileJava FAILED
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/util/DTOConverters.java:82: warning: [unchecked] unchecked call to withProperties(Map<String,String>) as a member of the raw type Builder
        .withProperties(metalake.properties())
                       ^
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/util/DTOConverters.java:132: warning: [unchecked] unchecked call to withProperties(Map<String,String>) as a member of the raw type Builder
        .withProperties(catalog.properties())
                       ^
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/util/DTOConverters.java:141: warning: [unchecked] unchecked call to withProperties(Map<String,String>) as a member of the raw type Builder
        .withProperties(schema.properties())
                       ^
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/util/DTOConverters.java:167: warning: [unchecked] unchecked call to withProperties(Map<String,String>) as a member of the raw type Builder
        .withProperties(table.properties())
                       ^
  where S is a type-variable:
    S extends Builder declared in class Builder
error: warnings found and -Werror specified
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/AuditDTO.java:90: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/AuditDTO.java:101: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/AuditDTO.java:112: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/AuditDTO.java:123: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/MetalakeDTO.java:86: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/MetalakeDTO.java:97: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/MetalakeDTO.java:108: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/MetalakeDTO.java:119: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:112: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:123: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:134: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:145: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:156: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/CatalogDTO.java:167: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/SchemaDTO.java:86: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/SchemaDTO.java:97: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/SchemaDTO.java:108: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/SchemaDTO.java:119: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:141: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:152: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:163: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:174: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:185: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/ColumnDTO.java:190: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:164: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:175: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:186: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:197: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:208: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:213: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:218: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:223: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/TableDTO.java:228: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/indexes/IndexDTO.java:93: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/indexes/IndexDTO.java:98: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
/Users/justin/gravitino/common/src/main/java/com/datastrato/gravitino/dto/rel/indexes/IndexDTO.java:103: warning: [unchecked] unchecked cast
      return (S) this;
                 ^
  required: S
  found:    Builder<S>
  where S is a type-variable:
    S extends Builder declared in class Builder
1 error
40 warnings

How should we improve?

Remove the warnings. This is required by https://www.bestpractices.dev/en

surajguduru commented 3 months ago

Hey @justinmclean I would like to work on this issue. Can you assign it to me?

justinmclean commented 3 months ago

Sure - this issue is quite old so the warnings may have changed since then.