Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Solution to getting int and int mixed up: Generic primitives. Anyone interested in Java having int
Solution to getting int and int mixed up: Generic primitives. Anyone interested in Java having int [message #216966] Thu, 13 October 2005 09:00
Eclipse UserFriend
Hi all,

Ever had the problem where a bug gets introduced because someone called
a function with two primitive values in the wrong order.

Well, I believe that we could solve this by extending the Java language
to support generic primitives.

I'd love to create an Eclipse JDT Compiler derivative to demonstrate it
(and also for internal use), but I'd need some support. Looking at the
grammar in the compiler, it looks like it could be quite a simple change.

The benefit is that instead of having the performance and garbage
collection hit of using classes:

class X extends Integer {}
class Y extends Integer {}

which we don't do anyway...

we could instead still declare those empty classes (or an enum ?), and
instead use int<X> and int<Y>

Could easily have something like:

public Rect createRect(
int<? extends X>, int<? extends Y>,
int <? extends Width>, int <? extends Height> )

But, unless I'm mistaken, we couldn't also have:
public Rect createRect(
int<? extends X>, int<? extends Y>,
int <? extends X>, int <? extends Y> )
as well, as the eventual compiled code would have clashing method
signatures.

Any takers, or votes for "I'd love to have that feature" ?

Cheers,

Neale

----------------------------------------
www.likemynds.com - What's on your Mynd?
Previous Topic:Dynamic Java build path
Next Topic:Find the CVS location associated with a resource
Goto Forum:
  


Current Time: Mon May 12 07:58:41 EDT 2025

Powered by FUDForum. Page generated in 0.04725 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top