Generics in production code?

Hi all!

As you probably noticed, we - after much debate - plan to support JSR014
"Generics" in Aurora. And you can expect at least the parser in a build or
two :).

However, our motto here is "to eat one's dog food" - that is, we would like
to use Generics in IDEA (and, as a matter of fact, are looking forward to
do so :) ).

The current beta implementation of Generics (version 1.3) can be used "on
top" of JDK 1.4.1 - that is, compile with generics supporting javac, and
run with JDK 1.4.1. You can even enjoy generic collections - a special
generic stubs are provided, against which your code should be compiled. And
we were actually able to compile IDEA with it and use it afterwards :)
(no, the next build is compiled with conventional javac of 1.4.1_something).

However, latest statements from Sun are somewhat vague on the point of
whether this happy state of events will continue past a revised version of
JSR014, due in the end of May. That is, it may well be that code using
Generics will not run on older JVMs.

So, the question is - have you tried to use Generics in production code?
Do you consider doing so before 1.5 is out? If you do so, how are you going
to cope with changes from Sun?

Your comments are very welcome.

Cheers,
Dmitry

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

64 comments

As you probably noticed, we - after much debate -
plan to support JSR014
"Generics" in Aurora. And you can expect at least the
parser in a build or
two :).

Coool!

However, latest statements from Sun are somewhat
vague on the point of
whether this happy state of events will continue past
a revised version of
JSR014, due in the end of May. That is, it may well
be that code using
Generics will not run on older JVMs.

I haven't followed the discussion. Though I'm very interested in this feature, I'm currently waiting till it's out of the specification phase.
It's the same as in the case of asserts. Those applications that use asserts don't run on older JVMs, too. That's no big concern for me since the OS' mainly used by our customers is Windows and Linux. So we don't fear that we lose an important plattform by such restrictiions.

So, the question is - have you tried to use Generics
in production code?

No. Waiting till it's part of a JDK.
But it's good to know IDEA will support it soon, so it'll be ready for JDK 1.5 when it comes out.

0

"Dmitry Lomov" <dsl@intellij.com> wrote:

As you probably noticed, we - after much debate - plan to support JSR014
"Generics" in Aurora. And you can expect at least the parser in a build or
two :).


Wow, that's pretty fast. I'm looking forward to it.

However, latest statements from Sun are somewhat vague on the point of
whether this happy state of events will continue past a revised version of
JSR014, due in the end of May. That is, it may well be that code using
Generics will not run on older JVMs.


Oops, I wasn't aware of that yet.

So, the question is - have you tried to use Generics in production code?
Do you consider doing so before 1.5 is out? If you do so, how are you going
to cope with changes from Sun?


Yes, we considered giving Generics a try in production code before 1.5 is out
and when they are supported in IDEA. But this was under the assumption that
the bytecode will be compatible with 1.4.1 JVMs. However, if code that uses
Generics will not be 1.4.1 compatible, we will wait until 1.5 is out.

Sascha


0

Sascha Weinreuter wrote:


Yes, we considered giving Generics a try in production code before 1.5 is
out and when they are supported in IDEA. But this was under the assumption
that the bytecode will be compatible with 1.4.1 JVMs. However, if code
that uses Generics will not be 1.4.1 compatible, we will wait until 1.5 is
out.


Well, I probably know as much as you do - that is, just some rumours in
forums at java.sun.com - do not rely on me as an authorative source :)
Current implementation generates bytecode that runs without problems on
1.4.1.

Anyway, it is really bad news for us if you EAP people will not try our
Generics support when while it is developed. It will be really hard to get
right without your feedback.... I am afraid we have got so accustomed to it
that it is difficult to imagine how we will manage without.... ;)

Cheers,
Dmitry

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Anyway, it is really bad news for us if you EAP people will not try our
Generics support when while it is developed. It will be really hard to
get right without your feedback.... I am afraid we have got so accustomed
to it that it is difficult to imagine how we will manage without.... ;)


We want to use it as soon as possible ...

The current beta implementation of Generics (version 1.3) can be used "on
top" of JDK 1.4.1 - that is, compile with generics supporting javac, and
run with JDK 1.4.1.


... if it runs "on top" of JDK 1.4.1.

So, the question is - have you tried to use Generics in production code?
Do you consider doing so before 1.5 is out? If you do so, how are you
going to cope with changes from Sun?


But you wanted to know about the past, not the future. No, we have not used
Generics in production code (how we should, if IDEA does not support it).

Tom

0

>

... if it runs "on top" of JDK 1.4.1.

>

Or in other words: if the Generics compiler produces "normal" Java 1.4.1
byte code (e.g. with class casts).

Tom

0

We could not use it because IDEA does not support it yet. I would not trade
IDEA even for generics.
If IDEA supports generics I will give it a try on some less important
projects/parts of projects
where I can mitigate the risk of incompatibility

"Dmitry Lomov" <dsl@intellij.com> wrote in message
news:b9nthf$67q$1@is.intellij.net...

Hi all!

>

