Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (652)
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 2533 times)
0 Members and 1 Guest are viewing this topic.
Offline Roquen
« Posted 2012-01-25 09: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 10:29:33 »

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

« JGO Spiffy Duke »

Medals: 556
Projects: 3
Exp: 16 years

Eh? Who? What? ... Me?

« Reply #2 - Posted 2012-01-25 11: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 14: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 14: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 Spiffy Duke »

Medals: 556
Projects: 3
Exp: 16 years

Eh? Who? What? ... Me?

« Reply #5 - Posted 2012-01-25 16: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: 202

« Reply #6 - Posted 2012-01-25 16: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 17: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.

SHC (24 views)
2015-08-01 03:58:20

Jesse (19 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (21 views)
2015-07-27 15:35:20

Riven (24 views)
2015-07-27 12:26:13

Riven (14 views)
2015-07-27 12:23:39

BurntPizza (36 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (28 views)
2015-07-24 06:06:53

NoxInc (36 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!