Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridging to JavaScript results in a stack overflow #3

Open
BrianGenisio opened this issue Feb 27, 2018 · 1 comment
Open

Bridging to JavaScript results in a stack overflow #3

BrianGenisio opened this issue Feb 27, 2018 · 1 comment

Comments

@BrianGenisio
Copy link

When I add the following code into the online teavm-javac interface, I get a stack overflow:

import org.teavm.jso.JSBody;

class Main {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
        
        log("TESTING BRIDGE");
    }
    
    @JSBody(params = { "message" }, script = "console.log(message)")
    private static native void log(String message);
}

Output

Message received: 0
runtime.js:414 Initializing
runtime.js:414 Initialized in 943 ms
runtime.js:414 Message received: 1
runtime.js:414 [parsing started RegularFileObject[/Main.java]]
runtime.js:414 [parsing completed 22ms]
runtime.js:414 [search path for source files: .]
runtime.js:414 [search path for class files: /stdlib,.]
runtime.js:414 [loading RegularFileObject[/stdlib/org/teavm/jso/JSBody.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/Object.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/String.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/annotation/Retention.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/annotation/RetentionPolicy.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/annotation/Target.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/annotation/ElementType.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/org/teavm/interop/Superclass.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/org/teavm/interop/Rename.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/org/teavm/interop/DelegateTo.class]]
runtime.js:414 [loading RegularFileObject[/stdlib/java/lang/annotation/Annotation.class]]
classes.js:38 Uncaught RangeError: Maximum call stack size exceeded
    at Erk (classes.js:12054)
    at SCk (classes.js:10783)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
    at T5d (classes.js:10818)
@shannah
Copy link

shannah commented Oct 2, 2019

I also get this stack overflow (though I'm compiling something more complex, and I have extended may stdlib with many additional .class files). The overflow always occurs at the same point described here though immediately after it says [loading RegularFileObject[/stdlib/java/lang/annotation/Annotation.class]].

It seems to be the annotation that trips it up. If you remove the use of annotations, it will build properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants