summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/tools/gnu
diff options
context:
space:
mode:
authorgandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-23 15:19:26 +0000
committergandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-23 15:19:26 +0000
commit5c7411981584e487ac41794feb98a66df9fd6fcb (patch)
treefebe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/tools/gnu
parent112dfe9f689af01c2dd00e0f153fc25d69095b6c (diff)
downloadppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.tar.gz
ppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.zip
Merge GNU Classpath 0.99 into libjava.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185741 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/tools/gnu')
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/common/Messages.java4
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/getopt/Messages.java4
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/javah/JniHelper.java2
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java5
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/javah/Main.java87
5 files changed, 64 insertions, 38 deletions
diff --git a/libjava/classpath/tools/gnu/classpath/tools/common/Messages.java b/libjava/classpath/tools/gnu/classpath/tools/common/Messages.java
index 1c92d348d2b..4f6d687fd4b 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/common/Messages.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/common/Messages.java
@@ -1,5 +1,5 @@
/* Messages.java -- i18n support for tools common code
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.ResourceBundle;
class Messages
{
private static final String BUNDLE_NAME
- = "gnu.classpath.tools.common.Messages"; //$NON-NLS-1$
+ = "gnu.classpath.tools.common.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE
= ResourceBundle.getBundle(BUNDLE_NAME);
diff --git a/libjava/classpath/tools/gnu/classpath/tools/getopt/Messages.java b/libjava/classpath/tools/gnu/classpath/tools/getopt/Messages.java
index 19f10174332..9a9c4ec8aa2 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/getopt/Messages.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/getopt/Messages.java
@@ -1,5 +1,5 @@
/* Messages.java -- i18n support for getopt
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.ResourceBundle;
class Messages
{
private static final String BUNDLE_NAME
- = "gnu.classpath.tools.getopt.Messages"; //$NON-NLS-1$
+ = "gnu.classpath.tools.getopt.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE
= ResourceBundle.getBundle(BUNDLE_NAME);
diff --git a/libjava/classpath/tools/gnu/classpath/tools/javah/JniHelper.java b/libjava/classpath/tools/gnu/classpath/tools/javah/JniHelper.java
index 9225444be27..9a723cadf1c 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/javah/JniHelper.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/javah/JniHelper.java
@@ -104,6 +104,8 @@ public class JniHelper
result.append("_3");
else if (c == '/')
result.append("_");
+ else if (c == '$')
+ result.append("_");
else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z'))
result.append(c);
diff --git a/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java b/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java
index cb8bcd8d9c2..cf5fed39f13 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/javah/JniIncludePrinter.java
@@ -1,5 +1,5 @@
/* JniIncludePrinter.java - Generate a JNI header file
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2011 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,6 +63,7 @@ public class JniIncludePrinter
{
klass.linkSupers();
boolean wroteAny = false;
+ ClassWrapper headerClass = klass;
for (; klass != null; klass = klass.superClass)
{
Iterator<?> i = klass.fields.iterator();
@@ -77,7 +78,7 @@ public class JniIncludePrinter
continue;
// Note that we don't want to mangle the field name.
- String name = (JniHelper.mangle(klass.name) + "_" + field.name);
+ String name = (JniHelper.mangle(headerClass.name) + "_" + field.name);
out.print("#undef ");
out.println(name);
out.print("#define ");
diff --git a/libjava/classpath/tools/gnu/classpath/tools/javah/Main.java b/libjava/classpath/tools/gnu/classpath/tools/javah/Main.java
index bec04f00dab..894a5c4d2c0 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/javah/Main.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/javah/Main.java
@@ -58,9 +58,11 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import java.util.Map;
import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.tree.InnerClassNode;
public class Main
{
@@ -101,6 +103,9 @@ public class Main
// Map class names to lists of Text objects.
HashMap<String,ArrayList<Text>> textMap = new HashMap<String,ArrayList<Text>>();
+ // Set of classes which have been parsed
+ Set<String> parsed = new HashSet<String>();
+
void readCommandFile(String textFileName) throws OptionException
{
FileInputStream fis;
@@ -317,7 +322,7 @@ public class Main
return result;
}
- private void writeHeaders(HashMap<File,ClassWrapper> klasses, Printer printer)
+ private void writeHeaders(Map<File,ClassWrapper> klasses, Printer printer)
throws IOException
{
Iterator<Map.Entry<File,ClassWrapper>> i = klasses.entrySet().iterator();
@@ -332,6 +337,53 @@ public class Main
}
}
+ private Map<File,ClassWrapper> parseClasses(Iterator<Object> inputs)
+ throws IOException
+ {
+ Map<File,ClassWrapper> results = new HashMap<File,ClassWrapper>();
+ while (inputs.hasNext())
+ {
+ // Let user specify either kind of class name or a
+ // file name.
+ Object item = inputs.next();
+ ClassWrapper klass;
+ File filename;
+ if (item instanceof File)
+ {
+ // Load class from file.
+ if (verbose)
+ System.err.println("[reading file " + item + "]");
+ klass = getClass((File) item);
+ filename = new File(klass.name);
+ }
+ else
+ {
+ // Load class given the class name.
+ String className = ((String) item).replace('.', '/');
+ if (verbose)
+ System.err.println("[reading class " + className + "]");
+ // Use the name the user specified, even if it is
+ // different from the ultimate class name.
+ filename = new File(className);
+ klass = getClass(className);
+ }
+ 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())
+ {
+ String innerName = ((InnerClassNode) innerClasses.next()).name;
+ if (!parsed.contains(innerName))
+ innerNames.add(innerName);
+ }
+ results.putAll(parseClasses(innerNames.iterator()));
+ }
+ return results;
+ }
+
protected void postParse(String[] names)
{
// Nothing here.
@@ -385,36 +437,7 @@ public class Main
}
}
- Iterator<Object> i = klasses.iterator();
- HashMap<File,ClassWrapper> results = new HashMap<File,ClassWrapper>();
- while (i.hasNext())
- {
- // Let user specify either kind of class name or a
- // file name.
- Object item = i.next();
- ClassWrapper klass;
- File filename;
- if (item instanceof File)
- {
- // Load class from file.
- if (verbose)
- System.err.println("[reading file " + item + "]");
- klass = getClass((File) item);
- filename = new File(klass.name);
- }
- else
- {
- // Load class given the class name.
- String className = ((String) item).replace('.', '/');
- if (verbose)
- System.err.println("[reading class " + className + "]");
- // Use the name the user specified, even if it is
- // different from the ultimate class name.
- filename = new File(className);
- klass = getClass(className);
- }
- results.put(filename, klass);
- }
+ Map<File, ClassWrapper> results = parseClasses(klasses.iterator());
writeHeaders(results, printer);
}
@@ -457,7 +480,7 @@ public class Main
ClassWrapper result = readClass(is);
classMap.put(name, result);
}
- return (ClassWrapper) classMap.get(name);
+ return classMap.get(name);
}
public static void main(String[] args) throws IOException
OpenPOWER on IntegriCloud