Skip to content

Commit

Permalink
Fixing some problem founded by Findbug
Browse files Browse the repository at this point in the history
  • Loading branch information
chungkwong committed Oct 7, 2016
1 parent b3f0768 commit 1d18939
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ JSchemeMin 是又一个JVM平台上的Scheme语言实现。

目前,JSchemeMin 只提供解释器而非编译器。基本的性能监视机制已经存在。调试器和覆盖率工具也已经提供。

性能并非JSchemeMin的主要设计目标,大部公情况下用明显的实现方式,不为性能牺牲实现的简单性,但相信足以满足预期的需要。
性能并非JSchemeMin的主要设计目标,大部分情况下用明显的实现方式,不为性能牺牲实现的简单性,但相信足以满足预期的需要。

本软件为自由软件: 你可以在自由软件基金会的GNU通用公共许可,版本3或按你的意愿更新的版本,的条款下再分发它和/或修改它。
3 changes: 2 additions & 1 deletion doc/first.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
\multicolumn{3}{c}{陈颂光 (\textit{Revisor})} \\
\multicolumn{3}{c}{A\authorsc{LEX} S\authorsc{HINN},
J\authorsc{OHN} C\authorsc{OWAN}, \authorsc{AND}
A\authorsc{RTHUR} A. G\authorsc{LECKLER} (\textit{Editors})} \\
A\authorsc{RTHUR} A. G\authorsc{LECKLER} } \\
\multicolumn{3}{c}{\textit{(Editors, Revised$^{\mathit{7}}$ Report on the Algorithmic Language Scheme)}} \\
\\
S\authorsc{TEVEN} G\authorsc{ANZ} &
A\authorsc{LEXEY} R\authorsc{ADUL} &
Expand Down
2 changes: 1 addition & 1 deletion doc/r7rs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\makeindex
\input{commands}

\def\headertitle{Revised$^{7}$ Scheme}
\def\headertitle{JSchemeMin User Manual}
\def\integerversion{7}

% Sizes and dimensions
Expand Down
3 changes: 0 additions & 3 deletions src/com/github/chungkwong/jschememin/Debugger.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ private boolean isCaredPoint(){
return cont.hasNext()&&cont.getCurrentEvaluable()instanceof ExpressionEvaluator&&
caredExpressions.containsKey(cont.getCurrentValue());
}
private boolean isFinished(){
return cont.hasNext();
}
public ScmObject eval(ScmObject obj){
return new Evaluator(cont.getCurrentEnvironment()).eval(obj);
}
Expand Down
6 changes: 0 additions & 6 deletions src/com/github/chungkwong/jschememin/lib/Java.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
import static com.github.chungkwong.jschememin.lib.Utility.car;
import static com.github.chungkwong.jschememin.lib.Utility.cdr;
import com.github.chungkwong.jschememin.type.*;
import java.lang.invoke.*;
import java.lang.reflect.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
/**
*
* @author Chan Chung Kwong <1m02math@126.com>
Expand Down Expand Up @@ -118,7 +116,6 @@ private static ScmObject invoke(ScmObject param)throws ClassNotFoundException
Object[] arguments=toArray(((ScmPair)param).getCddr());
Class[] paraType=toClassArray(arguments);
Method m=(Method)selectMethod(cls.getMethods(),method,paraType);
MethodHandle handle=MethodHandles.lookup().unreflect(m);
if(m!=null)
try{
return new ScmJavaObject(m.invoke(obj,adjustForVarargs(arguments,m)));
Expand Down Expand Up @@ -165,9 +162,6 @@ private static Object[] adjustForVarargs(Object[] args,Executable m){
private static ScmObject cast(ScmObject param) throws ClassNotFoundException{
return new ScmJavaObject(Class.forName(((ScmSymbol)cadr(param)).getValue()).cast(((ScmJavaObject)car(param)).getJavaObject()));
}
private static Set<Class> getPossibleReturnType(Class cls,String method){
return Arrays.stream(cls.getMethods()).filter((m)->m.getName().equals(method)).map((m)->m.getReturnType()).collect(Collectors.toSet());
}
private static Executable selectMethod(Executable[] choices,String name,Class[] argsType){
Executable best=null;
Class<?>[] bestParameterTypes=null;
Expand Down
2 changes: 1 addition & 1 deletion src/com/github/chungkwong/jschememin/type/ScmSymbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public String getValue(){
}
@Override
public boolean equals(Object obj){
return getClass().equals(obj.getClass())&&((ScmSymbol)obj).id.equals(id);
return obj!=null&&getClass().equals(obj.getClass())&&((ScmSymbol)obj).id.equals(id);
}
@Override
public int hashCode(){
Expand Down
2 changes: 1 addition & 1 deletion test/com/github/chungkwong/jschememin/LexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void testRealNumber(){
check("1.e-10)",new ScmFloatingPointNumber(new BigDecimal("1e-10")),SimpleToken.getToken(")"));
Assert.assertSame(new Lex("+nan.0)").nextToken(),ScmSpecialReal.POSITIVE_NAN);
try{
Assert.assertSame(new Lex("+nan.0)").getRemainingTokens().size(),2);
Assert.assertEquals(new Lex("+nan.0)").getRemainingTokens().size(),2);
Assert.assertEquals(new Lex("+nan.0)").getRemainingTokens().get(1),SimpleToken.getToken(")"));
}catch(IOException ex){
Assert.assertTrue(false);
Expand Down

0 comments on commit 1d18939

Please sign in to comment.