1

I am using Eclipse IDE Version: Luna Service Release 1 (4.4.1). Using GWT 2.7 and Java 1.7.

I have implemented some custom collection class using replace with rule provided by GWT.

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

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

whenever I create instance of arraylist using GWT.create it use my on CustomArrayList class.

//gwt.xml file contains this configuration

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

In GWT maven project on client side I use array list instantiation as per the mention above but But while project compilation got some stack overflow error with AbstarctTreeLogger related msg printing on console.

customcollection.CustomArrayList<java.lang.Object>

[INFO] [WARN] Checking all subtypes of Object which qualify for serialization [ERROR] Exception in thread "main" java.lang.StackOverflowError [ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:252) [ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:252) [ERROR] at

It produces this error repeatedly for at least a few thousand times and then the compiler crashes.

After failure If I try again it works but not every time.

Can any one help me to figure out issue.

Gautam
  • 1,030
  • 13
  • 37
  • And if that doesn't work ... I would try to talk to the GWT team directly. There is always the chance that you uncovered a bug. – GhostCat Mar 31 '17 at 07:03
  • I agree with Walen. Just giving the compiler more memory might do the trick. I had similar issues and just gave the compiler 8GB and all problems where gone. – Knarf Mar 31 '17 at 07:30
  • I setup a machine with 16GB ram :D but it didn't fix the issue. Is there a way I can make the compiler print more details instead of only Stack overflow message at the exception point ? And is there a way to debug the compiler while its in action in my project ? – Gautam Mar 31 '17 at 13:23

2 Answers2

1

Just a guess, but since GWT needs to make sure that every class that could ever be contained in a List is Serializable... By creating a custom List, you just doubled the compiler's work, and now it's hitting a memory limit.

You might be able to solve this by increasing the memory available to the compiler, but your best choice is to be more specific with the types that you use.
See How can I keep GWT from trying to include every serializable class when I use ArrayList and gwt - Using List<Serializable> in a RPC call?

Community
  • 1
  • 1
walen
  • 7,103
  • 2
  • 37
  • 58
0

Finally an updated plugin configuration seems to work that addresses various memory requirement issues -

<!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.7.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <!-- <goal>test</goal> -->
                    </goals>
                </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin
                documentation at codehaus.org -->
            <configuration>
                <runTarget>TrupublicBuilder.html</runTarget>

                <modules>
                    <module>com.trupublic.TrupublicBuilder</module>
                </modules>
                <extraJvmArgs>-XX:PermSize=1024m </extraJvmArgs>
                <extraJvmArgs>-XX:MaxPermSize=8192m</extraJvmArgs>
                <extraJvmArgs>-Xms512m </extraJvmArgs>
                <extraJvmArgs>-Xmx8192M </extraJvmArgs>
                <extraJvmArgs>-Xss2048k </extraJvmArgs>
            </configuration>
        </plugin>

We were missing the -Xss configuration and it was aptly pointed out by Jens in Gwt user google group here.

Gautam
  • 1,030
  • 13
  • 37