#166 Can't anonymous subclass with non-default constructor

open
nobody
None
7
2005-06-02
2004-05-03
Archie Cobbs
No

This should work but it doesn't:

bsh % x = new
java.io.FilterOutputStream(this.interpreter.out) { } ;
// Error: EvalError: Error constructing inner class
instance: bsh.ReflectError: Can't find constructor:
global$4( java.io.PrintStream ) in class: global$4 : at
Line: 1 : in file: <unknown file> : new java .io
.FilterOutputStream ( this .interpreter .out ) {

The problem seems to be that BSH can't handle an
anonymous inner subclass when the superclass
constructor takes any parameters.

It appears to be looking for the constructor in the
inner subclass rather than the superclass.

Discussion

  • Pat Niemeyer
    Pat Niemeyer
    2005-06-02

    • priority: 5 --> 7