Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93D4310848 for ; Tue, 28 Jan 2014 21:29:30 +0000 (UTC) Received: (qmail 38378 invoked by uid 500); 28 Jan 2014 21:29:29 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 38321 invoked by uid 500); 28 Jan 2014 21:29:29 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 38313 invoked by uid 99); 28 Jan 2014 21:29:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 21:29:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 21:29:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 92986238899C; Tue, 28 Jan 2014 21:29:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1562241 - /cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Date: Tue, 28 Jan 2014 21:29:05 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140128212905.92986238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Tue Jan 28 21:29:05 2014 New Revision: 1562241 URL: http://svn.apache.org/r1562241 Log: Merged revisions 1562238 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1562238 | dkulp | 2014-01-28 16:24:38 -0500 (Tue, 28 Jan 2014) | 3 lines [CXF-5524] More addType fixes Patch from Denis Simonov, although hard to apply and may have missed something ........ Modified: cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Modified: cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=1562241&r1=1562240&r2=1562241&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java (original) +++ cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java Tue Jan 28 21:29:05 2014 @@ -232,10 +232,13 @@ class JAXBContextInitializer extends Ser addClass((Class)cls); } } else if (cls instanceof ParameterizedType) { - addType(((ParameterizedType)cls).getRawType()); - if (!((ParameterizedType)cls).getRawType().equals(Enum.class)) { - for (Type t2 : ((ParameterizedType)cls).getActualTypeArguments()) { - addType(t2); + final ParameterizedType parameterizedType = (ParameterizedType)cls; + addType(parameterizedType.getRawType()); + if (!parameterizedType.getRawType().equals(Enum.class)) { + for (Type t2 : parameterizedType.getActualTypeArguments()) { + if (shouldTypeBeAdded(t2, parameterizedType)) { + addType(t2); + } } } } else if (cls instanceof GenericArrayType) { @@ -274,7 +277,20 @@ class JAXBContextInitializer extends Ser } } - + private boolean shouldTypeBeAdded(final Type t2, final ParameterizedType parameterizedType) { + if (!(t2 instanceof TypeVariable)) { + return true; + } + TypeVariable typeVariable = (TypeVariable) t2; + final Type[] bounds = typeVariable.getBounds(); + for (Type bound : bounds) { + if (bound instanceof ParameterizedType && bound.equals(parameterizedType)) { + return false; + } + } + return true; + } + void addClass(Class claz) { if (Throwable.class.isAssignableFrom(claz)) { if (!Throwable.class.equals(claz)