Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 42C64200AF7 for ; Tue, 14 Jun 2016 19:02:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4158B160A47; Tue, 14 Jun 2016 17:02:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 88F68160A06 for ; Tue, 14 Jun 2016 19:02:28 +0200 (CEST) Received: (qmail 97135 invoked by uid 500); 14 Jun 2016 17:02:27 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 97126 invoked by uid 99); 14 Jun 2016 17:02:27 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jun 2016 17:02:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 2788C1A0270 for ; Tue, 14 Jun 2016 17:02:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.374 X-Spam-Level: X-Spam-Status: No, score=0.374 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id vq74TO35uf_K for ; Tue, 14 Jun 2016 17:02:25 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 285595FBBD for ; Tue, 14 Jun 2016 17:02:25 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 195EEE031A for ; Tue, 14 Jun 2016 17:02:23 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 29A233A0096 for ; Tue, 14 Jun 2016 17:02:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1748444 - in /commons/proper/bcel/trunk/src: changes/changes.xml main/java/org/apache/bcel/generic/Type.java test/java/org/apache/bcel/generic/TypeTestCase.java Date: Tue, 14 Jun 2016 17:02:22 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160614170223.29A233A0096@svn01-us-west.apache.org> archived-at: Tue, 14 Jun 2016 17:02:29 -0000 Author: sebb Date: Tue Jun 14 17:02:22 2016 New Revision: 1748444 URL: http://svn.apache.org/viewvc?rev=1748444&view=rev Log: BCEL-243 Type.getType() needs to understand TypeVariableSignature(s) Added: commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java (with props) Modified: commons/proper/bcel/trunk/src/changes/changes.xml commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Modified: commons/proper/bcel/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/changes/changes.xml?rev=1748444&r1=1748443&r2=1748444&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/changes/changes.xml (original) +++ commons/proper/bcel/trunk/src/changes/changes.xml Tue Jun 14 17:02:22 2016 @@ -90,6 +90,7 @@ N.B. The Clirr report shows that there a External code should not have been relying on such classes to provide definitions of the constants. "> + Type.getType() needs to understand TypeVariableSignature(s) Add constants for Java 9 class file version 53 FCONST pattern does not include FCONST_2 Add missing Node.accept() implementations (ConstantMethodHandle, ConstantMethodType, ParameterAnnotationEntry) Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java?rev=1748444&r1=1748443&r2=1748444&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Tue Jun 14 17:02:22 2016 @@ -214,13 +214,11 @@ public abstract class Type { wrap(consumed_chars, _temp); return new ArrayType(t, dim); } else { // type == T_REFERENCE - int index = signature.indexOf(';'); // Look for closing `;' - if (index < 0) { - throw new ClassFormatException("Invalid signature: " + signature); - } - //corrected concurrent private static field acess - wrap(consumed_chars, index + 1); // "Lblabla;" `L' and `;' are removed - return ObjectType.getInstance(signature.substring(1, index).replace('/', '.')); + // Utility.signatureToString understands how to parse + // generic types. + String parsedSignature = Utility.signatureToString(signature, false); + wrap(consumed_chars, parsedSignature.length() + 2); // "Lblabla;" `L' and `;' are removed + return ObjectType.getInstance(parsedSignature.replace('/', '.')); } } Added: commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java?rev=1748444&view=auto ============================================================================== --- commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java (added) +++ commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java Tue Jun 14 17:02:22 2016 @@ -0,0 +1,16 @@ +package org.apache.bcel.generic; + +import junit.framework.TestCase; + +public class TypeTestCase extends TestCase { + public void testBCEL243() { + // expectedValue = "Ljava/util/Map;>;"; + // The line commented out above is the correct expected value; however, + // the constructor for ObjectType is yet another place where BCEL does + // not understand generics so we need to substitute the modified value below. + String expectedValue = "Ljava/util/Map>;"; + String actualValue = (Type.getType("Ljava/util/Map;>;")).getSignature(); + assertEquals("Type.getType", expectedValue, actualValue); + } + +} Propchange: commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/TypeTestCase.java ------------------------------------------------------------------------------ svn:eol-style = native