Re: [ovirt-devel] Diamonds are a (Java) developer's best friends

2015-12-03 Thread Allon Mureinik
Merged.

Huge thanks to all the reviewers!

On Tue, Dec 1, 2015 at 3:04 PM, Allon Mureinik  wrote:

> Hi team,
>
> Back in the day, somewhere between the discovery of fire and the wheel,
> Java 5 introduced generics. This was a great step forwards, but also
> created some of the most horrible boiler-plated code you could imagine:
>
> Map> = new HashMap>();
>
> Java 7 improved the situation by adding generic type inference, a.k.a the
> diamond operator [1]:
>
> Map> = new HashMap<>();
>
> This style is defacto the standard of the engine, with new patches using
> it and patches to fix old code that doesn't use it being accepted pretty
> quickly.
>
> Since we defacto agreed on this standard, I'd like to put my money where
> my mouth is, and make it a declarative standard.
> I have a series of patches [2] that fix **all** the occurrences of
> non-diamond declarations [3][4][5] (well, except for anonymous
> implementations like we have in the DAOs) and adds a checkstyle validation
> [6] to prevent further declarations like this from entering the project in
> the future.
>
> Engine maintainers, please review and assist in getting this series merged.
> The rebase will be hellacious as it is, and I'd like to minimize the
> effort as much as possible.
>
>
> Thanks,
> Allon
>
>
> [1]
> http://docs.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html
> [2]
> https://gerrit.ovirt.org/#/q/status:open+project:ovirt-engine+branch:master+topic:diamond
> [3] https://gerrit.ovirt.org/49490
> [4] https://gerrit.ovirt.org/49491
> [5] https://gerrit.ovirt.org/49492
> [6] https://gerrit.ovirt.org/49493
>
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel

[ovirt-devel] Diamonds are a (Java) developer's best friends

2015-12-01 Thread Allon Mureinik
Hi team,

Back in the day, somewhere between the discovery of fire and the wheel,
Java 5 introduced generics. This was a great step forwards, but also
created some of the most horrible boiler-plated code you could imagine:

Map> = new HashMap>();

Java 7 improved the situation by adding generic type inference, a.k.a the
diamond operator [1]:

Map> = new HashMap<>();

This style is defacto the standard of the engine, with new patches using it
and patches to fix old code that doesn't use it being accepted pretty
quickly.

Since we defacto agreed on this standard, I'd like to put my money where my
mouth is, and make it a declarative standard.
I have a series of patches [2] that fix **all** the occurrences of
non-diamond declarations [3][4][5] (well, except for anonymous
implementations like we have in the DAOs) and adds a checkstyle validation
[6] to prevent further declarations like this from entering the project in
the future.

Engine maintainers, please review and assist in getting this series merged.
The rebase will be hellacious as it is, and I'd like to minimize the effort
as much as possible.


Thanks,
Allon


[1]
http://docs.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html
[2]
https://gerrit.ovirt.org/#/q/status:open+project:ovirt-engine+branch:master+topic:diamond
[3] https://gerrit.ovirt.org/49490
[4] https://gerrit.ovirt.org/49491
[5] https://gerrit.ovirt.org/49492
[6] https://gerrit.ovirt.org/49493
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel