BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Talks.cam//talks.cam.ac.uk//
X-WR-CALNAME:Talks.cam
BEGIN:VEVENT
SUMMARY:Using the OpenJDK to investigate covariance in Java - Raoul-Gabrie
 l Urma and Janina Voigt (University of Cambridge)
DTSTART:20120202T130000Z
DTEND:20120202T140000Z
UID:TALK36104@talks.cam.ac.uk
CONTACT:Dominic Orchard
DESCRIPTION:The Java type system is unsafe since it allows covariant use o
 f arrays. For example\, an array of Bananas can be used where an array of 
 Fruit is expected\, given that Banana is a subclass of Fruit. This allows 
 the following unsafe code:\n\nBanana[] bananas = new Banana[ 5 ]\;\n\nFrui
 t[] fruits = bananas\;\n\nfruits[ 0 ] = new Apple()\;  // runtime exceptio
 n\n\nbananas[ 0 ]\;  //  Apple?\n\nIn the above example\, the programmer g
 ets back an Apple where he was expecting Bananas\, causing an undesired ru
 ntime exception.\n\nWe investigate the covariant use of arrays in open sou
 rce Java programs to see whether programmers use this problematic feature 
 of Java. We make use of the freely available OpenJDK\, modifying its Java 
 compiler to disallow covariant use of arrays\, thus reporting any such use
 s as compile errors. We apply this compiler to a code corpus of 106 open s
 ource programs\, including large and well-known programs such as Eclipse\,
  JUnit and Ant.\n\nInitial results of our investigation show that covarian
 ce is rarely used outside the context of legacy code and Java libraries. T
 his leads us to question its relevance in the Java language.\n\nIn our tal
 k\, we also discuss solutions to covariance taken by other languages such 
 as Scala and Google Dart\, explain our modifications to the OpenJDK Java c
 ompiler and report the full results of our study.\n
LOCATION:SS03\, Computer Laboratory
END:VEVENT
END:VCALENDAR
