Index: src/org/jruby/compiler/impl/StandardASMCompiler.java =================================================================== --- src/org/jruby/compiler/impl/StandardASMCompiler.java (revision 3916) +++ src/org/jruby/compiler/impl/StandardASMCompiler.java (working copy) @@ -171,6 +171,7 @@ FileOutputStream out = new FileOutputStream(new File(pathfile, filename)); out.write(writer.toByteArray()); + out.close(); } public String getClassname() { @@ -923,7 +924,7 @@ mv.dup_x2(); mv.pop(); - mv.ldc(new Boolean(isExclusive)); + mv.ldc(Boolean.valueOf(isExclusive)); mv.invokestatic(cg.p(RubyRange.class), "newRange", cg.sig(RubyRange.class, cg.params(Ruby.class, IRubyObject.class, IRubyObject.class, Boolean.TYPE))); } Index: src/org/jruby/evaluator/EvaluationState.java =================================================================== --- src/org/jruby/evaluator/EvaluationState.java (revision 3916) +++ src/org/jruby/evaluator/EvaluationState.java (working copy) @@ -678,7 +678,7 @@ if(!(_super instanceof RubyClass)) { throw runtime.newTypeError("superclass must be a Class (" + RubyObject.trueFalseNil(_super) + ") given"); } - superClass = superNode == null ? null : (RubyClass)_super; + superClass = (RubyClass)_super; } Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); Index: src/org/jruby/javasupport/util/CompilerHelpers.java =================================================================== --- src/org/jruby/javasupport/util/CompilerHelpers.java (revision 3916) +++ src/org/jruby/javasupport/util/CompilerHelpers.java (working copy) @@ -56,7 +56,7 @@ throw runtime.newTypeError("No class to add method."); } - if (containingClass == runtime.getObject() && name == "initialize") { + if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Index: src/org/jruby/lexer/yacc/RubyYaccLexer.java =================================================================== --- src/org/jruby/lexer/yacc/RubyYaccLexer.java (revision 3916) +++ src/org/jruby/lexer/yacc/RubyYaccLexer.java (working copy) @@ -93,12 +93,12 @@ static final int STR_FUNC_SYMBOL=0x10; static final int STR_FUNC_INDENT=0x20; - private final int str_squote = 0; - private final int str_dquote = STR_FUNC_EXPAND; - private final int str_xquote = STR_FUNC_EXPAND; - private final int str_regexp = STR_FUNC_REGEXP | STR_FUNC_ESCAPE | STR_FUNC_EXPAND; - private final int str_ssym = STR_FUNC_SYMBOL; - private final int str_dsym = STR_FUNC_SYMBOL | STR_FUNC_EXPAND; + private static final int str_squote = 0; + private static final int str_dquote = STR_FUNC_EXPAND; + private static final int str_xquote = STR_FUNC_EXPAND; + private static final int str_regexp = STR_FUNC_REGEXP | STR_FUNC_ESCAPE | STR_FUNC_EXPAND; + private static final int str_ssym = STR_FUNC_SYMBOL; + private static final int str_dsym = STR_FUNC_SYMBOL | STR_FUNC_EXPAND; public RubyYaccLexer() { reset(); Index: src/org/jruby/RubyArray.java =================================================================== --- src/org/jruby/RubyArray.java (revision 3916) +++ src/org/jruby/RubyArray.java (working copy) @@ -2201,7 +2201,7 @@ } } - final class DefaultComparator implements Comparator { + static final class DefaultComparator implements Comparator { public int compare(Object o1, Object o2) { if (o1 instanceof RubyFixnum && o2 instanceof RubyFixnum) { long a = ((RubyFixnum) o1).getLongValue(); Index: src/org/jruby/RubyDigest.java =================================================================== --- src/org/jruby/RubyDigest.java (revision 3916) +++ src/org/jruby/RubyDigest.java (working copy) @@ -129,7 +129,7 @@ } public static class Base extends RubyObject { - protected static ObjectAllocator BASE_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator BASE_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new Base(runtime, klass); } Index: src/org/jruby/RubyDir.java =================================================================== --- src/org/jruby/RubyDir.java (revision 3916) +++ src/org/jruby/RubyDir.java (working copy) @@ -486,6 +486,7 @@ int totalBytes = stream.available(); byte[] bytes = new byte[totalBytes]; stream.read(bytes); + stream.close(); passwd = new String(bytes); } catch (IOException e) { return recv.getRuntime().getNil(); Index: src/org/jruby/RubyIconv.java =================================================================== --- src/org/jruby/RubyIconv.java (revision 3916) +++ src/org/jruby/RubyIconv.java (working copy) @@ -102,7 +102,7 @@ return new RubyFailure(runtime, excptnClass, msg); } - protected static ObjectAllocator ICONV_FAILURE_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator ICONV_FAILURE_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new RubyFailure(runtime, klass); } Index: src/org/jruby/RubyNameError.java =================================================================== --- src/org/jruby/RubyNameError.java (revision 3916) +++ src/org/jruby/RubyNameError.java (working copy) @@ -59,7 +59,7 @@ } protected RubyNameError(Ruby runtime, RubyClass exceptionClass) { - this(runtime, exceptionClass, exceptionClass.getName().toString()); + this(runtime, exceptionClass, exceptionClass.getName()); } public RubyNameError(Ruby runtime, RubyClass exceptionClass, String message) { Index: src/org/jruby/RubyNil.java =================================================================== --- src/org/jruby/RubyNil.java (revision 3916) +++ src/org/jruby/RubyNil.java (working copy) @@ -54,7 +54,7 @@ return runtime; } - public static ObjectAllocator NIL_ALLOCATOR = new ObjectAllocator() { + public static final ObjectAllocator NIL_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return runtime.getNil(); } Index: src/org/jruby/RubyNoMethodError.java =================================================================== --- src/org/jruby/RubyNoMethodError.java (revision 3916) +++ src/org/jruby/RubyNoMethodError.java (working copy) @@ -51,7 +51,7 @@ } protected RubyNoMethodError(Ruby runtime, RubyClass exceptionClass) { - super(runtime, exceptionClass, exceptionClass.getName().toString()); + super(runtime, exceptionClass, exceptionClass.getName()); this.args = runtime.getNil(); } Index: src/org/jruby/RubyNumeric.java =================================================================== --- src/org/jruby/RubyNumeric.java (revision 3916) +++ src/org/jruby/RubyNumeric.java (working copy) @@ -87,13 +87,13 @@ return numeric; } - protected static ObjectAllocator NUMERIC_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator NUMERIC_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new RubyNumeric(runtime, klass); } }; - public static double DBL_EPSILON=2.2204460492503131e-16; + public static final double DBL_EPSILON=2.2204460492503131e-16; public RubyNumeric(Ruby runtime, RubyClass metaClass) { super(runtime, metaClass); Index: src/org/jruby/RubyObject.java =================================================================== --- src/org/jruby/RubyObject.java (revision 3916) +++ src/org/jruby/RubyObject.java (working copy) @@ -151,7 +151,7 @@ return objectClass; } - public static ObjectAllocator OBJECT_ALLOCATOR = new ObjectAllocator() { + public static final ObjectAllocator OBJECT_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { IRubyObject instance = new RubyObject(runtime, klass); instance.setMetaClass(klass); Index: src/org/jruby/RubyString.java =================================================================== --- src/org/jruby/RubyString.java (revision 3916) +++ src/org/jruby/RubyString.java (working copy) @@ -1729,7 +1729,7 @@ private static String getSaltChar(int amount) { StringBuffer sb = new StringBuffer(); for(int i=amount;i>0;i--) { - sb.append(theBaseSalts[(Math.abs(r_gen.nextInt())%64)]); + sb.append(theBaseSalts[r_gen.nextInt(64)]); } return sb.toString(); } Index: src/org/jruby/RubyThread.java =================================================================== --- src/org/jruby/RubyThread.java (revision 3916) +++ src/org/jruby/RubyThread.java (working copy) @@ -242,7 +242,9 @@ } public void cleanTerminate(IRubyObject result) { - finalResult = result; + synchronized (this) { + finalResult = result; + } isStopped = true; } Index: src/org/jruby/RubyZlib.java =================================================================== --- src/org/jruby/RubyZlib.java (revision 3916) +++ src/org/jruby/RubyZlib.java (working copy) @@ -411,7 +411,7 @@ } public static class Inflate extends ZStream { - protected static ObjectAllocator INFLATE_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator INFLATE_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new Inflate(runtime, klass); } @@ -492,7 +492,7 @@ } public static class Deflate extends ZStream { - protected static ObjectAllocator DEFLATE_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator DEFLATE_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new Deflate(runtime, klass); } @@ -617,7 +617,7 @@ return io; } - protected static ObjectAllocator GZIPFILE_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator GZIPFILE_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new RubyGzipFile(runtime, klass); } @@ -705,7 +705,7 @@ } public static class RubyGzipReader extends RubyGzipFile { - protected static ObjectAllocator GZIPREADER_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator GZIPREADER_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new RubyGzipReader(runtime, klass); } @@ -932,7 +932,7 @@ } public static class RubyGzipWriter extends RubyGzipFile { - protected static ObjectAllocator GZIPWRITER_ALLOCATOR = new ObjectAllocator() { + protected static final ObjectAllocator GZIPWRITER_ALLOCATOR = new ObjectAllocator() { public IRubyObject allocate(Ruby runtime, RubyClass klass) { return new RubyGzipWriter(runtime, klass); } Index: src/org/jruby/runtime/CallbackFactory.java =================================================================== --- src/org/jruby/runtime/CallbackFactory.java (revision 3916) +++ src/org/jruby/runtime/CallbackFactory.java (working copy) @@ -150,7 +150,7 @@ } if(System.getProperty("jruby.dump_invocations") != null) { dumping = true; - dumpingPath = System.getProperty("jruby.dump_invocations").toString(); + dumpingPath = System.getProperty("jruby.dump_invocations"); } } } Index: src/org/jruby/runtime/CallBlock.java =================================================================== --- src/org/jruby/runtime/CallBlock.java (revision 3916) +++ src/org/jruby/runtime/CallBlock.java (working copy) @@ -79,8 +79,7 @@ public IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue) { if (klass == null) { - self = this.self; - frame.setSelf(self); + frame.setSelf(this.self); } pre(context, klass); Index: src/org/jruby/runtime/MethodFactory.java =================================================================== --- src/org/jruby/runtime/MethodFactory.java (revision 3916) +++ src/org/jruby/runtime/MethodFactory.java (working copy) @@ -53,7 +53,7 @@ } if (System.getProperty("jruby.dump_invocations") != null) { dumping = true; - dumpingPath = System.getProperty("jruby.dump_invocations").toString(); + dumpingPath = System.getProperty("jruby.dump_invocations"); } } } Index: src/org/jruby/util/Glob.java =================================================================== --- src/org/jruby/util/Glob.java (revision 3916) +++ src/org/jruby/util/Glob.java (working copy) @@ -274,7 +274,7 @@ * * Glob and GlobPattern do a lot of list copying and transforming. This could be done better. */ - private class GlobPattern { + private static class GlobPattern { private String pattern; private String cwd; private boolean endsWithDelimeter; Index: src/org/jruby/util/IOHandler.java =================================================================== --- src/org/jruby/util/IOHandler.java (revision 3916) +++ src/org/jruby/util/IOHandler.java (working copy) @@ -227,13 +227,13 @@ return false; } - public class PipeException extends Exception { + public static class PipeException extends Exception { private static final long serialVersionUID = 1L; } - public class BadDescriptorException extends Exception { + public static class BadDescriptorException extends Exception { private static final long serialVersionUID = 1L; } - public class InvalidValueException extends Exception { + public static class InvalidValueException extends Exception { private static final long serialVersionUID = 1L; } } Index: test/org/jruby/ast/visitor/rewriter/TestReWriteVisitor.java =================================================================== --- test/org/jruby/ast/visitor/rewriter/TestReWriteVisitor.java (revision 3916) +++ test/org/jruby/ast/visitor/rewriter/TestReWriteVisitor.java (working copy) @@ -120,6 +120,7 @@ stream.close(); BufferedReader reader = new BufferedReader(new FileReader(fileName)); assertEquals(reader.readLine(), testString); + reader.close(); } finally { new java.io.File(fileName).delete(); } Index: test/org/jruby/test/ScriptTestSuite.java =================================================================== --- test/org/jruby/test/ScriptTestSuite.java (revision 3916) +++ test/org/jruby/test/ScriptTestSuite.java (working copy) @@ -93,6 +93,7 @@ suite.addTest(new ScriptTest(runtime, testDir, line)); } + testFiles.close(); return suite; } Index: test/org/jruby/test/TestUnitTestSuite.java =================================================================== --- test/org/jruby/test/TestUnitTestSuite.java (revision 3916) +++ test/org/jruby/test/TestUnitTestSuite.java (working copy) @@ -82,6 +82,7 @@ suite.addTest(new ScriptTest(line, testDir)); } + testFiles.close(); return suite; }