Java不可变构建器类在IntelliJ中未被检测到。

huangapple go评论75阅读模式
英文:

Java Immutable Builder classes not detected by IntelliJ

问题

以下是翻译好的内容:

我一直在想为什么IntelliJ不能检测由Immutables自动生成的类:

Java不可变构建器类在IntelliJ中未被检测到。

RemoteEntityACL的代码如下:

@Value.Immutable
@Value.Style(visibility = Value.Style.ImplementationVisibility.PRIVATE)
public interface RemoteEntityACL extends Serializable {
  @Nullable
  @Value.Default
  default List<String> read() {
    return new LinkedList<>();
  }

  @Nullable
  @Value.Default
  default List<String> write() {
    return new ArrayList<>();
  }

  @Nullable
  @Value.Default
  default Boolean publicRead() {
    return false;
  }

  @Nullable
  @Value.Default
  default Boolean publicWrite() {
    return false;
  }

  @Nullable
  @Value.Default
  default List<RemotePropertyACL> propertyACLs() {
    return new ArrayList<>();
  }
}

这里可能出了什么问题?

英文:

I keep on wondering why IntelliJ cannot detect the classes which are auto-generated by Immutables:

Java不可变构建器类在IntelliJ中未被检测到。

The code for the RemoteEntityACL is this:

@Value.Immutable
@Value.Style(visibility = Value.Style.ImplementationVisibility.PRIVATE)
public interface RemoteEntityACL extends Serializable {
  @Nullable
  @Value.Default
  default List&lt;String&gt; read() {
    return new LinkedList&lt;&gt;();
  }

  @Nullable
  @Value.Default
  default List&lt;String&gt; write() {
    return new ArrayList&lt;&gt;();
  }

  @Nullable
  @Value.Default
  default Boolean publicRead() {
    return false;
  }

  @Nullable
  @Value.Default
  default Boolean publicWrite() {
    return false;
  }

  @Nullable
  @Value.Default
  default List&lt;RemotePropertyACL&gt; propertyACLs() {
    return new ArrayList&lt;&gt;();
  }
}

What could be wrong here?

答案1

得分: 2

更新到最新版本应该有助于解决这个问题:

<dependency>
   <groupId>org.immutables</groupId>
   <artifactId>value</artifactId>
   <version>2.8.8</version>
</dependency>
英文:

Updating to latest version should help fix this:

&lt;dependency&gt;
   &lt;groupId&gt;org.immutables&lt;/groupId&gt;
   &lt;artifactId&gt;value&lt;/artifactId&gt;
   &lt;version&gt;2.8.8&lt;/version&gt;
&lt;/dependency&gt;

huangapple
  • 本文由 发表于 2020年10月20日 03:04:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/64433666.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定