grmartin / stab-language

Automatically exported from code.google.com/p/stab-language
Apache License 2.0
0 stars 0 forks source link

Raw type on method invocation not working #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using the raw type "List" on working:

using java.io;
using java.net;
using java.util;
using java.lang;

package test {

    public class Main {

        public static void main(String[] args){
            List s = Arrays.asList(1, 9, 4, 4, 20); // not working
            List<Integer> s = Arrays.asList<Integer>(1, 9, 4, 4, 20); // working

            System.out.println("DONE");
        }
    }
}

Original issue reported on code.google.com by ice.ta...@gmail.com on 29 Sep 2010 at 9:55

GoogleCodeExporter commented 8 years ago
When the compiler tries to infer the type parameter of the method 
'asList<T>(params T[] args)' from the arguments, it finds that T = int. The 
algorithm does not try to box the parameters (for some good reasons) and it 
fails because 'int' is not a valid type here.
This is the expected behavior.

Original comment by stab.hac...@gmail.com on 29 Sep 2010 at 7:48