Generics in Java does not compile

I am stuck trying to understand what exactly is going on over here. The two ways that the copy_v1 method is being used are shown below. The first way (1) produces a compile error. But the second way (2) does not produce any compile error (nor does it produce any runtime error when I try to execute the program once I comment out (1)). When I replace (2) with copy_v1(new Wrapper<String>("Hello"), new Wrapper<Object>(new Object()));, I end up getting a compile error on (2) as well. Not sure what is happening. How is the code on (1) any different from (2)? Can someone shed some light on this please.


public class SOQuestion {

    public static <T> void copy_v1(Wrapper<T> source, Wrapper<T> dest) {
        T srcObj = source.getRef();

    public static void main(String() args) {
        Wrapper<Object> objectWrapper = new Wrapper<>(new Object());
        Wrapper<String> stringWrapper = new Wrapper<>("Hello");
        copy_v1(stringWrapper, objectWrapper); // Compile error on this line (1)
        copy_v1(new Wrapper<>("Hello"), new Wrapper<>(new Object())); // But no error on this line (2)


class Wrapper<T> {

    private T ref;

    Wrapper(T ref) {this.ref = ref;}

    public T getRef() {return this.ref;}

    public void setRef(T ref) {this.ref = ref;}