Skip to content

This statement should not be reachable #2

Description

@andreabono

Hello,
I'm trying to run the Example1 code, but I get this error:

Exception in thread "main" java.lang.UnsupportedOperationException: Program error. This statement should not be reachable.
at github.footloosejava.go2.Goto._unreachable(Goto.java:173)
at github.footloosejava.go2.Goto.testBasicJump(Goto.java:116)
at github.footloosejava.go2.Goto.(Goto.java:19)

import github.footloosejava.go2.Goto;
import github.footloosejava.go2.transformers.GotoLoader;

public class Example1 extends Goto  implements Runnable {

    public void run() {
        int x = 0;

        _label(0);

        if (x > 0) {
            System.out.println("We jumped back to label 0 before reaching this code!");
            _goto(1);
        }

        x++;
        _goto(0);

        _label(1);
    }

    public static void main(String args[]) throws Exception {
        Runnable demo = (Runnable) GotoLoader.newInstance(Example1.class.getName());
        demo.run();
    }
}
  
  
// This code is in another class (my main application class):
public static void main(String[] args) {
        try {
            Runnable demo = (Runnable) GotoLoader.newInstance(Example1.class.getName());
            demo.run();
        } catch (Exception ex) {
            System.out.println("ERROR: " + ex.getMessage());
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions