You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by Jason Porter <li...@gmail.com> on 2012/05/11 17:20:06 UTC

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

We should probably make a decision about a minimum version of the JDK we
support.

On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> wrote:

> Updated Branches:
>  refs/heads/master 0aef2609c -> 447b50f17
>
>
> DELTASPIKE-102 workaround for old jdk versions
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
> Tree:
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
> Diff:
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
>
> Branch: refs/heads/master
> Commit: 447b50f17c5b1aff29b746f9110194977707067c
> Parents: 0aef260
> Author: gpetracek <gp...@apache.org>
> Authored: Fri May 11 01:14:26 2012 +0200
> Committer: gpetracek <gp...@apache.org>
> Committed: Fri May 11 01:14:26 2012 +0200
>
> ----------------------------------------------------------------------
>  .../deltaspike/core/util/ReflectionUtils.java      |   22 ---------------
>  .../util/metadata/builder/AnnotationBuilder.java   |    4 +--
>  .../core/impl/message/ImmutableBeanWrapper.java    |    4 +--
>  3 files changed, 2 insertions(+), 28 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> ----------------------------------------------------------------------
> diff --git
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> index 31b87fb..755f81b 100644
> ---
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> +++
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
>     }
>
>     /**
> -     * <p>
> -     * Perform a runtime cast. Similar to {@link Class#cast(Object)}, but
> useful
> -     * when you do not have a {@link Class} object for type you wish to
> cast to.
> -     * </p>
> -     * <p/>
> -     * <p>
> -     * {@link Class#cast(Object)} should be used if possible
> -     * </p>
> -     *
> -     * @param <T> the type to cast to
> -     * @param obj the object to perform the cast on
> -     * @return the casted object
> -     * @throws ClassCastException if the type T is not a subtype of the
> object
> -     * @see Class#cast(Object)
> -     */
> -    @SuppressWarnings("unchecked")
> -    public static <T> T cast(Object obj)
> -    {
> -        return (T) obj;
> -    }
> -
> -    /**
>      * Get all the declared fields on the class hierarchy. This <b>will</b>
>      * return overridden fields.
>      *
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> ----------------------------------------------------------------------
> diff --git
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> index 19a50a3..b71d9e4 100644
> ---
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> +++
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> @@ -19,8 +19,6 @@
>
>  package org.apache.deltaspike.core.util.metadata.builder;
>
> -import org.apache.deltaspike.core.util.ReflectionUtils;
> -
>  import java.lang.annotation.Annotation;
>  import java.lang.reflect.AnnotatedElement;
>  import java.util.Collection;
> @@ -152,7 +150,7 @@ class AnnotationBuilder
>      */
>     public <T extends Annotation> T getAnnotation(Class<T> anType)
>     {
> -        return ReflectionUtils.<T>cast(annotationMap.get(anType));
> +        return (T)annotationMap.get(anType);
>     }
>
>     /**
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> ----------------------------------------------------------------------
> diff --git
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> index 12b9b46..a91bd06 100644
> ---
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> +++
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> @@ -25,8 +25,6 @@ import java.util.Set;
>  import javax.enterprise.context.spi.CreationalContext;
>  import javax.enterprise.inject.spi.Bean;
>
> -import org.apache.deltaspike.core.util.ReflectionUtils;
> -
>  /**
>  * <p>
>  * This bean-wrapper allows you to build a general purpose bean (likely a
> @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> extends
> AbstractImmutableBean<T>
>     @Override
>     public T create(CreationalContext<T> creationalContext)
>     {
> -        return ReflectionUtils.cast(wrapped.create(creationalContext));
> +        return wrapped.create(creationalContext);
>     }
>
>     @Override
>
>


-- 
Jason Porter
http://lightguard-jp.blogspot.com
http://twitter.com/lightguardjp

Software Engineer
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling

PGP key id: 926CCFF5
PGP key available at: keyserver.net, pgp.mit.edu

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Gerhard Petracek <ge...@gmail.com>.
i never said that we should keep the compatibility in any case.

regards,
gerhard



2012/5/13 Mark Struberg <st...@yahoo.de>

> IF there are 2 equal ways to do something, then we can of course take the
> one which also works with a broken JDK. But if it means that we loose
> performance or get some more complicated code then -1 for adding the
> workaround.
>
> There is really no excuse to not update a JDK - ESPECIALLY for big
> companies!
>
> I once bombed down a banks test system with a JDK bug at a manager meeting
> after the internal IT chief told me that upgrading the jdk is too risky.
> Afterwards he doesn't say anything anymore and they went on doing the
> necessary tasks to upgrade their system.
>
>
>
> LieGrue,
> strub
>
>
>
> ----- Original Message -----
> > From: Gerhard Petracek <ge...@gmail.com>
> > To: deltaspike-dev@incubator.apache.org
> > Cc:
> > Sent: Sunday, May 13, 2012 3:57 PM
> > Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk versions
> >
> > -1 (if we can fix it easily and there is no disadvantage for us)
> >
> > regards,
> > gerhard
> >
> >
> >
> > 2012/5/13 Mark Struberg <st...@yahoo.de>
> >
> >>  If it is really a known JDK bug AND there is a JDK  on the market then
> we
> >>  should NOT fix it imo.
> >>
> >>
> >>  There are some bugs in jdk-1.5.x which NEVER will get fixed (a few mem
> >>  leaks). But are not targeting those anyway. All other uses should just
> >>  update to a new jdk.
> >>
> >>  LieGrue,
> >>  strub
> >>
> >>
> >>  ----- Original Message -----
> >>  > From: Gerhard Petracek <ge...@gmail.com>
> >>  > To: deltaspike-dev@incubator.apache.org
> >>  > Cc:
> >>  > Sent: Sunday, May 13, 2012 1:29 PM
> >>  > Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk
> > versions
> >>  >
> >>  > hi jason,
> >>  >
> >>  > if we can fix it easily, we should do it (imo).
> >>  > in this case the helper which caused the issue isn't needed at all
> >>  (because
> >>  > it does the same in the end + it's just a bit more complicated to
> > use).
> >>  >
> >>  > regards,
> >>  > gerhard
> >>  >
> >>  >
> >>  >
> >>  > 2012/5/11 Jason Porter <li...@gmail.com>
> >>  >
> >>  >>  We should probably make a decision about a minimum version of the
> > JDK
> >>  we
> >>  >>  support.
> >>  >>
> >>  >>  On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org>
> > wrote:
> >>  >>
> >>  >>  > Updated Branches:
> >>  >>  >  refs/heads/master 0aef2609c -> 447b50f17
> >>  >>  >
> >>  >>  >
> >>  >>  > DELTASPIKE-102 workaround for old jdk versions
> >>  >>  >
> >>  >>  >
> >>  >>  > Project:
> >>  >>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
> >>  >>  > Commit:
> >>  >>  >
> >>  >>
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
> >>  >>  > Tree:
> >>  >>  >
> >>  >>
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
> >>  >>  > Diff:
> >>  >>  >
> >>  >>
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
> >>  >>  >
> >>  >>  > Branch: refs/heads/master
> >>  >>  > Commit: 447b50f17c5b1aff29b746f9110194977707067c
> >>  >>  > Parents: 0aef260
> >>  >>  > Author: gpetracek <gp...@apache.org>
> >>  >>  > Authored: Fri May 11 01:14:26 2012 +0200
> >>  >>  > Committer: gpetracek <gp...@apache.org>
> >>  >>  > Committed: Fri May 11 01:14:26 2012 +0200
> >>  >>  >
> >>  >>  >
> >>  ----------------------------------------------------------------------
> >>  >>  >  .../deltaspike/core/util/ReflectionUtils.java      |   22
> >>  >>  ---------------
> >>  >>  >  .../util/metadata/builder/AnnotationBuilder.java   |    4
> > +--
> >>  >>  >  .../core/impl/message/ImmutableBeanWrapper.java    |    4
> > +--
> >>  >>  >  3 files changed, 2 insertions(+), 28 deletions(-)
> >>  >>  >
> >>  ----------------------------------------------------------------------
> >>  >>  >
> >>  >>  >
> >>  >>  >
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >>  >
> >>  ----------------------------------------------------------------------
> >>  >>  > diff --git
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >>  > index 31b87fb..755f81b 100644
> >>  >>  > ---
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >>  > +++
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >>  > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
> >>  >>  >     }
> >>  >>  >
> >>  >>  >     /**
> >>  >>  > -     * <p>
> >>  >>  > -     * Perform a runtime cast. Similar to {@link
> >>  Class#cast(Object)},
> >>  >>  but
> >>  >>  > useful
> >>  >>  > -     * when you do not have a {@link Class} object for type
> > you wish
> >>  > to
> >>  >>  > cast to.
> >>  >>  > -     * </p>
> >>  >>  > -     * <p/>
> >>  >>  > -     * <p>
> >>  >>  > -     * {@link Class#cast(Object)} should be used if
> > possible
> >>  >>  > -     * </p>
> >>  >>  > -     *
> >>  >>  > -     * @param <T> the type to cast to
> >>  >>  > -     * @param obj the object to perform the cast on
> >>  >>  > -     * @return the casted object
> >>  >>  > -     * @throws ClassCastException if the type T is not a
> > subtype of
> >>  > the
> >>  >>  > object
> >>  >>  > -     * @see Class#cast(Object)
> >>  >>  > -     */
> >>  >>  > -    @SuppressWarnings("unchecked")
> >>  >>  > -    public static <T> T cast(Object obj)
> >>  >>  > -    {
> >>  >>  > -        return (T) obj;
> >>  >>  > -    }
> >>  >>  > -
> >>  >>  > -    /**
> >>  >>  >      * Get all the declared fields on the class hierarchy.
> > This
> >>  >>  <b>will</b>
> >>  >>  >      * return overridden fields.
> >>  >>  >      *
> >>  >>  >
> >>  >>  >
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >>  >
> >>  ----------------------------------------------------------------------
> >>  >>  > diff --git
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >>  > index 19a50a3..b71d9e4 100644
> >>  >>  > ---
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >>  > +++
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >>  > @@ -19,8 +19,6 @@
> >>  >>  >
> >>  >>  >  package org.apache.deltaspike.core.util.metadata.builder;
> >>  >>  >
> >>  >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
> >>  >>  > -
> >>  >>  >  import java.lang.annotation.Annotation;
> >>  >>  >  import java.lang.reflect.AnnotatedElement;
> >>  >>  >  import java.util.Collection;
> >>  >>  > @@ -152,7 +150,7 @@ class AnnotationBuilder
> >>  >>  >      */
> >>  >>  >     public <T extends Annotation> T
> > getAnnotation(Class<T>
> >>  > anType)
> >>  >>  >     {
> >>  >>  > -        return
> >>  > ReflectionUtils.<T>cast(annotationMap.get(anType));
> >>  >>  > +        return (T)annotationMap.get(anType);
> >>  >>  >     }
> >>  >>  >
> >>  >>  >     /**
> >>  >>  >
> >>  >>  >
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >>  >
> >>  ----------------------------------------------------------------------
> >>  >>  > diff --git
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >>  > index 12b9b46..a91bd06 100644
> >>  >>  > ---
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >>  > +++
> >>  >>  >
> >>  >>
> >>  >
> >>
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >>  > @@ -25,8 +25,6 @@ import java.util.Set;
> >>  >>  >  import javax.enterprise.context.spi.CreationalContext;
> >>  >>  >  import javax.enterprise.inject.spi.Bean;
> >>  >>  >
> >>  >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
> >>  >>  > -
> >>  >>  >  /**
> >>  >>  >  * <p>
> >>  >>  >  * This bean-wrapper allows you to build a general purpose
> > bean
> >>  > (likely a
> >>  >>  > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T>
> > extends
> >>  >>  > AbstractImmutableBean<T>
> >>  >>  >     @Override
> >>  >>  >     public T create(CreationalContext<T>
> > creationalContext)
> >>  >>  >     {
> >>  >>  > -        return
> >>  > ReflectionUtils.cast(wrapped.create(creationalContext));
> >>  >>  > +        return wrapped.create(creationalContext);
> >>  >>  >     }
> >>  >>  >
> >>  >>  >     @Override
> >>  >>  >
> >>  >>  >
> >>  >>
> >>  >>
> >>  >>  --
> >>  >>  Jason Porter
> >>  >>  http://lightguard-jp.blogspot.com
> >>  >>  http://twitter.com/lightguardjp
> >>  >>
> >>  >>  Software Engineer
> >>  >>  Open Source Advocate
> >>  >>  Author of Seam Catch - Next Generation Java Exception Handling
> >>  >>
> >>  >>  PGP key id: 926CCFF5
> >>  >>  PGP key available at: keyserver.net, pgp.mit.edu
> >>  >>
> >>  >
> >>
> >
>

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Jason Porter <li...@gmail.com>.
I'd say there's *slightly* more risk to upgrade to a major version like 6-7 or 7-8 but if it's a minor update to the same major release I don't see that being a problem at all (_25 to _30). 

Sent from my iPhone

On May 13, 2012, at 8:04, Mark Struberg <st...@yahoo.de> wrote:

> IF there are 2 equal ways to do something, then we can of course take the one which also works with a broken JDK. But if it means that we loose performance or get some more complicated code then -1 for adding the workaround.
> 
> There is really no excuse to not update a JDK - ESPECIALLY for big companies!
> 
> I once bombed down a banks test system with a JDK bug at a manager meeting after the internal IT chief told me that upgrading the jdk is too risky. Afterwards he doesn't say anything anymore and they went on doing the necessary tasks to upgrade their system.
> 
> 
> 
> LieGrue,
> strub
> 
> 
> 
> ----- Original Message -----
>> From: Gerhard Petracek <ge...@gmail.com>
>> To: deltaspike-dev@incubator.apache.org
>> Cc: 
>> Sent: Sunday, May 13, 2012 3:57 PM
>> Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk versions
>> 
>> -1 (if we can fix it easily and there is no disadvantage for us)
>> 
>> regards,
>> gerhard
>> 
>> 
>> 
>> 2012/5/13 Mark Struberg <st...@yahoo.de>
>> 
>>> If it is really a known JDK bug AND there is a JDK  on the market then we
>>> should NOT fix it imo.
>>> 
>>> 
>>> There are some bugs in jdk-1.5.x which NEVER will get fixed (a few mem
>>> leaks). But are not targeting those anyway. All other uses should just
>>> update to a new jdk.
>>> 
>>> LieGrue,
>>> strub
>>> 
>>> 
>>> ----- Original Message -----
>>>> From: Gerhard Petracek <ge...@gmail.com>
>>>> To: deltaspike-dev@incubator.apache.org
>>>> Cc:
>>>> Sent: Sunday, May 13, 2012 1:29 PM
>>>> Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk 
>> versions
>>>> 
>>>> hi jason,
>>>> 
>>>> if we can fix it easily, we should do it (imo).
>>>> in this case the helper which caused the issue isn't needed at all
>>> (because
>>>> it does the same in the end + it's just a bit more complicated to 
>> use).
>>>> 
>>>> regards,
>>>> gerhard
>>>> 
>>>> 
>>>> 
>>>> 2012/5/11 Jason Porter <li...@gmail.com>
>>>> 
>>>>>   We should probably make a decision about a minimum version of the 
>> JDK
>>> we
>>>>>   support.
>>>>> 
>>>>>   On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> 
>> wrote:
>>>>> 
>>>>>   > Updated Branches:
>>>>>   >  refs/heads/master 0aef2609c -> 447b50f17
>>>>>   >
>>>>>   >
>>>>>   > DELTASPIKE-102 workaround for old jdk versions
>>>>>   >
>>>>>   >
>>>>>   > Project:
>>>>>   http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
>>>>>   > Commit:
>>>>>   >
>>>>> 
>>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
>>>>>   > Tree:
>>>>>   >
>>>>> 
>>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
>>>>>   > Diff:
>>>>>   >
>>>>> 
>>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
>>>>>   >
>>>>>   > Branch: refs/heads/master
>>>>>   > Commit: 447b50f17c5b1aff29b746f9110194977707067c
>>>>>   > Parents: 0aef260
>>>>>   > Author: gpetracek <gp...@apache.org>
>>>>>   > Authored: Fri May 11 01:14:26 2012 +0200
>>>>>   > Committer: gpetracek <gp...@apache.org>
>>>>>   > Committed: Fri May 11 01:14:26 2012 +0200
>>>>>   >
>>>>>   >
>>> ----------------------------------------------------------------------
>>>>>   >  .../deltaspike/core/util/ReflectionUtils.java      |   22
>>>>>   ---------------
>>>>>   >  .../util/metadata/builder/AnnotationBuilder.java   |    4 
>> +--
>>>>>   >  .../core/impl/message/ImmutableBeanWrapper.java    |    4 
>> +--
>>>>>   >  3 files changed, 2 insertions(+), 28 deletions(-)
>>>>>   >
>>> ----------------------------------------------------------------------
>>>>>   >
>>>>>   >
>>>>>   >
>>>>>   >
>>>>> 
>>>> 
>>> 
>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>>>>   >
>>> ----------------------------------------------------------------------
>>>>>   > diff --git
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>>>>   > index 31b87fb..755f81b 100644
>>>>>   > ---
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>>>>   > +++
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>>>>   > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
>>>>>   >     }
>>>>>   >
>>>>>   >     /**
>>>>>   > -     * <p>
>>>>>   > -     * Perform a runtime cast. Similar to {@link
>>> Class#cast(Object)},
>>>>>   but
>>>>>   > useful
>>>>>   > -     * when you do not have a {@link Class} object for type 
>> you wish
>>>> to
>>>>>   > cast to.
>>>>>   > -     * </p>
>>>>>   > -     * <p/>
>>>>>   > -     * <p>
>>>>>   > -     * {@link Class#cast(Object)} should be used if 
>> possible
>>>>>   > -     * </p>
>>>>>   > -     *
>>>>>   > -     * @param <T> the type to cast to
>>>>>   > -     * @param obj the object to perform the cast on
>>>>>   > -     * @return the casted object
>>>>>   > -     * @throws ClassCastException if the type T is not a 
>> subtype of
>>>> the
>>>>>   > object
>>>>>   > -     * @see Class#cast(Object)
>>>>>   > -     */
>>>>>   > -    @SuppressWarnings("unchecked")
>>>>>   > -    public static <T> T cast(Object obj)
>>>>>   > -    {
>>>>>   > -        return (T) obj;
>>>>>   > -    }
>>>>>   > -
>>>>>   > -    /**
>>>>>   >      * Get all the declared fields on the class hierarchy. 
>> This
>>>>>   <b>will</b>
>>>>>   >      * return overridden fields.
>>>>>   >      *
>>>>>   >
>>>>>   >
>>>>>   >
>>>>> 
>>>> 
>>> 
>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>>>>   >
>>> ----------------------------------------------------------------------
>>>>>   > diff --git
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>>>>   > index 19a50a3..b71d9e4 100644
>>>>>   > ---
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>>>>   > +++
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>>>>   > @@ -19,8 +19,6 @@
>>>>>   >
>>>>>   >  package org.apache.deltaspike.core.util.metadata.builder;
>>>>>   >
>>>>>   > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>>>>   > -
>>>>>   >  import java.lang.annotation.Annotation;
>>>>>   >  import java.lang.reflect.AnnotatedElement;
>>>>>   >  import java.util.Collection;
>>>>>   > @@ -152,7 +150,7 @@ class AnnotationBuilder
>>>>>   >      */
>>>>>   >     public <T extends Annotation> T 
>> getAnnotation(Class<T>
>>>> anType)
>>>>>   >     {
>>>>>   > -        return
>>>> ReflectionUtils.<T>cast(annotationMap.get(anType));
>>>>>   > +        return (T)annotationMap.get(anType);
>>>>>   >     }
>>>>>   >
>>>>>   >     /**
>>>>>   >
>>>>>   >
>>>>>   >
>>>>> 
>>>> 
>>> 
>> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>>>>   >
>>> ----------------------------------------------------------------------
>>>>>   > diff --git
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>>>>   > index 12b9b46..a91bd06 100644
>>>>>   > ---
>>>>>   >
>>>>> 
>>>> 
>>> 
>> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>>>>   > +++
>>>>>   >
>>>>> 
>>>> 
>>> 
>> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>>>>   > @@ -25,8 +25,6 @@ import java.util.Set;
>>>>>   >  import javax.enterprise.context.spi.CreationalContext;
>>>>>   >  import javax.enterprise.inject.spi.Bean;
>>>>>   >
>>>>>   > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>>>>   > -
>>>>>   >  /**
>>>>>   >  * <p>
>>>>>   >  * This bean-wrapper allows you to build a general purpose 
>> bean
>>>> (likely a
>>>>>   > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> 
>> extends
>>>>>   > AbstractImmutableBean<T>
>>>>>   >     @Override
>>>>>   >     public T create(CreationalContext<T> 
>> creationalContext)
>>>>>   >     {
>>>>>   > -        return
>>>> ReflectionUtils.cast(wrapped.create(creationalContext));
>>>>>   > +        return wrapped.create(creationalContext);
>>>>>   >     }
>>>>>   >
>>>>>   >     @Override
>>>>>   >
>>>>>   >
>>>>> 
>>>>> 
>>>>>   --
>>>>>   Jason Porter
>>>>>   http://lightguard-jp.blogspot.com
>>>>>   http://twitter.com/lightguardjp
>>>>> 
>>>>>   Software Engineer
>>>>>   Open Source Advocate
>>>>>   Author of Seam Catch - Next Generation Java Exception Handling
>>>>> 
>>>>>   PGP key id: 926CCFF5
>>>>>   PGP key available at: keyserver.net, pgp.mit.edu
>>>>> 
>>>> 
>>> 
>> 

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Mark Struberg <st...@yahoo.de>.
IF there are 2 equal ways to do something, then we can of course take the one which also works with a broken JDK. But if it means that we loose performance or get some more complicated code then -1 for adding the workaround.

There is really no excuse to not update a JDK - ESPECIALLY for big companies!

I once bombed down a banks test system with a JDK bug at a manager meeting after the internal IT chief told me that upgrading the jdk is too risky. Afterwards he doesn't say anything anymore and they went on doing the necessary tasks to upgrade their system.



LieGrue,
strub



----- Original Message -----
> From: Gerhard Petracek <ge...@gmail.com>
> To: deltaspike-dev@incubator.apache.org
> Cc: 
> Sent: Sunday, May 13, 2012 3:57 PM
> Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk versions
> 
> -1 (if we can fix it easily and there is no disadvantage for us)
> 
> regards,
> gerhard
> 
> 
> 
> 2012/5/13 Mark Struberg <st...@yahoo.de>
> 
>>  If it is really a known JDK bug AND there is a JDK  on the market then we
>>  should NOT fix it imo.
>> 
>> 
>>  There are some bugs in jdk-1.5.x which NEVER will get fixed (a few mem
>>  leaks). But are not targeting those anyway. All other uses should just
>>  update to a new jdk.
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>>  ----- Original Message -----
>>  > From: Gerhard Petracek <ge...@gmail.com>
>>  > To: deltaspike-dev@incubator.apache.org
>>  > Cc:
>>  > Sent: Sunday, May 13, 2012 1:29 PM
>>  > Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk 
> versions
>>  >
>>  > hi jason,
>>  >
>>  > if we can fix it easily, we should do it (imo).
>>  > in this case the helper which caused the issue isn't needed at all
>>  (because
>>  > it does the same in the end + it's just a bit more complicated to 
> use).
>>  >
>>  > regards,
>>  > gerhard
>>  >
>>  >
>>  >
>>  > 2012/5/11 Jason Porter <li...@gmail.com>
>>  >
>>  >>  We should probably make a decision about a minimum version of the 
> JDK
>>  we
>>  >>  support.
>>  >>
>>  >>  On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> 
> wrote:
>>  >>
>>  >>  > Updated Branches:
>>  >>  >  refs/heads/master 0aef2609c -> 447b50f17
>>  >>  >
>>  >>  >
>>  >>  > DELTASPIKE-102 workaround for old jdk versions
>>  >>  >
>>  >>  >
>>  >>  > Project:
>>  >>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
>>  >>  > Commit:
>>  >>  >
>>  >>
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
>>  >>  > Tree:
>>  >>  >
>>  >>
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
>>  >>  > Diff:
>>  >>  >
>>  >>
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
>>  >>  >
>>  >>  > Branch: refs/heads/master
>>  >>  > Commit: 447b50f17c5b1aff29b746f9110194977707067c
>>  >>  > Parents: 0aef260
>>  >>  > Author: gpetracek <gp...@apache.org>
>>  >>  > Authored: Fri May 11 01:14:26 2012 +0200
>>  >>  > Committer: gpetracek <gp...@apache.org>
>>  >>  > Committed: Fri May 11 01:14:26 2012 +0200
>>  >>  >
>>  >>  >
>>  ----------------------------------------------------------------------
>>  >>  >  .../deltaspike/core/util/ReflectionUtils.java      |   22
>>  >>  ---------------
>>  >>  >  .../util/metadata/builder/AnnotationBuilder.java   |    4 
> +--
>>  >>  >  .../core/impl/message/ImmutableBeanWrapper.java    |    4 
> +--
>>  >>  >  3 files changed, 2 insertions(+), 28 deletions(-)
>>  >>  >
>>  ----------------------------------------------------------------------
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >>  >
>>  ----------------------------------------------------------------------
>>  >>  > diff --git
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >>  > index 31b87fb..755f81b 100644
>>  >>  > ---
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >>  > +++
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >>  > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
>>  >>  >     }
>>  >>  >
>>  >>  >     /**
>>  >>  > -     * <p>
>>  >>  > -     * Perform a runtime cast. Similar to {@link
>>  Class#cast(Object)},
>>  >>  but
>>  >>  > useful
>>  >>  > -     * when you do not have a {@link Class} object for type 
> you wish
>>  > to
>>  >>  > cast to.
>>  >>  > -     * </p>
>>  >>  > -     * <p/>
>>  >>  > -     * <p>
>>  >>  > -     * {@link Class#cast(Object)} should be used if 
> possible
>>  >>  > -     * </p>
>>  >>  > -     *
>>  >>  > -     * @param <T> the type to cast to
>>  >>  > -     * @param obj the object to perform the cast on
>>  >>  > -     * @return the casted object
>>  >>  > -     * @throws ClassCastException if the type T is not a 
> subtype of
>>  > the
>>  >>  > object
>>  >>  > -     * @see Class#cast(Object)
>>  >>  > -     */
>>  >>  > -    @SuppressWarnings("unchecked")
>>  >>  > -    public static <T> T cast(Object obj)
>>  >>  > -    {
>>  >>  > -        return (T) obj;
>>  >>  > -    }
>>  >>  > -
>>  >>  > -    /**
>>  >>  >      * Get all the declared fields on the class hierarchy. 
> This
>>  >>  <b>will</b>
>>  >>  >      * return overridden fields.
>>  >>  >      *
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >>  >
>>  ----------------------------------------------------------------------
>>  >>  > diff --git
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >>  > index 19a50a3..b71d9e4 100644
>>  >>  > ---
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >>  > +++
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >>  > @@ -19,8 +19,6 @@
>>  >>  >
>>  >>  >  package org.apache.deltaspike.core.util.metadata.builder;
>>  >>  >
>>  >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>  >>  > -
>>  >>  >  import java.lang.annotation.Annotation;
>>  >>  >  import java.lang.reflect.AnnotatedElement;
>>  >>  >  import java.util.Collection;
>>  >>  > @@ -152,7 +150,7 @@ class AnnotationBuilder
>>  >>  >      */
>>  >>  >     public <T extends Annotation> T 
> getAnnotation(Class<T>
>>  > anType)
>>  >>  >     {
>>  >>  > -        return
>>  > ReflectionUtils.<T>cast(annotationMap.get(anType));
>>  >>  > +        return (T)annotationMap.get(anType);
>>  >>  >     }
>>  >>  >
>>  >>  >     /**
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >>  >
>>  ----------------------------------------------------------------------
>>  >>  > diff --git
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >>  > index 12b9b46..a91bd06 100644
>>  >>  > ---
>>  >>  >
>>  >>
>>  >
>> 
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >>  > +++
>>  >>  >
>>  >>
>>  >
>> 
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >>  > @@ -25,8 +25,6 @@ import java.util.Set;
>>  >>  >  import javax.enterprise.context.spi.CreationalContext;
>>  >>  >  import javax.enterprise.inject.spi.Bean;
>>  >>  >
>>  >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>  >>  > -
>>  >>  >  /**
>>  >>  >  * <p>
>>  >>  >  * This bean-wrapper allows you to build a general purpose 
> bean
>>  > (likely a
>>  >>  > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> 
> extends
>>  >>  > AbstractImmutableBean<T>
>>  >>  >     @Override
>>  >>  >     public T create(CreationalContext<T> 
> creationalContext)
>>  >>  >     {
>>  >>  > -        return
>>  > ReflectionUtils.cast(wrapped.create(creationalContext));
>>  >>  > +        return wrapped.create(creationalContext);
>>  >>  >     }
>>  >>  >
>>  >>  >     @Override
>>  >>  >
>>  >>  >
>>  >>
>>  >>
>>  >>  --
>>  >>  Jason Porter
>>  >>  http://lightguard-jp.blogspot.com
>>  >>  http://twitter.com/lightguardjp
>>  >>
>>  >>  Software Engineer
>>  >>  Open Source Advocate
>>  >>  Author of Seam Catch - Next Generation Java Exception Handling
>>  >>
>>  >>  PGP key id: 926CCFF5
>>  >>  PGP key available at: keyserver.net, pgp.mit.edu
>>  >>
>>  >
>> 
> 

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Gerhard Petracek <ge...@gmail.com>.
-1 (if we can fix it easily and there is no disadvantage for us)

regards,
gerhard



2012/5/13 Mark Struberg <st...@yahoo.de>

> If it is really a known JDK bug AND there is a JDK  on the market then we
> should NOT fix it imo.
>
>
> There are some bugs in jdk-1.5.x which NEVER will get fixed (a few mem
> leaks). But are not targeting those anyway. All other uses should just
> update to a new jdk.
>
> LieGrue,
> strub
>
>
> ----- Original Message -----
> > From: Gerhard Petracek <ge...@gmail.com>
> > To: deltaspike-dev@incubator.apache.org
> > Cc:
> > Sent: Sunday, May 13, 2012 1:29 PM
> > Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk versions
> >
> > hi jason,
> >
> > if we can fix it easily, we should do it (imo).
> > in this case the helper which caused the issue isn't needed at all
> (because
> > it does the same in the end + it's just a bit more complicated to use).
> >
> > regards,
> > gerhard
> >
> >
> >
> > 2012/5/11 Jason Porter <li...@gmail.com>
> >
> >>  We should probably make a decision about a minimum version of the JDK
> we
> >>  support.
> >>
> >>  On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> wrote:
> >>
> >>  > Updated Branches:
> >>  >  refs/heads/master 0aef2609c -> 447b50f17
> >>  >
> >>  >
> >>  > DELTASPIKE-102 workaround for old jdk versions
> >>  >
> >>  >
> >>  > Project:
> >>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
> >>  > Commit:
> >>  >
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
> >>  > Tree:
> >>  >
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
> >>  > Diff:
> >>  >
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
> >>  >
> >>  > Branch: refs/heads/master
> >>  > Commit: 447b50f17c5b1aff29b746f9110194977707067c
> >>  > Parents: 0aef260
> >>  > Author: gpetracek <gp...@apache.org>
> >>  > Authored: Fri May 11 01:14:26 2012 +0200
> >>  > Committer: gpetracek <gp...@apache.org>
> >>  > Committed: Fri May 11 01:14:26 2012 +0200
> >>  >
> >>  >
> ----------------------------------------------------------------------
> >>  >  .../deltaspike/core/util/ReflectionUtils.java      |   22
> >>  ---------------
> >>  >  .../util/metadata/builder/AnnotationBuilder.java   |    4 +--
> >>  >  .../core/impl/message/ImmutableBeanWrapper.java    |    4 +--
> >>  >  3 files changed, 2 insertions(+), 28 deletions(-)
> >>  >
> ----------------------------------------------------------------------
> >>  >
> >>  >
> >>  >
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >
> ----------------------------------------------------------------------
> >>  > diff --git
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  > index 31b87fb..755f81b 100644
> >>  > ---
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  > +++
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >>  > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
> >>  >     }
> >>  >
> >>  >     /**
> >>  > -     * <p>
> >>  > -     * Perform a runtime cast. Similar to {@link
> Class#cast(Object)},
> >>  but
> >>  > useful
> >>  > -     * when you do not have a {@link Class} object for type you wish
> > to
> >>  > cast to.
> >>  > -     * </p>
> >>  > -     * <p/>
> >>  > -     * <p>
> >>  > -     * {@link Class#cast(Object)} should be used if possible
> >>  > -     * </p>
> >>  > -     *
> >>  > -     * @param <T> the type to cast to
> >>  > -     * @param obj the object to perform the cast on
> >>  > -     * @return the casted object
> >>  > -     * @throws ClassCastException if the type T is not a subtype of
> > the
> >>  > object
> >>  > -     * @see Class#cast(Object)
> >>  > -     */
> >>  > -    @SuppressWarnings("unchecked")
> >>  > -    public static <T> T cast(Object obj)
> >>  > -    {
> >>  > -        return (T) obj;
> >>  > -    }
> >>  > -
> >>  > -    /**
> >>  >      * Get all the declared fields on the class hierarchy. This
> >>  <b>will</b>
> >>  >      * return overridden fields.
> >>  >      *
> >>  >
> >>  >
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >
> ----------------------------------------------------------------------
> >>  > diff --git
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  > index 19a50a3..b71d9e4 100644
> >>  > ---
> >>  >
> >>
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  > +++
> >>  >
> >>
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >>  > @@ -19,8 +19,6 @@
> >>  >
> >>  >  package org.apache.deltaspike.core.util.metadata.builder;
> >>  >
> >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
> >>  > -
> >>  >  import java.lang.annotation.Annotation;
> >>  >  import java.lang.reflect.AnnotatedElement;
> >>  >  import java.util.Collection;
> >>  > @@ -152,7 +150,7 @@ class AnnotationBuilder
> >>  >      */
> >>  >     public <T extends Annotation> T getAnnotation(Class<T>
> > anType)
> >>  >     {
> >>  > -        return
> > ReflectionUtils.<T>cast(annotationMap.get(anType));
> >>  > +        return (T)annotationMap.get(anType);
> >>  >     }
> >>  >
> >>  >     /**
> >>  >
> >>  >
> >>  >
> >>
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >
> ----------------------------------------------------------------------
> >>  > diff --git
> >>  >
> >>
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  >
> >>
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  > index 12b9b46..a91bd06 100644
> >>  > ---
> >>  >
> >>
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  > +++
> >>  >
> >>
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >>  > @@ -25,8 +25,6 @@ import java.util.Set;
> >>  >  import javax.enterprise.context.spi.CreationalContext;
> >>  >  import javax.enterprise.inject.spi.Bean;
> >>  >
> >>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
> >>  > -
> >>  >  /**
> >>  >  * <p>
> >>  >  * This bean-wrapper allows you to build a general purpose bean
> > (likely a
> >>  > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> extends
> >>  > AbstractImmutableBean<T>
> >>  >     @Override
> >>  >     public T create(CreationalContext<T> creationalContext)
> >>  >     {
> >>  > -        return
> > ReflectionUtils.cast(wrapped.create(creationalContext));
> >>  > +        return wrapped.create(creationalContext);
> >>  >     }
> >>  >
> >>  >     @Override
> >>  >
> >>  >
> >>
> >>
> >>  --
> >>  Jason Porter
> >>  http://lightguard-jp.blogspot.com
> >>  http://twitter.com/lightguardjp
> >>
> >>  Software Engineer
> >>  Open Source Advocate
> >>  Author of Seam Catch - Next Generation Java Exception Handling
> >>
> >>  PGP key id: 926CCFF5
> >>  PGP key available at: keyserver.net, pgp.mit.edu
> >>
> >
>

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Mark Struberg <st...@yahoo.de>.
If it is really a known JDK bug AND there is a JDK  on the market then we should NOT fix it imo. 


There are some bugs in jdk-1.5.x which NEVER will get fixed (a few mem leaks). But are not targeting those anyway. All other uses should just update to a new jdk.

LieGrue,
strub


----- Original Message -----
> From: Gerhard Petracek <ge...@gmail.com>
> To: deltaspike-dev@incubator.apache.org
> Cc: 
> Sent: Sunday, May 13, 2012 1:29 PM
> Subject: Re: git commit: DELTASPIKE-102 workaround for old jdk versions
> 
> hi jason,
> 
> if we can fix it easily, we should do it (imo).
> in this case the helper which caused the issue isn't needed at all (because
> it does the same in the end + it's just a bit more complicated to use).
> 
> regards,
> gerhard
> 
> 
> 
> 2012/5/11 Jason Porter <li...@gmail.com>
> 
>>  We should probably make a decision about a minimum version of the JDK we
>>  support.
>> 
>>  On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> wrote:
>> 
>>  > Updated Branches:
>>  >  refs/heads/master 0aef2609c -> 447b50f17
>>  >
>>  >
>>  > DELTASPIKE-102 workaround for old jdk versions
>>  >
>>  >
>>  > Project:
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
>>  > Commit:
>>  >
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
>>  > Tree:
>>  >
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
>>  > Diff:
>>  >
>>  http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
>>  >
>>  > Branch: refs/heads/master
>>  > Commit: 447b50f17c5b1aff29b746f9110194977707067c
>>  > Parents: 0aef260
>>  > Author: gpetracek <gp...@apache.org>
>>  > Authored: Fri May 11 01:14:26 2012 +0200
>>  > Committer: gpetracek <gp...@apache.org>
>>  > Committed: Fri May 11 01:14:26 2012 +0200
>>  >
>>  > ----------------------------------------------------------------------
>>  >  .../deltaspike/core/util/ReflectionUtils.java      |   22
>>  ---------------
>>  >  .../util/metadata/builder/AnnotationBuilder.java   |    4 +--
>>  >  .../core/impl/message/ImmutableBeanWrapper.java    |    4 +--
>>  >  3 files changed, 2 insertions(+), 28 deletions(-)
>>  > ----------------------------------------------------------------------
>>  >
>>  >
>>  >
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  > ----------------------------------------------------------------------
>>  > diff --git
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  > index 31b87fb..755f81b 100644
>>  > ---
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  > +++
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
>>  > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
>>  >     }
>>  >
>>  >     /**
>>  > -     * <p>
>>  > -     * Perform a runtime cast. Similar to {@link Class#cast(Object)},
>>  but
>>  > useful
>>  > -     * when you do not have a {@link Class} object for type you wish 
> to
>>  > cast to.
>>  > -     * </p>
>>  > -     * <p/>
>>  > -     * <p>
>>  > -     * {@link Class#cast(Object)} should be used if possible
>>  > -     * </p>
>>  > -     *
>>  > -     * @param <T> the type to cast to
>>  > -     * @param obj the object to perform the cast on
>>  > -     * @return the casted object
>>  > -     * @throws ClassCastException if the type T is not a subtype of 
> the
>>  > object
>>  > -     * @see Class#cast(Object)
>>  > -     */
>>  > -    @SuppressWarnings("unchecked")
>>  > -    public static <T> T cast(Object obj)
>>  > -    {
>>  > -        return (T) obj;
>>  > -    }
>>  > -
>>  > -    /**
>>  >      * Get all the declared fields on the class hierarchy. This
>>  <b>will</b>
>>  >      * return overridden fields.
>>  >      *
>>  >
>>  >
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  > ----------------------------------------------------------------------
>>  > diff --git
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  > index 19a50a3..b71d9e4 100644
>>  > ---
>>  >
>> 
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  > +++
>>  >
>> 
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
>>  > @@ -19,8 +19,6 @@
>>  >
>>  >  package org.apache.deltaspike.core.util.metadata.builder;
>>  >
>>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>  > -
>>  >  import java.lang.annotation.Annotation;
>>  >  import java.lang.reflect.AnnotatedElement;
>>  >  import java.util.Collection;
>>  > @@ -152,7 +150,7 @@ class AnnotationBuilder
>>  >      */
>>  >     public <T extends Annotation> T getAnnotation(Class<T> 
> anType)
>>  >     {
>>  > -        return 
> ReflectionUtils.<T>cast(annotationMap.get(anType));
>>  > +        return (T)annotationMap.get(anType);
>>  >     }
>>  >
>>  >     /**
>>  >
>>  >
>>  >
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  > ----------------------------------------------------------------------
>>  > diff --git
>>  >
>> 
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  >
>> 
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  > index 12b9b46..a91bd06 100644
>>  > ---
>>  >
>> 
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  > +++
>>  >
>> 
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
>>  > @@ -25,8 +25,6 @@ import java.util.Set;
>>  >  import javax.enterprise.context.spi.CreationalContext;
>>  >  import javax.enterprise.inject.spi.Bean;
>>  >
>>  > -import org.apache.deltaspike.core.util.ReflectionUtils;
>>  > -
>>  >  /**
>>  >  * <p>
>>  >  * This bean-wrapper allows you to build a general purpose bean 
> (likely a
>>  > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> extends
>>  > AbstractImmutableBean<T>
>>  >     @Override
>>  >     public T create(CreationalContext<T> creationalContext)
>>  >     {
>>  > -        return 
> ReflectionUtils.cast(wrapped.create(creationalContext));
>>  > +        return wrapped.create(creationalContext);
>>  >     }
>>  >
>>  >     @Override
>>  >
>>  >
>> 
>> 
>>  --
>>  Jason Porter
>>  http://lightguard-jp.blogspot.com
>>  http://twitter.com/lightguardjp
>> 
>>  Software Engineer
>>  Open Source Advocate
>>  Author of Seam Catch - Next Generation Java Exception Handling
>> 
>>  PGP key id: 926CCFF5
>>  PGP key available at: keyserver.net, pgp.mit.edu
>> 
> 

Re: git commit: DELTASPIKE-102 workaround for old jdk versions

Posted by Gerhard Petracek <ge...@gmail.com>.
hi jason,

if we can fix it easily, we should do it (imo).
in this case the helper which caused the issue isn't needed at all (because
it does the same in the end + it's just a bit more complicated to use).

regards,
gerhard



2012/5/11 Jason Porter <li...@gmail.com>

> We should probably make a decision about a minimum version of the JDK we
> support.
>
> On Thu, May 10, 2012 at 5:16 PM, <gp...@apache.org> wrote:
>
> > Updated Branches:
> >  refs/heads/master 0aef2609c -> 447b50f17
> >
> >
> > DELTASPIKE-102 workaround for old jdk versions
> >
> >
> > Project:
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
> > Commit:
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/447b50f1
> > Tree:
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/447b50f1
> > Diff:
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/447b50f1
> >
> > Branch: refs/heads/master
> > Commit: 447b50f17c5b1aff29b746f9110194977707067c
> > Parents: 0aef260
> > Author: gpetracek <gp...@apache.org>
> > Authored: Fri May 11 01:14:26 2012 +0200
> > Committer: gpetracek <gp...@apache.org>
> > Committed: Fri May 11 01:14:26 2012 +0200
> >
> > ----------------------------------------------------------------------
> >  .../deltaspike/core/util/ReflectionUtils.java      |   22
> ---------------
> >  .../util/metadata/builder/AnnotationBuilder.java   |    4 +--
> >  .../core/impl/message/ImmutableBeanWrapper.java    |    4 +--
> >  3 files changed, 2 insertions(+), 28 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> > ----------------------------------------------------------------------
> > diff --git
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> > index 31b87fb..755f81b 100644
> > ---
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> > +++
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ReflectionUtils.java
> > @@ -49,28 +49,6 @@ public abstract class ReflectionUtils
> >     }
> >
> >     /**
> > -     * <p>
> > -     * Perform a runtime cast. Similar to {@link Class#cast(Object)},
> but
> > useful
> > -     * when you do not have a {@link Class} object for type you wish to
> > cast to.
> > -     * </p>
> > -     * <p/>
> > -     * <p>
> > -     * {@link Class#cast(Object)} should be used if possible
> > -     * </p>
> > -     *
> > -     * @param <T> the type to cast to
> > -     * @param obj the object to perform the cast on
> > -     * @return the casted object
> > -     * @throws ClassCastException if the type T is not a subtype of the
> > object
> > -     * @see Class#cast(Object)
> > -     */
> > -    @SuppressWarnings("unchecked")
> > -    public static <T> T cast(Object obj)
> > -    {
> > -        return (T) obj;
> > -    }
> > -
> > -    /**
> >      * Get all the declared fields on the class hierarchy. This
> <b>will</b>
> >      * return overridden fields.
> >      *
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> > ----------------------------------------------------------------------
> > diff --git
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> > index 19a50a3..b71d9e4 100644
> > ---
> >
> a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> > +++
> >
> b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/builder/AnnotationBuilder.java
> > @@ -19,8 +19,6 @@
> >
> >  package org.apache.deltaspike.core.util.metadata.builder;
> >
> > -import org.apache.deltaspike.core.util.ReflectionUtils;
> > -
> >  import java.lang.annotation.Annotation;
> >  import java.lang.reflect.AnnotatedElement;
> >  import java.util.Collection;
> > @@ -152,7 +150,7 @@ class AnnotationBuilder
> >      */
> >     public <T extends Annotation> T getAnnotation(Class<T> anType)
> >     {
> > -        return ReflectionUtils.<T>cast(annotationMap.get(anType));
> > +        return (T)annotationMap.get(anType);
> >     }
> >
> >     /**
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/447b50f1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> > ----------------------------------------------------------------------
> > diff --git
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> > index 12b9b46..a91bd06 100644
> > ---
> >
> a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> > +++
> >
> b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/ImmutableBeanWrapper.java
> > @@ -25,8 +25,6 @@ import java.util.Set;
> >  import javax.enterprise.context.spi.CreationalContext;
> >  import javax.enterprise.inject.spi.Bean;
> >
> > -import org.apache.deltaspike.core.util.ReflectionUtils;
> > -
> >  /**
> >  * <p>
> >  * This bean-wrapper allows you to build a general purpose bean (likely a
> > @@ -115,7 +113,7 @@ class ImmutableBeanWrapper<T> extends
> > AbstractImmutableBean<T>
> >     @Override
> >     public T create(CreationalContext<T> creationalContext)
> >     {
> > -        return ReflectionUtils.cast(wrapped.create(creationalContext));
> > +        return wrapped.create(creationalContext);
> >     }
> >
> >     @Override
> >
> >
>
>
> --
> Jason Porter
> http://lightguard-jp.blogspot.com
> http://twitter.com/lightguardjp
>
> Software Engineer
> Open Source Advocate
> Author of Seam Catch - Next Generation Java Exception Handling
>
> PGP key id: 926CCFF5
> PGP key available at: keyserver.net, pgp.mit.edu
>