From: Andrew Haley <aph@redhat.com>
To: classpath-patches <classpath-patches@gnu.org>,
"java@gcc.gnu.org" <java@gcc.gnu.org>
Subject: [4.8 Regression] gjavah throws an exception
Date: Mon, 17 Dec 2012 15:39:00 -0000 [thread overview]
Message-ID: <50CF3C9D.50203@redhat.com> (raw)
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<Object> innerNames = new HashSet<Object>();
@@ -381,6 +383,7 @@
}
results.putAll(parseClasses(innerNames.iterator()));
}
+ }
return results;
}
Andrew.
2012-12-17 Andrew Haley <aph@redhat.com>
* 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<Object> innerNames = new HashSet<Object>();
- 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<Object> innerNames = new HashSet<Object>();
+ 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;
}
next reply other threads:[~2012-12-17 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 15:39 Andrew Haley [this message]
2012-12-17 18:38 ` [cp-patches] " Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50CF3C9D.50203@redhat.com \
--to=aph@redhat.com \
--cc=classpath-patches@gnu.org \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).