Friday, May 29, 2020

GWTC 2.9.0 has problems compiling my generics

I switched from GWT 2.8.2 to GWT 2.9.0 and I get some GWTC compilation errors when compiling with certain generic constructs.
It compiles fine with JDK11 and in IntelliJ, but GWTC no longer seems to support this:

[INFO] --- gwt-maven-plugin:1.0.0:compile (default-compile) @ cloud.platform.ui.demo-app ---
[INFO] Compiling module com.swift.cloud.platform.ui.demo.Demo
[INFO]    Tracing compile failure path for type 'com.swift.cloud.platform.ui.webcomponent.widget.query.QueryEditor'
[INFO]       [ERROR] Errors in 'jar:file:/home/dnouls/liteevolutiontfr/platform/main/ui/webcomponent/target/cloud.platform.ui.webcomponent-0.0.5-SNAPSHOT.jar!/com/swift/cloud/platform/ui/webcomponent/widget/query/QueryEditor.java'
[INFO]          [ERROR] Line 376: The method byKey(IFilterKey<KEY>) in the type QueryConfiguration is not applicable for the arguments (capture#67-of ? extends IFilterKey<?>)
[INFO]    [ERROR] Aborting compile due to errors in some input files


A small piece of the QueryEditor class where this error is reported:

  public void setFilterKeys(Set<? extends IFilterKey<?>> filterKeys) {
    this.allowedFilterKeys = filterKeys.stream().filter(key -> config.byKey(key).isPresent()).collect(Collectors.toCollection(ArrayList::new));

    // sort by label
    allowedFilterKeys.sort(Comparator.comparing(config.getLabels()::getKeyLabel));
  }

This is the method that it is trying to call:
  @SuppressWarnings("unchecked")
  public <KEY, VO, CONFIG extends AbstractCriteria<KEY, VO, CONFIG>> Optional<CONFIG> byKey(IFilterKey<KEY> key) {
    return Optional.ofNullable((CONFIG) byKey.get(key));
  }

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/011da579-79ee-4bf2-946f-93e095d0c58d%40googlegroups.com.

No comments:

Post a Comment