Saturday, November 17, 2012

JVM type erasure

I think the best way to explain type erasure in the JVM (Java Virtual Machine) is to see what happens when you define to methods with different arguments.... oh wait not so different due to type erasure:


Try running this code (click on the clone icon to go to www.ideone.com, and once there press the "submit" button) and you'll see how the compiler gets all confused by you trying to define the same method twice....

In any case, this a documented restrictions, so spending a bit of quality time with Java's online tutorials, will certainly reduce the amount of surprise :)

http://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#cannotOverload

Can anyone patent "book page turning"?

The answer is yes!!! It has been Apple who has patented something like that, claiming that their on screen animation is somehow special:

http://bits.blogs.nytimes.com/2012/11/16/apple-now-owns-the-page-turn/

Weird times. At least in Europe this kind of nonsense is more difficult to patent.