This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: getInputStream
- From: Per Bothner <per at bothner dot com>
- To: walter at pelissero dot org
- Cc: kawa at sources dot redhat dot com
- Date: Wed, 21 Nov 2001 16:56:55 -0800
- Subject: Re: getInputStream
- References: <15356.12104.561497.552753@hyde.lpds.sublink.org>
Walter C. Pelissero wrote:
>(define rt (invoke-static <java.lang.Runtime> 'get-runtime))
> (define p (invoke rt 'exec "sleep 1000"))
> (define is (invoke p 'get-input-stream))
>
>java.lang.RuntimeException: apply not implemented for PrimProcedure java.io.InputStream java.lang.UNIXProcess.getInputStream() - java.lang.IllegalAccessException: java/lang/UNIXProcess
>
I checked in the attached patch.
--Per
Index: gnu/bytecode/ChangeLog
===================================================================
RCS file: /cvs/kawa/kawa/gnu/bytecode/ChangeLog,v
retrieving revision 1.122
diff -u -r1.122 ChangeLog
--- ChangeLog 2001/11/18 00:41:50 1.122
+++ ChangeLog 2001/11/22 00:51:51
@@ -1,3 +1,16 @@
+2001-11-21 Per Bothner <per@bothner.com>
+
+ * ClassType.java (noClasses): New static field.
+ (getInterfaces): Use getReflectClass().
+ Use noClasses when there are no intefaces.
+ (getMethods): Search interface also of super-classes.
+ Fixes problem reported by Valtteri Vuorikoski.
+
+ * ClassType.java (getMethods): Context is now a package name, rather
+ than a ClassType. Fixes problem reported by Walter Pelissero, where
+ Sun has a private java.lang.UnixProcess which we considered to be in
+ the same package as java.lang.Object, which used to mean "any class",
+
2001-11-17 Per Bothner <per@bothner.com>
* ClassType.java (getPackageName): New method.
Index: gnu/kawa/reflect/ChangeLog
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/reflect/ChangeLog,v
retrieving revision 1.34
diff -u -r1.34 ChangeLog
--- ChangeLog 2001/11/19 04:07:48 1.34
+++ ChangeLog 2001/11/22 00:51:51
@@ -1,3 +1,9 @@
+2001-11-21 Per Bothner <per@bothner.com>
+
+ * ClassMethods.java (getMethods): Match change in ClassType's
+ getMethods class. Now use "-" to specify "no package" - i.e. skip all
+ private classes. Fixes problem reported by Walter Pelissero
+
2001-11-18 Per Bothner <per@bothner.com>
* ClassMethods.java (getMethods): Use ClassType's new getMethods
Index: gnu/bytecode/ClassType.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/bytecode/ClassType.java,v
retrieving revision 1.41
diff -u -r1.41 ClassType.java
--- ClassType.java 2001/11/18 00:41:50 1.41
+++ ClassType.java 2001/11/22 00:51:51
@@ -45,6 +45,8 @@
public final void setAttributes (Attribute attributes)
{ this.attributes = attributes; }
+ public static final ClassType[] noClasses = { };
+
String sourcefile;
boolean emitDebugInfo = true;
@@ -127,12 +129,14 @@
*/
public ClassType[] getInterfaces()
{
- if (interfaces == null && reflectClass != null)
+ if (interfaces == null && getReflectClass() != null)
{
Class[] reflectInterfaces = reflectClass.getInterfaces();
- interfaces = new ClassType[reflectInterfaces.length];
+ int numInterfaces = reflectInterfaces.length;
+ interfaces
+ = numInterfaces == 0 ? noClasses : new ClassType[numInterfaces];
- for (int i = 0; i < reflectInterfaces.length; i++)
+ for (int i = 0; i < numInterfaces; i++)
interfaces[i] = (ClassType) Type.make(reflectInterfaces[i]);
}
return interfaces;
@@ -429,17 +433,18 @@
}
if (searchSupers == 0)
break;
+
+ if (searchSupers > 1)
+ {
+ ClassType[] interfaces = ctype.getInterfaces();
+ if (interfaces != null)
+ {
+ for (int i = 0; i < interfaces.length; i++)
+ count += interfaces[i].getMethods(filter, searchSupers,
+ result, offset+count);
+ }
+ }
}
- if (searchSupers > 1)
- {
- ClassType[] interfaces = getInterfaces();
- if (interfaces != null)
- {
- for (int i = 0; i < interfaces.length; i++)
- count += interfaces[i].getMethods(filter, searchSupers,
- result, offset+count);
- }
- }
return count;
}
@@ -449,11 +454,11 @@
* 1 if superclasses should also be searched,
* 2 if super-interfaces should also be search
* @param result Vector to add selected methods in
- * @param context If non-null, skip if class not visible in context.
+ * @param context If non-null, skip if class not visible in named package.
* @return number of methods placed in result array
*/
public int getMethods (Filter filter, int searchSupers, Vector result,
- ClassType context)
+ String context)
{
int count = 0;
for (ClassType ctype = this; ctype != null;
@@ -461,7 +466,7 @@
{
if (context == null
|| (ctype.getModifiers() & Access.PUBLIC) != 0
- || context.getPackageName().equals(ctype.getPackageName()))
+ || context.equals(ctype.getPackageName()))
{
for (Method meth = ctype.getDeclaredMethods();
meth != null; meth = meth.getNext())
@@ -474,17 +479,18 @@
}
if (searchSupers == 0)
break;
+
+ if (searchSupers > 1)
+ {
+ ClassType[] interfaces = ctype.getInterfaces();
+ if (interfaces != null)
+ {
+ for (int i = 0; i < interfaces.length; i++)
+ count += interfaces[i].getMethods(filter, searchSupers,
+ result, context);
+ }
+ }
}
- if (searchSupers > 1)
- {
- ClassType[] interfaces = getInterfaces();
- if (interfaces != null)
- {
- for (int i = 0; i < interfaces.length; i++)
- count += interfaces[i].getMethods(filter, searchSupers,
- result, context);
- }
- }
return count;
}
Index: gnu/kawa/reflect/ClassMethods.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/reflect/ClassMethods.java,v
retrieving revision 1.12
diff -u -r1.12 ClassMethods.java
--- ClassMethods.java 2001/11/19 04:07:48 1.12
+++ ClassMethods.java 2001/11/22 00:51:51
@@ -56,7 +56,7 @@
Vector methods = new Vector();
dtype.getMethods(filter, "<init>".equals(mname) ? 0 : 2,
methods,
- Type.pointer_type); // FIXME
+ "-"); // Should be more specific - FIXME
// Remove over-ridden methods.
int mlength = methods.size();