java.util/372: unmodifiableList isn't unmodifiable
Wed Nov 22 02:16:00 GMT 2000

>Number:         372
>Category:       java.util
>Synopsis:       unmodifiableList isn't unmodifiable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    warrenl
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 22 02:16:00 PST 2000
>Release:        unknown-1.0

Collections.UnModifiableList appears to be implemented
incorrectly. Refer to the test case.
import java.util.*;

public class Unmodifiable
  public static void main(String[] args)
    List l = new ArrayList();
    l = Collections.unmodifiableList(l);
    System.out.println (l); // should print contents of list
    l.set(0, "bar"); // should throw exception


More information about the Java-prs mailing list