As you probably noticed, we - after much debate - plan to support JSR014
"Generics" in Aurora. And you can expect at least the parser in a build or
two :).

>

However, our motto here is "to eat one's dog food" - that is, we would

like

to use Generics in IDEA (and, as a matter of fact, are looking forward to
do so :) ).

>

The current beta implementation of Generics (version 1.3) can be used "on
top" of JDK 1.4.1 - that is, compile with generics supporting javac, and
run with JDK 1.4.1. You can even enjoy generic collections - a special
generic stubs are provided, against which your code should be compiled.

And

we were actually able to compile IDEA with it and use it afterwards :)
(no, the next build is compiled with conventional javac of

1.4.1_something).
>

However, latest statements from Sun are somewhat vague on the point of
whether this happy state of events will continue past a revised version of
JSR014, due in the end of May. That is, it may well be that code using
Generics will not run on older JVMs.

>

So, the question is - have you tried to use Generics in production code?
Do you consider doing so before 1.5 is out? If you do so, how are you

going

to cope with changes from Sun?

>

Your comments are very welcome.

>

Cheers,
Dmitry

>

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"



0

If IDEA supports generics I will give it a try on
some less important
projects/parts of projects
where I can mitigate the risk of incompatibility

I think I will do it the same way.
So don't fear that no one will test the feature.
We sure will find those bugs if there are any ;)

0

Robert F. Beeger wrote:

>> If IDEA supports generics I will give it a try on
>> some less important
>> projects/parts of projects
>> where I can mitigate the risk of incompatibility

I think I will do it the same way.
So don't fear that no one will test the feature.
We sure will find those bugs if there are any ;)


EAP is not about bugs, really - EAP is about features :)

Generics affect many things - code insight, refactorings, intentions,
generation (Alt+Ins), to name a few - and we really need the community
opinion and ideas on how to integrate generics nicely into all that...

Friendly,
Dmitry
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Dmitry Lomov wrote:
Anyway, it is really bad news for us if you EAP people will not try our

Generics support when while it is developed. It will be really hard to get
right without your feedback.... I am afraid we have got so accustomed to it
that it is difficult to imagine how we will manage without...


Will go with it if you add it.

Jon

0

Sun clearly states (in the "Adding generics" forum):

"When 1.5 is released, code compiled with
generics enabled will require a 1.5 VM to run"

I am really eager to use generics, but with this premise I think it would be really inappropriate to use them in production code, being the 1.5 release so distant in the future.

Francesco

0

That why we cannot use them right now. But we're patiently waiting for
aspectj support. It will definitely simplify the design of our system.

/kesh

"Francesco Bellomi" <fbellomi@libero.it> wrote in message
news:31688235.1052765747192.JavaMail.javamailuser@localhost...

Sun clearly states (in the "Adding generics" forum):

>

"When 1.5 is released, code compiled with
generics enabled will require a 1.5 VM to run"

>

I am really eager to use generics, but with this premise I think it would

be really inappropriate to use them in production code, being the 1.5
release so distant in the future.
>

Francesco



0

Does it need to effect Aurora? IIRC there is already a JDK1.4.1-compatible
Generics available for some time (sorry, have not tried it). If the syntax
is the same as the planned 1.5 Generics, there should not be a problem
(from my point of view, that might be wrong).

BTW, using javac from JDK 1.4.1 (without special command line options) does
not work on a JDK 1.3.*, too.

Tom

0

No touchie touchie here until it's part of the JDK, even if that means
customers have to use that JDK, but until then, no touching.

R
"Dmitry Lomov" <dsl@intellij.com> wrote in message
news:b9nthf$67q$1@is.intellij.net...

Hi all!

>

As you probably noticed, we - after much debate - plan to support JSR014
"Generics" in Aurora. And you can expect at least the parser in a build or
two :).

>

However, our motto here is "to eat one's dog food" - that is, we would

like

to use Generics in IDEA (and, as a matter of fact, are looking forward to
do so :) ).

>

The current beta implementation of Generics (version 1.3) can be used "on
top" of JDK 1.4.1 - that is, compile with generics supporting javac, and
run with JDK 1.4.1. You can even enjoy generic collections - a special
generic stubs are provided, against which your code should be compiled.

And

we were actually able to compile IDEA with it and use it afterwards :)
(no, the next build is compiled with conventional javac of

1.4.1_something).
>

However, latest statements from Sun are somewhat vague on the point of
whether this happy state of events will continue past a revised version of
JSR014, due in the end of May. That is, it may well be that code using
Generics will not run on older JVMs.

>

So, the question is - have you tried to use Generics in production code?
Do you consider doing so before 1.5 is out? If you do so, how are you

going

to cope with changes from Sun?

>

Your comments are very welcome.

>

Cheers,
Dmitry

>

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"



0

Dmitry Lomov <dsl@intellij.com> wrote:

Well, I probably know as much as you do - that is, just some rumours in
forums at java.sun.com - do not rely on me as an authorative source :)
Current implementation generates bytecode that runs without problems on
1.4.1.


