gpt4 book ai didi

java - 当我扩展 ArrayList 或其他常见集合时,gwt 构建中出现奇怪的异常/错误

转载 作者:行者123 更新时间:2023-11-30 06:49:13 25 4
gpt4 key购买 nike

我正在使用 Eclipse IDE 版本:Luna Service Release 1 (4.4.1)。使用 GWT 2.7 和 Java 1.7。

我使用 GWT 提供的替换规则实现了一些自定义集合类。

public class CustomArrayList<E> extends ArrayList{
// ...... overridden methods here
}

ArrayList arraList=GWT.create(ArrayList.class);

每当我使用 GWT.create 创建 arraylist 实例时,它都会使用我的 CustomArrayList 类。

//gwt.xml file contains this configuration

<replace-with
class="xxxxxxxx.yyyyyyy.CustomArrayList">
<when-type-is class="java.util.ArrayList" />
</replace-with>

在客户端的 GWT maven 项目中,我按照上面提到的那样使用数组列表实例化,但是当项目编译时出现一些堆栈溢出错误,并在控制台上打印与 AbstarctTreeLogger 相关的消息。

customcollection.CustomArrayList<java.lang.Object>

[INFO] [WARN] 检查符合序列化条件的所有对象子类型[错误] 线程“main”中出现异常 java.lang.StackOverflowError[错误]位于 com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:252)[错误]位于 com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:252)[错误]位于

它会重复产生此错误至少几千次,然后编译器崩溃。

失败后,如果我再试一次,它会起作用,但并非每次都有效。

谁能帮我解决问题。

最佳答案

只是猜测,但由于 GWT 需要确保列表中可能包含的每个类都是可序列化的...通过创建自定义列表,您只是使编译器的工作量增加了一倍,现在它达到了内存限制.

您也许可以通过增加编译器可用的内存来解决此问题,但您最好的选择是更具体地说明您使用的类型。
请参阅How can I keep GWT from trying to include every serializable class when I use ArrayListgwt - Using List<Serializable> in a RPC call?

关于java - 当我扩展 ArrayList 或其他常见集合时,gwt 构建中出现奇怪的异常/错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43132656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com