1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#!/bin/java bsh.Interpreter
source("TestHarness.bsh");
private int bar() { }
private bar() { }
private int bar() { }
private synchronized int bar() { }
private synchronized bar() { }
private synchronized final bar() { }
assert( isEvalError("private private int bar() { }") );
assert( isEvalError("private private bar() { }") );
assert( isEvalError("private public int bar() { }") );
assert( isEvalError("private public bar() { }") );
assert( isEvalError("volatile int bar() { }") );
int foo;
int foo2=5;
private int foo3;
private final int foo3;
private int foo4=5;
private int foo5;
private volatile int foo6;
private volatile int foo7 = 2;
assert( isEvalError("synchronized int bar20") );
assert( isEvalError("public private int bar21") );
final int fin = 1;
assert( isEvalError("fin=2") );
// static not allowed outside of class?
// perhaps we'll just ignore it
//assert( isEvalError("static int a") );
//assert( isEvalError("static int method() { }") );
static int a;
static int method() { };
// untyped can't have modifiers right now
//final qbert=2;
//private qbert;
//private final qbert2=5;
complete();
|