# HG changeset patch # User lagergren # Date 1415011661 -3600 # Node ID e1e27c4262be3833f003a4a7e44628de7f02b5cf # Parent a54684572f143e9ba6bcd0f0f4c503656d658ce9 8060204: Fix warnings in Joni and tests Reviewed-by: hannesw, sundar, attila diff -r a54684572f14 -r e1e27c4262be docs/source/EvalFile.java --- a/docs/source/EvalFile.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/EvalFile.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,14 +29,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class EvalFile { - public static void main(String[] args) throws Exception { + public static void main(final String[] args) throws Exception { // create a script engine manager - ScriptEngineManager factory = new ScriptEngineManager(); + final ScriptEngineManager factory = new ScriptEngineManager(); // create JavaScript engine - ScriptEngine engine = factory.getEngineByName("nashorn"); + final ScriptEngine engine = factory.getEngineByName("nashorn"); // evaluate JavaScript code from given file - specified by first argument engine.eval(new java.io.FileReader(args[0])); } diff -r a54684572f14 -r e1e27c4262be docs/source/EvalScript.java --- a/docs/source/EvalScript.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/EvalScript.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,14 +29,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class EvalScript { - public static void main(String[] args) throws Exception { + public static void main(final String[] args) throws Exception { // create a script engine manager - ScriptEngineManager factory = new ScriptEngineManager(); + final ScriptEngineManager factory = new ScriptEngineManager(); // create a JavaScript engine - ScriptEngine engine = factory.getEngineByName("nashorn"); + final ScriptEngine engine = factory.getEngineByName("nashorn"); // evaluate JavaScript code from String engine.eval("print('Hello, World')"); } diff -r a54684572f14 -r e1e27c4262be docs/source/InvokeScriptFunction.java --- a/docs/source/InvokeScriptFunction.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/InvokeScriptFunction.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,22 +29,25 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class InvokeScriptFunction { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); // JavaScript code in a String - String script = "function hello(name) { print('Hello, ' + name); }"; + final String script = "function hello(name) { print('Hello, ' + name); }"; // evaluate script engine.eval(script); // javax.script.Invocable is an optional interface. // Check whether your script engine implements or not! // Note that the JavaScript engine implements Invocable interface. - Invocable inv = (Invocable) engine; + final Invocable inv = (Invocable) engine; // invoke the global function named "hello" inv.invokeFunction("hello", "Scripting!!" ); diff -r a54684572f14 -r e1e27c4262be docs/source/InvokeScriptMethod.java --- a/docs/source/InvokeScriptMethod.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/InvokeScriptMethod.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,26 +29,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class InvokeScriptMethod { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); // JavaScript code in a String. This code defines a script object 'obj' // with one method called 'hello'. - String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }"; + final String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }"; // evaluate script engine.eval(script); // javax.script.Invocable is an optional interface. // Check whether your script engine implements or not! // Note that the JavaScript engine implements Invocable interface. - Invocable inv = (Invocable) engine; + final Invocable inv = (Invocable) engine; // get script object on which we want to call the method - Object obj = engine.get("obj"); + final Object obj = engine.get("obj"); // invoke the method named "hello" on the script object "obj" inv.invokeMethod(obj, "hello", "Script Method !!" ); diff -r a54684572f14 -r e1e27c4262be docs/source/MultiScopes.java --- a/docs/source/MultiScopes.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/MultiScopes.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,12 +29,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.Bindings; +import javax.script.ScriptContext; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.SimpleScriptContext; +@SuppressWarnings("javadoc") public class MultiScopes { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); engine.put("x", "hello"); // print global variable "x" @@ -42,9 +47,9 @@ // the above line prints "hello" // Now, pass a different script context - ScriptContext newContext = new SimpleScriptContext(); + final ScriptContext newContext = new SimpleScriptContext(); newContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE); - Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE); + final Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE); // add new variable "x" to the new engineScope engineScope.put("x", "world"); diff -r a54684572f14 -r e1e27c4262be docs/source/RunnableImpl.java --- a/docs/source/RunnableImpl.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/RunnableImpl.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,28 +29,31 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class RunnableImpl { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); // JavaScript code in a String - String script = "function run() { print('run called'); }"; + final String script = "function run() { print('run called'); }"; // evaluate script engine.eval(script); - Invocable inv = (Invocable) engine; + final Invocable inv = (Invocable) engine; // get Runnable interface object from engine. This interface methods // are implemented by script functions with the matching name. - Runnable r = inv.getInterface(Runnable.class); + final Runnable r = inv.getInterface(Runnable.class); // start a new thread that runs the script implemented // runnable interface - Thread th = new Thread(r); + final Thread th = new Thread(r); th.start(); th.join(); } diff -r a54684572f14 -r e1e27c4262be docs/source/RunnableImplObject.java --- a/docs/source/RunnableImplObject.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/RunnableImplObject.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,31 +29,34 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class RunnableImplObject { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); // JavaScript code in a String - String script = "var obj = new Object(); obj.run = function() { print('run method called'); }"; + final String script = "var obj = new Object(); obj.run = function() { print('run method called'); }"; // evaluate script engine.eval(script); // get script object on which we want to implement the interface with - Object obj = engine.get("obj"); + final Object obj = engine.get("obj"); - Invocable inv = (Invocable) engine; + final Invocable inv = (Invocable) engine; // get Runnable interface object from engine. This interface methods // are implemented by script methods of object 'obj' - Runnable r = inv.getInterface(obj, Runnable.class); + final Runnable r = inv.getInterface(obj, Runnable.class); // start a new thread that runs the script implemented // runnable interface - Thread th = new Thread(r); + final Thread th = new Thread(r); th.start(); th.join(); } diff -r a54684572f14 -r e1e27c4262be docs/source/ScriptVars.java --- a/docs/source/ScriptVars.java Mon Nov 03 07:29:46 2014 +0100 +++ b/docs/source/ScriptVars.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,15 +29,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import javax.script.*; -import java.io.*; +import java.io.File; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +@SuppressWarnings("javadoc") public class ScriptVars { - public static void main(String[] args) throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("nashorn"); + public static void main(final String[] args) throws Exception { + final ScriptEngineManager manager = new ScriptEngineManager(); + final ScriptEngine engine = manager.getEngineByName("nashorn"); - File f = new File("test.txt"); + final File f = new File("test.txt"); // expose File object as variable to script engine.put("file", f); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/AssertsEnabled.java --- a/src/jdk/nashorn/internal/AssertsEnabled.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/AssertsEnabled.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,8 +27,8 @@ /** * Class that exposes the current state of asserts. - * */ +@SuppressWarnings("all") public final class AssertsEnabled { private static boolean assertsEnabled = false; static { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java --- a/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Mon Nov 03 11:47:41 2014 +0100 @@ -31,7 +31,6 @@ import java.util.Deque; import java.util.HashMap; import java.util.Map; - import jdk.nashorn.internal.IntDeque; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.Block; @@ -250,7 +249,7 @@ static Type getTypeForSlotDescriptor(final char typeDesc) { // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor(). - switch(typeDesc) { + switch (typeDesc) { case 'I': case 'i': return Type.INT; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/codegen/Compiler.java --- a/src/jdk/nashorn/internal/codegen/Compiler.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/codegen/Compiler.java Mon Nov 03 11:47:41 2014 +0100 @@ -389,6 +389,7 @@ * @param continuationEntryPoints continuation entry points for restof method * @param runtimeScope runtime scope for recompilation type lookup in {@code TypeEvaluator} */ + @SuppressWarnings("unused") public Compiler( final Context context, final ScriptEnvironment env, diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java --- a/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN; import static jdk.nashorn.internal.ir.Expression.isAlwaysFalse; import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue; - import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; @@ -236,12 +235,12 @@ private byte conversions; void recordConversion(final LvarType from, final LvarType to) { - switch(from) { + switch (from) { case UNDEFINED: return; case INT: case BOOLEAN: - switch(to) { + switch (to) { case LONG: recordConversion(I2L); return; @@ -256,7 +255,7 @@ return; } case LONG: - switch(to) { + switch (to) { case DOUBLE: recordConversion(L2D); return; @@ -1425,6 +1424,7 @@ * @param symbol the symbol representing the variable * @param type the type */ + @SuppressWarnings("unused") private void setType(final Symbol symbol, final LvarType type) { if(getLocalVariableTypeOrNull(symbol) == type) { return; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/codegen/types/Type.java --- a/src/jdk/nashorn/internal/codegen/types/Type.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/codegen/types/Type.java Mon Nov 03 11:47:41 2014 +0100 @@ -356,7 +356,7 @@ final int pp = input.readInt(); final int typeChar = input.readByte(); final Type type; - switch(typeChar) { + switch (typeChar) { case 'L': type = Type.OBJECT; break; case 'D': type = Type.NUMBER; break; case 'J': type = Type.LONG; break; @@ -376,13 +376,13 @@ } private static jdk.internal.org.objectweb.asm.Type lookupInternalType(final Class type) { - final Map, jdk.internal.org.objectweb.asm.Type> cache = INTERNAL_TYPE_CACHE; - jdk.internal.org.objectweb.asm.Type itype = cache.get(type); + final Map, jdk.internal.org.objectweb.asm.Type> c = INTERNAL_TYPE_CACHE; + jdk.internal.org.objectweb.asm.Type itype = c.get(type); if (itype != null) { return itype; } itype = jdk.internal.org.objectweb.asm.Type.getType(type); - cache.put(type, itype); + c.put(type, itype); return itype; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/objects/ArrayBufferView.java --- a/src/jdk/nashorn/internal/objects/ArrayBufferView.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/objects/ArrayBufferView.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; - import java.nio.ByteBuffer; import java.nio.ByteOrder; import jdk.internal.dynalink.CallSiteDescriptor; @@ -44,6 +43,9 @@ import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.arrays.TypedArrayData; +/** + * ArrayBufferView, es6 class or TypedArray implementation + */ @ScriptClass("ArrayBufferView") public abstract class ArrayBufferView extends ScriptObject { private final NativeArrayBuffer buffer; @@ -71,6 +73,13 @@ setArray(data); } + /** + * Constructor + * + * @param buffer underlying NativeArrayBuffer + * @param byteOffset byte offset for buffer + * @param elementLength element length in bytes + */ protected ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) { this(buffer, byteOffset, elementLength, Global.instance()); } @@ -89,22 +98,42 @@ return factory().bytesPerElement; } + /** + * Buffer getter as per spec + * @param self ArrayBufferView instance + * @return buffer + */ @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) public static Object buffer(final Object self) { return ((ArrayBufferView)self).buffer; } + /** + * Buffer offset getter as per spec + * @param self ArrayBufferView instance + * @return buffer offset + */ @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) public static int byteOffset(final Object self) { return ((ArrayBufferView)self).byteOffset; } + /** + * Byte length getter as per spec + * @param self ArrayBufferView instance + * @return array buffer view length in bytes + */ @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) public static int byteLength(final Object self) { final ArrayBufferView view = (ArrayBufferView)self; return ((TypedArrayData)view.getArray()).getElementLength() * view.bytesPerElement(); } + /** + * Length getter as per spec + * @param self ArrayBufferView instance + * @return length in elements + */ @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) public static int length(final Object self) { return ((ArrayBufferView)self).elementLength(); @@ -119,15 +148,29 @@ return ((TypedArrayData)getArray()).getElementLength(); } + /** + * Factory class for byte ArrayBufferViews + */ protected static abstract class Factory { final int bytesPerElement; final int maxElementLength; + /** + * Constructor + * + * @param bytesPerElement number of bytes per element for this buffer + */ public Factory(final int bytesPerElement) { this.bytesPerElement = bytesPerElement; this.maxElementLength = Integer.MAX_VALUE / bytesPerElement; } + /** + * Factory method + * + * @param elementLength number of elements + * @return new ArrayBufferView + */ public final ArrayBufferView construct(final int elementLength) { if (elementLength > maxElementLength) { throw rangeError("inappropriate.array.buffer.length", JSType.toString(elementLength)); @@ -135,15 +178,47 @@ return construct(new NativeArrayBuffer(elementLength * bytesPerElement), 0, elementLength); } - public abstract ArrayBufferView construct(NativeArrayBuffer buffer, int byteOffset, int elementLength); + /** + * Factory method + * + * @param buffer underlying buffer + * @param byteOffset byte offset + * @param elementLength number of elements + * + * @return new ArrayBufferView + */ + public abstract ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength); - public abstract TypedArrayData createArrayData(ByteBuffer nb, int start, int end); + /** + * Factory method for array data + * + * @param nb underlying nativebuffer + * @param start start element + * @param end end element + * + * @return new array data + */ + public abstract TypedArrayData createArrayData(final ByteBuffer nb, final int start, final int end); + /** + * Get the class name for this type of buffer + * + * @return class name + */ public abstract String getClassName(); } + /** + * Get the factor for this kind of buffer + * @return Factory + */ protected abstract Factory factory(); + /** + * Get the prototype for this ArrayBufferView + * @param global global instance + * @return prototype + */ protected abstract ScriptObject getPrototype(final Global global); @Override @@ -151,10 +226,23 @@ return factory().getClassName(); } + /** + * Check if this array contains floats + * @return true if float array (or double) + */ protected boolean isFloatArray() { return false; } + /** + * Inheritable constructor implementation + * + * @param newObj is this a new constructor + * @param args arguments + * @param factory factory + * + * @return new ArrayBufferView + */ protected static ArrayBufferView constructorImpl(final boolean newObj, final Object[] args, final Factory factory) { final Object arg0 = args.length != 0 ? args[0] : 0; final ArrayBufferView dest; @@ -200,6 +288,15 @@ return dest; } + /** + * Inheritable implementation of set, if no efficient implementation is available + * + * @param self ArrayBufferView instance + * @param array array + * @param offset0 array offset + * + * @return result of setter + */ protected static Object setImpl(final Object self, final Object array, final Object offset0) { final ArrayBufferView dest = (ArrayBufferView)self; final int length; @@ -244,6 +341,15 @@ return (int)(length & Integer.MAX_VALUE); } + /** + * Implementation of subarray if no efficient override exists + * + * @param self ArrayBufferView instance + * @param begin0 begin index + * @param end0 end index + * + * @return sub array + */ protected static ScriptObject subarrayImpl(final Object self, final Object begin0, final Object end0) { final ArrayBufferView arrayView = (ArrayBufferView)self; final int byteOffset = arrayView.byteOffset; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/CompiledFunction.java --- a/src/jdk/nashorn/internal/runtime/CompiledFunction.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/CompiledFunction.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid; - import java.lang.invoke.CallSite; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -777,7 +776,7 @@ // Compiler needs a call site type as its input, which always has a callee parameter, so we must add it if // this function doesn't have a callee parameter. - final MethodType callSiteType = type.parameterType(0) == ScriptFunction.class ? + final MethodType ct = type.parameterType(0) == ScriptFunction.class ? type : type.insertParameterTypes(0, ScriptFunction.class); final OptimismInfo currentOptInfo = optimismInfo; @@ -788,29 +787,29 @@ final OptimismInfo effectiveOptInfo = currentOptInfo != null ? currentOptInfo : oldOptInfo; FunctionNode fn = effectiveOptInfo.reparse(); final boolean serialized = effectiveOptInfo.isSerialized(); - final Compiler compiler = effectiveOptInfo.getCompiler(fn, callSiteType, re); //set to non rest-of + final Compiler compiler = effectiveOptInfo.getCompiler(fn, ct, re); //set to non rest-of if (!shouldRecompile) { // It didn't necessarily recompile, e.g. for an outer invocation of a recursive function if we already // recompiled a deoptimized version for an inner invocation. // We still need to do the rest of from the beginning - logRecompile("Rest-of compilation [STANDALONE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); + logRecompile("Rest-of compilation [STANDALONE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); return restOfHandle(effectiveOptInfo, compiler.compile(fn, serialized ? CompilationPhases.COMPILE_SERIALIZED_RESTOF : CompilationPhases.COMPILE_ALL_RESTOF), currentOptInfo != null); } - logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); + logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); fn = compiler.compile(fn, serialized ? CompilationPhases.RECOMPILE_SERIALIZED_UPTO_BYTECODE : CompilationPhases.COMPILE_UPTO_BYTECODE); log.info("Reusable IR generated"); // compile the rest of the function, and install it log.info("Generating and installing bytecode from reusable IR..."); - logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); + logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); final FunctionNode normalFn = compiler.compile(fn, CompilationPhases.GENERATE_BYTECODE_AND_INSTALL); if (effectiveOptInfo.data.usePersistentCodeCache()) { final RecompilableScriptFunctionData data = effectiveOptInfo.data; final int functionNodeId = data.getFunctionNodeId(); - final TypeMap typeMap = data.typeMap(callSiteType); + final TypeMap typeMap = data.typeMap(ct); final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId); final String cacheKey = CodeStore.getCacheKey(functionNodeId, paramTypes); compiler.persistClassInfo(cacheKey, normalFn); @@ -871,6 +870,7 @@ private SwitchPoint optimisticAssumptions; private final DebugLogger log; + @SuppressWarnings("unused") OptimismInfo(final RecompilableScriptFunctionData data, final Map invalidatedProgramPoints) { this.data = data; this.log = data.getLogger(); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -475,6 +474,7 @@ * @return either the existing map, or a loaded map from the persistent type info cache, or a new empty map if * neither an existing map or a persistent cached type info is available. */ + @SuppressWarnings("unused") private static Map getEffectiveInvalidatedProgramPoints( final Map invalidatedProgramPoints, final Object typeInformationFile) { if(invalidatedProgramPoints != null) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/ScriptEnvironment.java --- a/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java Mon Nov 03 11:47:41 2014 +0100 @@ -212,6 +212,7 @@ * @param out output print writer * @param err error print writer */ + @SuppressWarnings("unused") public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) { this.out = out; this.err = err; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java --- a/src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java Mon Nov 03 11:47:41 2014 +0100 @@ -50,7 +50,6 @@ * {@link RewriteException#getReturnValueNonDestructive()} public, we pass it as * an extra parameter, rather than querying the getter from another package. */ - @SuppressWarnings("javadoc") public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) { super(level, rewriteException); assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() : diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java --- a/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,8 +25,10 @@ package jdk.nashorn.internal.runtime.linker; -import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.*; - +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETMEMBER; +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETSLOT; +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETMEMBER; +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETSLOT; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import jdk.internal.dynalink.CallSiteDescriptor; @@ -114,12 +116,10 @@ case "getMethod": if (c > 2) { return findGetMethod(desc); - } else { - // For indexed get, we want GuardedInvocation from beans linker and pass it. - // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access. - final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); - return findGetIndexMethod(beanInv); } + // For indexed get, we want GuardedInvocation from beans linker and pass it. + // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access. + return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices)); case "setProp": case "setElem": return c > 2 ? findSetMethod(desc) : findSetIndexMethod(); @@ -166,9 +166,8 @@ final String name = (String)key; if (name.indexOf('(') != -1) { return fallback.invokeExact(jsobj, key); - } else { - return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key); } + return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key); } return null; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java --- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Nov 03 11:47:41 2014 +0100 @@ -120,12 +120,10 @@ case "getMethod": if (c > 2) { return findGetMethod(desc); - } else { - // For indexed get, we want get GuardedInvocation beans linker and pass it. - // JSObjectLinker.get uses this fallback getter for explicit signature method access. - final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); - return findGetIndexMethod(beanInv); } + // For indexed get, we want get GuardedInvocation beans linker and pass it. + // JSObjectLinker.get uses this fallback getter for explicit signature method access. + return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices)); case "setProp": case "setElem": return c > 2 ? findSetMethod(desc) : findSetIndexMethod(); @@ -192,9 +190,8 @@ // get with method name and signature. delegate it to beans linker! if (name.indexOf('(') != -1) { return fallback.invokeExact(jsobj, key); - } else { - return ((JSObject)jsobj).getMember(name); } + return ((JSObject)jsobj).getMember(name); } return null; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline; import static jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode.newAltNode; import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; - import java.util.HashSet; import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode; import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode; @@ -53,6 +52,7 @@ super(env, chars, p, end); } + @SuppressWarnings("unused") protected final void compile() { if (Config.DEBUG) { Config.log.println(new String(chars, getBegin(), getEnd())); @@ -76,7 +76,9 @@ root = setupTree(root, 0); if (Config.DEBUG_PARSE_TREE) { - if (Config.DEBUG_PARSE_TREE_RAW) Config.log.println(""); + if (Config.DEBUG_PARSE_TREE_RAW) { + Config.log.println(""); + } root.verifyTree(new HashSet(), env.reg.warnings); Config.log.println(root + "\n"); } @@ -94,7 +96,9 @@ regex.clearOptimizeInfo(); - if (!Config.DONT_OPTIMIZE) setOptimizedInfoFromTree(root); + if (!Config.DONT_OPTIMIZE) { + setOptimizedInfoFromTree(root); + } env.memNodes = null; @@ -110,7 +114,9 @@ if (Config.DEBUG_COMPILE) { Config.log.println("stack used: " + regex.stackNeeded); - if (Config.USE_STRING_TEMPLATES) Config.log.print("templates: " + regex.templateNum + "\n"); + if (Config.USE_STRING_TEMPLATES) { + Config.log.print("templates: " + regex.templateNum + "\n"); + } Config.log.println(new ByteCodePrinter(regex).byteCodeListToString()); } // DEBUG_COMPILE @@ -136,7 +142,9 @@ ConsAltNode can = (ConsAltNode)node; do { final int v = quantifiersMemoryInfo(can.car); - if (v > info) info = v; + if (v > info) { + info = v; + } } while ((can = can.cdr) != null); break; @@ -182,7 +190,9 @@ switch (node.getType()) { case NodeType.BREF: final BackRefNode br = (BackRefNode)node; - if (br.isRecursion()) break; + if (br.isRecursion()) { + break; + } if (br.backRef > env.numMem) { throw new ValueException(ERR_INVALID_BACKREF); @@ -249,6 +259,9 @@ case EncloseType.STOP_BACKTRACK: min = getMinMatchLength(en.target); break; + + default: + break; } // inner switch break; @@ -276,7 +289,9 @@ ConsAltNode an = (ConsAltNode)node; do { final int tmax = getMaxMatchLength(an.car); - if (max < tmax) max = tmax; + if (max < tmax) { + max = tmax; + } } while ((an = an.cdr) != null); break; @@ -304,7 +319,9 @@ throw new ValueException(ERR_INVALID_BACKREF); } final int tmax = getMaxMatchLength(env.memNodes[br.backRef]); - if (max < tmax) max = tmax; + if (max < tmax) { + max = tmax; + } break; case NodeType.QTFR: @@ -338,6 +355,9 @@ case EncloseType.STOP_BACKTRACK: max = getMaxMatchLength(en.target); break; + + default: + break; } // inner switch break; @@ -355,8 +375,8 @@ return getCharLengthTree(node, 0); } - private int getCharLengthTree(final Node node, int level) { - level++; + private int getCharLengthTree(final Node node, final int levelp) { + final int level = levelp + 1; int len = 0; returnCode = 0; @@ -366,7 +386,9 @@ ConsAltNode ln = (ConsAltNode)node; do { final int tlen = getCharLengthTree(ln.car, level); - if (returnCode == 0) len = MinMaxLen.distanceAdd(len, tlen); + if (returnCode == 0) { + len = MinMaxLen.distanceAdd(len, tlen); + } } while (returnCode == 0 && (ln = ln.cdr) != null); break; @@ -378,7 +400,9 @@ while (returnCode == 0 && (an = an.cdr) != null) { final int tlen2 = getCharLengthTree(an.car, level); if (returnCode == 0) { - if (tlen != tlen2) varLen = true; + if (tlen != tlen2) { + varLen = true; + } } } @@ -404,7 +428,9 @@ final QuantifierNode qn = (QuantifierNode)node; if (qn.lower == qn.upper) { tlen = getCharLengthTree(qn.target, level); - if (returnCode == 0) len = MinMaxLen.distanceMultiply(tlen, qn.lower); + if (returnCode == 0) { + len = MinMaxLen.distanceMultiply(tlen, qn.lower); + } } else { returnCode = GET_CHAR_LEN_VARLEN; } @@ -435,6 +461,9 @@ case EncloseType.STOP_BACKTRACK: len = getCharLengthTree(en.target, level); break; + + default: + break; } // inner switch break; @@ -448,7 +477,9 @@ } /* x is not included y ==> 1 : 0 */ - private boolean isNotIncluded(Node x, Node y) { + private static boolean isNotIncluded(final Node xn, final Node yn) { + Node x = xn; + Node y = yn; Node tmp; // !retry:! @@ -492,10 +523,14 @@ boolean v = xc.bs.at(i); if ((v && !xc.isNot()) || (!v && xc.isNot())) { v = yc.bs.at(i); - if ((v && !yc.isNot()) || (!v && yc.isNot())) return false; + if ((v && !yc.isNot()) || (!v && yc.isNot())) { + return false; + } } } - if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) return true; + if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) { + return true; + } return false; // break; not reached @@ -514,7 +549,9 @@ case NodeType.STR: final StringNode xs = (StringNode)x; - if (xs.length() == 0) break; + if (xs.length() == 0) { + break; + } switch (yType) { @@ -526,13 +563,16 @@ case NodeType.STR: final StringNode ys = (StringNode)y; int len = xs.length(); - if (len > ys.length()) len = ys.length(); + if (len > ys.length()) { + len = ys.length(); + } if (xs.isAmbig() || ys.isAmbig()) { /* tiny version */ return false; - } else { - for (int i=0, p=ys.p, q=xs.p; i (?<=A)|(?<=B) (? (?= sbuf.length) { final char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); @@ -798,8 +862,8 @@ updateStringNodeCaseFoldMultiByte(sn); } - private Node expandCaseFoldMakeRemString(final char[] chars, final int p, final int end) { - final StringNode node = new StringNode(chars, p, end); + private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) { + final StringNode node = new StringNode(ch, pp, end); updateStringNodeCaseFold(node); node.setAmbig(); @@ -807,7 +871,7 @@ return node; } - private boolean expandCaseFoldStringAlt(final int itemNum, final char[] items, + private static boolean expandCaseFoldStringAlt(final int itemNum, final char[] items, final char[] chars, final int p, final int slen, final int end, final ObjPtr node) { ConsAltNode altNode; @@ -833,59 +897,68 @@ private Node expandCaseFoldString(final Node node) { final StringNode sn = (StringNode)node; - if (sn.isAmbig() || sn.length() <= 0) return node; + if (sn.isAmbig() || sn.length() <= 0) { + return node; + } - final char[] chars = sn.chars; - int p = sn.p; + final char[] chars1 = sn.chars; + int pt = sn.p; final int end = sn.end; int altNum = 1; - ConsAltNode topRoot = null, root = null; + ConsAltNode topRoot = null, r = null; + @SuppressWarnings("unused") final ObjPtr prevNode = new ObjPtr(); StringNode stringNode = null; - while (p < end) { - final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars[p]); + while (pt < end) { + final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]); if (items.length == 0) { if (stringNode == null) { - if (root == null && prevNode.p != null) { - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); + if (r == null && prevNode.p != null) { + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL); - if (root != null) ConsAltNode.listAdd(root, stringNode); + if (r != null) { + ConsAltNode.listAdd(r, stringNode); + } } - stringNode.cat(chars, p, p + 1); + stringNode.cat(chars1, pt, pt + 1); } else { altNum *= (items.length + 1); - if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break; - - if (root == null && prevNode.p != null) { - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); + if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) { + break; } - expandCaseFoldStringAlt(items.length, items, chars, p, 1, end, prevNode); - if (root != null) ConsAltNode.listAdd(root, prevNode.p); + if (r == null && prevNode.p != null) { + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); + } + + expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode); + if (r != null) { + ConsAltNode.listAdd(r, prevNode.p); + } stringNode = null; } - p++; + pt++; } - if (p < end) { - final Node srem = expandCaseFoldMakeRemString(chars, p, end); + if (pt < end) { + final Node srem = expandCaseFoldMakeRemString(chars1, pt, end); - if (prevNode.p != null && root == null) { - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); + if (prevNode.p != null && r == null) { + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } - if (root == null) { + if (r == null) { prevNode.p = srem; } else { - ConsAltNode.listAdd(root, srem); + ConsAltNode.listAdd(r, srem); } } /* ending */ @@ -909,7 +982,10 @@ 5. find invalid patterns in look-behind. 6. expand repeated string. */ - protected final Node setupTree(Node node, int state) { + protected final Node setupTree(final Node nodep, final int statep) { + Node node = nodep; + int state = statep; + restart: while (true) { switch (node.getType()) { case NodeType.LIST: @@ -958,7 +1034,9 @@ final QuantifierNode qn = (QuantifierNode)node; Node target = qn.target; - if ((state & IN_REPEAT) != 0) qn.setInRepeat(); + if ((state & IN_REPEAT) != 0) { + qn.setInRepeat(); + } if (isRepeatInfinite(qn.upper) || qn.lower >= 1) { final int d = getMinMatchLength(target); @@ -966,14 +1044,18 @@ qn.targetEmptyInfo = TargetInfo.IS_EMPTY; if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) { final int info = quantifiersMemoryInfo(target); - if (info > 0) qn.targetEmptyInfo = info; + if (info > 0) { + qn.targetEmptyInfo = info; + } } // USE_INFINITE_REPEAT_MONOMANIAC_MEM_STATUS_CHECK // strange stuff here (turned off) } } state |= IN_REPEAT; - if (qn.lower != qn.upper) state |= IN_VAR_REPEAT; + if (qn.lower != qn.upper) { + state |= IN_VAR_REPEAT; + } target = setupTree(target, state); @@ -1035,11 +1117,16 @@ final QuantifierNode tqn = (QuantifierNode)en.target; if (isRepeatInfinite(tqn.upper) && tqn.lower <= 1 && tqn.greedy) { /* (?>a*), a*+ etc... */ - if (tqn.target.isSimple()) en.setStopBtSimpleRepeat(); + if (tqn.target.isSimple()) { + en.setStopBtSimpleRepeat(); + } } } break; + default: + break; + } // inner switch break; @@ -1059,7 +1146,9 @@ throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); } node = setupLookBehind(node); - if (node.getType() != NodeType.ANCHOR) continue restart; + if (node.getType() != NodeType.ANCHOR) { + continue restart; + } setupTree(((AnchorNode)node).target, state); break; @@ -1068,12 +1157,19 @@ throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); } node = setupLookBehind(node); - if (node.getType() != NodeType.ANCHOR) continue restart; + if (node.getType() != NodeType.ANCHOR) { + continue restart; + } setupTree(((AnchorNode)node).target, (state | IN_NOT)); break; + default: + break; + } // inner switch break; + default: + break; } // switch return node; } // restart: while @@ -1191,7 +1287,9 @@ opt.expr.copy(nopt.exm); } opt.expr.reachEnd = false; - if (nopt.map.value > 0) opt.map.copy(nopt.map); + if (nopt.map.value > 0) { + opt.map.copy(nopt.map); + } break; case AnchorType.PREC_READ_NOT: @@ -1199,6 +1297,9 @@ case AnchorType.LOOK_BEHIND_NOT: break; + default: + break; + } // inner switch break; } @@ -1282,8 +1383,12 @@ if (++en.optCount > MAX_NODE_OPT_INFO_REF_COUNT) { int min = 0; int max = MinMaxLen.INFINITE_DISTANCE; - if (en.isMinFixed()) min = en.minLength; - if (en.isMaxFixed()) max = en.maxLength; + if (en.isMinFixed()) { + min = en.minLength; + } + if (en.isMaxFixed()) { + max = en.maxLength; + } opt.length.set(min, max); } else { // USE_SUBEXP_CALL optimizeNodeLeft(en.target, opt, oenv); @@ -1298,6 +1403,9 @@ case EncloseType.STOP_BACKTRACK: optimizeNodeLeft(en.target, opt, oenv); break; + + default: + break; } // inner switch break; } @@ -1307,6 +1415,7 @@ } // switch } + @SuppressWarnings("unused") protected final void setOptimizedInfoFromTree(final Node node) { final NodeOptInfo opt = new NodeOptInfo(); final OptEnvironment oenv = new OptEnvironment(); @@ -1347,7 +1456,9 @@ regex.setSubAnchor(opt.map.anchor); } else { regex.subAnchor |= opt.anchor.leftAnchor & AnchorType.BEGIN_LINE; - if (opt.length.max == 0) regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE; + if (opt.length.max == 0) { + regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE; + } } if (Config.DEBUG_COMPILE || Config.DEBUG_MATCH) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Mon Nov 03 11:47:41 2014 +0100 @@ -24,7 +24,7 @@ final class ApplyCaseFold { // i_apply_case_fold - public void apply(final int from, final int to, final Object o) { + public static void apply(final int from, final int to, final Object o) { final ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o; final ScanEnvironment env = arg.env; @@ -45,7 +45,9 @@ } else { if (inCC) { if (to >= BitSet.SINGLE_BYTE_SIZE) { - if (cc.isNot()) cc.clearNotFlag(); + if (cc.isNot()) { + cc.clearNotFlag(); + } cc.addCodeRange(env, to, to); } else { if (cc.isNot()) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java Mon Nov 03 11:47:41 2014 +0100 @@ -22,6 +22,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode; +@SuppressWarnings("javadoc") public final class ApplyCaseFoldArg { final ScanEnvironment env; final CClassNode cc; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java Mon Nov 03 11:47:41 2014 +0100 @@ -24,7 +24,6 @@ import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase; import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline; import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; - import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode; import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode; import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; @@ -98,15 +97,15 @@ } while ((aln = aln.cdr) != null); } - private boolean isNeedStrLenOpExact(final int op) { + private static boolean isNeedStrLenOpExact(final int op) { return op == OPCode.EXACTN || op == OPCode.EXACTN_IC; } - private boolean opTemplated(final int op) { + private static boolean opTemplated(final int op) { return isNeedStrLenOpExact(op); } - private int selectStrOpcode(final int strLength, final boolean ignoreCase) { + private static int selectStrOpcode(final int strLength, final boolean ignoreCase) { int op; if (ignoreCase) { @@ -139,7 +138,7 @@ compileTree(node); if (emptyInfo != 0) { - switch(emptyInfo) { + switch (emptyInfo) { case TargetInfo.IS_EMPTY: addOpcode(OPCode.NULL_CHECK_END); break; @@ -149,13 +148,15 @@ case TargetInfo.IS_EMPTY_REC: addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH); break; + default: + break; } // switch addMemNum(savedNumNullCheck); /* NULL CHECK ID */ } } - private int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) { + private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) { final int op = selectStrOpcode(strLength, ignoreCase); int len = OPSize.OPCODE; @@ -163,7 +164,9 @@ // string length, template index, template string pointer len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX; } else { - if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH; + if (isNeedStrLenOpExact(op)) { + len += OPSize.LENGTH; + } len += strLength; } return len; @@ -187,9 +190,11 @@ } } - private int compileLengthStringNode(final Node node) { + private static int compileLengthStringNode(final Node node) { final StringNode sn = (StringNode)node; - if (sn.length() <= 0) return 0; + if (sn.length() <= 0) { + return 0; + } final boolean ambig = sn.isAmbig(); int p, prev; @@ -210,8 +215,10 @@ return rlen; } - private int compileLengthStringRawNode(final StringNode sn) { - if (sn.length() <= 0) return 0; + private static int compileLengthStringRawNode(final StringNode sn) { + if (sn.length() <= 0) { + return 0; + } return addCompileStringlength(sn.chars, sn.p, sn.length(), false); } @@ -220,8 +227,10 @@ addInts(mbuf.p, mbuf.used); } - private int compileLengthCClassNode(final CClassNode cc) { - if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER; + private static int compileLengthCClassNode(final CClassNode cc) { + if (cc.isShare()) { + return OPSize.OPCODE + OPSize.POINTER; + } int len; if (cc.mbuf == null) { @@ -360,9 +369,8 @@ if (qn.greedy && infinite) { if (qn.nextHeadExact != null) { return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower; - } else { - return OPSize.ANYCHAR_STAR + tlen * qn.lower; } + return OPSize.ANYCHAR_STAR + tlen * qn.lower; } } @@ -425,14 +433,13 @@ final StringNode sn = (StringNode)qn.nextHeadExact; addChars(sn.chars, sn.p, 1); return; + } + if (isMultiline(regex.options)) { + addOpcode(OPCode.ANYCHAR_ML_STAR); } else { - if (isMultiline(regex.options)) { - addOpcode(OPCode.ANYCHAR_ML_STAR); - } else { - addOpcode(OPCode.ANYCHAR_STAR); - } - return; + addOpcode(OPCode.ANYCHAR_STAR); } + return; } int modTLen; @@ -510,9 +517,8 @@ if (isDynamic(prev ^ node.option)) { return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION; - } else { - return tlen; } + return tlen; } @Override @@ -675,13 +681,15 @@ break; case AnchorType.WORD_BEGIN: - if (Config.USE_WORD_BEGIN_END) + if (Config.USE_WORD_BEGIN_END) { addOpcode(OPCode.WORD_BEGIN); + } break; case AnchorType.WORD_END: - if (Config.USE_WORD_BEGIN_END) + if (Config.USE_WORD_BEGIN_END) { addOpcode(OPCode.WORD_END); + } break; case AnchorType.PREC_READ: @@ -701,7 +709,9 @@ addOpcode(OPCode.LOOK_BEHIND); if (node.charLength < 0) { n = analyser.getCharLengthTree(node.target); - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (analyser.returnCode != 0) { + newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + } } else { n = node.charLength; } @@ -714,7 +724,9 @@ addOpcodeRelAddr(OPCode.PUSH_LOOK_BEHIND_NOT, len + OPSize.FAIL_LOOK_BEHIND_NOT); if (node.charLength < 0) { n = analyser.getCharLengthTree(node.target); - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (analyser.returnCode != 0) { + newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + } } else { n = node.charLength; } @@ -796,7 +808,9 @@ private void ensure(final int size) { if (size >= code.length) { int length = code.length << 1; - while (length <= size) length <<= 1; + while (length <= size) { + length <<= 1; + } final int[]tmp = new int[length]; System.arraycopy(code, 0, tmp, 0, code.length); code = tmp; @@ -829,11 +843,14 @@ regex.operands[regex.operandLength++] = o; } - private void addChars(final char[] chars, int p ,final int length) { + private void addChars(final char[] chars, final int pp ,final int length) { ensure(codeLength + length); + int p = pp; final int end = p + length; - while (p < end) code[codeLength++] = chars[p++]; + while (p < end) { + code[codeLength++] = chars[p++]; + } } private void addInts(final int[]ints, final int length) { @@ -876,6 +893,9 @@ case OPCode.CALL: case OPCode.RETURN: // it will appear only with CALL though regex.stackNeeded = true; + break; + default: + break; } } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; +@SuppressWarnings("javadoc") public final class BitSet { static final int BITS_PER_BYTE = 8; public static final int SINGLE_BYTE_SIZE = (1 << BITS_PER_BYTE); @@ -34,7 +35,9 @@ final StringBuilder buffer = new StringBuilder(); buffer.append("BitSet"); for (int i=0; i>>= 1) != 0) log++; + int n = np; + while ((n >>>= 1) != 0) { + log++; + } return log; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java Mon Nov 03 11:47:41 2014 +0100 @@ -34,7 +34,8 @@ return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0; } - public static int bsOnAt(int stats, final int n) { + public static int bsOnAt(final int statsp, final int n) { + int stats = statsp; if (n < BIT_STATUS_BITS_NUM) { stats |= (1 << n); } else { @@ -43,12 +44,7 @@ return stats; } - public static int bsOnOff(int v, final int f, final boolean negative) { - if (negative) { - v &= ~f; - } else { - v |= f; - } - return v; + public static int bsOnOff(final int v, final int f, final boolean negative) { + return negative ? (v & ~f) : (v | f); } } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,10 +27,8 @@ import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotBol; import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotEol; import static jdk.nashorn.internal.runtime.regexp.joni.Option.isPosixRegion; - import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; import jdk.nashorn.internal.runtime.regexp.joni.constants.OPCode; -import jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize; import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException; @@ -52,8 +50,8 @@ this.code = regex.code; } - private boolean stringCmpIC(final int caseFlodFlag, int s1, final IntHolder ps2, final int mbLen, final int textEnd) { - + private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) { + int s1 = s1p; int s2 = ps2.value; final int end1 = s1 + mbLen; @@ -83,12 +81,16 @@ Config.log.printf("%4d", (s - str)).print("> \""); int q, i; for (i=0, q=s; i<7 && q=0; i++) { - if (q < end) Config.log.print(new String(new char[]{chars[q++]})); + if (q < end) { + Config.log.print(new String(new char[]{chars[q++]})); + } } - final String str = q < end ? "...\"" : "\""; - q += str.length(); - Config.log.print(str); - for (i=0; i<20-(q-s);i++) Config.log.print(" "); + final String string = q < end ? "...\"" : "\""; + q += string.length(); + Config.log.print(string); + for (i=0; i<20-(q-s);i++) { + Config.log.print(" "); + } final StringBuilder sb = new StringBuilder(); new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip); Config.log.println(sb.toString()); @@ -96,28 +98,34 @@ } @Override - protected final int matchAt(final int range, final int sstart, final int sprev) { - this.range = range; - this.sstart = sstart; - this.sprev = sprev; + protected final int matchAt(final int r, final int ss, final int sp) { + this.range = r; + this.sstart = ss; + this.sprev = sp; stk = 0; ip = 0; - if (Config.DEBUG_MATCH) debugMatchBegin(); + if (Config.DEBUG_MATCH) { + debugMatchBegin(); + } init(); bestLen = -1; - s = sstart; + s = ss; - final int[]code = this.code; + final int[] c = this.code; while (true) { - if (Config.DEBUG_MATCH) debugMatchLoop(); + if (Config.DEBUG_MATCH) { + debugMatchLoop(); + } sbegin = s; - switch (code[ip++]) { - case OPCode.END: if (opEnd()) return finish(); break; + switch (c[ip++]) { + case OPCode.END: if (opEnd()) { + return finish(); + } break; case OPCode.EXACT1: opExact1(); break; case OPCode.EXACT2: opExact2(); continue; case OPCode.EXACT3: opExact3(); continue; @@ -358,10 +366,14 @@ final char[] bs = regex.templates[code[ip++]]; int ps = code[ip++]; - while (tlen-- > 0) if (bs[ps++] != chars[s++]) {opFail(); return;} + while (tlen-- > 0) { + if (bs[ps++] != chars[s++]) {opFail(); return;} + } } else { - while (tlen-- > 0) if (code[ip++] != chars[s++]) {opFail(); return;} + while (tlen-- > 0) { + if (code[ip++] != chars[s++]) {opFail(); return;} + } } sprev = s - 1; } @@ -380,10 +392,14 @@ final char[] bs = regex.templates[code[ip++]]; int ps = code[ip++]; - while (tlen-- > 0) if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} + while (tlen-- > 0) { + if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} + } } else { - while (tlen-- > 0) if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} + while (tlen-- > 0) { + if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} + } } sprev = s - 1; } @@ -402,11 +418,15 @@ private boolean isInClassMB() { final int tlen = code[ip++]; - if (s >= range) return false; + if (s >= range) { + return false; + } final int ss = s; s++; final int c = chars[ss]; - if (!EncodingHelper.isInCodeRange(code, ip, c)) return false; + if (!EncodingHelper.isInCodeRange(code, ip, c)) { + return false; + } ip += tlen; return true; } @@ -444,7 +464,9 @@ final int tlen = code[ip++]; if (!(s + 1 <= range)) { - if (s >= range) return false; + if (s >= range) { + return false; + } s = end; ip += tlen; return true; @@ -454,7 +476,9 @@ s++; final int c = chars[ss]; - if (EncodingHelper.isInCodeRange(code, ip, c)) return false; + if (EncodingHelper.isInCodeRange(code, ip, c)) { + return false; + } ip += tlen; return true; } @@ -511,10 +535,10 @@ } private void opAnyCharStar() { - final char[] chars = this.chars; + final char[] ch = this.chars; while (s < range) { pushAlt(ip, s, sprev); - if (isNewLine(chars, s, end)) {opFail(); return;} + if (isNewLine(ch, s, end)) {opFail(); return;} sprev = s; s++; } @@ -532,11 +556,13 @@ private void opAnyCharStarPeekNext() { final char c = (char)code[ip]; - final char[] chars = this.chars; + final char[] ch = this.chars; while (s < range) { - final char b = chars[s]; - if (c == b) pushAlt(ip + 1, s, sprev); + final char b = ch[s]; + if (c == b) { + pushAlt(ip + 1, s, sprev); + } if (isNewLine(b)) {opFail(); return;} sprev = s; s++; @@ -547,10 +573,12 @@ private void opAnyCharMLStarPeekNext() { final char c = (char)code[ip]; - final char[] chars = this.chars; + final char[] ch = this.chars; while (s < range) { - if (c == chars[s]) pushAlt(ip + 1, s, sprev); + if (c == ch[s]) { + pushAlt(ip + 1, s, sprev); + } sprev = s; s++; } @@ -592,29 +620,39 @@ private void opWordBegin() { if (s < range && EncodingHelper.isWord(chars[s])) { - if (s == str || !EncodingHelper.isWord(chars[sprev])) return; + if (s == str || !EncodingHelper.isWord(chars[sprev])) { + return; + } } opFail(); } private void opWordEnd() { if (s != str && EncodingHelper.isWord(chars[sprev])) { - if (s == end || !EncodingHelper.isWord(chars[s])) return; + if (s == end || !EncodingHelper.isWord(chars[s])) { + return; + } } opFail(); } private void opBeginBuf() { - if (s != str) opFail(); + if (s != str) { + opFail(); + } } private void opEndBuf() { - if (s != end) opFail(); + if (s != end) { + opFail(); + } } private void opBeginLine() { if (s == str) { - if (isNotBol(msaOptions)) opFail(); + if (isNotBol(msaOptions)) { + opFail(); + } return; } else if (isNewLine(chars, sprev, end) && s != end) { return; @@ -626,13 +664,16 @@ if (s == end) { if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { if (str == end || !isNewLine(chars, sprev, end)) { - if (isNotEol(msaOptions)) opFail(); + if (isNotEol(msaOptions)) { + opFail(); + } } return; - } else { - if (isNotEol(msaOptions)) opFail(); - return; } + if (isNotEol(msaOptions)) { + opFail(); + } + return; } else if (isNewLine(chars, s, end)) { return; } @@ -643,13 +684,16 @@ if (s == end) { if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { if (str == end || !isNewLine(chars, sprev, end)) { - if (isNotEol(msaOptions)) opFail(); + if (isNotEol(msaOptions)) { + opFail(); + } } return; - } else { - if (isNotEol(msaOptions)) opFail(); - return; } + if (isNotEol(msaOptions)) { + opFail(); + } + return; } else if (isNewLine(chars, s, end) && s + 1 == end) { return; } @@ -657,7 +701,9 @@ } private void opBeginPosition() { - if (s != msaStart) opFail(); + if (s != msaStart) { + opFail(); + } } private void opMemoryStartPush() { @@ -726,11 +772,15 @@ sprev = s; // STRING_CMP - while(n-- > 0) if (chars[pstart++] != chars[s++]) {opFail(); return;} + while(n-- > 0) { + if (chars[pstart++] != chars[s++]) {opFail(); return;} + } // beyond string check if (sprev < range) { - while (sprev + 1 < s) sprev++; + while (sprev + 1 < s) { + sprev++; + } } } @@ -764,7 +814,9 @@ s = value; // if (sprev < chars.length) - while (sprev + 1 < s) sprev++; + while (sprev + 1 < s) { + sprev++; + } } private void opBackRefMulti() { @@ -773,7 +825,9 @@ int i; loop:for (i=0; i 0) { - if (chars[pstart++] != chars[swork++]) continue loop; + if (chars[pstart++] != chars[swork++]) { + continue loop; + } } s = swork; // beyond string check if (sprev < range) { - while (sprev + 1 < s) sprev++; + while (sprev + 1 < s) { + sprev++; + } } ip += tlen - i - 1; // * SIZE_MEMNUM (1) @@ -807,7 +865,9 @@ int i; loop:for (i=0; i end - s) return false; /* or goto next_mem; */ + if (pend - pstart > end - s) { + return false; /* or goto next_mem; */ + } int p = pstart; value = s; @@ -867,7 +936,9 @@ } } else { while (p < pend) { - if (chars[p++] != chars[value++]) return false; /* or goto next_mem; */ + if (chars[p++] != chars[value++]) { + return false; /* or goto next_mem; */ + } } } s = value; @@ -893,24 +964,15 @@ sprev = s; if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit - while (sprev + 1 < s) sprev++; + while (sprev + 1 < s) { + sprev++; + } ip += tlen; // * SIZE_MEMNUM } else { {opFail(); return;} } } - /* no need: IS_DYNAMIC_OPTION() == 0 */ - private void opSetOptionPush() { - // option = code[ip++]; // final for now - pushAlt(ip, s, sprev); - ip += OPSize.SET_OPTION + OPSize.FAIL; - } - - private void opSetOption() { - // option = code[ip++]; // final for now - } - private void opNullCheckStart() { final int mem = code[ip++]; pushNullCheckStart(mem, s); @@ -1142,13 +1204,6 @@ sprev = EncodingHelper.prevCharHead(str, s); } - private void opLookBehindSb() { - final int tlen = code[ip++]; - s -= tlen; - if (s < str) {opFail(); return;} - sprev = s == str ? -1 : s - 1; - } - private void opPushLookBehindNot() { final int addr = code[ip++]; final int tlen = code[ip++]; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java Mon Nov 03 11:47:41 2014 +0100 @@ -236,16 +236,17 @@ sb.append(new String(code, s, len)); } - private void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) { + private static void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) { sb.append(":T:").append(len).append(":"); sb.append(tm, idx, len); } - public int compiledByteCodeToString(final StringBuilder sb, int bp) { + public int compiledByteCodeToString(final StringBuilder sb, final int bptr) { int len, n, mem, addr, scn, cod; BitSet bs; CClassNode cc; int tm, idx; + int bp = bptr; sb.append("[").append(OpCodeNames[code[bp]]); final int argType = OpCodeArgTypes[code[bp]]; @@ -253,6 +254,7 @@ if (argType != Arguments.SPECIAL) { bp++; switch (argType) { + default: case Arguments.NON: break; @@ -410,7 +412,9 @@ for (int i=0; i 0) sb.append(", "); + if (i > 0) { + sb.append(", "); + } sb.append(mem); } break; @@ -428,7 +432,9 @@ for (int i=0; i 0) sb.append(", "); + if (i > 0) { + sb.append(", "); + } sb.append(mem); } break; @@ -501,7 +507,9 @@ while (bp < end) { ncode++; - if (bp > 0) sb.append(ncode % 5 == 0 ? "\n" : " "); + if (bp > 0) { + sb.append(ncode % 5 == 0 ? "\n" : " "); + } bp = compiledByteCodeToString(sb, bp); } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java Mon Nov 03 11:47:41 2014 +0100 @@ -22,6 +22,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; +@SuppressWarnings("javadoc") public final class CodeRangeBuffer implements Cloneable { private static final int INIT_MULTI_BYTE_RANGE_SIZE = 5; private static final int ALL_MULTI_BYTE_RANGE = 0x7fffffff; @@ -68,7 +69,9 @@ for (int i=0; i 0 && i % 6 == 0) buf.append("\n "); + if (i > 0 && i % 6 == 0) { + buf.append("\n "); + } } return buf.toString(); @@ -97,9 +100,13 @@ } private void moveRight(final int from, final int to, final int n) { - if (to + n > p.length) expand(to + n); + if (to + n > p.length) { + expand(to + n); + } System.arraycopy(p, from, p, to, n); - if (to + n > used) used = to + n; + if (to + n > used) { + used = to + n; + } } protected void moveLeft(final int from, final int to, final int n) { @@ -113,9 +120,13 @@ public void writeCodePoint(final int pos, final int b) { final int u = pos + 1; - if (p.length < u) expand(u); + if (p.length < u) { + expand(u); + } p[pos] = b; - if (used < u) used = u; + if (used < u) { + used = u; + } } @Override @@ -125,14 +136,19 @@ // ugly part: these methods should be made OO // add_code_range_to_buf - public static CodeRangeBuffer addCodeRangeToBuff(CodeRangeBuffer pbuf, int from, int to) { + public static CodeRangeBuffer addCodeRangeToBuff(final CodeRangeBuffer pbufp, final int fromp, final int top) { + int from = fromp, to = top; + CodeRangeBuffer pbuf = pbufp; + if (from > to) { final int n = from; from = to; to = n; } - if (pbuf == null) pbuf = new CodeRangeBuffer(); // move to CClassNode + if (pbuf == null) { + pbuf = new CodeRangeBuffer(); // move to CClassNode + } final int[]p = pbuf.p; int n = p[0]; @@ -163,11 +179,17 @@ final int incN = low + 1 - high; - if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES); + if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) { + throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES); + } if (incN != 1) { - if (from > p[low * 2 + 1]) from = p[low * 2 + 1]; - if (to < p[(high - 1) * 2 + 2]) to = p[(high - 1) * 2 + 2]; + if (from > p[low * 2 + 1]) { + from = p[low * 2 + 1]; + } + if (to < p[(high - 1) * 2 + 2]) { + to = p[(high - 1) * 2 + 2]; + } } if (incN != 0 && high < n) { @@ -197,9 +219,8 @@ if (from > to) { if (env.syntax.allowEmptyRangeInCC()) { return pbuf; - } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } return addCodeRangeToBuff(pbuf, from, to); } @@ -218,12 +239,16 @@ public static CodeRangeBuffer notCodeRangeBuff(final CodeRangeBuffer bbuf) { CodeRangeBuffer pbuf = null; - if (bbuf == null) return setAllMultiByteRange(pbuf); + if (bbuf == null) { + return setAllMultiByteRange(pbuf); + } final int[]p = bbuf.p; final int n = p[0]; - if (n <= 0) return setAllMultiByteRange(pbuf); + if (n <= 0) { + return setAllMultiByteRange(pbuf); + } int pre = EncodingHelper.mbcodeStartPosition(); @@ -235,18 +260,26 @@ if (pre <= from - 1) { pbuf = addCodeRangeToBuff(pbuf, pre, from - 1); } - if (to == ALL_MULTI_BYTE_RANGE) break; + if (to == ALL_MULTI_BYTE_RANGE) { + break; + } pre = to + 1; } - if (to < ALL_MULTI_BYTE_RANGE) pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE); + if (to < ALL_MULTI_BYTE_RANGE) { + pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE); + } return pbuf; } // or_code_range_buf - public static CodeRangeBuffer orCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1, - CodeRangeBuffer bbuf2, boolean not2) { + public static CodeRangeBuffer orCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p, + final CodeRangeBuffer bbuf2p, final boolean not2p) { CodeRangeBuffer pbuf = null; + CodeRangeBuffer bbuf1 = bbuf1p; + CodeRangeBuffer bbuf2 = bbuf2p; + boolean not1 = not1p; + boolean not2 = not2p; if (bbuf1 == null && bbuf2 == null) { if (not1 || not2) { @@ -266,13 +299,11 @@ if (bbuf1 == null) { if (not1) { return setAllMultiByteRange(pbuf); - } else { - if (!not2) { - return bbuf2.clone(); - } else { - return notCodeRangeBuff(bbuf2); - } } + if (!not2) { + return bbuf2.clone(); + } + return notCodeRangeBuff(bbuf2); } if (not1) { @@ -302,16 +333,18 @@ } // and_code_range1 - public static CodeRangeBuffer andCodeRange1(CodeRangeBuffer pbuf, int from1, int to1, final int[]data, final int n) { + public static CodeRangeBuffer andCodeRange1(final CodeRangeBuffer pbufp, final int from1p, final int to1p, final int[]data, final int n) { + CodeRangeBuffer pbuf = pbufp; + int from1 = from1p, to1 = to1p; + for (int i=0; i to1) break; + if (from1 > to1) { + break; + } } if (from1 <= to1) { @@ -335,15 +370,22 @@ } // and_code_range_buf - public static CodeRangeBuffer andCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1, - CodeRangeBuffer bbuf2, boolean not2) { + public static CodeRangeBuffer andCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p, + final CodeRangeBuffer bbuf2p, final boolean not2p) { CodeRangeBuffer pbuf = null; + CodeRangeBuffer bbuf1 = bbuf1p; + CodeRangeBuffer bbuf2 = bbuf2p; + boolean not1 = not1p, not2 = not2p; if (bbuf1 == null) { - if (not1 && bbuf2 != null) return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */ + if (not1 && bbuf2 != null) { + return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */ + } return null; } else if (bbuf2 == null) { - if (not2) return bbuf1.clone(); + if (not2) { + return bbuf1.clone(); + } return null; } @@ -369,8 +411,12 @@ final int from2 = p2[j * 2 + 1]; final int to2 = p2[j * 2 + 2]; - if (from2 > to1) break; - if (to2 < from1) continue; + if (from2 > to1) { + break; + } + if (to2 < from1) { + continue; + } final int from = from1 > from2 ? from1 : from2; final int to = to1 < to2 ? to1 : to2; pbuf = addCodeRangeToBuff(pbuf, from, to); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java Mon Nov 03 11:47:41 2014 +0100 @@ -53,13 +53,17 @@ protected abstract void compileAltNode(ConsAltNode node); private void compileStringRawNode(final StringNode sn) { - if (sn.length() <= 0) return; + if (sn.length() <= 0) { + return; + } addCompileString(sn.chars, sn.p, sn.length(), false); } private void compileStringNode(final StringNode node) { final StringNode sn = node; - if (sn.length() <= 0) return; + if (sn.length() <= 0) { + return; + } final boolean ambig = sn.isAmbig(); @@ -145,7 +149,9 @@ } protected final void compileTreeNTimes(final Node node, final int n) { - for (int i=0; i 0) { - if (s <= p) return -1; + public static int stepBack(final int p, final int sp, final int np) { + int s = sp, n = np; + while (s != -1 && n-- > 0) { + if (s <= p) { + return -1; + } s--; } return s; @@ -122,7 +128,7 @@ final int upper = toUpperCase(c); if (upper != c) { - fun.apply(c, upper, arg); + ApplyCaseFold.apply(c, upper, arg); } } } @@ -133,7 +139,7 @@ final int upper = toUpperCase(c); if (upper != c) { - fun.apply(upper, c, arg); + ApplyCaseFold.apply(upper, c, arg); } } } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java Mon Nov 03 11:47:41 2014 +0100 @@ -21,7 +21,6 @@ import static jdk.nashorn.internal.runtime.regexp.joni.Option.isSingleline; import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; - import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode; import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; import jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar; @@ -53,9 +52,8 @@ if (!left()) { if (synAllow) { return 1; /* "....{" : OK! */ - } else { - throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); } + throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); } if (!synAllow) { @@ -83,7 +81,9 @@ } } - if (!left()) return invalidRangeQuantifier(synAllow); + if (!left()) { + return invalidRangeQuantifier(synAllow); + } fetch(); int up; @@ -99,25 +99,35 @@ } if (p == prev) { - if (nonLow) return invalidRangeQuantifier(synAllow); + if (nonLow) { + return invalidRangeQuantifier(synAllow); + } up = QuantifierNode.REPEAT_INFINITE; /* {n,} : {n,infinite} */ } } else { - if (nonLow) return invalidRangeQuantifier(synAllow); + if (nonLow) { + return invalidRangeQuantifier(synAllow); + } unfetch(); up = low; /* {n} : exact n times */ ret = 2; /* fixed */ } - if (!left()) return invalidRangeQuantifier(synAllow); + if (!left()) { + return invalidRangeQuantifier(synAllow); + } fetch(); if (syntax.opEscBraceInterval()) { - if (c != syntax.metaCharTable.esc) return invalidRangeQuantifier(synAllow); + if (c != syntax.metaCharTable.esc) { + return invalidRangeQuantifier(synAllow); + } fetch(); } - if (c != '}') return invalidRangeQuantifier(synAllow); + if (c != '}') { + return invalidRangeQuantifier(synAllow); + } if (!isRepeatInfinite(up) && low > up) { throw new ValueException(ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); @@ -134,9 +144,8 @@ if (synAllow) { restore(); return 1; - } else { - throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); } + throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); } @SuppressWarnings("fallthrough") @@ -218,17 +227,6 @@ } } - private int nameEndCodePoint(final int start) { - switch(start) { - case '<': - return '>'; - case '\'': - return '\''; - default: - return 0; - } - } - private void fetchTokenInCCFor_charType(final boolean flag, final int type) { token.type = TokenType.CHAR_TYPE; token.setPropCType(type); @@ -236,7 +234,9 @@ } private void fetchTokenInCCFor_x() { - if (!left()) return; + if (!left()) { + return; + } final int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { @@ -274,7 +274,9 @@ } private void fetchTokenInCCFor_u() { - if (!left()) return; + if (!left()) { + return; + } final int last = p; if (syntax.op2EscUHex4()) { @@ -329,7 +331,9 @@ } else if (c == '-') { token.type = TokenType.CC_RANGE; } else if (c == syntax.metaCharTable.esc) { - if (!syntax.backSlashEscapeInCC()) return token.type; + if (!syntax.backSlashEscapeInCC()) { + return token.type; + } if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE); } @@ -357,10 +361,14 @@ fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); break; case 'h': - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); + if (syntax.op2EscHXDigit()) { + fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); + } break; case 'H': - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); + if (syntax.op2EscHXDigit()) { + fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); + } break; case 'x': fetchTokenInCCFor_x(); @@ -424,7 +432,9 @@ } private void fetchTokenFor_xBrace() { - if (!left()) return; + if (!left()) { + return; + } final int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { @@ -461,7 +471,9 @@ } private void fetchTokenFor_uHex() { - if (!left()) return; + if (!left()) { + return; + } final int last = p; if (syntax.op2EscUHex4()) { @@ -562,79 +574,129 @@ switch(c) { case '*': - if (syntax.opEscAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); + if (syntax.opEscAsteriskZeroInf()) { + fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); + } break; case '+': - if (syntax.opEscPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); + if (syntax.opEscPlusOneInf()) { + fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); + } break; case '?': - if (syntax.opEscQMarkZeroOne()) fetchTokenFor_repeat(0, 1); + if (syntax.opEscQMarkZeroOne()) { + fetchTokenFor_repeat(0, 1); + } break; case '{': - if (syntax.opEscBraceInterval()) fetchTokenFor_openBrace(); + if (syntax.opEscBraceInterval()) { + fetchTokenFor_openBrace(); + } break; case '|': - if (syntax.opEscVBarAlt()) token.type = TokenType.ALT; + if (syntax.opEscVBarAlt()) { + token.type = TokenType.ALT; + } break; case '(': - if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_OPEN; + if (syntax.opEscLParenSubexp()) { + token.type = TokenType.SUBEXP_OPEN; + } break; case ')': - if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE; + if (syntax.opEscLParenSubexp()) { + token.type = TokenType.SUBEXP_CLOSE; + } break; case 'w': - if (syntax.opEscWWord()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); + if (syntax.opEscWWord()) { + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); + } break; case 'W': - if (syntax.opEscWWord()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); + if (syntax.opEscWWord()) { + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); + } break; case 'b': - if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.WORD_BOUND); + if (syntax.opEscBWordBound()) { + fetchTokenFor_anchor(AnchorType.WORD_BOUND); + } break; case 'B': - if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND); + if (syntax.opEscBWordBound()) { + fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND); + } break; case '<': - if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_BEGIN); + if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { + fetchTokenFor_anchor(AnchorType.WORD_BEGIN); + } break; case '>': - if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_END); + if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { + fetchTokenFor_anchor(AnchorType.WORD_END); + } break; case 's': - if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); + if (syntax.opEscSWhiteSpace()) { + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); + } break; case 'S': - if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); + if (syntax.opEscSWhiteSpace()) { + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); + } break; case 'd': - if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); + if (syntax.opEscDDigit()) { + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); + } break; case 'D': - if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); + if (syntax.opEscDDigit()) { + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); + } break; case 'h': - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); + if (syntax.op2EscHXDigit()) { + fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); + } break; case 'H': - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); + if (syntax.op2EscHXDigit()) { + fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); + } break; case 'A': - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF); + if (syntax.opEscAZBufAnchor()) { + fetchTokenFor_anchor(AnchorType.BEGIN_BUF); + } break; case 'Z': - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.SEMI_END_BUF); + if (syntax.opEscAZBufAnchor()) { + fetchTokenFor_anchor(AnchorType.SEMI_END_BUF); + } break; case 'z': - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF); + if (syntax.opEscAZBufAnchor()) { + fetchTokenFor_anchor(AnchorType.END_BUF); + } break; case 'G': - if (syntax.opEscCapitalGBeginAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_POSITION); + if (syntax.opEscCapitalGBeginAnchor()) { + fetchTokenFor_anchor(AnchorType.BEGIN_POSITION); + } break; case '`': - if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF); + if (syntax.op2EscGnuBufAnchor()) { + fetchTokenFor_anchor(AnchorType.BEGIN_BUF); + } break; case '\'': - if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF); + if (syntax.op2EscGnuBufAnchor()) { + fetchTokenFor_anchor(AnchorType.END_BUF); + } break; case 'x': fetchTokenFor_xBrace(); @@ -684,22 +746,34 @@ { switch(c) { case '.': - if (syntax.opDotAnyChar()) token.type = TokenType.ANYCHAR; + if (syntax.opDotAnyChar()) { + token.type = TokenType.ANYCHAR; + } break; case '*': - if (syntax.opAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); + if (syntax.opAsteriskZeroInf()) { + fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); + } break; case '+': - if (syntax.opPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); + if (syntax.opPlusOneInf()) { + fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); + } break; case '?': - if (syntax.opQMarkZeroOne()) fetchTokenFor_repeat(0, 1); + if (syntax.opQMarkZeroOne()) { + fetchTokenFor_repeat(0, 1); + } break; case '{': - if (syntax.opBraceInterval()) fetchTokenFor_openBrace(); + if (syntax.opBraceInterval()) { + fetchTokenFor_openBrace(); + } break; case '|': - if (syntax.opVBarAlt()) token.type = TokenType.ALT; + if (syntax.opVBarAlt()) { + token.type = TokenType.ALT; + } break; case '(': @@ -713,9 +787,13 @@ } fetch(); if (c == syntax.metaCharTable.esc) { - if (left()) fetch(); + if (left()) { + fetch(); + } } else { - if (c == ')') break; + if (c == ')') { + break; + } } } continue start; // goto start @@ -723,19 +801,29 @@ unfetch(); } - if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_OPEN; + if (syntax.opLParenSubexp()) { + token.type = TokenType.SUBEXP_OPEN; + } break; case ')': - if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE; + if (syntax.opLParenSubexp()) { + token.type = TokenType.SUBEXP_CLOSE; + } break; case '^': - if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE); + if (syntax.opLineAnchor()) { + fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE); + } break; case '$': - if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE); + if (syntax.opLineAnchor()) { + fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE); + } break; case '[': - if (syntax.opBracketCC()) token.type = TokenType.CC_CC_OPEN; + if (syntax.opBracketCC()) { + token.type = TokenType.CC_CC_OPEN; + } break; case ']': //if (*src > env->pattern) /* /].../ is allowed. */ @@ -745,7 +833,9 @@ if (Option.isExtend(env.option)) { while (left()) { fetch(); - if (EncodingHelper.isNewLine(c)) break; + if (EncodingHelper.isNewLine(c)) { + break; + } } continue start; // goto start } @@ -756,7 +846,10 @@ case '\n': case '\r': case '\f': - if (Option.isExtend(env.option)) continue start; // goto start + if (Option.isExtend(env.option)) + { + continue start; // goto start + } break; default: // string @@ -798,8 +891,8 @@ } } - protected final void syntaxWarn(final String message, final char c) { - syntaxWarn(message.replace("<%n>", Character.toString(c))); + protected final void syntaxWarn(final String message, final char ch) { + syntaxWarn(message.replace("<%n>", Character.toString(ch))); } protected final void syntaxWarn(final String message) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java Mon Nov 03 11:47:41 2014 +0100 @@ -21,10 +21,10 @@ package jdk.nashorn.internal.runtime.regexp.joni; import static jdk.nashorn.internal.runtime.regexp.joni.Option.isFindLongest; - import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; +@SuppressWarnings("javadoc") public abstract class Matcher extends IntHolder { protected final Regex regex; @@ -73,7 +73,9 @@ protected final void msaInit(final int option, final int start) { msaOptions = option; msaStart = start; - if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) msaBestLen = -1; + if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { + msaBestLen = -1; + } } public final int match(final int at, final int range, final int option) { @@ -83,20 +85,19 @@ if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) { return matchAt(end /*range*/, at, prev); - } else { - return matchAt(range /*range*/, at, prev); } + return matchAt(range /*range*/, at, prev); } int low, high; // these are the return values - private boolean forwardSearchRange(final char[] chars, final int str, final int end, final int s, final int range, final IntHolder lowPrev) { + private boolean forwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final IntHolder lowPrev) { int pprev = -1; int p = s; if (Config.DEBUG_SEARCH) { Config.log.println("forward_search_range: "+ - "str: " + str + - ", end: " + end + + "str: " + string + + ", end: " + e + ", s: " + s + ", range: " + range); } @@ -106,7 +107,7 @@ } retry:while (true) { - p = regex.searchAlgorithm.search(regex, chars, p, end, range); + p = regex.searchAlgorithm.search(regex, ch, p, e, range); if (p != -1 && p < range) { if (p - regex.dMin < s) { @@ -119,9 +120,9 @@ if (regex.subAnchor != 0) { switch (regex.subAnchor) { case AnchorType.BEGIN_LINE: - if (p != str) { - final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); - if (!EncodingHelper.isNewLine(chars, prev, end)) { + if (p != string) { + final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); + if (!EncodingHelper.isNewLine(ch, prev, e)) { // goto retry_gate; pprev = p; p++; @@ -131,17 +132,17 @@ break; case AnchorType.END_LINE: - if (p == end) { + if (p == e) { if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { - final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); - if (prev != -1 && EncodingHelper.isNewLine(chars, prev, end)) { + final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); + if (prev != -1 && EncodingHelper.isNewLine(ch, prev, e)) { // goto retry_gate; pprev = p; p++; continue retry; } } - } else if (!EncodingHelper.isNewLine(chars, p, end)) { + } else if (!EncodingHelper.isNewLine(ch, p, e)) { //if () break; // goto retry_gate; pprev = p; @@ -149,6 +150,9 @@ continue retry; } break; + + default: + break; } // switch } @@ -158,7 +162,7 @@ if (low > s) { lowPrev.value = EncodingHelper.prevCharHead(s, p); } else { - lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); + lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); } } } else { @@ -172,7 +176,7 @@ } } else { if (lowPrev != null) { - lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, low); + lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, low); } } } @@ -182,8 +186,8 @@ if (Config.DEBUG_SEARCH) { Config.log.println("forward_search_range success: "+ - "low: " + (low - str) + - ", high: " + (high - str) + + "low: " + (low - string) + + ", high: " + (high - string) + ", dmin: " + regex.dMin + ", dmax: " + regex.dMax); } @@ -196,20 +200,21 @@ } // low, high - private boolean backwardSearchRange(final char[] chars, final int str, final int end, final int s, int range, final int adjrange) { - range += regex.dMin; + private boolean backwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final int adjrange) { + int r = range; + r += regex.dMin; int p = s; retry:while (true) { - p = regex.searchAlgorithm.searchBackward(regex, chars, range, adjrange, end, p, s, range); + p = regex.searchAlgorithm.searchBackward(regex, ch, r, adjrange, e, p, s, r); if (p != -1) { if (regex.subAnchor != 0) { switch (regex.subAnchor) { case AnchorType.BEGIN_LINE: - if (p != str) { - final int prev = EncodingHelper.prevCharHead(str, p); - if (!EncodingHelper.isNewLine(chars, prev, end)) { + if (p != string) { + final int prev = EncodingHelper.prevCharHead(string, p); + if (!EncodingHelper.isNewLine(ch, prev, e)) { p = prev; continue retry; } @@ -217,21 +222,28 @@ break; case AnchorType.END_LINE: - if (p == end) { + if (p == e) { if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { final int prev = EncodingHelper.prevCharHead(adjrange, p); - if (prev == -1) return false; - if (EncodingHelper.isNewLine(chars, prev, end)) { + if (prev == -1) { + return false; + } + if (EncodingHelper.isNewLine(ch, prev, e)) { p = prev; continue retry; } } - } else if (!EncodingHelper.isNewLine(chars, p, end)) { + } else if (!EncodingHelper.isNewLine(ch, p, e)) { p = EncodingHelper.prevCharHead(adjrange, p); - if (p == -1) return false; + if (p == -1) { + return false; + } continue retry; } break; + + default: + break; } // switch } @@ -243,14 +255,16 @@ if (Config.DEBUG_SEARCH) { Config.log.println("backward_search_range: "+ - "low: " + (low - str) + - ", high: " + (high - str)); + "low: " + (low - string) + + ", high: " + (high - string)); } return true; } - if (Config.DEBUG_SEARCH) Config.log.println("backward_search_range: fail."); + if (Config.DEBUG_SEARCH) { + Config.log.println("backward_search_range: fail."); + } return false; } // while } @@ -261,27 +275,36 @@ if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { //range = upperRange; if (matchAt(upperRange, s, prev) != -1) { - if (!isFindLongest(regex.options)) return true; + if (!isFindLongest(regex.options)) { + return true; + } } } else { //range = upperRange; - if (matchAt(upperRange, s, prev) != -1) return true; + if (matchAt(upperRange, s, prev) != -1) { + return true; + } } } else { if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { if (matchAt(end, s, prev) != -1) { //range = upperRange; - if (!isFindLongest(regex.options)) return true; + if (!isFindLongest(regex.options)) { + return true; + } } } else { //range = upperRange; - if (matchAt(end, s, prev) != -1) return true; + if (matchAt(end, s, prev) != -1) { + return true; + } } } return false; } - public final int search(int start, int range, final int option) { + public final int search(final int startp, final int rangep, final int option) { + int start = startp, range = rangep; int s, prev; int origStart = start; final int origRange = range; @@ -294,7 +317,9 @@ ", range " + (range - str)); } - if (start > end || start < str) return -1; + if (start > end || start < str) { + return -1; + } /* anchor optimize: resume search range */ if (regex.anchor != 0 && str < end) { @@ -311,7 +336,10 @@ } else if ((regex.anchor & AnchorType.BEGIN_BUF) != 0) { /* search str-position only */ if (range > start) { - if (start != str) return -1; // mismatch_no_msa; + if (start != str) + { + return -1; // mismatch_no_msa; + } range = str + 1; } else { if (range <= str) { @@ -324,7 +352,10 @@ } else if ((regex.anchor & AnchorType.END_BUF) != 0) { minSemiEnd = maxSemiEnd = end; // !end_buf:! - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) + { + return -1; // mismatch_no_msa; + } } else if ((regex.anchor & AnchorType.SEMI_END_BUF) != 0) { final int preEnd = EncodingHelper.stepBack(str, end, 1); maxSemiEnd = end; @@ -332,12 +363,18 @@ minSemiEnd = preEnd; if (minSemiEnd > str && start <= minSemiEnd) { // !goto end_buf;! - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) + { + return -1; // mismatch_no_msa; + } } } else { minSemiEnd = end; // !goto end_buf;! - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) + { + return -1; // mismatch_no_msa; + } } } else if ((regex.anchor & AnchorType.ANYCHAR_STAR_ML) != 0) { // goto !begin_position;! @@ -359,7 +396,9 @@ prev = -1; msaInit(option, start); - if (matchCheck(end, s, prev)) return match(s); + if (matchCheck(end, s, prev)) { + return match(s); + } return mismatch(); } return -1; // goto mismatch_no_msa; @@ -389,49 +428,62 @@ schRange = end; } else { schRange += regex.dMax; - if (schRange > end) schRange = end; + if (schRange > end) { + schRange = end; + } } } - if ((end - start) < regex.thresholdLength) return mismatch(); + if ((end - start) < regex.thresholdLength) { + return mismatch(); + } if (regex.dMax != MinMaxLen.INFINITE_DISTANCE) { do { - if (!forwardSearchRange(chars, str, end, s, schRange, this)) return mismatch(); // low, high, lowPrev + if (!forwardSearchRange(chars, str, end, s, schRange, this)) { + return mismatch(); // low, high, lowPrev + } if (s < low) { s = low; prev = value; } while (s <= high) { - if (matchCheck(origRange, s, prev)) return match(s); // ??? + if (matchCheck(origRange, s, prev)) { + return match(s); // ??? + } prev = s; s++; } } while (s < range); + } + /* check only. */ + if (!forwardSearchRange(chars, str, end, s, schRange, null)) { return mismatch(); - - } else { /* check only. */ - if (!forwardSearchRange(chars, str, end, s, schRange, null)) return mismatch(); + } - if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) { - do { - if (matchCheck(origRange, s, prev)) return match(s); - prev = s; - s++; - } while (s < range); - return mismatch(); - } - + if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) { + do { + if (matchCheck(origRange, s, prev)) { + return match(s); + } + prev = s; + s++; + } while (s < range); + return mismatch(); } } do { - if (matchCheck(origRange, s, prev)) return match(s); + if (matchCheck(origRange, s, prev)) { + return match(s); + } prev = s; s++; } while (s < range); if (s == range) { /* because empty match with /$/. */ - if (matchCheck(origRange, s, prev)) return match(s); + if (matchCheck(origRange, s, prev)) { + return match(s); + } } } else { /* backward search */ if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) { @@ -450,37 +502,51 @@ if (regex.dMax != MinMaxLen.INFINITE_DISTANCE && (end - range) >= regex.thresholdLength) { do { int schStart = s + regex.dMax; - if (schStart > end) schStart = end; - if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch(); // low, high - if (s > high) s = high; + if (schStart > end) { + schStart = end; + } + if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) + { + return mismatch(); // low, high + } + if (s > high) { + s = high; + } while (s != -1 && s >= low) { prev = EncodingHelper.prevCharHead(str, s); - if (matchCheck(origStart, s, prev)) return match(s); + if (matchCheck(origStart, s, prev)) { + return match(s); + } s = prev; } } while (s >= range); return mismatch(); - } else { /* check only. */ - if ((end - range) < regex.thresholdLength) return mismatch(); + } + if ((end - range) < regex.thresholdLength) { + return mismatch(); + } - int schStart = s; - if (regex.dMax != 0) { - if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) { + int schStart = s; + if (regex.dMax != 0) { + if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) { + schStart = end; + } else { + schStart += regex.dMax; + if (schStart > end) { schStart = end; - } else { - schStart += regex.dMax; - if (schStart > end) { - schStart = end; - } } } - if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch(); + } + if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) { + return mismatch(); } } do { prev = EncodingHelper.prevCharHead(str, s); - if (matchCheck(origStart, s, prev)) return match(s); + if (matchCheck(origStart, s, prev)) { + return match(s); + } s = prev; } while (s >= range); @@ -488,8 +554,13 @@ return mismatch(); } - private boolean endBuf(int start, int range, final int minSemiEnd, final int maxSemiEnd) { - if ((maxSemiEnd - str) < regex.anchorDmin) return true; // mismatch_no_msa; + private boolean endBuf(final int startp, final int rangep, final int minSemiEnd, final int maxSemiEnd) { + int start = startp; + int range = rangep; + + if ((maxSemiEnd - str) < regex.anchorDmin) { + return true; // mismatch_no_msa; + } if (range > start) { if ((minSemiEnd - start) > regex.anchorDmax) { @@ -502,7 +573,10 @@ if ((maxSemiEnd - (range - 1)) < regex.anchorDmin) { range = maxSemiEnd - regex.anchorDmin + 1; } - if (start >= range) return true; // mismatch_no_msa; + if (start >= range) + { + return true; // mismatch_no_msa; + } } else { if ((minSemiEnd - range) > regex.anchorDmax) { range = minSemiEnd - regex.anchorDmax; @@ -510,7 +584,10 @@ if ((maxSemiEnd - start) < regex.anchorDmin) { start = maxSemiEnd - regex.anchorDmin; } - if (range > start) return true; // mismatch_no_msa; + if (range > start) + { + return true; // mismatch_no_msa; + } } return false; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; +@SuppressWarnings("javadoc") public abstract class MatcherFactory { public abstract Matcher create(Regex regex, char[] chars, int p, int end); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java Mon Nov 03 11:47:41 2014 +0100 @@ -46,24 +46,40 @@ }; int distanceValue() { - if (max == INFINITE_DISTANCE) return 0; + if (max == INFINITE_DISTANCE) { + return 0; + } final int d = max - min; /* return dist_vals[d] * 16 / (mm->min + 12); */ return d < distValues.length ? distValues[d] : 1; } - int compareDistanceValue(final MinMaxLen other, int v1, int v2) { - if (v2 <= 0) return -1; - if (v1 <= 0) return 1; + int compareDistanceValue(final MinMaxLen other, final int v1p, final int v2p) { + int v1 = v1p, v2 = v2p; + + if (v2 <= 0) { + return -1; + } + if (v1 <= 0) { + return 1; + } v1 *= distanceValue(); v2 *= other.distanceValue(); - if (v2 > v1) return 1; - if (v2 < v1) return -1; + if (v2 > v1) { + return 1; + } + if (v2 < v1) { + return -1; + } - if (other.min < min) return 1; - if (other.min > min) return -1; + if (other.min < min) { + return 1; + } + if (other.min > min) { + return -1; + } return 0; } @@ -96,27 +112,33 @@ } void altMerge(final MinMaxLen other) { - if (min > other.min) min = other.min; - if (max < other.max) max = other.max; + if (min > other.min) { + min = other.min; + } + if (max < other.max) { + max = other.max; + } } static final int INFINITE_DISTANCE = 0x7FFFFFFF; static int distanceAdd(final int d1, final int d2) { if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) { return INFINITE_DISTANCE; - } else { - if (d1 <= INFINITE_DISTANCE - d2) return d1 + d2; - else return INFINITE_DISTANCE; } + if (d1 <= INFINITE_DISTANCE - d2) { + return d1 + d2; + } + return INFINITE_DISTANCE; } static int distanceMultiply(final int d, final int m) { - if (m == 0) return 0; + if (m == 0) { + return 0; + } if (d < INFINITE_DISTANCE / m) { return d * m; - } else { - return INFINITE_DISTANCE; } + return INFINITE_DISTANCE; } static String distanceRangeToString(final int a, final int b) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; +@SuppressWarnings("javadoc") public final class NodeOptInfo { final MinMaxLen length = new MinMaxLen(); final OptAnchorInfo anchor = new OptAnchorInfo(); @@ -91,8 +92,12 @@ if (other.length.max > 0) { // TODO: make sure it is not an Oniguruma bug (casting unsigned int to int for arithmetic comparison) int otherLengthMax = other.length.max; - if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) otherLengthMax = -1; - if (expr.length > otherLengthMax) expr.length = otherLengthMax; + if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) { + otherLengthMax = -1; + } + if (expr.length > otherLengthMax) { + expr.length = otherLengthMax; + } if (expr.mmd.max == 0) { exb.select(expr); } else { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java Mon Nov 03 11:47:41 2014 +0100 @@ -36,14 +36,20 @@ void concat(final OptAnchorInfo left, final OptAnchorInfo right, final int leftLength, final int rightLength) { leftAnchor = left.leftAnchor; - if (leftLength == 0) leftAnchor |= right.leftAnchor; + if (leftLength == 0) { + leftAnchor |= right.leftAnchor; + } rightAnchor = right.rightAnchor; - if (rightLength == 0) rightAnchor |= left.rightAnchor; + if (rightLength == 0) { + rightAnchor |= left.rightAnchor; + } } boolean isSet(final int anchor) { - if ((leftAnchor & anchor) != 0) return true; + if ((leftAnchor & anchor) != 0) { + return true; + } return (rightAnchor & anchor) != 0; } @@ -77,14 +83,30 @@ static String anchorToString(final int anchor) { final StringBuffer s = new StringBuffer("["); - if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf "); - if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line "); - if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos "); - if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf "); - if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf "); - if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line "); - if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star "); - if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl "); + if ((anchor & AnchorType.BEGIN_BUF) !=0 ) { + s.append("begin-buf "); + } + if ((anchor & AnchorType.BEGIN_LINE) !=0 ) { + s.append("begin-line "); + } + if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) { + s.append("begin-pos "); + } + if ((anchor & AnchorType.END_BUF) !=0 ) { + s.append("end-buf "); + } + if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) { + s.append("semi-end-buf "); + } + if ((anchor & AnchorType.END_LINE) !=0 ) { + s.append("end-line "); + } + if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) { + s.append("anychar-star "); + } + if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) { + s.append("anychar-star-pl "); + } s.append("]"); return s.toString(); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java Mon Nov 03 11:47:41 2014 +0100 @@ -56,7 +56,9 @@ void concat(final OptExactInfo other) { if (!ignoreCase && other.ignoreCase) { - if (length >= other.length) return; /* avoid */ + if (length >= other.length) { + return; /* avoid */ + } ignoreCase = true; } @@ -65,7 +67,9 @@ int i; for (i = length; p < end;) { - if (i + 1 > OPT_EXACT_MAXLEN) break; + if (i + 1 > OPT_EXACT_MAXLEN) { + break; + } chars[i++] = other.chars[p++]; } @@ -74,15 +78,20 @@ final OptAnchorInfo tmp = new OptAnchorInfo(); tmp.concat(anchor, other.anchor, 1, 1); - if (!other.reachEnd) tmp.rightAnchor = 0; + if (!other.reachEnd) { + tmp.rightAnchor = 0; + } anchor.copy(tmp); } // ?? raw is not used here - void concatStr(final char[] lchars, int p, final int end, final boolean raw) { + void concatStr(final char[] lchars, final int pp, final int end, final boolean raw) { int i; + int p = pp; for (i = length; p < end && i < OPT_EXACT_MAXLEN;) { - if (i + 1 > OPT_EXACT_MAXLEN) break; + if (i + 1 > OPT_EXACT_MAXLEN) { + break; + } chars[i++] = lchars[p++]; } @@ -102,17 +111,23 @@ int i; for (i = 0; i < length && i < other.length; i++) { - if (chars[i] != other.chars[i]) break; + if (chars[i] != other.chars[i]) { + break; + } } - if (!other.reachEnd || i 1) v1 += 5; - if (alt.length > 1) v2 += 5; + if (length > 1) { + v1 += 5; + } + if (alt.length > 1) { + v2 += 5; + } } - if (!ignoreCase) v1 *= 2; - if (!alt.ignoreCase) v2 *= 2; + if (!ignoreCase) { + v1 *= 2; + } + if (!alt.ignoreCase) { + v2 *= 2; + } - if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); + if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) { + copy(alt); + } } // comp_opt_exact_or_map_info private static final int COMP_EM_BASE = 20; int compare(final OptMapInfo m) { - if (m.value <= 0) return -1; + if (m.value <= 0) { + return -1; + } final int ve = COMP_EM_BASE * length * (ignoreCase ? 1 : 2); final int vm = COMP_EM_BASE * 5 * 2 / m.value; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java Mon Nov 03 11:47:41 2014 +0100 @@ -31,7 +31,9 @@ mmd.clear(); anchor.clear(); value = 0; - for (int i=0; i 0) copy(alt); + if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) { + copy(alt); + } } // alt_merge_opt_map_info void altMerge(final OptMapInfo other) { /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ - if (value == 0) return; + if (value == 0) { + return; + } if (other.value == 0 || mmd.max < other.mmd.max) { clear(); return; @@ -89,8 +96,12 @@ int val = 0; for (int i=0; i 0) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Region.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; +@SuppressWarnings("javadoc") public final class Region { static final int REGION_NOTPOS = -1; @@ -36,7 +37,9 @@ public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Region: \n"); - for (int i=0; i textRange) end = textRange; + if (end > textRange) { + end = textRange; + } int s = textP; @@ -71,11 +74,15 @@ int p = s + 1; int t = targetP + 1; while (t < targetEnd) { - if (target[t] != text[p++]) break; + if (target[t] != text[p++]) { + break; + } t++; } - if (t == targetEnd) return s; + if (t == targetEnd) { + return s; + } } s++; } @@ -101,10 +108,14 @@ int p = s + 1; int t = targetP + 1; while (t < targetEnd) { - if (target[t] != text[p++]) break; + if (target[t] != text[p++]) { + break; + } t++; } - if (t == targetEnd) return s; + if (t == targetEnd) { + return s; + } } // s = enc.prevCharHead or s = s <= adjustText ? -1 : s - 1; s--; @@ -114,10 +125,8 @@ }; public static final class SLOW_IC extends SearchAlgorithm { - private final int caseFoldFlag; - public SLOW_IC(final Regex regex) { - this.caseFoldFlag = regex.caseFoldFlag; + //empty } @Override @@ -134,11 +143,15 @@ int end = textEnd; end -= targetEnd - targetP - 1; - if (end > textRange) end = textRange; + if (end > textRange) { + end = textRange; + } int s = textP; while (s < end) { - if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s; + if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) { + return s; + } s++; } return -1; @@ -158,17 +171,21 @@ } while (s >= textP) { - if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s; + if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) { + return s; + } s = EncodingHelper.prevCharHead(adjustText, s); } return -1; } - private boolean lowerCaseMatch(final char[] t, int tP, final int tEnd, - final char[] chars, int p, final int end) { + private static boolean lowerCaseMatch(final char[] t, final int tPp, final int tEnd, + final char[] chars, final int pp, final int end) { - while (tP < tEnd) { - if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) return false; + for (int tP = tPp, p = pp; tP < tEnd; ) { + if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) { + return false; + } } return true; } @@ -188,7 +205,9 @@ final int targetEnd = regex.exactEnd; int end = textRange + (targetEnd - targetP) - 1; - if (end > textEnd) end = textEnd; + if (end > textEnd) { + end = textEnd; + } final int tail = targetEnd - 1; int s = textP + (targetEnd - targetP) - 1; @@ -199,7 +218,9 @@ int t = tail; while (text[p] == target[t]) { - if (t == targetP) return p; + if (t == targetP) { + return p; + } p--; t--; } @@ -211,7 +232,9 @@ int t = tail; while (text[p] == target[t]) { - if (t == targetP) return p; + if (t == targetP) { + return p; + } p--; t--; } @@ -249,7 +272,9 @@ while (t < targetEnd && text[p] == target[t]) { p++; t++; } - if (t == targetEnd) return s; + if (t == targetEnd) { + return s; + } s -= regex.intMapBackward[text[s] & 0xff]; } @@ -268,8 +293,12 @@ final int len = end - p; - for (int i=0; i0; i--) skip[chars[i] & 0xff] = i; + for (int i=0; i0; i--) { + skip[chars[i] & 0xff] = i; + } } }; @@ -286,7 +315,9 @@ int s = textP; while (s < textRange) { - if (text[s] > 0xff || map[text[s]] != 0) return s; + if (text[s] > 0xff || map[text[s]] != 0) { + return s; + } s++; } return -1; @@ -297,9 +328,13 @@ final byte[] map = regex.map; int s = textStart; - if (s >= textEnd) s = textEnd - 1; + if (s >= textEnd) { + s = textEnd - 1; + } while (s >= textP) { - if (text[s] > 0xff || map[text[s]] != 0) return s; + if (text[s] > 0xff || map[text[s]] != 0) { + return s; + } s--; } return -1; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java Mon Nov 03 11:47:41 2014 +0100 @@ -20,7 +20,6 @@ package jdk.nashorn.internal.runtime.regexp.joni; import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt; - import java.lang.ref.WeakReference; import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel; import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType; @@ -61,12 +60,14 @@ static final ThreadLocal> stacks = new ThreadLocal>() { + @SuppressWarnings("unused") @Override protected WeakReference initialValue() { return new WeakReference(allocateStack()); } }; + @SuppressWarnings("unused") private static StackEntry[] fetchStack() { WeakReference ref = stacks.get(); StackEntry[] stack = ref.get(); @@ -78,7 +79,9 @@ } protected final void init() { - if (stack != null) pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */ + if (stack != null) { + pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */ + } if (repeatStk != null) { for (int i=1; i<=regex.numMem; i++) { repeatStk[i + memStartStk] = repeatStk[i + memEndStk] = INVALID_INDEX; @@ -87,9 +90,13 @@ } protected final StackEntry ensure1() { - if (stk >= stack.length) doubleStack(); + if (stk >= stack.length) { + doubleStack(); + } StackEntry e = stack[stk]; - if (e == null) stack[stk] = e = new StackEntry(); + if (e == null) { + stack[stk] = e = new StackEntry(); + } return e; } @@ -190,7 +197,9 @@ if ((e.type & MASK_MEM_END_OR_MARK) != 0 && e.getMemNum() == mnum) { level++; } else if (e.type == MEM_START && e.getMemNum() == mnum) { - if (level == 0) break; + if (level == 0) { + break; + } level--; } } @@ -371,9 +380,8 @@ if (e.getNullCheckNum() == id) { if (level == 0) { return e.getNullCheckPStr() == s ? 1 : 0; - } else { - level--; } + level--; } } else if (e.type == NULL_CHECK_END) { level++; @@ -393,7 +401,52 @@ if (e.getNullCheckPStr() != s) { isNull = 0; break; - } else { + } + int endp; + isNull = 1; + while (k < stk) { + if (e.type == MEM_START) { + if (e.getMemEnd() == INVALID_INDEX) { + isNull = 0; + break; + } + if (bsAt(regex.btMemEnd, e.getMemNum())) { + endp = stack[e.getMemEnd()].getMemPStr(); + } else { + endp = e.getMemEnd(); + } + if (stack[e.getMemStart()].getMemPStr() != endp) { + isNull = 0; + break; + } else if (endp != s) { + isNull = -1; /* empty, but position changed */ + } + } + k++; + e = stack[k]; // !! + } + break; + } + } + } + return isNull; + } + + protected final int nullCheckMemStRec(final int id, final int s) { + int level = 0; + int k = stk; + int isNull; + while (true) { + k--; + StackEntry e = stack[k]; + + if (e.type == NULL_CHECK_START) { + if (e.getNullCheckNum() == id) { + if (level == 0) { + if (e.getNullCheckPStr() != s) { + isNull = 0; + break; + } int endp; isNull = 1; while (k < stk) { @@ -415,62 +468,16 @@ } } k++; - e = stack[k]; // !! + e = stack[k]; } break; } - } - } - } - return isNull; - } - - protected final int nullCheckMemStRec(final int id, final int s) { - int level = 0; - int k = stk; - int isNull; - while (true) { - k--; - StackEntry e = stack[k]; - - if (e.type == NULL_CHECK_START) { - if (e.getNullCheckNum() == id) { - if (level == 0) { - if (e.getNullCheckPStr() != s) { - isNull = 0; - break; - } else { - int endp; - isNull = 1; - while (k < stk) { - if (e.type == MEM_START) { - if (e.getMemEnd() == INVALID_INDEX) { - isNull = 0; - break; - } - if (bsAt(regex.btMemEnd, e.getMemNum())) { - endp = stack[e.getMemEnd()].getMemPStr(); - } else { - endp = e.getMemEnd(); - } - if (stack[e.getMemStart()].getMemPStr() != endp) { - isNull = 0; - break; - } else if (endp != s) { - isNull = -1; /* empty, but position changed */ - } - } - k++; - e = stack[k]; - } - break; - } - } else { - level--; - } + level--; } } else if (e.type == NULL_CHECK_END) { - if (e.getNullCheckNum() == id) level++; + if (e.getNullCheckNum() == id) { + level++; + } } } return isNull; @@ -485,7 +492,9 @@ if (e.type == REPEAT) { if (level == 0) { - if (e.getRepeatNum() == id) return k; + if (e.getRepeatNum() == id) { + return k; + } } } else if (e.type == CALL_FRAME) { level--; @@ -505,9 +514,8 @@ if (e.type == CALL_FRAME) { if (level == 0) { return e.getCallFrameRetAddr(); - } else { - level--; } + level--; } else if (e.type == RETURN) { level++; } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java Mon Nov 03 11:47:41 2014 +0100 @@ -20,10 +20,10 @@ package jdk.nashorn.internal.runtime.regexp.joni; import static jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar.INEFFECTIVE_META_CHAR; - import jdk.nashorn.internal.runtime.regexp.joni.constants.SyntaxProperties; -public final class Syntax implements SyntaxProperties{ +@SuppressWarnings("javadoc") +public final class Syntax implements SyntaxProperties { private final int op; private final int op2; private final int behavior; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java Mon Nov 03 11:47:41 2014 +0100 @@ -22,6 +22,7 @@ /** * @author Ola Bini */ +@SuppressWarnings("javadoc") public interface WarnCallback { WarnCallback DEFAULT = new WarnCallback() { @Override diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; +@SuppressWarnings("javadoc") public interface Warnings { final String INVALID_BACKREFERENCE = "invalid back reference"; final String INVALID_SUBEXP_CALL = "invalid subexp call"; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -21,6 +21,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; +@SuppressWarnings("javadoc") public final class AnchorNode extends Node implements AnchorType { public int type; public Node target; @@ -65,28 +66,60 @@ } public String typeToString() { - final StringBuilder type = new StringBuilder(); - if (isType(BEGIN_BUF)) type.append("BEGIN_BUF "); - if (isType(BEGIN_LINE)) type.append("BEGIN_LINE "); - if (isType(BEGIN_POSITION)) type.append("BEGIN_POSITION "); - if (isType(END_BUF)) type.append("END_BUF "); - if (isType(SEMI_END_BUF)) type.append("SEMI_END_BUF "); - if (isType(END_LINE)) type.append("END_LINE "); - if (isType(WORD_BOUND)) type.append("WORD_BOUND "); - if (isType(NOT_WORD_BOUND)) type.append("NOT_WORD_BOUND "); - if (isType(WORD_BEGIN)) type.append("WORD_BEGIN "); - if (isType(WORD_END)) type.append("WORD_END "); - if (isType(PREC_READ)) type.append("PREC_READ "); - if (isType(PREC_READ_NOT)) type.append("PREC_READ_NOT "); - if (isType(LOOK_BEHIND)) type.append("LOOK_BEHIND "); - if (isType(LOOK_BEHIND_NOT)) type.append("LOOK_BEHIND_NOT "); - if (isType(ANYCHAR_STAR)) type.append("ANYCHAR_STAR "); - if (isType(ANYCHAR_STAR_ML)) type.append("ANYCHAR_STAR_ML "); - return type.toString(); + final StringBuilder sb = new StringBuilder(); + if (isType(BEGIN_BUF)) { + sb.append("BEGIN_BUF "); + } + if (isType(BEGIN_LINE)) { + sb.append("BEGIN_LINE "); + } + if (isType(BEGIN_POSITION)) { + sb.append("BEGIN_POSITION "); + } + if (isType(END_BUF)) { + sb.append("END_BUF "); + } + if (isType(SEMI_END_BUF)) { + sb.append("SEMI_END_BUF "); + } + if (isType(END_LINE)) { + sb.append("END_LINE "); + } + if (isType(WORD_BOUND)) { + sb.append("WORD_BOUND "); + } + if (isType(NOT_WORD_BOUND)) { + sb.append("NOT_WORD_BOUND "); + } + if (isType(WORD_BEGIN)) { + sb.append("WORD_BEGIN "); + } + if (isType(WORD_END)) { + sb.append("WORD_END "); + } + if (isType(PREC_READ)) { + sb.append("PREC_READ "); + } + if (isType(PREC_READ_NOT)) { + sb.append("PREC_READ_NOT "); + } + if (isType(LOOK_BEHIND)) { + sb.append("LOOK_BEHIND "); + } + if (isType(LOOK_BEHIND_NOT)) { + sb.append("LOOK_BEHIND_NOT "); + } + if (isType(ANYCHAR_STAR)) { + sb.append("ANYCHAR_STAR "); + } + if (isType(ANYCHAR_STAR_ML)) { + sb.append("ANYCHAR_STAR_ML "); + } + return sb.toString(); } - private boolean isType(final int type) { - return (this.type & type) != 0; + private boolean isType(final int t) { + return (this.type & t) != 0; } } diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.ast; +@SuppressWarnings("javadoc") public final class AnyCharNode extends Node { public AnyCharNode(){} diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -21,6 +21,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment; +@SuppressWarnings("javadoc") public final class BackRefNode extends StateNode { public final int backRef; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -34,6 +34,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.exception.SyntaxException; import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; +@SuppressWarnings("javadoc") public final class CClassNode extends Node { private static final int FLAG_NCCLASS_NOT = 1<<0; private static final int FLAG_NCCLASS_SHARE = 1<<1; @@ -100,7 +101,9 @@ @Override public boolean equals(final Object other) { - if (!(other instanceof CClassNode)) return false; + if (!(other instanceof CClassNode)) { + return false; + } final CClassNode cc = (CClassNode)other; return ctype == cc.ctype && isNot() == cc.isNot(); } @@ -110,11 +113,12 @@ if (Config.USE_SHARED_CCLASS_TABLE) { int hash = 0; hash += ctype; - if (isNot()) hash++; + if (isNot()) { + hash++; + } return hash + (hash >> 5); - } else { - return super.hashCode(); } + return super.hashCode(); } @Override @@ -128,10 +132,14 @@ } public String flagsToString() { - final StringBuilder flags = new StringBuilder(); - if (isNot()) flags.append("NOT "); - if (isShare()) flags.append("SHARE "); - return flags.toString(); + final StringBuilder f = new StringBuilder(); + if (isNot()) { + f.append("NOT "); + } + if (isShare()) { + f.append("SHARE "); + } + return f.toString(); } public boolean isEmpty() { @@ -251,7 +259,7 @@ } // add_ctype_to_cc_by_range // Encoding out! - public void addCTypeByRange(final int ctype, final boolean not, final int sbOut, final int mbr[]) { + public void addCTypeByRange(final int ct, final boolean not, final int sbOut, final int mbr[]) { final int n = mbr[0]; if (!not) { @@ -294,10 +302,14 @@ // !goto sb_end2!, remove duplication prev = sbOut; for (i=0; i 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); + if (arg.vs > 0xff) { + throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); + } bs.set(arg.vs); } else if (arg.type == CCVALTYPE.CODE_POINT) { addCodeRange(env, arg.vs, arg.vs); @@ -450,16 +489,17 @@ case RANGE: if (arg.inType == arg.type) { if (arg.inType == CCVALTYPE.SB) { - if (arg.vs > 0xff || arg.v > 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); + if (arg.vs > 0xff || arg.v > 0xff) { + throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); + } if (arg.vs > arg.v) { if (env.syntax.allowEmptyRangeInCC()) { // goto ccs_range_end arg.state = CCSTATE.COMPLETE; break; - } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } bs.setRange(arg.vs, arg.v); } else { @@ -471,9 +511,8 @@ // goto ccs_range_end arg.state = CCSTATE.COMPLETE; break; - } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); } bs.setRange(arg.vs, arg.v < 0xff ? arg.v : 0xff); addCodeRange(env, arg.vs, arg.v); @@ -509,9 +548,8 @@ if (isNot()) { return !found; - } else { - return found; } + return found; } // onig_is_code_in_cc diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -24,6 +24,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException; +@SuppressWarnings("javadoc") public final class ConsAltNode extends Node { public Node car; public ConsAltNode cdr; @@ -31,9 +32,13 @@ private ConsAltNode(final Node car, final ConsAltNode cdr, final int type) { this.car = car; - if (car != null) car.parent = this; + if (car != null) { + car.parent = this; + } this.cdr = cdr; - if (cdr != null) cdr.parent = this; + if (cdr != null) { + cdr.parent = this; + } this.type = type; } @@ -46,8 +51,9 @@ return new ConsAltNode(left, right, LIST); } - public static ConsAltNode listAdd(ConsAltNode list, final Node x) { + public static ConsAltNode listAdd(final ConsAltNode listp, final Node x) { final ConsAltNode n = newListNode(x, null); + ConsAltNode list = listp; if (list != null) { while (list.cdr != null) { diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Mon Nov 03 11:47:41 2014 +0100 @@ -22,6 +22,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.Option; import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType; +@SuppressWarnings("javadoc") public final class EncloseNode extends StateNode implements EncloseType { public final int type; // enclose type diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Mon Nov 03 11:47:41 2014 +0100 @@ -24,6 +24,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.WarnCallback; import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType; +@SuppressWarnings("javadoc") public abstract class Node implements NodeType { public Node parent; @@ -33,8 +34,12 @@ return 1 << getType(); } - protected void setChild(final Node tgt){} // default definition - protected Node getChild(){return null;} // default definition + protected void setChild(final Node tgt) { + //empty, default definition + } + protected Node getChild() { + return null; // default definition + } public void swap(final Node with) { Node tmp; @@ -46,9 +51,13 @@ //setChild(with.getChild()); //with.setChild(tmp); - if (parent != null) parent.setChild(with); + if (parent != null) { + parent.setChild(with); + } - if (with.parent != null) with.parent.setChild(this); + if (with.parent != null) { + with.parent.setChild(this); + } tmp = parent; parent = with.parent; @@ -81,16 +90,22 @@ } protected static String pad(final Object value, final int level) { - if (value == null) return "NULL"; + if (value == null) { + return "NULL"; + } final StringBuilder pad = new StringBuilder(" "); - for (int i=0; i { public ObjPtr() { this(null); diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.exception; +@SuppressWarnings("javadoc") public interface ErrorMessages { /* from jcodings */ diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.exception; +@SuppressWarnings("javadoc") public class InternalException extends JOniException{ private static final long serialVersionUID = -3871816465397927992L; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.exception; +@SuppressWarnings("javadoc") public class JOniException extends RuntimeException{ private static final long serialVersionUID = -6027192180014164667L; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,6 +19,7 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.exception; +@SuppressWarnings("javadoc") public class SyntaxException extends JOniException{ private static final long serialVersionUID = 7862720128961874288L; diff -r a54684572f14 -r e1e27c4262be src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java Mon Nov 03 07:29:46 2014 +0100 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java Mon Nov 03 11:47:41 2014 +0100 @@ -19,7 +19,8 @@ */ package jdk.nashorn.internal.runtime.regexp.joni.exception; -public class ValueException extends SyntaxException{ +@SuppressWarnings("javadoc") +public class ValueException extends SyntaxException { private static final long serialVersionUID = -196013852479929134L; public ValueException(final String message) { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java --- a/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,7 +29,6 @@ import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertTrue; - import java.util.Arrays; import java.util.List; import javax.script.ScriptContext; @@ -41,6 +40,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class ArrayConversionTest { private static ScriptEngine e = null; @@ -49,7 +49,7 @@ } @BeforeClass - public static void setUpClass() throws ScriptException { + public static void setUpClass() { e = new ScriptEngineManager().getEngineByName("nashorn"); } @@ -205,7 +205,7 @@ assertEquals(Arrays.asList("apple", "orange"), array[1]); } - public static void assertVarArg_42_17(final Object... args) throws ScriptException { + public static void assertVarArg_42_17(final Object... args) { assertEquals(2, args.length); assertEquals(42, ((Number)args[0]).intValue()); assertEquals(17, ((Number)args[1]).intValue()); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java --- a/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; - import java.util.Arrays; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; @@ -42,6 +41,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest */ +@SuppressWarnings("javadoc") public class BooleanAccessTest { private static ScriptEngine e = null; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java --- a/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,7 +26,6 @@ package jdk.nashorn.api.javaaccess; import static org.testng.AssertJUnit.assertEquals; - import java.util.HashMap; import java.util.Map; import javax.script.Bindings; @@ -40,6 +39,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class ConsStringTest { private static ScriptEngine e = null; @@ -48,7 +48,7 @@ } @BeforeClass - public static void setUpClass() throws ScriptException { + public static void setUpClass() { e = new ScriptEngineManager().getEngineByName("nashorn"); } @@ -69,7 +69,7 @@ @Test public void testConsStringFromMirror() throws ScriptException { final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE); - final Map m = new HashMap<>(); + //final Map m = new HashMap<>(); e.eval("var x = 'f'; x += 'oo'; var obj = {x: x};"); assertEquals("foo", ((JSObject)b.get("obj")).getMember("x")); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java --- a/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; - import java.util.Arrays; import java.util.Calendar; import java.util.Locale; @@ -45,6 +44,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest */ +@SuppressWarnings("javadoc") public class MethodAccessTest { private static ScriptEngine e = null; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java --- a/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; - import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -42,6 +41,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest */ +@SuppressWarnings("javadoc") public class NumberAccessTest { private static ScriptEngine e; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java --- a/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; - import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -41,6 +40,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest */ +@SuppressWarnings("javadoc") public class NumberBoxingTest { private static ScriptEngine e; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java --- a/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; - import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -41,6 +40,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest */ +@SuppressWarnings("javadoc") public class ObjectAccessTest { private static ScriptEngine e = null; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/Person.java --- a/test/src/jdk/nashorn/api/javaaccess/Person.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/Person.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.api.javaaccess; +@SuppressWarnings("javadoc") public class Person { public int id = 0; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/SharedObject.java --- a/test/src/jdk/nashorn/api/javaaccess/SharedObject.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/SharedObject.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,6 +29,7 @@ import javax.script.ScriptEngine; import javax.script.ScriptException; +@SuppressWarnings("javadoc") public class SharedObject { // Public fields diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java --- a/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; - import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -41,6 +40,7 @@ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest */ +@SuppressWarnings("javadoc") public class StringAccessTest { private static ScriptEngine e = null; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/InvocableTest.java --- a/test/src/jdk/nashorn/api/scripting/InvocableTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/InvocableTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; - import java.util.Objects; import java.util.function.Function; import javax.script.Invocable; @@ -42,9 +41,10 @@ /** * Tests for javax.script.Invocable implementation of nashorn. */ +@SuppressWarnings("javadoc") public class InvocableTest { - private void log(final String msg) { + private static void log(final String msg) { org.testng.Reporter.log(msg, true); } @@ -100,7 +100,7 @@ try { final Object obj = e.eval("({})"); - final Object res = ((Invocable) e).invokeMethod(obj, null); + ((Invocable) e).invokeMethod(obj, null); fail("should have thrown NPE"); } catch (final Exception exp) { if (!(exp instanceof NullPointerException)) { @@ -120,7 +120,7 @@ try { final Object obj = e.eval("({})"); - final Object res = ((Invocable) e).invokeMethod(obj, "nonExistentMethod"); + ((Invocable) e).invokeMethod(obj, "nonExistentMethod"); fail("should have thrown NoSuchMethodException"); } catch (final Exception exp) { if (!(exp instanceof NoSuchMethodException)) { @@ -398,7 +398,7 @@ final ScriptEngine e = m.getEngineByName("nashorn"); try { - final Object res = ((Invocable) e).invokeFunction(null); + ((Invocable)e).invokeFunction(null); fail("should have thrown NPE"); } catch (final Exception exp) { if (!(exp instanceof NullPointerException)) { @@ -418,7 +418,7 @@ final ScriptEngine e = m.getEngineByName("nashorn"); try { - final Object res = ((Invocable) e).invokeFunction("NonExistentFunc"); + ((Invocable)e).invokeFunction("NonExistentFunc"); fail("should have thrown NoSuchMethodException"); } catch (final Exception exp) { if (!(exp instanceof NoSuchMethodException)) { @@ -439,7 +439,7 @@ try { // define an object with method on it - final Object obj = e.eval("function hello() { return 'Hello World!'; }"); + e.eval("function hello() { return 'Hello World!'; }"); final ScriptContext ctxt = new SimpleScriptContext(); ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE); // change engine's current context @@ -526,13 +526,13 @@ } @Test - @SuppressWarnings("unchecked") public void defaultMethodTest() throws ScriptException { final ScriptEngineManager m = new ScriptEngineManager(); final ScriptEngine e = m.getEngineByName("nashorn"); final Invocable inv = (Invocable) e; final Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})"); + @SuppressWarnings("unchecked") final Function func = inv.getInterface(obj, Function.class); assertEquals(func.apply("hello"), "HELLO"); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java --- a/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -37,7 +37,7 @@ * @test * @run testng jdk.nashorn.api.scripting.MultipleEngineTest */ - +@SuppressWarnings("javadoc") public class MultipleEngineTest { @Test public void createAndUseManyEngine() throws ScriptException { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java --- a/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -44,6 +44,7 @@ * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external * JSObject implementations. */ +@SuppressWarnings("javadoc") public class PluggableJSObjectTest { public static class MapWrapperObject extends AbstractJSObject { private final HashMap map = new LinkedHashMap<>(); @@ -202,6 +203,7 @@ } public static class Factory extends AbstractJSObject { + @SuppressWarnings("unused") @Override public Object newObject(final Object... args) { return new HashMap(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/ScopeTest.java --- a/test/src/jdk/nashorn/api/scripting/ScopeTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/ScopeTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - import javax.script.Bindings; import javax.script.ScriptContext; import javax.script.ScriptEngine; @@ -42,6 +41,7 @@ /** * Tests for jsr223 Bindings "scope" (engine, global scopes) */ +@SuppressWarnings("javadoc") public class ScopeTest { @Test @@ -655,6 +655,8 @@ /** * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals. + * @throws ScriptException + * @throws InterruptedException */ @Test public static void testSlowScope() throws ScriptException, InterruptedException { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,12 +26,9 @@ package jdk.nashorn.api.scripting; import static org.testng.Assert.fail; - import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import java.util.Objects; -import javax.script.Invocable; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -40,9 +37,10 @@ /** * jsr223 tests for security access checks. */ +@SuppressWarnings("javadoc") public class ScriptEngineSecurityTest { - private void log(final String msg) { + private static void log(final String msg) { org.testng.Reporter.log(msg, true); } @@ -169,6 +167,7 @@ } // @bug 8032948: Nashorn linkages awry + @SuppressWarnings("serial") public static class FakeProxy extends Proxy { public FakeProxy(final InvocationHandler ih) { super(ih); @@ -180,7 +179,7 @@ } @Test - public void fakeProxySubclassAccessCheckTest() throws ScriptException { + public void fakeProxySubclassAccessCheckTest() { if (System.getSecurityManager() == null) { // pass vacuously return; @@ -197,7 +196,7 @@ // Should not be able to call static methods of Proxy via fake subclass try { - final Class c = (Class)e.eval(getClass); + e.eval(getClass); fail("should have thrown SecurityException"); } catch (final Exception exp) { if (! (exp instanceof SecurityException)) { @@ -207,7 +206,7 @@ } @Test - public void fakeProxySubclassAccessCheckTest2() throws ScriptException { + public void fakeProxySubclassAccessCheckTest2() { if (System.getSecurityManager() == null) { // pass vacuously return; @@ -224,7 +223,7 @@ // Should not be able to call static methods of Proxy via fake subclass try { - final Class c = (Class)e.eval(getClass); + e.eval(getClass); fail("should have thrown SecurityException"); } catch (final Exception exp) { if (! (exp instanceof SecurityException)) { @@ -234,7 +233,7 @@ } @Test - public static void proxyStaticAccessCheckTest() throws ScriptException { + public static void proxyStaticAccessCheckTest() { if (System.getSecurityManager() == null) { // pass vacuously return; @@ -247,7 +246,7 @@ new Class[] { Runnable.class }, new InvocationHandler() { @Override - public Object invoke(final Object p, final Method m, final Object[] a) { + public Object invoke(final Object p, final Method mtd, final Object[] a) { return null; } }); @@ -284,7 +283,9 @@ } }); fail("SecurityException should have been thrown"); - } catch (final SecurityException exp) {} + } catch (final SecurityException e) { + //empty + } } @Test @@ -303,6 +304,8 @@ } }); fail("SecurityException should have been thrown"); - } catch (final SecurityException exp) {} + } catch (final SecurityException e) { + //empty + } } } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,7 +29,6 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - import java.io.StringReader; import java.io.StringWriter; import java.lang.reflect.InvocationHandler; @@ -54,9 +53,10 @@ * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest */ +@SuppressWarnings("javadoc") public class ScriptEngineTest { - private void log(final String msg) { + private static void log(final String msg) { org.testng.Reporter.log(msg, true); } @@ -145,6 +145,8 @@ case "nashorn": seenNashorn = true; break; case "javascript": seenJavaScript = true; break; case "ECMAScript": seenECMAScript = true; break; + default: + break; } } @@ -159,6 +161,8 @@ case "application/ecmascript": seenAppECMA = true; break; case "text/javascript": seenTextJS = true; break; case "text/ecmascript": seenTextECMA = true; break; + default: + break; } } @@ -548,7 +552,7 @@ new Class[] { Runnable.class }, new InvocationHandler() { @Override - public Object invoke(final Object p, final Method m, final Object[] a) { + public Object invoke(final Object p, final Method mtd, final Object[] a) { reached[0] = true; return null; } @@ -633,7 +637,7 @@ public static class Context { private Object myobj; - public void set(Object o) { + public void set(final Object o) { myobj = o; } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java --- a/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -46,6 +46,7 @@ /** * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API. */ +@SuppressWarnings("javadoc") public class ScriptObjectMirrorTest { @SuppressWarnings("unchecked") @@ -343,14 +344,13 @@ assertEquals(ScriptObjectMirror.class, value3.getClass()); assertEquals(ScriptObjectMirror.class, value4.getClass()); assertTrue((boolean)invocable.invokeFunction("compare", value1, value1)); - assertTrue((boolean)example.compare(value1, value1)); + assertTrue(example.compare(value1, value1)); assertTrue((boolean)invocable.invokeFunction("compare", value3, value4)); - assertTrue((boolean)example.compare(value3, value4)); + assertTrue(example.compare(value3, value4)); } // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface @Test - @SuppressWarnings("unchecked") public void mirrorUnwrapInterfaceMethod() throws Exception { final ScriptEngineManager engineManager = new ScriptEngineManager(); final ScriptEngine engine = engineManager.getEngineByName("nashorn"); @@ -358,6 +358,7 @@ engine.eval("function apply(obj) { " + " return obj instanceof Packages.jdk.nashorn.api.scripting.ScriptObjectMirror; " + "}"); + @SuppressWarnings("unchecked") final Function func = invocable.getInterface(Function.class); assertFalse((boolean)func.apply(engine.eval("({ x: 2 })"))); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java --- a/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.api.scripting; +@SuppressWarnings("javadoc") public interface VariableArityTestInterface { public String test1(int i, String... strings); public String test2(int i, String... strings); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/Window.java --- a/test/src/jdk/nashorn/api/scripting/Window.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/Window.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,6 +28,7 @@ import java.util.Map; import javax.script.Bindings; +@SuppressWarnings("javadoc") public class Window { private String location = "http://localhost:8080/window"; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/api/scripting/WindowEventHandler.java --- a/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,8 +25,7 @@ package jdk.nashorn.api.scripting; +@SuppressWarnings("javadoc") public interface WindowEventHandler { - public boolean loaded(); - } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/codegen/CompilerTest.java --- a/test/src/jdk/nashorn/internal/codegen/CompilerTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/codegen/CompilerTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static jdk.nashorn.internal.runtime.Source.readFully; import static jdk.nashorn.internal.runtime.Source.sourceFor; - import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; @@ -45,6 +44,7 @@ /** * Tests to check Nashorn JS compiler - just compiler and not execution of scripts. */ +@SuppressWarnings("javadoc") public class CompilerTest { private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("compilertest.verbose")); private static final boolean TEST262 = Boolean.valueOf(System.getProperty("compilertest.test262")); @@ -56,7 +56,7 @@ public boolean exclude(File file, String content); } - private void log(final String msg) { + private static void log(final String msg) { org.testng.Reporter.log(msg, true); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/parser/ParserTest.java --- a/test/src/jdk/nashorn/internal/parser/ParserTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/parser/ParserTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static jdk.nashorn.internal.runtime.Source.readFully; import static jdk.nashorn.internal.runtime.Source.sourceFor; - import java.io.File; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ErrorManager; @@ -41,6 +40,7 @@ /** * Run tests to check Nashorn's parser. */ +@SuppressWarnings("javadoc") public class ParserTest { private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("parsertest.verbose")); private static final boolean TEST262 = Boolean.valueOf(System.getProperty("parsertest.test262")); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/performance/AuroraWrapper.java --- a/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java Mon Nov 03 11:47:41 2014 +0100 @@ -43,6 +43,7 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +@SuppressWarnings("javadoc") public class AuroraWrapper { public static String fileName = "report.xml"; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/performance/OctaneTest.java --- a/test/src/jdk/nashorn/internal/performance/OctaneTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/performance/OctaneTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -40,6 +40,7 @@ import java.util.List; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class OctaneTest { @Test @@ -72,7 +73,7 @@ genericTest("GBEMU"); } - /* @Test +/* @Test public void mandreelTest() { genericTest("Mandreel"); }*/ @@ -107,10 +108,20 @@ genericTest("Splay"); } + @Test +/* public void typeScriptTest() { + genericTest("TypeScript"); + } + + @Test + public void zlibTest() { + genericTest("zlib"); + }/*/ + public void genericTest(final String benchmark) { try { final String mainScript = "test/script/basic/run-octane.js"; - final String benchmarkScript = "test/script/external/octane/benchmarks/"+benchmark.toLowerCase() + ".js"; + final String benchmarkScript = "test/script/external/octane/benchmarks/" + benchmark.toLowerCase() + ".js"; final String[] args = { "--", benchmarkScript, diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java --- a/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java Mon Nov 03 11:47:41 2014 +0100 @@ -36,10 +36,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptRuntime; -/** - * - * @author Pavel Stepanov - */ +@SuppressWarnings("javadoc") public class PerformanceWrapper extends jdk.nashorn.tools.Shell { int _numberOfIterations; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/performance/SplayTest.java --- a/test/src/jdk/nashorn/internal/performance/SplayTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/performance/SplayTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,10 +27,7 @@ import org.testng.annotations.Test; -/** - * - * @author Pavel Stepanov - */ +@SuppressWarnings("javadoc") public class SplayTest { @Test diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java --- a/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,18 +25,17 @@ package jdk.nashorn.internal.runtime; +import static org.testng.Assert.fail; +import java.io.File; +import javax.script.ScriptEngine; +import javax.script.ScriptException; import jdk.nashorn.api.scripting.ClassFilter; import jdk.nashorn.api.scripting.NashornScriptEngineFactory; import jdk.nashorn.api.scripting.URLReader; import jdk.nashorn.internal.test.framework.TestFinder; import org.testng.annotations.Test; -import javax.script.ScriptEngine; -import javax.script.ScriptException; -import java.io.File; - -import static org.testng.Assert.fail; - +@SuppressWarnings("javadoc") public class ClassFilterTest { private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache"; private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache"; @@ -48,7 +47,7 @@ // test contributes much. We need faster "ant clean test" cycle for // developers. public void runExternalJsTest() { - String[] paths = new String[]{ + final String[] paths = new String[]{ "test/script/basic/compile-octane.js", "test/script/basic/jquery.js", "test/script/basic/prototype.js", @@ -57,12 +56,12 @@ "test/script/basic/yui.js", "test/script/basic/run-octane.js" }; - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); - for (String path : paths) { - ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter()); + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + for (final String path : paths) { + final ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter()); try { engine.eval(new URLReader(new File(path).toURI().toURL())); - } catch (Exception e) { + } catch (final Exception e) { fail("Script " + path + " fails with exception :" + e.getMessage()); } } @@ -70,12 +69,13 @@ @Test public void noJavaOptionTest() { - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); - ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter()); + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + final ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter()); try { engine.eval("var str = Java.type('java.lang.String');"); fail("TypeError should have been thrown"); - } catch (ScriptException exc) { + } catch (final ScriptException e) { + //emtpy } } @@ -85,27 +85,31 @@ return; } - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); - ScriptEngine engine = factory.getScriptEngine(getClassFilter()); + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + final ScriptEngine engine = factory.getScriptEngine(getClassFilter()); try { engine.eval("var thread = Java.type('sun.misc.Unsafe')"); fail("SecurityException should have been thrown"); - } catch (final Exception exc) { + } catch (final Exception e) { + //empty } try { engine.eval("var thread = new sun.misc.Unsafe()"); fail("SecurityException should have been thrown"); - } catch (final Exception exc) { + } catch (final Exception e) { + //empty } try { engine.eval("var thread = Java.extend(sun.misc.Unsafe, {})"); fail("TypeError should have been thrown"); - } catch (final Exception exc) { + } catch (final Exception e) { + //empty } try { engine.eval("java.lang.System.exit(0)"); fail("SecurityException should have been thrown"); - } catch (final Exception exc) { + } catch (final Exception e) { + //empty } } @@ -124,24 +128,24 @@ } private void persistentCacheTestImpl() { - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); - ScriptEngine engine = factory.getScriptEngine( + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); + final ScriptEngine engine = factory.getScriptEngine( TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}), getClass().getClassLoader(), getClassFilter() ); - String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore(); + final String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore(); try { engine.eval(testScript); } catch (final ScriptException exc) { fail(exc.getMessage()); } - ScriptEngine engineSafe = factory.getScriptEngine( + final ScriptEngine engineSafe = factory.getScriptEngine( TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}), getClass().getClassLoader(), new ClassFilter() { @Override - public boolean exposeToScripts(String s) { + public boolean exposeToScripts(final String s) { return false; } } @@ -156,8 +160,8 @@ } } - private String generateCodeForPersistentStore() { - StringBuilder stringBuilder = new StringBuilder(); + private static String generateCodeForPersistentStore() { + final StringBuilder stringBuilder = new StringBuilder(); for (int i=0; i < 100; i++) { stringBuilder.append("function i") .append(i) @@ -170,10 +174,10 @@ return stringBuilder.toString(); } - private ClassFilter getClassFilter() { + private static ClassFilter getClassFilter() { return new ClassFilter() { @Override - public boolean exposeToScripts(String s) { + public boolean exposeToScripts(final String s) { return true; } }; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java --- a/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,7 +26,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; - import java.io.File; import java.io.IOException; import java.nio.file.DirectoryStream; @@ -44,7 +43,7 @@ * @summary Test for persistent code cache and path handling * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest */ - +@SuppressWarnings("javadoc") public class CodeStoreAndPathTest { final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; " @@ -98,19 +97,22 @@ private static final String[] ENGINE_OPTIONS = new String[]{"--persistent-code-cache", "--optimistic-types=false", "--lazy-compilation=false"}; - public void checkCompiledScripts(final DirectoryStream stream, int numberOfScripts) throws IOException { - for (final Path file : stream) { - numberOfScripts--; + public void checkCompiledScripts(final DirectoryStream stream, final int numberOfScripts) throws IOException { + int n = numberOfScripts; + for (@SuppressWarnings("unused") final Path file : stream) { + n--; } stream.close(); - assertEquals(numberOfScripts,0); + assertEquals(n, 0); } @Test - public void pathHandlingTest() throws ScriptException, IOException { + public void pathHandlingTest() { System.setProperty("nashorn.persistent.code.cache", codeCache); final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); - final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS); + + fac.getScriptEngine(ENGINE_OPTIONS); + final Path expectedCodeCachePath = FileSystems.getDefault().getPath(oldUserDir + File.separator + codeCache); final Path actualCodeCachePath = FileSystems.getDefault().getPath(System.getProperty( "nashorn.persistent.code.cache")).toAbsolutePath(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/ContextTest.java --- a/test/src/jdk/nashorn/internal/runtime/ContextTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/ContextTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,7 +29,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - import java.util.Map; import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.options.Options; @@ -41,6 +40,7 @@ * @test * @run testng jdk.nashorn.internal.runtime.ContextTest */ +@SuppressWarnings("javadoc") public class ContextTest { // basic context eval test @Test @@ -96,7 +96,7 @@ final String code = "var obj = { x: 344, y: 42 }"; eval(cx, "", code); - final Object obj = cx.getGlobal().get("obj"); + final Object obj = Context.getGlobal().get("obj"); assertTrue(obj instanceof ScriptObject); @@ -129,7 +129,7 @@ } } - private Object eval(final Context cx, final String name, final String code) { + private static Object eval(final Context cx, final String name, final String code) { final Source source = sourceFor(name, code); final ScriptObject global = Context.getGlobal(); final ScriptFunction func = cx.compileScript(source, global); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java --- a/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,7 +27,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.NotSerializableException; @@ -43,6 +42,7 @@ * @test * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable */ +@SuppressWarnings("javadoc") public class ExceptionsNotSerializable { @Test public void rewriteExceptionNotSerializable() throws ScriptException { @@ -59,7 +59,7 @@ } @Test - public void unwarrantedOptimismExceptionNotSerializable() throws IOException { + public void unwarrantedOptimismExceptionNotSerializable() { tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128)); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java --- a/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,7 +25,6 @@ package jdk.nashorn.internal.runtime; import static org.testng.Assert.fail; - import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.regex.Matcher; @@ -46,6 +45,7 @@ * @summary Sanity tests for no persistence caching * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest */ +@SuppressWarnings("javadoc") public class NoPersistenceCachingTest { private ScriptEngine engine; @@ -102,6 +102,8 @@ engine.eval(scriptThreeContexts, context2); engine.eval(scriptThreeContexts, context3); break; + default: + break; } } catch (final Exception se) { se.printStackTrace(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/SourceTest.java --- a/test/src/jdk/nashorn/internal/runtime/SourceTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/SourceTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -29,7 +29,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - import java.io.File; import java.io.IOException; import java.io.InputStreamReader; @@ -42,6 +41,7 @@ /** * Tests different Source representations. */ +@SuppressWarnings("javadoc") public class SourceTest { final private static String SOURCE_NAME = "source.js"; @@ -104,11 +104,11 @@ } } - private Reader getReader(final String path) { + private static Reader getReader(final String path) { return new InputStreamReader(SourceTest.class.getResourceAsStream(path)); } - private void testSources(final Source source1, final Source source2) { + private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java --- a/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,7 +28,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; - import javax.script.ScriptContext; import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; @@ -42,6 +41,7 @@ /** * Tests for trusted client usage of nashorn script engine factory extension API */ +@SuppressWarnings("javadoc") public class TrustedScriptEngineTest { @Test public void versionTest() { @@ -64,7 +64,7 @@ public boolean reached() { return reached[0]; } - }; + } // These are for "private" extension API of NashornScriptEngineFactory that // accepts a ClassLoader and/or command line options. @@ -140,7 +140,8 @@ // try nashorn specific extension e.eval("var f = funtion(x) 2*x;"); fail("should have thrown exception!"); - } catch (final ScriptException se) { + } catch (final Exception ex) { + //empty } return; } @@ -276,7 +277,9 @@ try { fac.getScriptEngine((ClassFilter)null); fail("should have thrown NPE"); - } catch (NullPointerException npe) {} + } catch (final NullPointerException e) { + //empty + } } @Test @@ -285,7 +288,9 @@ try { fac.getScriptEngine(new String[0], null, null); fail("should have thrown NPE"); - } catch (NullPointerException npe) {} + } catch (final NullPointerException e) { + //empty + } } @Test @@ -294,7 +299,9 @@ try { fac.getScriptEngine((String[])null); fail("should have thrown NPE"); - } catch (NullPointerException npe) {} + } catch (final NullPointerException e) { + //empty + } } @Test @@ -308,7 +315,9 @@ } }); fail("should have thrown NPE"); - } catch (NullPointerException npe) {} + } catch (final NullPointerException e) { + //empty + } } @Test diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java --- a/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -33,6 +33,7 @@ * @test * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest */ +@SuppressWarnings("javadoc") public class JoniTest { @Test diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java --- a/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Mon Nov 03 11:47:41 2014 +0100 @@ -34,7 +34,6 @@ import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FAIL_LIST; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_SHARED_CONTEXT; - import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -50,6 +49,7 @@ /** * Abstract class to compile and run one .js script file. */ +@SuppressWarnings("javadoc") public abstract class AbstractScriptRunnable { // some test scripts need a "framework" script - whose features are used // in the test script. This optional framework script can be null. @@ -274,14 +274,14 @@ // compile and run this script protected abstract void execute(); - private boolean equalsCompilerMsgs(final String es, final String as) { + private static boolean equalsCompilerMsgs(final String es, final String as) { final int split = es.indexOf(':'); // Replace both types of separators ('/' and '\') with the one from // current environment return (split >= 0) && as.equals(es.substring(0, split).replaceAll("[/\\\\]", Matcher.quoteReplacement(File.separator)) + es.substring(split)); } - private void escape(final String value, final StringBuilder out) { + private static void escape(final String value, final StringBuilder out) { final int len = value.length(); for (int i = 0; i < len; i++) { final char ch = value.charAt(i); @@ -297,7 +297,7 @@ } } - private String escape(final String value) { + private static String escape(final String value) { final StringBuilder sb = new StringBuilder(); escape(value, sb); return sb.toString(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java --- a/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java Mon Nov 03 11:47:41 2014 +0100 @@ -34,6 +34,7 @@ * Test case used by JSCompilerTest to complain if test files are marked as * neither test nor subtest. */ +@SuppressWarnings("javadoc") public final class OrphanTestFinder implements ITest { private final Set orphanFiles; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java --- a/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java Mon Nov 03 11:47:41 2014 +0100 @@ -31,7 +31,6 @@ import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_EXCLUDE_LIST; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FRAMEWORK; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS; - import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -73,6 +72,7 @@ * Parallel test runner runs tests in multiple threads - but avoids any dependency * on third-party test framework library such as TestNG. */ +@SuppressWarnings("javadoc") public class ParallelTestRunner { // ParallelTestRunner-specific @@ -247,7 +247,7 @@ } } - private void compare(final String outputFileName, final String expected, final boolean compareCompilerMsg) throws IOException { + private void compare(final String fileName, final String expected, final boolean compareCompilerMsg) throws IOException { final File expectedFile = new File(expected); BufferedReader expectedReader; @@ -257,7 +257,7 @@ expectedReader = new BufferedReader(new StringReader("")); } - final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(outputFileName))); + final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); compare(actual, expectedReader, compareCompilerMsg); } @@ -434,8 +434,8 @@ public static void main(final String[] args) throws Exception { parseArgs(args); - while(new ParallelTestRunner().run()) { - ; + while (new ParallelTestRunner().run()) { + //empty } } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java --- a/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Mon Nov 03 11:47:41 2014 +0100 @@ -52,6 +52,7 @@ * class. Optionally, output from running the script is compared against the * corresponding .EXPECTED file. */ +@SuppressWarnings("javadoc") public final class ScriptRunnable extends AbstractScriptRunnable implements ITest { public ScriptRunnable(final String framework, final File testFile, final List engineOptions, final Map testOptions, final List scriptArguments) { super(framework, testFile, engineOptions, testOptions, scriptArguments); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/ScriptTest.java --- a/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,7 +26,6 @@ package jdk.nashorn.internal.test.framework; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_INCLUDES; - import java.io.File; import java.util.ArrayList; import java.util.List; @@ -48,7 +47,9 @@ * Creates a test factory for the set of .js source tests. * * @return a Object[] of test objects. + * @throws Exception upon failure */ + @SuppressWarnings("static-method") @Factory public Object[] suite() throws Exception { Locale.setDefault(new Locale("")); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/TestConfig.java --- a/test/src/jdk/nashorn/internal/test/framework/TestConfig.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/TestConfig.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,6 +28,7 @@ /** * Configuration info for script tests. */ +@SuppressWarnings("javadoc") public interface TestConfig { // Test options inferred from various test @foo tags and passed to test factory. public static final String OPTIONS_RUN = "run"; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/TestFinder.java --- a/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Mon Nov 03 11:47:41 2014 +0100 @@ -42,7 +42,6 @@ import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_LIST; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_UNCHECKED_DIR; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -76,6 +75,7 @@ * Utility class to find/parse script test files and to create 'test' instances. * Actual 'test' object type is decided by clients of this class. */ +@SuppressWarnings("javadoc") public final class TestFinder { private TestFinder() {} @@ -299,6 +299,8 @@ case "@fork": fork = true; break; + default: + break; } // negative tests are expected to fail at runtime only @@ -377,7 +379,7 @@ * * @args new argument list array */ - public static String[] addExplicitOptimisticTypes(String[] args) { + public static String[] addExplicitOptimisticTypes(final String[] args) { if (hasOptimisticOverride()) { final List newList = new ArrayList<>(Arrays.asList(args)); newList.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE)); @@ -392,7 +394,7 @@ * * @args argument list */ - public static void addExplicitOptimisticTypes(List args) { + public static void addExplicitOptimisticTypes(final List args) { if (hasOptimisticOverride()) { args.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE)); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/TestHelper.java --- a/test/src/jdk/nashorn/internal/test/framework/TestHelper.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/TestHelper.java Mon Nov 03 11:47:41 2014 +0100 @@ -36,6 +36,7 @@ /** * Simple utilities to deal with build-dir, read/dump files etc. */ +@SuppressWarnings("javadoc") public abstract class TestHelper { public static final String TEST_ROOT = "test"; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java --- a/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java Mon Nov 03 11:47:41 2014 +0100 @@ -47,10 +47,9 @@ final Object o2 = mi2.getInstance(); if (o1 instanceof ITest && o2 instanceof ITest) { return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName()); - } else { - // something else, don't care about the order - return 0; } + // something else, don't care about the order + return 0; } }); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/models/InternalRunnable.java --- a/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java Mon Nov 03 11:47:41 2014 +0100 @@ -28,6 +28,7 @@ import java.io.PrintWriter; import java.io.StringWriter; +@SuppressWarnings("javadoc") public class InternalRunnable implements Runnable, RestrictedRunnable { // This is a public field in a restricted class; scripts should not see it. diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java --- a/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,8 +27,8 @@ /** * Acts as a restricted interface implemented by a restricted class. - * */ +@SuppressWarnings("javadoc") public interface RestrictedRunnable { public void restrictedRun(); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java --- a/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,7 +25,10 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class ClassWithFinalFinalizer { + @Override protected final void finalize() { + //empty } } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java --- a/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,5 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class ClassWithInheritedFinalFinalizer extends ClassWithFinalFinalizer { + //empty } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/ConstructorWithArgument.java --- a/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public abstract class ConstructorWithArgument { private final String token; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/DessertTopping.java --- a/test/src/jdk/nashorn/test/models/DessertTopping.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/DessertTopping.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public interface DessertTopping { public String pourOnDessert(); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java --- a/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class DessertToppingFloorWaxDriver { public void decorateDessert(final DessertTopping dt) { dt.pourOnDessert(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/FinalClass.java --- a/test/src/jdk/nashorn/test/models/FinalClass.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/FinalClass.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public final class FinalClass { //empty } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/FloorWax.java --- a/test/src/jdk/nashorn/test/models/FloorWax.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/FloorWax.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public interface FloorWax { public String shineUpTheFloor(); } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java --- a/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java Mon Nov 03 11:47:41 2014 +0100 @@ -24,6 +24,7 @@ */ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class IntFloatOverloadSelection { public static String overloadedMethod(final int i) { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java --- a/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java Mon Nov 03 11:47:41 2014 +0100 @@ -30,8 +30,9 @@ /** * Acts as a non-restricted superclass for a restricted class. - * */ + +@SuppressWarnings("javadoc") public class InternalRunnableSuperclass { public final int canSeeThisField = 19; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java --- a/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,8 +26,9 @@ package jdk.nashorn.test.models; /** - * Test class used by JDK-8011362.js. + * Test class used by JDK-8011362.js */ +@SuppressWarnings("javadoc") public class Jdk8011362TestSubject { // This is selected for overloaded("", null) public String overloaded(final String a, final String b) { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java --- a/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class Nashorn401TestSubject { public String method2(final int arg) { return "int method 2"; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java --- a/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class NoAccessibleConstructorClass { NoAccessibleConstructorClass() { } } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/OuterClass.java --- a/test/src/jdk/nashorn/test/models/OuterClass.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/OuterClass.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class OuterClass { private final String value; @@ -35,6 +36,7 @@ public static class InnerStaticClass { public static class InnerInnerStaticClass { + //empty } private final String value; @@ -50,15 +52,15 @@ } public class InnerNonStaticClass { - private final String value; + private final String val; public InnerNonStaticClass(final String value) { - this.value = value; + this.val = value; } @Override public String toString() { - return "InnerNonStaticClass[value=" + value + ", outer=" + OuterClass.this + "]"; + return "InnerNonStaticClass[value=" + val + ", outer=" + OuterClass.this + "]"; } } diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/OverloadedSam.java --- a/test/src/jdk/nashorn/test/models/OverloadedSam.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/OverloadedSam.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public interface OverloadedSam { public void sam(String s); public void sam(String s1, String s2); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/OverrideObject.java --- a/test/src/jdk/nashorn/test/models/OverrideObject.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/OverrideObject.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class OverrideObject { @Override public int hashCode() { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/PropertyBind.java --- a/test/src/jdk/nashorn/test/models/PropertyBind.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/PropertyBind.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public class PropertyBind { public static int publicStaticInt; public static final int publicStaticFinalInt = 2112; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/SourceHelper.java --- a/test/src/jdk/nashorn/test/models/SourceHelper.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/SourceHelper.java Mon Nov 03 11:47:41 2014 +0100 @@ -34,6 +34,7 @@ /** * Helper class to facilitate script access of nashorn Source class. */ +@SuppressWarnings("javadoc") public final class SourceHelper { private SourceHelper() {} diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/StringArgs.java --- a/test/src/jdk/nashorn/test/models/StringArgs.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/StringArgs.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,6 +27,7 @@ import java.util.List; +@SuppressWarnings("javadoc") public class StringArgs { public static void checkString(final List list) { diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/Toothpaste.java --- a/test/src/jdk/nashorn/test/models/Toothpaste.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/Toothpaste.java Mon Nov 03 11:47:41 2014 +0100 @@ -25,6 +25,7 @@ package jdk.nashorn.test.models; +@SuppressWarnings("javadoc") public abstract class Toothpaste { public void applyToBrush() { applyToBrushImpl(); diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/models/VarArgConstructor.java --- a/test/src/jdk/nashorn/test/models/VarArgConstructor.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/models/VarArgConstructor.java Mon Nov 03 11:47:41 2014 +0100 @@ -27,6 +27,7 @@ import java.util.List; +@SuppressWarnings("javadoc") public class VarArgConstructor { private final String indicator; diff -r a54684572f14 -r e1e27c4262be test/src/jdk/nashorn/test/tools/StaticTypeInspector.java --- a/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java Mon Nov 03 07:29:46 2014 +0100 +++ b/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java Mon Nov 03 11:47:41 2014 +0100 @@ -26,6 +26,7 @@ import jdk.nashorn.internal.runtime.Undefined; +@SuppressWarnings("javadoc") public class StaticTypeInspector { public static String inspect(final boolean x, final String w) {