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

Instrumentation verification doesn't help when abstract/interface call sites are not instrumented #86

Closed
circlespainter opened this issue May 12, 2015 · 1 comment

Comments

@circlespainter
Copy link
Member

For example, the code below triggers a strange exception that instrumentation verification can't diagnose while marking the interface as suspendable solves it.

public class Test {
///////////////////////////////////////////////////////////////////////
// Uncomment this to solve the issue
///////////////////////////////////////////////////////////////////////
//    @Suspendable
    interface I {
        void doIt();
    }

    static class C implements I {

        @Override
        @Suspendable
        public void doIt() {
            try {
                Fiber.sleep(10);
            } catch (InterruptedException e) {
                throw new AssertionError(e);
            } catch (SuspendExecution suspendExecution) {
                throw new AssertionError(suspendExecution);
            }
        }
    }

    static public Integer doAll() throws ExecutionException, InterruptedException {
        final I i = new C();

        Fiber<Integer> increasing = new Fiber<>("INCREASER", new SuspendableCallable<Integer>() { @Override public Integer run() throws SuspendExecution, InterruptedException {
            Object o = new Object();
            try {
                i.doIt();
            } finally {
                i.doIt();
                o.toString();
            }
            return 1;
        }}).start();

        return increasing.get();
    }

    static public void main(String[] args) throws ExecutionException, InterruptedException {
        doAll();
    }
}
@circlespainter
Copy link
Member Author

See #87, comment out only the last two lines in resources/META-INF/suspendables to see a case of failed instrumentation verification even when there's no interface involved.

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

No branches or pull requests

1 participant