From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2404 invoked by alias); 17 Dec 2012 15:39:28 -0000 Received: (qmail 2218 invoked by uid 22791); 17 Dec 2012 15:39:24 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Dec 2012 15:39:12 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBHFdBGY014247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2012 10:39:11 -0500 Received: from zebedee.pink (ovpn-113-63.phx2.redhat.com [10.3.113.63]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBHFdANs027798; Mon, 17 Dec 2012 10:39:10 -0500 Message-ID: <50CF3C9D.50203@redhat.com> Date: Mon, 17 Dec 2012 15:39:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: classpath-patches , "java@gcc.gnu.org" Subject: [4.8 Regression] gjavah throws an exception Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00011.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55716 This bug is caused by http://cvs.savannah.gnu.org/viewvc/classpath/tools/gnu/classpath/tools/javah/Main.java?root=classpath&r1=1.13&r2=1.14 Automagic handling of inner classes was added, but in a bogus way. If a class has inner classes, those inner classes are searched on the classpath. This is wrong if the argument to javah is a filename: the inner class may not exist on the classpath, and even if they do they will be the wrong versions. IMO, if given filenames gjavah should not search for inner classes at all. This patch does so. I have another patch that finds the correct inner class files for a a class, but this is better. As a whitespace diff it is simply Index: Main.java =================================================================== --- Main.java (revision 194553) +++ Main.java (working copy) @@ -370,6 +370,8 @@ results.put(filename, klass); parsed.add(item.toString()); + if (! (item instanceof File)) + { // Check to see if there are inner classes to also parse Iterator innerClasses = klass.innerClasses.iterator(); HashSet innerNames = new HashSet(); @@ -381,6 +383,7 @@ } results.putAll(parseClasses(innerNames.iterator())); } + } return results; } Andrew. 2012-12-17 Andrew Haley * tools/gnu/classpath/tools/javah/Main.java (parseClasses): Dont scan inner classes if our item is a file. Index: Main.java =================================================================== --- Main.java (revision 194553) +++ Main.java (working copy) @@ -370,16 +370,19 @@ results.put(filename, klass); parsed.add(item.toString()); - // Check to see if there are inner classes to also parse - Iterator innerClasses = klass.innerClasses.iterator(); - HashSet innerNames = new HashSet(); - while (innerClasses.hasNext()) + if (! (item instanceof File)) { - String innerName = ((InnerClassNode) innerClasses.next()).name; - if (!parsed.contains(innerName)) - innerNames.add(innerName); + // Check to see if there are inner classes to also parse + Iterator innerClasses = klass.innerClasses.iterator(); + HashSet innerNames = new HashSet(); + while (innerClasses.hasNext()) + { + String innerName = ((InnerClassNode) innerClasses.next()).name; + if (!parsed.contains(innerName)) + innerNames.add(innerName); + } + results.putAll(parseClasses(innerNames.iterator())); } - results.putAll(parseClasses(innerNames.iterator())); } return results; }