Diamond - no method matches

Issue #173 open
Jörg Hagemann
created an issue

This example causes an error:

Diamond.java:6: error: no method named addAll(java.util.ArrayList<java.lang.Object>) in java.util.Set<java.lang.String> matches. However, there is a method addAll(java.util.Collection<wildcards.? extends java.lang.String>)

import java.util.*;
public class Diamond {
    public static void main(String[] args) {
        Set<String> hashSet01 = new HashSet<>();
        Set<String> hashSet02 = new HashSet<>();
        hashSet02.addAll(new ArrayList<>(hashSet01));   // new ArrayList<String>(hashSet01) works
    }
}

Comments (3)

  1. Log in to comment