Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Type Erasure: die. Die! DIE!!!!  (Read 2152 times)
0 Members and 1 Guest are viewing this topic.
Offline Roquen
« Posted 2012-01-25 10:30:21 »

No question. No information.  I just want to say that type erasure sucks and imagine a couple of heads around the world nodding in agreement.

Thanks...I feel better already.

(edit: grammar error)
Offline Danny02
« Reply #1 - Posted 2012-01-25 11:29:33 »

here have something for you Smiley
Anonymous classes don't suffer from type erasure.
Offline princec

JGO Kernel


Medals: 342
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2012-01-25 12:22:07 »

It is a bit of a pain that it erases the info but... isn't it nice how it just retrofitted with the nice simple bytecode of yesteryear and kept everyone's VM implementations simpler and old libraries working fine.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« Reply #3 - Posted 2012-01-25 15:09:56 »

But that's really just an excuse for an easier implementation.  I'd have been fine with working generics which one could not compile down to older targets.  My guess is that very little of that happened anyway.
Offline Danny02
« Reply #4 - Posted 2012-01-25 15:25:29 »

As cas pointed out, all the old libarys wouldn't be compatible like all Collections^^
No List<String>!

What they do now for Java 8 with the class extensions thing, to handle lambda expressions in old libarys could be extendend perhaps for better generics ...
Offline princec

JGO Kernel


Medals: 342
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2012-01-25 17:25:21 »

It was a crafty upgrade. Sun weren't / aren't the only JVM vendors and forcing every licensee to completely overhaul their VMs for this one small change would have been daft. The way it is now keeps things really simple under the hood.

Cas Smiley

Offline sproingie

JGO Kernel


Medals: 201



« Reply #6 - Posted 2012-01-25 17:37:57 »

Type erasure isn't really so much the problem -- even Haskell uses erasure -- it's that they left it at the halfway point and didn't add in any reification for when you do need it.  It doesn't have to be all or nothing, so Java could conceivably add reified types in the future.  I just have my doubts it'll happen.  Scala is a good way toward finishing the job using manifests, but they can't do everything.

The bytecode format did change for generics (classes have generic info, it's instances that are erased), and having every licensee overhaul their VMs is what versioning and a rigid spec is all about.  I don't think Sun really cared about third party VMs keeping up anyway.
Offline Roquen
« Reply #7 - Posted 2012-01-25 18:53:34 »

@Danny2: JDK4 compliant stuff would have work just fine.  They could have required the VM change to be JDK5 compat.  We have to make that choice anyway because of public API changes.  It wouldn't have been a big deal. 

@princec: But it wouldn't have been an big overhaul to the VM.  It would have required a few change to the verifier, which they completely overhauled in the next release anyway.  The amount of work to update the the new public APIs introduced was much bigger.

@sproingie: My big problem with type erasure in Java is that it makes self referencing types pretty much useless without ugly, error-prone, and pointless (as everyone BUT the VM is aware) boilerplate code.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (24 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!