I have not been able to extend the Java class PrintStream with NetRexx.
Am I doing something wrong? NetRexx code: -- All writes to this print stream are copied to two print streams class TeeStream extends PrintStream out=PrintStream method TeeStream(out1=PrintStream,out2=PrintStream) super(out1) out=out2 method write(buf=byte[],off=int,len=int) super.write(buf,off,len) out.write(buf,off,len) method flush super.flush out.flush NetRexx compile output: NetRexx portable processor, version 2.05 Copyright (c) IBM Corporation, 2005. All rights reserved. Program TeeStream.nrx === class TeeStream === constructor TeeStream(PrintStream,PrintStream) method write(byte[],int,int) overrides PrintStream.write(byte[],int,int) method flush overrides PrintStream.flush [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(CharSequence) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(CharSequence,int,int) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(char) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] |
I would like to report this NetRexx bug but I don't quite know who to
report it to. Mike? Ren?? (NetRexx ownership seems in limbo at the moment.) Anyway here is the workaround I am using which unfortunately wrecks havoc with my Ant builds but at least gets me there: Change class to an "adapter" class like this to get NetRexxC to produce Java code that it likes but that will not compile under javac: -- All writes to this print stream are copied to two print streams class TeeStream adapter extends PrintStream out=PrintStream method TeeStream(out1=PrintStream,out2=PrintStream) super(out1) out=out2 method write(buf=byte[],off=int,len=int) super.write(buf,off,len) out.write(buf,off,len) method flush super.flush out.flush -- The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. -------------------------------------------------------------------------------------------------------------------------------- Then remove the three "append" methods generated by NetRexx which Javac refuses to accept and compile the Java code : /* Generated from 'TeeStream.nrx' 16 Oct 2009 14:26:40 [v2.05] */ /* Options: Comments Compact Decimal Format Java Logo Replace Trace2 Verbose3 */ // All writes to this print stream are copied to two print streams public class TeeStream extends java.io.PrintStream{ private static final java.lang.String $0="TeeStream.nrx"; protected java.io.PrintStream out; public TeeStream(java.io.PrintStream out1,java.io.PrintStream out2){ super((java.io.OutputStream)out1); out=out2; return;} public void write(byte buf[],int off,int len){ super.write(buf,off,len); out.write(buf,off,len); return;} public void flush(){ super.flush(); out.flush(); return;} public java.lang.Appendable append(java.lang.CharSequence $1) throws java.io.IOException{return null;} public java.lang.Appendable append(java.lang.CharSequence $2,int $3,int $4) throws java.io.IOException{return null;} public java.lang.Appendable append(char $5) throws java.io.IOException{return null;} } // The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. ---------------------------------------------------------------------------------------------------------------------------------- My guess is that NetRexx is not recognizing the append methods in Printstream as valid because they return Printstream objects rather than direct Appendable objects. This would not have been a problem with earlier Java versions because the Appendable stuff did not exist then. Does anyone know what to do with this bug report? TIA, -- Kermit On 10/13/2009 11:57 AM, Kermit Kiser wrote: > I have not been able to extend the Java class PrintStream with > NetRexx. Am I doing something wrong? > > NetRexx code: > > -- All writes to this print stream are copied to two print streams > > class TeeStream extends PrintStream > out=PrintStream > method TeeStream(out1=PrintStream,out2=PrintStream) > super(out1) > out=out2 > method write(buf=byte[],off=int,len=int) > super.write(buf,off,len) > out.write(buf,off,len) > method flush > super.flush > out.flush > > NetRexx compile output: > > NetRexx portable processor, version 2.05 > Copyright (c) IBM Corporation, 2005. All rights reserved. > Program TeeStream.nrx > === class TeeStream === > constructor TeeStream(PrintStream,PrintStream) > method write(byte[],int,int) > overrides PrintStream.write(byte[],int,int) > method flush > overrides PrintStream.flush > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(CharSequence) returns java.lang.Appendable' from abstract > class 'java.lang.Appendable' > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(CharSequence,int,int) returns java.lang.Appendable' from > abstract class 'java.lang.Appendable' > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(char) returns java.lang.Appendable' from abstract class > 'java.lang.Appendable' > Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > |
Kermit, I've got to ask...why are you trying to do it this way ?
Or, rather curious about how you are using this Tee. Got annoyed the other day and made my own Netrexx version of Tail for win. ;-) Hint: This ain't java - you're making it way too hard. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser Sent: Friday, October 16, 2009 5:28 PM To: IBM Netrexx Subject: [Ibm-netrexx] Bug in NetRexx compiler (was: Problem extendingPrintStream) I would like to report this NetRexx bug but I don't quite know who to report it to. Mike? Ren?? (NetRexx ownership seems in limbo at the moment.) Anyway here is the workaround I am using which unfortunately wrecks havoc with my Ant builds but at least gets me there: Change class to an "adapter" class like this to get NetRexxC to produce Java code that it likes but that will not compile under javac: -- All writes to this print stream are copied to two print streams class TeeStream adapter extends PrintStream out=PrintStream method TeeStream(out1=PrintStream,out2=PrintStream) super(out1) out=out2 method write(buf=byte[],off=int,len=int) super.write(buf,off,len) out.write(buf,off,len) method flush super.flush out.flush -- The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. -------------------------------------------------------------------------------------------------------------------------------- Then remove the three "append" methods generated by NetRexx which Javac refuses to accept and compile the Java code : /* Generated from 'TeeStream.nrx' 16 Oct 2009 14:26:40 [v2.05] */ /* Options: Comments Compact Decimal Format Java Logo Replace Trace2 Verbose3 */ // All writes to this print stream are copied to two print streams public class TeeStream extends java.io.PrintStream{ private static final java.lang.String $0="TeeStream.nrx"; protected java.io.PrintStream out; public TeeStream(java.io.PrintStream out1,java.io.PrintStream out2){ super((java.io.OutputStream)out1); out=out2; return;} public void write(byte buf[],int off,int len){ super.write(buf,off,len); out.write(buf,off,len); return;} public void flush(){ super.flush(); out.flush(); return;} public java.lang.Appendable append(java.lang.CharSequence $1) throws java.io.IOException{return null;} public java.lang.Appendable append(java.lang.CharSequence $2,int $3,int $4) throws java.io.IOException{return null;} public java.lang.Appendable append(char $5) throws java.io.IOException{return null;} } // The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. ---------------------------------------------------------------------------------------------------------------------------------- My guess is that NetRexx is not recognizing the append methods in Printstream as valid because they return Printstream objects rather than direct Appendable objects. This would not have been a problem with earlier Java versions because the Appendable stuff did not exist then. Does anyone know what to do with this bug report? TIA, -- Kermit On 10/13/2009 11:57 AM, Kermit Kiser wrote: > I have not been able to extend the Java class PrintStream with > NetRexx. Am I doing something wrong? > > NetRexx code: > > -- All writes to this print stream are copied to two print streams > > class TeeStream extends PrintStream > out=PrintStream > method TeeStream(out1=PrintStream,out2=PrintStream) > super(out1) > out=out2 > method write(buf=byte[],off=int,len=int) > super.write(buf,off,len) > out.write(buf,off,len) > method flush > super.flush > out.flush > > NetRexx compile output: > > NetRexx portable processor, version 2.05 > Copyright (c) IBM Corporation, 2005. All rights reserved. > Program TeeStream.nrx > === class TeeStream === > constructor TeeStream(PrintStream,PrintStream) > method write(byte[],int,int) > overrides PrintStream.write(byte[],int,int) > method flush > overrides PrintStream.flush > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(CharSequence) returns java.lang.Appendable' from abstract > class 'java.lang.Appendable' > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(CharSequence,int,int) returns java.lang.Appendable' from > abstract class 'java.lang.Appendable' > [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx > 4 8 9] Error: Class is not abstract, yet it does not implement method > 'append(char) returns java.lang.Appendable' from abstract class > 'java.lang.Appendable' > Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > Ibm-netrexx mailing list [hidden email] |
Hi Mike;
I am in the process of adding a dockable console window to the jEdit plugin for NetRexx scripts that I am developing. (see http://kermitkiser.com/NetRexx ) In order to route the output from the NetRexxA parser and the interpreted NetRexx scripts "say" and trace output to the right windows, I need to intercept System.out and System.err so that the plugin window also receives whatever they send to the jEdit activity log. In short, I need to intercept the output from a lot of code that I did not write. This part actually works well so far but I have not posted the latest code yet because I am still working on allowing the user to respond to "ask" statements from the console window. When that part is done the plugin will be mostly feature complete and ready for beta testing. It should be very useful for NetRexx testing and development as well as for extending jEdit (ain't no IDE of course!). There are a few tricks I have learned such as the fact that you must replace System.out before any "say" instructions are executed because the RexxIO class copies the stream object when it is first loaded. Does that make it any clearer? Do you know any better way to do it? -- Kermit On 10/16/2009 4:13 PM, Measel, Mike wrote: > Kermit, I've got to ask...why are you trying to do it this way ? > > Or, rather curious about how you are using this Tee. Got annoyed the other day and made my own Netrexx version of Tail for win. ;-) > > Hint: This ain't java - you're making it way too hard. > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser > Sent: Friday, October 16, 2009 5:28 PM > To: IBM Netrexx > Subject: [Ibm-netrexx] Bug in NetRexx compiler (was: Problem extendingPrintStream) > > I would like to report this NetRexx bug but I don't quite know who to > report it to. Mike? Ren?? (NetRexx ownership seems in limbo at the > moment.) Anyway here is the workaround I am using which unfortunately > wrecks havoc with my Ant builds but at least gets me there: Change > class to an "adapter" class like this to get NetRexxC to produce Java > code that it likes but that will not compile under javac: > > -- All writes to this print stream are copied to two print streams > > class TeeStream adapter extends PrintStream > > out=PrintStream > > method TeeStream(out1=PrintStream,out2=PrintStream) > super(out1) > out=out2 > > method write(buf=byte[],off=int,len=int) > super.write(buf,off,len) > out.write(buf,off,len) > > method flush > super.flush > out.flush > > -- The three generated methods (append) have to be removed by hand due > to a bug in NetRexx when extending PrintStream. > -------------------------------------------------------------------------------------------------------------------------------- > Then remove the three "append" methods generated by NetRexx which Javac > refuses to accept and compile the Java code : > > /* Generated from 'TeeStream.nrx' 16 Oct 2009 14:26:40 [v2.05] */ > /* Options: Comments Compact Decimal Format Java Logo Replace Trace2 > Verbose3 */ > > > // All writes to this print stream are copied to two print streams > > > public class TeeStream extends java.io.PrintStream{ > private static final java.lang.String $0="TeeStream.nrx"; > > protected java.io.PrintStream out; > > > > public TeeStream(java.io.PrintStream out1,java.io.PrintStream out2){ > super((java.io.OutputStream)out1); > out=out2; > return;} > > > public void write(byte buf[],int off,int len){ > super.write(buf,off,len); > out.write(buf,off,len); > return;} > > > public void flush(){ > super.flush(); > out.flush(); > return;} > > public java.lang.Appendable append(java.lang.CharSequence $1) throws > java.io.IOException{return null;} > > public java.lang.Appendable append(java.lang.CharSequence $2,int $3,int > $4) throws java.io.IOException{return null;} > > public java.lang.Appendable append(char $5) throws > java.io.IOException{return null;} > } > // The three generated methods (append) have to be removed by hand due > to a bug in NetRexx when extending PrintStream. > ---------------------------------------------------------------------------------------------------------------------------------- > > My guess is that NetRexx is not recognizing the append methods in > Printstream as valid because they return Printstream objects rather than > direct Appendable objects. This would not have been a problem with > earlier Java versions because the Appendable stuff did not exist then. > Does anyone know what to do with this bug report? > > TIA, > -- Kermit > > > On 10/13/2009 11:57 AM, Kermit Kiser wrote: > >> I have not been able to extend the Java class PrintStream with >> NetRexx. Am I doing something wrong? >> >> NetRexx code: >> >> -- All writes to this print stream are copied to two print streams >> >> class TeeStream extends PrintStream >> out=PrintStream >> method TeeStream(out1=PrintStream,out2=PrintStream) >> super(out1) >> out=out2 >> method write(buf=byte[],off=int,len=int) >> super.write(buf,off,len) >> out.write(buf,off,len) >> method flush >> super.flush >> out.flush >> >> NetRexx compile output: >> >> NetRexx portable processor, version 2.05 >> Copyright (c) IBM Corporation, 2005. All rights reserved. >> Program TeeStream.nrx >> === class TeeStream === >> constructor TeeStream(PrintStream,PrintStream) >> method write(byte[],int,int) >> overrides PrintStream.write(byte[],int,int) >> method flush >> overrides PrintStream.flush >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx >> 4 8 9] Error: Class is not abstract, yet it does not implement method >> 'append(CharSequence) returns java.lang.Appendable' from abstract >> class 'java.lang.Appendable' >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx >> 4 8 9] Error: Class is not abstract, yet it does not implement method >> 'append(CharSequence,int,int) returns java.lang.Appendable' from >> abstract class 'java.lang.Appendable' >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx >> 4 8 9] Error: Class is not abstract, yet it does not implement method >> 'append(char) returns java.lang.Appendable' from abstract class >> 'java.lang.Appendable' >> Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> >> >> >> > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > > An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20091016/41528d44/attachment-0001.html |
In reply to this post by Kermit Kiser
> I would like to report this NetRexx bug but I don't quite know who to
> report it to. I have already transferred the code to Ren?, but he wouldn't be able to release a bug fix until RexxLA has ownership of the code, so yes a bit of a limbo just at the moment. (We're waiting on RexxLA, by the way -- I think it's essentially all done on the IBM side.) It would take me ages to work out what your problem is, in any case -- I haven't written anything for the Java platform for around a decade, so I've very rusty ... Mike Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU |
In reply to this post by Kermit Kiser
PS as a workaround, how about adding the Append methods manually (not
using the ADAPTER option) so they have the right signature? They can then call the superclass's methods to effect the operations. Mike - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mike Cowlishaw, IBM Fellow http://bit.ly/mfc IBM UK (MP8), PO Box 31, Birmingham Road, Warwick, CV34 5JL Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU |
In reply to this post by Kermit Kiser
Hi Kermit,
just to let you know that I am looking into it. best regards, Ren? Jansen. On 17 okt 2009, at 00:27, Kermit Kiser wrote: > I would like to report this NetRexx bug but I don't quite know who > to report it to. Mike? Ren?? (NetRexx ownership seems in limbo at > the moment.) Anyway here is the workaround I am using which > unfortunately wrecks havoc with my Ant builds but at least gets me > there: Change class to an "adapter" class like this to get NetRexxC > to produce Java code that it likes but that will not compile under > javac: > > -- All writes to this print stream are copied to two print > streams > > class TeeStream adapter extends PrintStream > out=PrintStream > method TeeStream(out1=PrintStream,out2=PrintStream) > super(out1) > out=out2 > method write(buf=byte[],off=int,len=int) > super.write(buf,off,len) > out.write(buf,off,len) > method flush > super.flush > out.flush > -- The three generated methods (append) have to be removed > by hand due to a bug in NetRexx when extending PrintStream. > -------------------------------------------------------------------------------------------------------------------------------- > Then remove the three "append" methods generated by NetRexx which > Javac refuses to accept and compile the Java code : > > /* Generated from 'TeeStream.nrx' 16 Oct 2009 14:26:40 [v2.05] */ > /* Options: Comments Compact Decimal Format Java Logo Replace Trace2 > Verbose3 */ > > > // All writes to this print stream are copied to two print > streams > > > public class TeeStream extends java.io.PrintStream{ > private static final java.lang.String $0="TeeStream.nrx"; > protected java.io.PrintStream out; > > public TeeStream(java.io.PrintStream out1,java.io.PrintStream out2){ > super((java.io.OutputStream)out1); > out=out2; > return;} > > public void write(byte buf[],int off,int len){ > super.write(buf,off,len); > out.write(buf,off,len); > return;} > > public void flush(){ > super.flush(); > out.flush(); > return;} > public java.lang.Appendable append(java.lang.CharSequence $1) throws > java.io.IOException{return null;} > public java.lang.Appendable append(java.lang.CharSequence $2,int > $3,int $4) throws java.io.IOException{return null;} > public java.lang.Appendable append(char $5) throws > java.io.IOException{return null;} > } > // The three generated methods (append) have to be removed by hand > due to a bug in NetRexx when extending PrintStream. > ---------------------------------------------------------------------------------------------------------------------------------- > > My guess is that NetRexx is not recognizing the append methods in > Printstream as valid because they return Printstream objects rather > than direct Appendable objects. This would not have been a problem > with earlier Java versions because the Appendable stuff did not > exist then. Does anyone know what to do with this bug report? > > TIA, > -- Kermit > > > On 10/13/2009 11:57 AM, Kermit Kiser wrote: >> I have not been able to extend the Java class PrintStream with >> NetRexx. Am I doing something wrong? >> >> NetRexx code: >> >> -- All writes to this print stream are copied to two print >> streams >> >> class TeeStream extends PrintStream >> out=PrintStream >> method TeeStream(out1=PrintStream,out2=PrintStream) >> super(out1) >> out=out2 >> method write(buf=byte[],off=int,len=int) >> super.write(buf,off,len) >> out.write(buf,off,len) >> method flush >> super.flush >> out.flush >> >> NetRexx compile output: >> >> NetRexx portable processor, version 2.05 >> Copyright (c) IBM Corporation, 2005. All rights reserved. >> Program TeeStream.nrx >> === class TeeStream === >> constructor TeeStream(PrintStream,PrintStream) >> method write(byte[],int,int) >> overrides PrintStream.write(byte[],int,int) >> method flush >> overrides PrintStream.flush >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src >> \TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not >> implement method 'append(CharSequence) returns >> java.lang.Appendable' from abstract class 'java.lang.Appendable' >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src >> \TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not >> implement method 'append(CharSequence,int,int) returns >> java.lang.Appendable' from abstract class 'java.lang.Appendable' >> [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src >> \TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not >> implement method 'append(char) returns java.lang.Appendable' from >> abstract class 'java.lang.Appendable' >> Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> >> >> > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > |
In reply to this post by Mike Cowlishaw-2
I already tried that one. If I say the append methods return PrintStream
like the superclass does, then NetRexx tells me they must return Appendable. If I say they return Appendable, then NetRexx tells me they must return PrintStream. Apparently it does not recognize that one is a subset of the other. Kermit On 10/16/2009 11:59 PM, Mike Cowlishaw wrote: > PS as a workaround, how about adding the Append methods manually (not > using the ADAPTER option) so they have the right signature? They can > then call the superclass's methods to effect the operations. > > Mike > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > Mike Cowlishaw, IBM Fellow > http://bit.ly/mfc > IBM UK (MP8), PO Box 31, Birmingham Road, Warwick, CV34 5JL > > > > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > > > > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > > > |
In reply to this post by Kermit Kiser
Kermit,
Are you trying to intercept Say output ? I looked at your plug-in and that read function to replace ask...must be a better way. From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser Sent: Friday, October 16, 2009 7:35 PM To: IBM Netrexx Subject: Re: [Ibm-netrexx] Bug in NetRexx compiler Hi Mike; I am in the process of adding a dockable console window to the jEdit plugin for NetRexx scripts that I am developing. (see http://kermitkiser.com/NetRexx ) In order to route the output from the NetRexxA parser and the interpreted NetRexx scripts "say" and trace output to the right windows, I need to intercept System.out and System.err so that the plugin window also receives whatever they send to the jEdit activity log. In short, I need to intercept the output from a lot of code that I did not write. This part actually works well so far but I have not posted the latest code yet because I am still working on allowing the user to respond to "ask" statements from the console window. When that part is done the plugin will be mostly feature complete and ready for beta testing. It should be very useful for NetRexx testing and development as well as for extending jEdit (ain't no IDE of course!). There are a few tricks I have learned such as the fact that you must replace System.out before any "say" instructions are executed because the RexxIO class copies the stream object when it is first loaded. Does that make it any clearer? Do you know any better way to do it? -- Kermit On 10/16/2009 4:13 PM, Measel, Mike wrote: Kermit, I've got to ask...why are you trying to do it this way ? Or, rather curious about how you are using this Tee. Got annoyed the other day and made my own Netrexx version of Tail for win. ;-) Hint: This ain't java - you're making it way too hard. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser Sent: Friday, October 16, 2009 5:28 PM To: IBM Netrexx Subject: [Ibm-netrexx] Bug in NetRexx compiler (was: Problem extendingPrintStream) I would like to report this NetRexx bug but I don't quite know who to report it to. Mike? Ren?? (NetRexx ownership seems in limbo at the moment.) Anyway here is the workaround I am using which unfortunately wrecks havoc with my Ant builds but at least gets me there: Change class to an "adapter" class like this to get NetRexxC to produce Java code that it likes but that will not compile under javac: -- All writes to this print stream are copied to two print streams class TeeStream adapter extends PrintStream out=PrintStream method TeeStream(out1=PrintStream,out2=PrintStream) super(out1) out=out2 method write(buf=byte[],off=int,len=int) super.write(buf,off,len) out.write(buf,off,len) method flush super.flush out.flush -- The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. -------------------------------------------------------------------------------------------------------------------------------- Then remove the three "append" methods generated by NetRexx which Javac refuses to accept and compile the Java code : /* Generated from 'TeeStream.nrx' 16 Oct 2009 14:26:40 [v2.05] */ /* Options: Comments Compact Decimal Format Java Logo Replace Trace2 Verbose3 */ // All writes to this print stream are copied to two print streams public class TeeStream extends java.io.PrintStream{ private static final java.lang.String $0="TeeStream.nrx"; protected java.io.PrintStream out; public TeeStream(java.io.PrintStream out1,java.io.PrintStream out2){ super((java.io.OutputStream)out1); out=out2; return;} public void write(byte buf[],int off,int len){ super.write(buf,off,len); out.write(buf,off,len); return;} public void flush(){ super.flush(); out.flush(); return;} public java.lang.Appendable append(java.lang.CharSequence $1) throws java.io.IOException{return null;} public java.lang.Appendable append(java.lang.CharSequence $2,int $3,int $4) throws java.io.IOException{return null;} public java.lang.Appendable append(char $5) throws java.io.IOException{return null;} } // The three generated methods (append) have to be removed by hand due to a bug in NetRexx when extending PrintStream. ---------------------------------------------------------------------------------------------------------------------------------- My guess is that NetRexx is not recognizing the append methods in Printstream as valid because they return Printstream objects rather than direct Appendable objects. This would not have been a problem with earlier Java versions because the Appendable stuff did not exist then. Does anyone know what to do with this bug report? TIA, -- Kermit On 10/13/2009 11:57 AM, Kermit Kiser wrote: I have not been able to extend the Java class PrintStream with NetRexx. Am I doing something wrong? NetRexx code: -- All writes to this print stream are copied to two print streams class TeeStream extends PrintStream out=PrintStream method TeeStream(out1=PrintStream,out2=PrintStream) super(out1) out=out2 method write(buf=byte[],off=int,len=int) super.write(buf,off,len) out.write(buf,off,len) method flush super.flush out.flush NetRexx compile output: NetRexx portable processor, version 2.05 Copyright (c) IBM Corporation, 2005. All rights reserved. Program TeeStream.nrx === class TeeStream === constructor TeeStream(PrintStream,PrintStream) method write(byte[],int,int) overrides PrintStream.write(byte[],int,int) method flush overrides PrintStream.flush [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(CharSequence) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(CharSequence,int,int) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' [C:\personal\KERMITS\programming\jEdit\NetRexxScript\src\TeeStream.nrx 4 8 9] Error: Class is not abstract, yet it does not implement method 'append(char) returns java.lang.Appendable' from abstract class 'java.lang.Appendable' Compilation of 'TeeStream.nrx' failed [javac failed, 3 errors] _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20091019/a03d57e4/attachment-0001.html |
Mike;
Do you work for IBM? Yes, I am intercepting "say" output and "ask" input. Can't make it any clearer. Did you try the plugin or just look at the code? The code has a lot of experimental spaghetti from trial and error as I learned what worked and what did not - I am not a professional programmer. The latest posted build (0.0.15) is feature complete for V1 and very close to what will be the beta test version shortly. I may clean up the code some and document some things better. As for the read function to handle "ask" requests... I was kinda looking for helpful suggestions. Thanks anyway. ;-) -- Kermit On 10/19/2009 5:42 PM, Measel, Mike wrote: > > Kermit, > > > > Are you trying to intercept Say output ? > > > > I looked at your plug-in and that read function to replace ask...must > be a better way. > > > > > > *From:* [hidden email] > [mailto:[hidden email]] *On Behalf Of *Kermit Kiser > *Sent:* Friday, October 16, 2009 7:35 PM > *To:* IBM Netrexx > *Subject:* Re: [Ibm-netrexx] Bug in NetRexx compiler > > > > Hi Mike; > > I am in the process of adding a dockable console window to the jEdit > plugin for NetRexx scripts that I am developing. (see > http://kermitkiser.com/NetRexx ) > > In order to route the output from the NetRexxA parser and the > interpreted NetRexx scripts "say" and trace output to the right > windows, I need to intercept System.out and System.err so that the > plugin window also receives whatever they send to the jEdit activity > log. In short, I need to intercept the output from a lot of code that > I did not write. This part actually works well so far but I have not > posted the latest code yet because I am still working on allowing the > user to respond to "ask" statements from the console window. When that > part is done the plugin will be mostly feature complete and ready for > beta testing. It should be very useful for NetRexx testing and > development as well as for extending jEdit (ain't no IDE of course!). > > There are a few tricks I have learned such as the fact that you must > replace System.out before any "say" instructions are executed because > the RexxIO class copies the stream object when it is first loaded. > > Does that make it any clearer? Do you know any better way to do it? > > -- Kermit > > > On 10/16/2009 4:13 PM, Measel, Mike wrote: > > Kermit, I've got to ask...why are you trying to do it this way ? > > Or, rather curious about how you are using this Tee. Got annoyed the other day and made my own Netrexx version of Tail for win. ;-) > > Hint: This ain't java - you're making it way too hard. > An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20091022/100ab043/attachment.html |
Kermit, no I did work for IBM long ago. Now I'm just a big fan of
NetRexx. I've been using Rexx since the early 80's. I run a team of hot shot java performance analysts that travel the world, you guessed it, pointing out java performance problems. I've done a bit of trying to trap or redirect output of another java class and in my experience it is better to let it go where it wants. I'm also very big fan of Jedit. I used the old plugin. I'd like to help. On the "say" output why the tee? Mike Measel Sr. Director Emerging Technology CA/Wily From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser Sent: Thursday, October 22, 2009 11:39 PM To: IBM Netrexx Subject: Re: [Ibm-netrexx] NetRexxScript jEdit plugin Mike; Do you work for IBM? Yes, I am intercepting "say" output and "ask" input. Can't make it any clearer. Did you try the plugin or just look at the code? The code has a lot of experimental spaghetti from trial and error as I learned what worked and what did not - I am not a professional programmer. The latest posted build (0.0.15) is feature complete for V1 and very close to what will be the beta test version shortly. I may clean up the code some and document some things better. As for the read function to handle "ask" requests... I was kinda looking for helpful suggestions. Thanks anyway. ;-) -- Kermit On 10/19/2009 5:42 PM, Measel, Mike wrote: Kermit, Are you trying to intercept Say output ? I looked at your plug-in and that read function to replace ask...must be a better way. From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser Sent: Friday, October 16, 2009 7:35 PM To: IBM Netrexx Subject: Re: [Ibm-netrexx] Bug in NetRexx compiler Hi Mike; I am in the process of adding a dockable console window to the jEdit plugin for NetRexx scripts that I am developing. (see http://kermitkiser.com/NetRexx ) In order to route the output from the NetRexxA parser and the interpreted NetRexx scripts "say" and trace output to the right windows, I need to intercept System.out and System.err so that the plugin window also receives whatever they send to the jEdit activity log. In short, I need to intercept the output from a lot of code that I did not write. This part actually works well so far but I have not posted the latest code yet because I am still working on allowing the user to respond to "ask" statements from the console window. When that part is done the plugin will be mostly feature complete and ready for beta testing. It should be very useful for NetRexx testing and development as well as for extending jEdit (ain't no IDE of course!). There are a few tricks I have learned such as the fact that you must replace System.out before any "say" instructions are executed because the RexxIO class copies the stream object when it is first loaded. Does that make it any clearer? Do you know any better way to do it? -- Kermit On 10/16/2009 4:13 PM, Measel, Mike wrote: Kermit, I've got to ask...why are you trying to do it this way ? Or, rather curious about how you are using this Tee. Got annoyed the other day and made my own Netrexx version of Tail for win. ;-) Hint: This ain't java - you're making it way too hard. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20091023/bb05b041/attachment-0001.html |
Free forum by Nabble | Edit this page |