Methods have the same type of erasure

I have this program in my eclipse. And if I compile it using JDK 1.5 (build path → configure build path → java compilern → JDK compliance → compiler compliance level = 1.5), I get a type erase error for method m1

I have the option to select the compiler match level as 5 in driop down (build path → configure build path → java compilern → JDK match → compiler match level = 5), I do not get this error.

I do not see any difference in the setting that I choose. But why am I getting an error? what is the difference between 1.5 and 5

import java.util.*;   
class  TestWrapper   
{   
public static void main(String[] args) {   
            List<Number> ls1 = new ArrayList<Number>();   
            List<String> ls2 = new ArrayList<String>();   
            m1(ls1,ls2);   
        }   
        public static void m1(List<Integer> l1,List<Integer> l2){}               
      public static void m1(List<Number> l1,List<String> l2)  {}  

Thanks everyone for the Java answers :)

+3
source share
2 answers

Java , . , . , , List<Integer> List. List<Number> List<String>. , public static void m1(List, List).

Java; , .

+3

IMO . , JDK "5"

0

Source: https://habr.com/ru/post/1757300/


All Articles