How does this affect users of other platforms like MacOS X?

Dirk Dittert

0

@jetbrains

the question shouldnt be "will you use it in production code", the question should be "will you go through all the testing with us".

Yes, definitely. I am quite interessted in using generics before 1.5, but without an IDE, i dont have much alternatives (no notepad!). There are so many projects, private ones and open source branches, where we have the freedom to use them.

So please, give it a try, for my part, i will use it right away after release.

0

Oh Sure, for testing things in IDEA I have no issue with that. The question came across to me as will you use it. Will I use it? No, not yet. Will I test it? heck yeah, I want to be working when I use it :)

R

0

Dmitry Lomov wrote:

Robert F. Beeger wrote:

>>>If IDEA supports generics I will give it a try on
>>>some less important
>>>projects/parts of projects
>>>where I can mitigate the risk of incompatibility
>>
>>I think I will do it the same way.
>>So don't fear that no one will test the feature.
>>We sure will find those bugs if there are any ;)


EAP is not about bugs, really - EAP is about features :)

Generics affect many things - code insight, refactorings, intentions,
generation (Alt+Ins), to name a few - and we really need the community
opinion and ideas on how to integrate generics nicely into all that...

Friendly,
Dmitry


We are doing research project and are eager to try generics, as they
will help us to significantly reduce codebase.
That's why I will definetly use generics support, when it will be
integrated in IDEA.

Friendly

Sergey Yevtushenko

0

we wouldn't use generics until they would run on all the platforms we support. meaning until 1.5 is ported. so we couldn't use it that early. :(

0

We would use it immediately in our development. Though, our system won't be in "production" for at least 2 years.

-mark chandler

0

On Mon, 12 May 2003 20:04:05 +0400, Dmitry Lomov wrote:

Anyway, it is really bad news for us if you EAP people will not try our
Generics support when while it is developed. It will be really hard to get
right without your feedback.... I am afraid we have got so accustomed to
it that it is difficult to imagine how we will manage without.... ;)


It'll definitely give it a bash ;) Whats involved? Just downloading a
different compiler/jdk stub?

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0

On Mon, 12 May 2003 22:39:13 +0400, Dmitry Lomov wrote:

Generics affect many things - code insight, refactorings, intentions,
generation (Alt+Ins), to name a few - and we really need the community
opinion and ideas on how to integrate generics nicely into all that...


I could see a need for some Generics based intentions as well, i.e. notice
that you're creating a List foo = new List(); list.add( new Integer());
and suggest changing it to List]]>. Would have to be quite smart
thou...


--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0

This is great news!
I will definitively use generics in multiple projects of mine (both at work and at home) as soon as you release it. Go for it.
As a side note this isn't a new paradigm like AOP is for most of us. I am sure that a lot of us have done C++ before (and know the power of templates and its cost... ;-).

Jacques

0

I thought about this too, and realized that IDEA already has enough 'smarts' to accomplish this. The 'iterate collection' template already figures out what sort of objects must be in any given collection for you.

(An intention to automatically update for-loops over collections and arrays to the new JSR201 syntax would also be very sweet.)

0

Dave Griffith wrote:

I thought about this too, and realized that IDEA already has enough
'smarts' to accomplish this. The 'iterate collection' template already
figures out what sort of objects must be in any given collection for you.


The correct wording is "most probably are". There is no compilcated analysis
involved - just a guess from usages. Mark's suggestion will require some
work to implement correctly.

(An intention to automatically update for-loops over collections and
arrays to the new JSR201 syntax would also be very sweet.)


As yet we decided only on JSR-014, and not on all 1.5 language features ;)

Friendly,
Dmitry

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

As yet we decided only on JSR-014, and not on all 1.5 language features
;)


Fine. Only Generics are really valuable for us, the rest can be achieved
with existing Java (and is therefore redundant).

Tom

0

I readily admit that I wouldn't stake my day job on use of pre-1.5 generics in production code.

-Steve

0

That said, I will be using it on other smaller projects and I'll have plenty of feedback to give. It's a really exciting feature - I really only care about the syntax being final, not about bytecode incompatability.

0

On Tue, 13 May 2003 19:37:17 +0400, Dmitry Lomov wrote:

The correct wording is "most probably are". There is no compilcated
analysis involved - just a guess from usages. Mark's suggestion will
require some work to implement correctly.


Maybe the intention could offer the choice - when the template examples
and you get the red boxes abound the fields, maybe introduce one next to
the Iterator for "no generic||]]>" for each
guessable class.

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0

You can even enjoy generic collections - a special generic stubs are
provided, against which your code should be compiled.


Are they backward-compatible, so we can switch to Generics step-by-step?

Tom

0

What exactly is so exicting about Generics ?

You can have type-safe collections (which is not bad) and you save a couple of type casts (syntactic sugar).
I wouldn't call that a killer feature ;)

It would be far more interesting to have primitive types in collections, for example an IntHashMap, or a LongTreeSet, etc.

However, you don't need to modify the language definition for that.

0

Please sign in to leave a comment.