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

javac: binary operator adds erroneous cast on 1st operand. #10

Closed
amelentev opened this issue Jan 3, 2014 · 1 comment
Closed

javac: binary operator adds erroneous cast on 1st operand. #10

amelentev opened this issue Jan 3, 2014 · 1 comment
Assignees
Labels

Comments

@amelentev
Copy link
Owner

For example when multiplying Vector to Matrix:

class VecMat {
    static class Vec {
        Vec multiply(Mat A) { return this; }
    }
    static class Mat {}
    public static void main(String[] s) {
        Vec a = new Vec();
        Mat A = new Mat();
        System.out.println(a*A);
    }
}

a*A transforms to ((Mat)a).multiply(A)
which causes ClassCastException at runtime.

@ghost ghost assigned amelentev Jan 3, 2014
@amelentev
Copy link
Owner Author

The cast added on TransTypes stage because javac plugin adds a custom method-operator which confused the compiler.
Fixed by moving desugar to TransTypes stage.

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

No branches or pull requests

1 participant