AdaptRecursive StackOverflowError

2019-08-01 12:02发布

While compiling my project I get:

The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
    at com.sun.tools.javac.code.Type$WildcardType.isSuperBound(Type.java:435)
    at com.sun.tools.javac.code.Types$1.visitWildcardType(Types.java:102)
    at com.sun.tools.javac.code.Types$1.visitWildcardType(Types.java:98)
    at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:416)
    at com.sun.tools.javac.code.Types$MapVisitor.visit(Types.java:3232)
    at com.sun.tools.javac.code.Types.upperBound(Types.java:95)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
    at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
    at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
    at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
    at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
    at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
    ...

How do you find the root of the problem?

I have found a bug report...

3条回答
走好不送
2楼-- · 2019-08-01 12:15

What about trying a different compiler, like the one in Eclipse? It's error messages are at least different, in my experience often more to the point. Also I haven't seen compilation failures like this yet.

查看更多
贪生不怕死
3楼-- · 2019-08-01 12:17

The bug report you linked to indicates that the bug was fixed in JDK 6. Which version of the JDK are you using to build?

If you can't identify the part of your source that is causing the problem, perhaps you could try compiling with JDK 6 to see if it can identify the problem without crashing.

Otherwise, I would use the "divide and conquer" approach: Remove half your source code, compile, and see if it still crashes. Depending on whether it does or not, you will know which half the problem is in. Repeat.

查看更多
放荡不羁爱自由
4楼-- · 2019-08-01 12:31

I would start by running javac with the -verbose option to see which .java file was causing the problem.

查看更多
登录 后发表回答