amelentev / java-oo

Java Operator Overloading
http://amelentev.github.io/java-oo/
268 stars 31 forks source link

index-set OO doesn't works with implicit type conversion #6

Closed amelentev closed 11 years ago

amelentev commented 11 years ago

javac on:

import java.util.*;
import java.math.*;
class bug {
        public static void main(String[] args) {
                List<BigInteger> a = new ArrayList<>();
                a.add(BigInteger.ONE);
                a[0] = BigInteger.TEN;
                a[0] = 5; // BigInteger.valueOf(5)
                System.out.println(a[0]);
        }
}

outputs:

bug.java:8: error: array required, but List<BigInteger> found
        a[0] = 5; // BigInteger.valueOf(5)
amelentev commented 11 years ago

In this case a[0] = 5 should transform to a.set(0, BigInteger.valueOf(5)) but if class of a have also #set(int, int) method then there will be confusion. So wontfix for now.