X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/jvm/clojure/lang/AFn.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ public Object call() {
}

public void run(){
try
{
invoke();
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
invoke();
}


Expand Down
29 changes: 11 additions & 18 deletions src/jvm/clojure/lang/AFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,16 @@ public int getRequiredArity(){
}

public int compare(Object o1, Object o2){
try
{
Object o = invoke(o1, o2);

if(o instanceof Boolean)
{
if(RT.booleanCast(o))
return -1;
return RT.booleanCast(invoke(o2,o1))? 1 : 0;
}

Number n = (Number) o;
return n.intValue();
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
Object o = invoke(o1, o2);

if(o instanceof Boolean)
{
if(RT.booleanCast(o))
return -1;
return RT.booleanCast(invoke(o2,o1))? 1 : 0;
}

Number n = (Number) o;
return n.intValue();
}
}
33 changes: 4 additions & 29 deletions src/jvm/clojure/lang/ARef.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ void validate(IFn vf, Object val){
if(vf != null && !RT.booleanCast(vf.invoke(val)))
throw new IllegalStateException("Invalid reference state");
}
catch(RuntimeException re)
{
throw re;
}
catch(Exception e)
{
throw new IllegalStateException("Invalid reference state", e);
Expand All @@ -47,14 +43,7 @@ void validate(Object val){
}

public void setValidator(IFn vf){
try
{
validate(vf, deref());
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
validate(vf, deref());
validator = vf;
}

Expand All @@ -72,14 +61,7 @@ synchronized public IRef addWatch(Object key, IFn callback){
}

synchronized public IRef removeWatch(Object key){
try
{
watches = watches.without(key);
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
watches = watches.without(key);

return this;
}
Expand All @@ -92,15 +74,8 @@ public void notifyWatches(Object oldval, Object newval){
{
Map.Entry e = (Map.Entry) s.first();
IFn fn = (IFn) e.getValue();
try
{
if(fn != null)
fn.invoke(e.getKey(), this, oldval, newval);
}
catch(Exception e1)
{
throw Util.runtimeException(e1);
}
if(fn != null)
fn.invoke(e.getKey(), this, oldval, newval);
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions src/jvm/clojure/lang/LazySeq.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,8 @@ public Obj withMeta(IPersistentMap meta){
final synchronized Object sval(){
if(fn != null)
{
try
{
sv = fn.invoke();
fn = null;
}
catch(RuntimeException e)
{
throw e;
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
}
if(sv != null)
return sv;
Expand Down
7 changes: 1 addition & 6 deletions src/jvm/clojure/lang/RT.java
Original file line number Diff line number Diff line change
Expand Up @@ -1688,12 +1688,7 @@ static public String printString(Object x){

static public Object readString(String s){
PushbackReader r = new PushbackReader(new StringReader(s));
try {
return LispReader.read(r, true, null, false);
}
catch(Exception e) {
throw Util.runtimeException(e);
}
return LispReader.read(r, true, null, false);
}

static public void print(Object x, Writer w) throws IOException{
Expand Down
9 changes: 1 addition & 8 deletions src/jvm/clojure/lang/Ref.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,7 @@ public Object call() {
}

public void run(){
try
{
invoke();
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
invoke();
}

public Object invoke() {
Expand Down
19 changes: 2 additions & 17 deletions src/jvm/clojure/lang/TransactionalHashMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,7 @@ public V remove(Object k){
Ref r = bins[binFor(k)];
IPersistentMap map = (IPersistentMap) r.deref();
Object ret = map.valAt(k);
//checked exceptions are a bad idea, especially in an interface
try
{
r.set(map.without(k));
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
r.set(map.without(k));
return (V) ret;
}

Expand Down Expand Up @@ -157,14 +149,7 @@ public boolean remove(Object k, Object v){
if(e != null && e.getValue().equals(v))
{
//checked exceptions are a bad idea, especially in an interface
try
{
r.set(map.without(k));
}
catch(Exception ex)
{
throw Util.runtimeException(ex);
}
r.set(map.without(k));
return true;
}
return false;
Expand Down
18 changes: 2 additions & 16 deletions src/jvm/clojure/lang/Var.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,7 @@ public Object call() {
}

public void run(){
try
{
invoke();
}
catch(Exception e)
{
throw Util.runtimeException(e);
}
invoke();
}

public Object invoke() {
Expand Down Expand Up @@ -541,14 +534,7 @@ public Object invoke(Object m, Object k, Object v) {
static IFn dissoc = new AFn() {
@Override
public Object invoke(Object c, Object k) {
try
{
return RT.dissoc(c, k);
}
catch(Exception e)
{
return Util.runtimeException(e);
}
return RT.dissoc(c, k);
}
};
}
X Tutup