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

Comments

Projects
None yet
1 participant
@amelentev
Owner

amelentev commented Jan 3, 2014

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 amelentev closed this in 7e7dc56 Jan 3, 2014

@amelentev

This comment has been minimized.

Show comment
Hide comment
@amelentev

amelentev Jan 3, 2014

Owner

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.

Owner

amelentev commented Jan 3, 2014

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