Mon, 03 Nov 2014 11:47:41 +0100
8060204: Fix warnings in Joni and tests
Reviewed-by: hannesw, sundar, attila
1.1 --- a/docs/source/EvalFile.java Mon Nov 03 07:29:46 2014 +0100 1.2 +++ b/docs/source/EvalFile.java Mon Nov 03 11:47:41 2014 +0100 1.3 @@ -29,14 +29,16 @@ 1.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.5 */ 1.6 1.7 -import javax.script.*; 1.8 +import javax.script.ScriptEngine; 1.9 +import javax.script.ScriptEngineManager; 1.10 1.11 +@SuppressWarnings("javadoc") 1.12 public class EvalFile { 1.13 - public static void main(String[] args) throws Exception { 1.14 + public static void main(final String[] args) throws Exception { 1.15 // create a script engine manager 1.16 - ScriptEngineManager factory = new ScriptEngineManager(); 1.17 + final ScriptEngineManager factory = new ScriptEngineManager(); 1.18 // create JavaScript engine 1.19 - ScriptEngine engine = factory.getEngineByName("nashorn"); 1.20 + final ScriptEngine engine = factory.getEngineByName("nashorn"); 1.21 // evaluate JavaScript code from given file - specified by first argument 1.22 engine.eval(new java.io.FileReader(args[0])); 1.23 }
2.1 --- a/docs/source/EvalScript.java Mon Nov 03 07:29:46 2014 +0100 2.2 +++ b/docs/source/EvalScript.java Mon Nov 03 11:47:41 2014 +0100 2.3 @@ -29,14 +29,16 @@ 2.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2.5 */ 2.6 2.7 -import javax.script.*; 2.8 +import javax.script.ScriptEngine; 2.9 +import javax.script.ScriptEngineManager; 2.10 2.11 +@SuppressWarnings("javadoc") 2.12 public class EvalScript { 2.13 - public static void main(String[] args) throws Exception { 2.14 + public static void main(final String[] args) throws Exception { 2.15 // create a script engine manager 2.16 - ScriptEngineManager factory = new ScriptEngineManager(); 2.17 + final ScriptEngineManager factory = new ScriptEngineManager(); 2.18 // create a JavaScript engine 2.19 - ScriptEngine engine = factory.getEngineByName("nashorn"); 2.20 + final ScriptEngine engine = factory.getEngineByName("nashorn"); 2.21 // evaluate JavaScript code from String 2.22 engine.eval("print('Hello, World')"); 2.23 }
3.1 --- a/docs/source/InvokeScriptFunction.java Mon Nov 03 07:29:46 2014 +0100 3.2 +++ b/docs/source/InvokeScriptFunction.java Mon Nov 03 11:47:41 2014 +0100 3.3 @@ -29,22 +29,25 @@ 3.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3.5 */ 3.6 3.7 -import javax.script.*; 3.8 +import javax.script.Invocable; 3.9 +import javax.script.ScriptEngine; 3.10 +import javax.script.ScriptEngineManager; 3.11 3.12 +@SuppressWarnings("javadoc") 3.13 public class InvokeScriptFunction { 3.14 - public static void main(String[] args) throws Exception { 3.15 - ScriptEngineManager manager = new ScriptEngineManager(); 3.16 - ScriptEngine engine = manager.getEngineByName("nashorn"); 3.17 + public static void main(final String[] args) throws Exception { 3.18 + final ScriptEngineManager manager = new ScriptEngineManager(); 3.19 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 3.20 3.21 // JavaScript code in a String 3.22 - String script = "function hello(name) { print('Hello, ' + name); }"; 3.23 + final String script = "function hello(name) { print('Hello, ' + name); }"; 3.24 // evaluate script 3.25 engine.eval(script); 3.26 3.27 // javax.script.Invocable is an optional interface. 3.28 // Check whether your script engine implements or not! 3.29 // Note that the JavaScript engine implements Invocable interface. 3.30 - Invocable inv = (Invocable) engine; 3.31 + final Invocable inv = (Invocable) engine; 3.32 3.33 // invoke the global function named "hello" 3.34 inv.invokeFunction("hello", "Scripting!!" );
4.1 --- a/docs/source/InvokeScriptMethod.java Mon Nov 03 07:29:46 2014 +0100 4.2 +++ b/docs/source/InvokeScriptMethod.java Mon Nov 03 11:47:41 2014 +0100 4.3 @@ -29,26 +29,29 @@ 4.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4.5 */ 4.6 4.7 -import javax.script.*; 4.8 +import javax.script.Invocable; 4.9 +import javax.script.ScriptEngine; 4.10 +import javax.script.ScriptEngineManager; 4.11 4.12 +@SuppressWarnings("javadoc") 4.13 public class InvokeScriptMethod { 4.14 - public static void main(String[] args) throws Exception { 4.15 - ScriptEngineManager manager = new ScriptEngineManager(); 4.16 - ScriptEngine engine = manager.getEngineByName("nashorn"); 4.17 + public static void main(final String[] args) throws Exception { 4.18 + final ScriptEngineManager manager = new ScriptEngineManager(); 4.19 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 4.20 4.21 // JavaScript code in a String. This code defines a script object 'obj' 4.22 // with one method called 'hello'. 4.23 - String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }"; 4.24 + final String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }"; 4.25 // evaluate script 4.26 engine.eval(script); 4.27 4.28 // javax.script.Invocable is an optional interface. 4.29 // Check whether your script engine implements or not! 4.30 // Note that the JavaScript engine implements Invocable interface. 4.31 - Invocable inv = (Invocable) engine; 4.32 + final Invocable inv = (Invocable) engine; 4.33 4.34 // get script object on which we want to call the method 4.35 - Object obj = engine.get("obj"); 4.36 + final Object obj = engine.get("obj"); 4.37 4.38 // invoke the method named "hello" on the script object "obj" 4.39 inv.invokeMethod(obj, "hello", "Script Method !!" );
5.1 --- a/docs/source/MultiScopes.java Mon Nov 03 07:29:46 2014 +0100 5.2 +++ b/docs/source/MultiScopes.java Mon Nov 03 11:47:41 2014 +0100 5.3 @@ -29,12 +29,17 @@ 5.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5.5 */ 5.6 5.7 -import javax.script.*; 5.8 +import javax.script.Bindings; 5.9 +import javax.script.ScriptContext; 5.10 +import javax.script.ScriptEngine; 5.11 +import javax.script.ScriptEngineManager; 5.12 +import javax.script.SimpleScriptContext; 5.13 5.14 +@SuppressWarnings("javadoc") 5.15 public class MultiScopes { 5.16 - public static void main(String[] args) throws Exception { 5.17 - ScriptEngineManager manager = new ScriptEngineManager(); 5.18 - ScriptEngine engine = manager.getEngineByName("nashorn"); 5.19 + public static void main(final String[] args) throws Exception { 5.20 + final ScriptEngineManager manager = new ScriptEngineManager(); 5.21 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 5.22 5.23 engine.put("x", "hello"); 5.24 // print global variable "x" 5.25 @@ -42,9 +47,9 @@ 5.26 // the above line prints "hello" 5.27 5.28 // Now, pass a different script context 5.29 - ScriptContext newContext = new SimpleScriptContext(); 5.30 + final ScriptContext newContext = new SimpleScriptContext(); 5.31 newContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE); 5.32 - Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE); 5.33 + final Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE); 5.34 5.35 // add new variable "x" to the new engineScope 5.36 engineScope.put("x", "world");
6.1 --- a/docs/source/RunnableImpl.java Mon Nov 03 07:29:46 2014 +0100 6.2 +++ b/docs/source/RunnableImpl.java Mon Nov 03 11:47:41 2014 +0100 6.3 @@ -29,28 +29,31 @@ 6.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6.5 */ 6.6 6.7 -import javax.script.*; 6.8 +import javax.script.Invocable; 6.9 +import javax.script.ScriptEngine; 6.10 +import javax.script.ScriptEngineManager; 6.11 6.12 +@SuppressWarnings("javadoc") 6.13 public class RunnableImpl { 6.14 - public static void main(String[] args) throws Exception { 6.15 - ScriptEngineManager manager = new ScriptEngineManager(); 6.16 - ScriptEngine engine = manager.getEngineByName("nashorn"); 6.17 + public static void main(final String[] args) throws Exception { 6.18 + final ScriptEngineManager manager = new ScriptEngineManager(); 6.19 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 6.20 6.21 // JavaScript code in a String 6.22 - String script = "function run() { print('run called'); }"; 6.23 + final String script = "function run() { print('run called'); }"; 6.24 6.25 // evaluate script 6.26 engine.eval(script); 6.27 6.28 - Invocable inv = (Invocable) engine; 6.29 + final Invocable inv = (Invocable) engine; 6.30 6.31 // get Runnable interface object from engine. This interface methods 6.32 // are implemented by script functions with the matching name. 6.33 - Runnable r = inv.getInterface(Runnable.class); 6.34 + final Runnable r = inv.getInterface(Runnable.class); 6.35 6.36 // start a new thread that runs the script implemented 6.37 // runnable interface 6.38 - Thread th = new Thread(r); 6.39 + final Thread th = new Thread(r); 6.40 th.start(); 6.41 th.join(); 6.42 }
7.1 --- a/docs/source/RunnableImplObject.java Mon Nov 03 07:29:46 2014 +0100 7.2 +++ b/docs/source/RunnableImplObject.java Mon Nov 03 11:47:41 2014 +0100 7.3 @@ -29,31 +29,34 @@ 7.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 7.5 */ 7.6 7.7 -import javax.script.*; 7.8 +import javax.script.Invocable; 7.9 +import javax.script.ScriptEngine; 7.10 +import javax.script.ScriptEngineManager; 7.11 7.12 +@SuppressWarnings("javadoc") 7.13 public class RunnableImplObject { 7.14 - public static void main(String[] args) throws Exception { 7.15 - ScriptEngineManager manager = new ScriptEngineManager(); 7.16 - ScriptEngine engine = manager.getEngineByName("nashorn"); 7.17 + public static void main(final String[] args) throws Exception { 7.18 + final ScriptEngineManager manager = new ScriptEngineManager(); 7.19 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 7.20 7.21 // JavaScript code in a String 7.22 - String script = "var obj = new Object(); obj.run = function() { print('run method called'); }"; 7.23 + final String script = "var obj = new Object(); obj.run = function() { print('run method called'); }"; 7.24 7.25 // evaluate script 7.26 engine.eval(script); 7.27 7.28 // get script object on which we want to implement the interface with 7.29 - Object obj = engine.get("obj"); 7.30 + final Object obj = engine.get("obj"); 7.31 7.32 - Invocable inv = (Invocable) engine; 7.33 + final Invocable inv = (Invocable) engine; 7.34 7.35 // get Runnable interface object from engine. This interface methods 7.36 // are implemented by script methods of object 'obj' 7.37 - Runnable r = inv.getInterface(obj, Runnable.class); 7.38 + final Runnable r = inv.getInterface(obj, Runnable.class); 7.39 7.40 // start a new thread that runs the script implemented 7.41 // runnable interface 7.42 - Thread th = new Thread(r); 7.43 + final Thread th = new Thread(r); 7.44 th.start(); 7.45 th.join(); 7.46 }
8.1 --- a/docs/source/ScriptVars.java Mon Nov 03 07:29:46 2014 +0100 8.2 +++ b/docs/source/ScriptVars.java Mon Nov 03 11:47:41 2014 +0100 8.3 @@ -29,15 +29,17 @@ 8.4 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 8.5 */ 8.6 8.7 -import javax.script.*; 8.8 -import java.io.*; 8.9 +import java.io.File; 8.10 +import javax.script.ScriptEngine; 8.11 +import javax.script.ScriptEngineManager; 8.12 8.13 +@SuppressWarnings("javadoc") 8.14 public class ScriptVars { 8.15 - public static void main(String[] args) throws Exception { 8.16 - ScriptEngineManager manager = new ScriptEngineManager(); 8.17 - ScriptEngine engine = manager.getEngineByName("nashorn"); 8.18 + public static void main(final String[] args) throws Exception { 8.19 + final ScriptEngineManager manager = new ScriptEngineManager(); 8.20 + final ScriptEngine engine = manager.getEngineByName("nashorn"); 8.21 8.22 - File f = new File("test.txt"); 8.23 + final File f = new File("test.txt"); 8.24 // expose File object as variable to script 8.25 engine.put("file", f); 8.26
9.1 --- a/src/jdk/nashorn/internal/AssertsEnabled.java Mon Nov 03 07:29:46 2014 +0100 9.2 +++ b/src/jdk/nashorn/internal/AssertsEnabled.java Mon Nov 03 11:47:41 2014 +0100 9.3 @@ -27,8 +27,8 @@ 9.4 9.5 /** 9.6 * Class that exposes the current state of asserts. 9.7 - * 9.8 */ 9.9 +@SuppressWarnings("all") 9.10 public final class AssertsEnabled { 9.11 private static boolean assertsEnabled = false; 9.12 static {
10.1 --- a/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Mon Nov 03 07:29:46 2014 +0100 10.2 +++ b/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Mon Nov 03 11:47:41 2014 +0100 10.3 @@ -31,7 +31,6 @@ 10.4 import java.util.Deque; 10.5 import java.util.HashMap; 10.6 import java.util.Map; 10.7 - 10.8 import jdk.nashorn.internal.IntDeque; 10.9 import jdk.nashorn.internal.codegen.types.Type; 10.10 import jdk.nashorn.internal.ir.Block; 10.11 @@ -250,7 +249,7 @@ 10.12 static Type getTypeForSlotDescriptor(final char typeDesc) { 10.13 // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see 10.14 // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor(). 10.15 - switch(typeDesc) { 10.16 + switch (typeDesc) { 10.17 case 'I': 10.18 case 'i': 10.19 return Type.INT;
11.1 --- a/src/jdk/nashorn/internal/codegen/Compiler.java Mon Nov 03 07:29:46 2014 +0100 11.2 +++ b/src/jdk/nashorn/internal/codegen/Compiler.java Mon Nov 03 11:47:41 2014 +0100 11.3 @@ -389,6 +389,7 @@ 11.4 * @param continuationEntryPoints continuation entry points for restof method 11.5 * @param runtimeScope runtime scope for recompilation type lookup in {@code TypeEvaluator} 11.6 */ 11.7 + @SuppressWarnings("unused") 11.8 public Compiler( 11.9 final Context context, 11.10 final ScriptEnvironment env,
12.1 --- a/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Mon Nov 03 07:29:46 2014 +0100 12.2 +++ b/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Mon Nov 03 11:47:41 2014 +0100 12.3 @@ -28,7 +28,6 @@ 12.4 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN; 12.5 import static jdk.nashorn.internal.ir.Expression.isAlwaysFalse; 12.6 import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue; 12.7 - 12.8 import java.util.ArrayDeque; 12.9 import java.util.ArrayList; 12.10 import java.util.Collections; 12.11 @@ -236,12 +235,12 @@ 12.12 private byte conversions; 12.13 12.14 void recordConversion(final LvarType from, final LvarType to) { 12.15 - switch(from) { 12.16 + switch (from) { 12.17 case UNDEFINED: 12.18 return; 12.19 case INT: 12.20 case BOOLEAN: 12.21 - switch(to) { 12.22 + switch (to) { 12.23 case LONG: 12.24 recordConversion(I2L); 12.25 return; 12.26 @@ -256,7 +255,7 @@ 12.27 return; 12.28 } 12.29 case LONG: 12.30 - switch(to) { 12.31 + switch (to) { 12.32 case DOUBLE: 12.33 recordConversion(L2D); 12.34 return; 12.35 @@ -1425,6 +1424,7 @@ 12.36 * @param symbol the symbol representing the variable 12.37 * @param type the type 12.38 */ 12.39 + @SuppressWarnings("unused") 12.40 private void setType(final Symbol symbol, final LvarType type) { 12.41 if(getLocalVariableTypeOrNull(symbol) == type) { 12.42 return;
13.1 --- a/src/jdk/nashorn/internal/codegen/types/Type.java Mon Nov 03 07:29:46 2014 +0100 13.2 +++ b/src/jdk/nashorn/internal/codegen/types/Type.java Mon Nov 03 11:47:41 2014 +0100 13.3 @@ -356,7 +356,7 @@ 13.4 final int pp = input.readInt(); 13.5 final int typeChar = input.readByte(); 13.6 final Type type; 13.7 - switch(typeChar) { 13.8 + switch (typeChar) { 13.9 case 'L': type = Type.OBJECT; break; 13.10 case 'D': type = Type.NUMBER; break; 13.11 case 'J': type = Type.LONG; break; 13.12 @@ -376,13 +376,13 @@ 13.13 } 13.14 13.15 private static jdk.internal.org.objectweb.asm.Type lookupInternalType(final Class<?> type) { 13.16 - final Map<Class<?>, jdk.internal.org.objectweb.asm.Type> cache = INTERNAL_TYPE_CACHE; 13.17 - jdk.internal.org.objectweb.asm.Type itype = cache.get(type); 13.18 + final Map<Class<?>, jdk.internal.org.objectweb.asm.Type> c = INTERNAL_TYPE_CACHE; 13.19 + jdk.internal.org.objectweb.asm.Type itype = c.get(type); 13.20 if (itype != null) { 13.21 return itype; 13.22 } 13.23 itype = jdk.internal.org.objectweb.asm.Type.getType(type); 13.24 - cache.put(type, itype); 13.25 + c.put(type, itype); 13.26 return itype; 13.27 } 13.28
14.1 --- a/src/jdk/nashorn/internal/objects/ArrayBufferView.java Mon Nov 03 07:29:46 2014 +0100 14.2 +++ b/src/jdk/nashorn/internal/objects/ArrayBufferView.java Mon Nov 03 11:47:41 2014 +0100 14.3 @@ -28,7 +28,6 @@ 14.4 import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError; 14.5 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; 14.6 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; 14.7 - 14.8 import java.nio.ByteBuffer; 14.9 import java.nio.ByteOrder; 14.10 import jdk.internal.dynalink.CallSiteDescriptor; 14.11 @@ -44,6 +43,9 @@ 14.12 import jdk.nashorn.internal.runtime.arrays.ArrayData; 14.13 import jdk.nashorn.internal.runtime.arrays.TypedArrayData; 14.14 14.15 +/** 14.16 + * ArrayBufferView, es6 class or TypedArray implementation 14.17 + */ 14.18 @ScriptClass("ArrayBufferView") 14.19 public abstract class ArrayBufferView extends ScriptObject { 14.20 private final NativeArrayBuffer buffer; 14.21 @@ -71,6 +73,13 @@ 14.22 setArray(data); 14.23 } 14.24 14.25 + /** 14.26 + * Constructor 14.27 + * 14.28 + * @param buffer underlying NativeArrayBuffer 14.29 + * @param byteOffset byte offset for buffer 14.30 + * @param elementLength element length in bytes 14.31 + */ 14.32 protected ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) { 14.33 this(buffer, byteOffset, elementLength, Global.instance()); 14.34 } 14.35 @@ -89,22 +98,42 @@ 14.36 return factory().bytesPerElement; 14.37 } 14.38 14.39 + /** 14.40 + * Buffer getter as per spec 14.41 + * @param self ArrayBufferView instance 14.42 + * @return buffer 14.43 + */ 14.44 @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) 14.45 public static Object buffer(final Object self) { 14.46 return ((ArrayBufferView)self).buffer; 14.47 } 14.48 14.49 + /** 14.50 + * Buffer offset getter as per spec 14.51 + * @param self ArrayBufferView instance 14.52 + * @return buffer offset 14.53 + */ 14.54 @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) 14.55 public static int byteOffset(final Object self) { 14.56 return ((ArrayBufferView)self).byteOffset; 14.57 } 14.58 14.59 + /** 14.60 + * Byte length getter as per spec 14.61 + * @param self ArrayBufferView instance 14.62 + * @return array buffer view length in bytes 14.63 + */ 14.64 @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) 14.65 public static int byteLength(final Object self) { 14.66 final ArrayBufferView view = (ArrayBufferView)self; 14.67 return ((TypedArrayData<?>)view.getArray()).getElementLength() * view.bytesPerElement(); 14.68 } 14.69 14.70 + /** 14.71 + * Length getter as per spec 14.72 + * @param self ArrayBufferView instance 14.73 + * @return length in elements 14.74 + */ 14.75 @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE) 14.76 public static int length(final Object self) { 14.77 return ((ArrayBufferView)self).elementLength(); 14.78 @@ -119,15 +148,29 @@ 14.79 return ((TypedArrayData<?>)getArray()).getElementLength(); 14.80 } 14.81 14.82 + /** 14.83 + * Factory class for byte ArrayBufferViews 14.84 + */ 14.85 protected static abstract class Factory { 14.86 final int bytesPerElement; 14.87 final int maxElementLength; 14.88 14.89 + /** 14.90 + * Constructor 14.91 + * 14.92 + * @param bytesPerElement number of bytes per element for this buffer 14.93 + */ 14.94 public Factory(final int bytesPerElement) { 14.95 this.bytesPerElement = bytesPerElement; 14.96 this.maxElementLength = Integer.MAX_VALUE / bytesPerElement; 14.97 } 14.98 14.99 + /** 14.100 + * Factory method 14.101 + * 14.102 + * @param elementLength number of elements 14.103 + * @return new ArrayBufferView 14.104 + */ 14.105 public final ArrayBufferView construct(final int elementLength) { 14.106 if (elementLength > maxElementLength) { 14.107 throw rangeError("inappropriate.array.buffer.length", JSType.toString(elementLength)); 14.108 @@ -135,15 +178,47 @@ 14.109 return construct(new NativeArrayBuffer(elementLength * bytesPerElement), 0, elementLength); 14.110 } 14.111 14.112 - public abstract ArrayBufferView construct(NativeArrayBuffer buffer, int byteOffset, int elementLength); 14.113 + /** 14.114 + * Factory method 14.115 + * 14.116 + * @param buffer underlying buffer 14.117 + * @param byteOffset byte offset 14.118 + * @param elementLength number of elements 14.119 + * 14.120 + * @return new ArrayBufferView 14.121 + */ 14.122 + public abstract ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength); 14.123 14.124 - public abstract TypedArrayData<?> createArrayData(ByteBuffer nb, int start, int end); 14.125 + /** 14.126 + * Factory method for array data 14.127 + * 14.128 + * @param nb underlying nativebuffer 14.129 + * @param start start element 14.130 + * @param end end element 14.131 + * 14.132 + * @return new array data 14.133 + */ 14.134 + public abstract TypedArrayData<?> createArrayData(final ByteBuffer nb, final int start, final int end); 14.135 14.136 + /** 14.137 + * Get the class name for this type of buffer 14.138 + * 14.139 + * @return class name 14.140 + */ 14.141 public abstract String getClassName(); 14.142 } 14.143 14.144 + /** 14.145 + * Get the factor for this kind of buffer 14.146 + * @return Factory 14.147 + */ 14.148 protected abstract Factory factory(); 14.149 14.150 + /** 14.151 + * Get the prototype for this ArrayBufferView 14.152 + * @param global global instance 14.153 + * @return prototype 14.154 + */ 14.155 protected abstract ScriptObject getPrototype(final Global global); 14.156 14.157 @Override 14.158 @@ -151,10 +226,23 @@ 14.159 return factory().getClassName(); 14.160 } 14.161 14.162 + /** 14.163 + * Check if this array contains floats 14.164 + * @return true if float array (or double) 14.165 + */ 14.166 protected boolean isFloatArray() { 14.167 return false; 14.168 } 14.169 14.170 + /** 14.171 + * Inheritable constructor implementation 14.172 + * 14.173 + * @param newObj is this a new constructor 14.174 + * @param args arguments 14.175 + * @param factory factory 14.176 + * 14.177 + * @return new ArrayBufferView 14.178 + */ 14.179 protected static ArrayBufferView constructorImpl(final boolean newObj, final Object[] args, final Factory factory) { 14.180 final Object arg0 = args.length != 0 ? args[0] : 0; 14.181 final ArrayBufferView dest; 14.182 @@ -200,6 +288,15 @@ 14.183 return dest; 14.184 } 14.185 14.186 + /** 14.187 + * Inheritable implementation of set, if no efficient implementation is available 14.188 + * 14.189 + * @param self ArrayBufferView instance 14.190 + * @param array array 14.191 + * @param offset0 array offset 14.192 + * 14.193 + * @return result of setter 14.194 + */ 14.195 protected static Object setImpl(final Object self, final Object array, final Object offset0) { 14.196 final ArrayBufferView dest = (ArrayBufferView)self; 14.197 final int length; 14.198 @@ -244,6 +341,15 @@ 14.199 return (int)(length & Integer.MAX_VALUE); 14.200 } 14.201 14.202 + /** 14.203 + * Implementation of subarray if no efficient override exists 14.204 + * 14.205 + * @param self ArrayBufferView instance 14.206 + * @param begin0 begin index 14.207 + * @param end0 end index 14.208 + * 14.209 + * @return sub array 14.210 + */ 14.211 protected static ScriptObject subarrayImpl(final Object self, final Object begin0, final Object end0) { 14.212 final ArrayBufferView arrayView = (ArrayBufferView)self; 14.213 final int byteOffset = arrayView.byteOffset;
15.1 --- a/src/jdk/nashorn/internal/runtime/CompiledFunction.java Mon Nov 03 07:29:46 2014 +0100 15.2 +++ b/src/jdk/nashorn/internal/runtime/CompiledFunction.java Mon Nov 03 11:47:41 2014 +0100 15.3 @@ -27,7 +27,6 @@ 15.4 import static jdk.nashorn.internal.lookup.Lookup.MH; 15.5 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; 15.6 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid; 15.7 - 15.8 import java.lang.invoke.CallSite; 15.9 import java.lang.invoke.MethodHandle; 15.10 import java.lang.invoke.MethodHandles; 15.11 @@ -777,7 +776,7 @@ 15.12 15.13 // Compiler needs a call site type as its input, which always has a callee parameter, so we must add it if 15.14 // this function doesn't have a callee parameter. 15.15 - final MethodType callSiteType = type.parameterType(0) == ScriptFunction.class ? 15.16 + final MethodType ct = type.parameterType(0) == ScriptFunction.class ? 15.17 type : 15.18 type.insertParameterTypes(0, ScriptFunction.class); 15.19 final OptimismInfo currentOptInfo = optimismInfo; 15.20 @@ -788,29 +787,29 @@ 15.21 final OptimismInfo effectiveOptInfo = currentOptInfo != null ? currentOptInfo : oldOptInfo; 15.22 FunctionNode fn = effectiveOptInfo.reparse(); 15.23 final boolean serialized = effectiveOptInfo.isSerialized(); 15.24 - final Compiler compiler = effectiveOptInfo.getCompiler(fn, callSiteType, re); //set to non rest-of 15.25 + final Compiler compiler = effectiveOptInfo.getCompiler(fn, ct, re); //set to non rest-of 15.26 15.27 if (!shouldRecompile) { 15.28 // It didn't necessarily recompile, e.g. for an outer invocation of a recursive function if we already 15.29 // recompiled a deoptimized version for an inner invocation. 15.30 // We still need to do the rest of from the beginning 15.31 - logRecompile("Rest-of compilation [STANDALONE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); 15.32 + logRecompile("Rest-of compilation [STANDALONE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); 15.33 return restOfHandle(effectiveOptInfo, compiler.compile(fn, serialized ? CompilationPhases.COMPILE_SERIALIZED_RESTOF : CompilationPhases.COMPILE_ALL_RESTOF), currentOptInfo != null); 15.34 } 15.35 15.36 - logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); 15.37 + logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); 15.38 fn = compiler.compile(fn, serialized ? CompilationPhases.RECOMPILE_SERIALIZED_UPTO_BYTECODE : CompilationPhases.COMPILE_UPTO_BYTECODE); 15.39 log.info("Reusable IR generated"); 15.40 15.41 // compile the rest of the function, and install it 15.42 log.info("Generating and installing bytecode from reusable IR..."); 15.43 - logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints); 15.44 + logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, ct, effectiveOptInfo.invalidatedProgramPoints); 15.45 final FunctionNode normalFn = compiler.compile(fn, CompilationPhases.GENERATE_BYTECODE_AND_INSTALL); 15.46 15.47 if (effectiveOptInfo.data.usePersistentCodeCache()) { 15.48 final RecompilableScriptFunctionData data = effectiveOptInfo.data; 15.49 final int functionNodeId = data.getFunctionNodeId(); 15.50 - final TypeMap typeMap = data.typeMap(callSiteType); 15.51 + final TypeMap typeMap = data.typeMap(ct); 15.52 final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId); 15.53 final String cacheKey = CodeStore.getCacheKey(functionNodeId, paramTypes); 15.54 compiler.persistClassInfo(cacheKey, normalFn); 15.55 @@ -871,6 +870,7 @@ 15.56 private SwitchPoint optimisticAssumptions; 15.57 private final DebugLogger log; 15.58 15.59 + @SuppressWarnings("unused") 15.60 OptimismInfo(final RecompilableScriptFunctionData data, final Map<Integer, Type> invalidatedProgramPoints) { 15.61 this.data = data; 15.62 this.log = data.getLogger();
16.1 --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Nov 03 07:29:46 2014 +0100 16.2 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Nov 03 11:47:41 2014 +0100 16.3 @@ -26,7 +26,6 @@ 16.4 package jdk.nashorn.internal.runtime; 16.5 16.6 import static jdk.nashorn.internal.lookup.Lookup.MH; 16.7 - 16.8 import java.io.IOException; 16.9 import java.lang.invoke.MethodHandle; 16.10 import java.lang.invoke.MethodHandles; 16.11 @@ -475,6 +474,7 @@ 16.12 * @return either the existing map, or a loaded map from the persistent type info cache, or a new empty map if 16.13 * neither an existing map or a persistent cached type info is available. 16.14 */ 16.15 + @SuppressWarnings("unused") 16.16 private static Map<Integer, Type> getEffectiveInvalidatedProgramPoints( 16.17 final Map<Integer, Type> invalidatedProgramPoints, final Object typeInformationFile) { 16.18 if(invalidatedProgramPoints != null) {
17.1 --- a/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java Mon Nov 03 07:29:46 2014 +0100 17.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java Mon Nov 03 11:47:41 2014 +0100 17.3 @@ -212,6 +212,7 @@ 17.4 * @param out output print writer 17.5 * @param err error print writer 17.6 */ 17.7 + @SuppressWarnings("unused") 17.8 public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) { 17.9 this.out = out; 17.10 this.err = err;
18.1 --- a/src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java Mon Nov 03 07:29:46 2014 +0100 18.2 +++ b/src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java Mon Nov 03 11:47:41 2014 +0100 18.3 @@ -50,7 +50,6 @@ 18.4 * {@link RewriteException#getReturnValueNonDestructive()} public, we pass it as 18.5 * an extra parameter, rather than querying the getter from another package. 18.6 */ 18.7 - @SuppressWarnings("javadoc") 18.8 public RecompilationEvent(final Level level, final RewriteException rewriteException, final Object returnValue) { 18.9 super(level, rewriteException); 18.10 assert Context.getContext().getLogger(RecompilableScriptFunctionData.class).isEnabled() :
19.1 --- a/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java Mon Nov 03 07:29:46 2014 +0100 19.2 +++ b/src/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java Mon Nov 03 11:47:41 2014 +0100 19.3 @@ -25,8 +25,10 @@ 19.4 19.5 package jdk.nashorn.internal.runtime.linker; 19.6 19.7 -import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.*; 19.8 - 19.9 +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETMEMBER; 19.10 +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETSLOT; 19.11 +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETMEMBER; 19.12 +import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETSLOT; 19.13 import java.lang.invoke.MethodHandle; 19.14 import java.lang.invoke.MethodHandles; 19.15 import jdk.internal.dynalink.CallSiteDescriptor; 19.16 @@ -114,12 +116,10 @@ 19.17 case "getMethod": 19.18 if (c > 2) { 19.19 return findGetMethod(desc); 19.20 - } else { 19.21 - // For indexed get, we want GuardedInvocation from beans linker and pass it. 19.22 - // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access. 19.23 - final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); 19.24 - return findGetIndexMethod(beanInv); 19.25 } 19.26 + // For indexed get, we want GuardedInvocation from beans linker and pass it. 19.27 + // BrowserJSObjectLinker.get uses this fallback getter for explicit signature method access. 19.28 + return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices)); 19.29 case "setProp": 19.30 case "setElem": 19.31 return c > 2 ? findSetMethod(desc) : findSetIndexMethod(); 19.32 @@ -166,9 +166,8 @@ 19.33 final String name = (String)key; 19.34 if (name.indexOf('(') != -1) { 19.35 return fallback.invokeExact(jsobj, key); 19.36 - } else { 19.37 - return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key); 19.38 } 19.39 + return JSOBJECT_GETMEMBER.invokeExact(jsobj, (String)key); 19.40 } 19.41 return null; 19.42 }
20.1 --- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Nov 03 07:29:46 2014 +0100 20.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Nov 03 11:47:41 2014 +0100 20.3 @@ -120,12 +120,10 @@ 20.4 case "getMethod": 20.5 if (c > 2) { 20.6 return findGetMethod(desc); 20.7 - } else { 20.8 - // For indexed get, we want get GuardedInvocation beans linker and pass it. 20.9 - // JSObjectLinker.get uses this fallback getter for explicit signature method access. 20.10 - final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); 20.11 - return findGetIndexMethod(beanInv); 20.12 } 20.13 + // For indexed get, we want get GuardedInvocation beans linker and pass it. 20.14 + // JSObjectLinker.get uses this fallback getter for explicit signature method access. 20.15 + return findGetIndexMethod(nashornBeansLinker.getGuardedInvocation(request, linkerServices)); 20.16 case "setProp": 20.17 case "setElem": 20.18 return c > 2 ? findSetMethod(desc) : findSetIndexMethod(); 20.19 @@ -192,9 +190,8 @@ 20.20 // get with method name and signature. delegate it to beans linker! 20.21 if (name.indexOf('(') != -1) { 20.22 return fallback.invokeExact(jsobj, key); 20.23 - } else { 20.24 - return ((JSObject)jsobj).getMember(name); 20.25 } 20.26 + return ((JSObject)jsobj).getMember(name); 20.27 } 20.28 return null; 20.29 }
21.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Mon Nov 03 07:29:46 2014 +0100 21.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Mon Nov 03 11:47:41 2014 +0100 21.3 @@ -27,7 +27,6 @@ 21.4 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline; 21.5 import static jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode.newAltNode; 21.6 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; 21.7 - 21.8 import java.util.HashSet; 21.9 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode; 21.10 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode; 21.11 @@ -53,6 +52,7 @@ 21.12 super(env, chars, p, end); 21.13 } 21.14 21.15 + @SuppressWarnings("unused") 21.16 protected final void compile() { 21.17 if (Config.DEBUG) { 21.18 Config.log.println(new String(chars, getBegin(), getEnd())); 21.19 @@ -76,7 +76,9 @@ 21.20 21.21 root = setupTree(root, 0); 21.22 if (Config.DEBUG_PARSE_TREE) { 21.23 - if (Config.DEBUG_PARSE_TREE_RAW) Config.log.println("<TREE>"); 21.24 + if (Config.DEBUG_PARSE_TREE_RAW) { 21.25 + Config.log.println("<TREE>"); 21.26 + } 21.27 root.verifyTree(new HashSet<Node>(), env.reg.warnings); 21.28 Config.log.println(root + "\n"); 21.29 } 21.30 @@ -94,7 +96,9 @@ 21.31 21.32 regex.clearOptimizeInfo(); 21.33 21.34 - if (!Config.DONT_OPTIMIZE) setOptimizedInfoFromTree(root); 21.35 + if (!Config.DONT_OPTIMIZE) { 21.36 + setOptimizedInfoFromTree(root); 21.37 + } 21.38 21.39 env.memNodes = null; 21.40 21.41 @@ -110,7 +114,9 @@ 21.42 21.43 if (Config.DEBUG_COMPILE) { 21.44 Config.log.println("stack used: " + regex.stackNeeded); 21.45 - if (Config.USE_STRING_TEMPLATES) Config.log.print("templates: " + regex.templateNum + "\n"); 21.46 + if (Config.USE_STRING_TEMPLATES) { 21.47 + Config.log.print("templates: " + regex.templateNum + "\n"); 21.48 + } 21.49 Config.log.println(new ByteCodePrinter(regex).byteCodeListToString()); 21.50 21.51 } // DEBUG_COMPILE 21.52 @@ -136,7 +142,9 @@ 21.53 ConsAltNode can = (ConsAltNode)node; 21.54 do { 21.55 final int v = quantifiersMemoryInfo(can.car); 21.56 - if (v > info) info = v; 21.57 + if (v > info) { 21.58 + info = v; 21.59 + } 21.60 } while ((can = can.cdr) != null); 21.61 break; 21.62 21.63 @@ -182,7 +190,9 @@ 21.64 switch (node.getType()) { 21.65 case NodeType.BREF: 21.66 final BackRefNode br = (BackRefNode)node; 21.67 - if (br.isRecursion()) break; 21.68 + if (br.isRecursion()) { 21.69 + break; 21.70 + } 21.71 21.72 if (br.backRef > env.numMem) { 21.73 throw new ValueException(ERR_INVALID_BACKREF); 21.74 @@ -249,6 +259,9 @@ 21.75 case EncloseType.STOP_BACKTRACK: 21.76 min = getMinMatchLength(en.target); 21.77 break; 21.78 + 21.79 + default: 21.80 + break; 21.81 } // inner switch 21.82 break; 21.83 21.84 @@ -276,7 +289,9 @@ 21.85 ConsAltNode an = (ConsAltNode)node; 21.86 do { 21.87 final int tmax = getMaxMatchLength(an.car); 21.88 - if (max < tmax) max = tmax; 21.89 + if (max < tmax) { 21.90 + max = tmax; 21.91 + } 21.92 } while ((an = an.cdr) != null); 21.93 break; 21.94 21.95 @@ -304,7 +319,9 @@ 21.96 throw new ValueException(ERR_INVALID_BACKREF); 21.97 } 21.98 final int tmax = getMaxMatchLength(env.memNodes[br.backRef]); 21.99 - if (max < tmax) max = tmax; 21.100 + if (max < tmax) { 21.101 + max = tmax; 21.102 + } 21.103 break; 21.104 21.105 case NodeType.QTFR: 21.106 @@ -338,6 +355,9 @@ 21.107 case EncloseType.STOP_BACKTRACK: 21.108 max = getMaxMatchLength(en.target); 21.109 break; 21.110 + 21.111 + default: 21.112 + break; 21.113 } // inner switch 21.114 break; 21.115 21.116 @@ -355,8 +375,8 @@ 21.117 return getCharLengthTree(node, 0); 21.118 } 21.119 21.120 - private int getCharLengthTree(final Node node, int level) { 21.121 - level++; 21.122 + private int getCharLengthTree(final Node node, final int levelp) { 21.123 + final int level = levelp + 1; 21.124 21.125 int len = 0; 21.126 returnCode = 0; 21.127 @@ -366,7 +386,9 @@ 21.128 ConsAltNode ln = (ConsAltNode)node; 21.129 do { 21.130 final int tlen = getCharLengthTree(ln.car, level); 21.131 - if (returnCode == 0) len = MinMaxLen.distanceAdd(len, tlen); 21.132 + if (returnCode == 0) { 21.133 + len = MinMaxLen.distanceAdd(len, tlen); 21.134 + } 21.135 } while (returnCode == 0 && (ln = ln.cdr) != null); 21.136 break; 21.137 21.138 @@ -378,7 +400,9 @@ 21.139 while (returnCode == 0 && (an = an.cdr) != null) { 21.140 final int tlen2 = getCharLengthTree(an.car, level); 21.141 if (returnCode == 0) { 21.142 - if (tlen != tlen2) varLen = true; 21.143 + if (tlen != tlen2) { 21.144 + varLen = true; 21.145 + } 21.146 } 21.147 } 21.148 21.149 @@ -404,7 +428,9 @@ 21.150 final QuantifierNode qn = (QuantifierNode)node; 21.151 if (qn.lower == qn.upper) { 21.152 tlen = getCharLengthTree(qn.target, level); 21.153 - if (returnCode == 0) len = MinMaxLen.distanceMultiply(tlen, qn.lower); 21.154 + if (returnCode == 0) { 21.155 + len = MinMaxLen.distanceMultiply(tlen, qn.lower); 21.156 + } 21.157 } else { 21.158 returnCode = GET_CHAR_LEN_VARLEN; 21.159 } 21.160 @@ -435,6 +461,9 @@ 21.161 case EncloseType.STOP_BACKTRACK: 21.162 len = getCharLengthTree(en.target, level); 21.163 break; 21.164 + 21.165 + default: 21.166 + break; 21.167 } // inner switch 21.168 break; 21.169 21.170 @@ -448,7 +477,9 @@ 21.171 } 21.172 21.173 /* x is not included y ==> 1 : 0 */ 21.174 - private boolean isNotIncluded(Node x, Node y) { 21.175 + private static boolean isNotIncluded(final Node xn, final Node yn) { 21.176 + Node x = xn; 21.177 + Node y = yn; 21.178 Node tmp; 21.179 21.180 // !retry:! 21.181 @@ -492,10 +523,14 @@ 21.182 boolean v = xc.bs.at(i); 21.183 if ((v && !xc.isNot()) || (!v && xc.isNot())) { 21.184 v = yc.bs.at(i); 21.185 - if ((v && !yc.isNot()) || (!v && yc.isNot())) return false; 21.186 + if ((v && !yc.isNot()) || (!v && yc.isNot())) { 21.187 + return false; 21.188 + } 21.189 } 21.190 } 21.191 - if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) return true; 21.192 + if ((xc.mbuf == null && !xc.isNot()) || yc.mbuf == null && !yc.isNot()) { 21.193 + return true; 21.194 + } 21.195 return false; 21.196 // break; not reached 21.197 21.198 @@ -514,7 +549,9 @@ 21.199 21.200 case NodeType.STR: 21.201 final StringNode xs = (StringNode)x; 21.202 - if (xs.length() == 0) break; 21.203 + if (xs.length() == 0) { 21.204 + break; 21.205 + } 21.206 21.207 switch (yType) { 21.208 21.209 @@ -526,13 +563,16 @@ 21.210 case NodeType.STR: 21.211 final StringNode ys = (StringNode)y; 21.212 int len = xs.length(); 21.213 - if (len > ys.length()) len = ys.length(); 21.214 + if (len > ys.length()) { 21.215 + len = ys.length(); 21.216 + } 21.217 if (xs.isAmbig() || ys.isAmbig()) { 21.218 /* tiny version */ 21.219 return false; 21.220 - } else { 21.221 - for (int i=0, p=ys.p, q=xs.p; i<len; i++, p++, q++) { 21.222 - if (ys.chars[p] != xs.chars[q]) return true; 21.223 + } 21.224 + for (int i=0, pt=ys.p, q=xs.p; i<len; i++, pt++, q++) { 21.225 + if (ys.chars[pt] != xs.chars[q]) { 21.226 + return true; 21.227 } 21.228 } 21.229 break; 21.230 @@ -542,6 +582,8 @@ 21.231 } // inner switch 21.232 21.233 break; // case NodeType.STR 21.234 + default: 21.235 + break; 21.236 21.237 } // switch 21.238 21.239 @@ -561,7 +603,9 @@ 21.240 21.241 case NodeType.CTYPE: 21.242 case NodeType.CCLASS: 21.243 - if (!exact) n = node; 21.244 + if (!exact) { 21.245 + n = node; 21.246 + } 21.247 break; 21.248 21.249 case NodeType.LIST: 21.250 @@ -570,7 +614,10 @@ 21.251 21.252 case NodeType.STR: 21.253 final StringNode sn = (StringNode)node; 21.254 - if (sn.end <= sn.p) break; // ??? 21.255 + if (sn.end <= sn.p) 21.256 + { 21.257 + break; // ??? 21.258 + } 21.259 21.260 if (exact && !sn.isRaw() && isIgnoreCase(regex.options)){ 21.261 // nothing 21.262 @@ -605,12 +652,17 @@ 21.263 case EncloseType.STOP_BACKTRACK: 21.264 n = getHeadValueNode(en.target, exact); 21.265 break; 21.266 + 21.267 + default: 21.268 + break; 21.269 } // inner switch 21.270 break; 21.271 21.272 case NodeType.ANCHOR: 21.273 final AnchorNode an = (AnchorNode)node; 21.274 - if (an.type == AnchorType.PREC_READ) n = getHeadValueNode(an.target, exact); 21.275 + if (an.type == AnchorType.PREC_READ) { 21.276 + n = getHeadValueNode(an.target, exact); 21.277 + } 21.278 break; 21.279 21.280 default: 21.281 @@ -622,7 +674,9 @@ 21.282 21.283 // true: invalid 21.284 private boolean checkTypeTree(final Node node, final int typeMask, final int encloseMask, final int anchorMask) { 21.285 - if ((node.getType2Bit() & typeMask) == 0) return true; 21.286 + if ((node.getType2Bit() & typeMask) == 0) { 21.287 + return true; 21.288 + } 21.289 21.290 boolean invalid = false; 21.291 21.292 @@ -641,15 +695,21 @@ 21.293 21.294 case NodeType.ENCLOSE: 21.295 final EncloseNode en = (EncloseNode)node; 21.296 - if ((en.type & encloseMask) == 0) return true; 21.297 + if ((en.type & encloseMask) == 0) { 21.298 + return true; 21.299 + } 21.300 invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask); 21.301 break; 21.302 21.303 case NodeType.ANCHOR: 21.304 final AnchorNode an = (AnchorNode)node; 21.305 - if ((an.type & anchorMask) == 0) return true; 21.306 + if ((an.type & anchorMask) == 0) { 21.307 + return true; 21.308 + } 21.309 21.310 - if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask); 21.311 + if (an.target != null) { 21.312 + invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask); 21.313 + } 21.314 break; 21.315 21.316 default: 21.317 @@ -664,7 +724,8 @@ 21.318 (?<=A|B) ==> (?<=A)|(?<=B) 21.319 (?<!A|B) ==> (?<!A)(?<!B) 21.320 */ 21.321 - private Node divideLookBehindAlternatives(Node node) { 21.322 + private Node divideLookBehindAlternatives(final Node nodep) { 21.323 + Node node = nodep; 21.324 final AnchorNode an = (AnchorNode)node; 21.325 final int anchorType = an.type; 21.326 Node head = an.target; 21.327 @@ -699,7 +760,7 @@ 21.328 private Node setupLookBehind(final Node node) { 21.329 final AnchorNode an = (AnchorNode)node; 21.330 final int len = getCharLengthTree(an.target); 21.331 - switch(returnCode) { 21.332 + switch (returnCode) { 21.333 case 0: 21.334 an.charLength = len; 21.335 break; 21.336 @@ -708,14 +769,17 @@ 21.337 case GET_CHAR_LEN_TOP_ALT_VARLEN: 21.338 if (syntax.differentLengthAltLookBehind()) { 21.339 return divideLookBehindAlternatives(node); 21.340 - } else { 21.341 - throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 21.342 } 21.343 + throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 21.344 + default: 21.345 + break; 21.346 } 21.347 return node; 21.348 } 21.349 21.350 - private void nextSetup(Node node, final Node nextNode) { 21.351 + private void nextSetup(final Node nodep, final Node nextNode) { 21.352 + Node node = nodep; 21.353 + 21.354 // retry: 21.355 retry: while(true) { 21.356 21.357 @@ -762,7 +826,7 @@ 21.358 } 21.359 21.360 private void updateStringNodeCaseFoldMultiByte(final StringNode sn) { 21.361 - final char[] chars = sn.chars; 21.362 + final char[] ch = sn.chars; 21.363 final int end = sn.end; 21.364 value = sn.p; 21.365 int sp = 0; 21.366 @@ -770,15 +834,15 @@ 21.367 21.368 while (value < end) { 21.369 final int ovalue = value; 21.370 - buf = EncodingHelper.toLowerCase(chars[value++]); 21.371 + buf = EncodingHelper.toLowerCase(ch[value++]); 21.372 21.373 - if (chars[ovalue] != buf) { 21.374 + if (ch[ovalue] != buf) { 21.375 21.376 char[] sbuf = new char[sn.length() << 1]; 21.377 - System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p); 21.378 + System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p); 21.379 value = ovalue; 21.380 while (value < end) { 21.381 - buf = EncodingHelper.toLowerCase(chars[value++]); 21.382 + buf = EncodingHelper.toLowerCase(ch[value++]); 21.383 if (sp >= sbuf.length) { 21.384 final char[]tmp = new char[sbuf.length << 1]; 21.385 System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); 21.386 @@ -798,8 +862,8 @@ 21.387 updateStringNodeCaseFoldMultiByte(sn); 21.388 } 21.389 21.390 - private Node expandCaseFoldMakeRemString(final char[] chars, final int p, final int end) { 21.391 - final StringNode node = new StringNode(chars, p, end); 21.392 + private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) { 21.393 + final StringNode node = new StringNode(ch, pp, end); 21.394 21.395 updateStringNodeCaseFold(node); 21.396 node.setAmbig(); 21.397 @@ -807,7 +871,7 @@ 21.398 return node; 21.399 } 21.400 21.401 - private boolean expandCaseFoldStringAlt(final int itemNum, final char[] items, 21.402 + private static boolean expandCaseFoldStringAlt(final int itemNum, final char[] items, 21.403 final char[] chars, final int p, final int slen, final int end, final ObjPtr<Node> node) { 21.404 21.405 ConsAltNode altNode; 21.406 @@ -833,59 +897,68 @@ 21.407 private Node expandCaseFoldString(final Node node) { 21.408 final StringNode sn = (StringNode)node; 21.409 21.410 - if (sn.isAmbig() || sn.length() <= 0) return node; 21.411 + if (sn.isAmbig() || sn.length() <= 0) { 21.412 + return node; 21.413 + } 21.414 21.415 - final char[] chars = sn.chars; 21.416 - int p = sn.p; 21.417 + final char[] chars1 = sn.chars; 21.418 + int pt = sn.p; 21.419 final int end = sn.end; 21.420 int altNum = 1; 21.421 21.422 - ConsAltNode topRoot = null, root = null; 21.423 + ConsAltNode topRoot = null, r = null; 21.424 + @SuppressWarnings("unused") 21.425 final ObjPtr<Node> prevNode = new ObjPtr<Node>(); 21.426 StringNode stringNode = null; 21.427 21.428 - while (p < end) { 21.429 - final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars[p]); 21.430 + while (pt < end) { 21.431 + final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]); 21.432 21.433 if (items.length == 0) { 21.434 if (stringNode == null) { 21.435 - if (root == null && prevNode.p != null) { 21.436 - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); 21.437 + if (r == null && prevNode.p != null) { 21.438 + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); 21.439 } 21.440 21.441 prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL); 21.442 21.443 - if (root != null) ConsAltNode.listAdd(root, stringNode); 21.444 + if (r != null) { 21.445 + ConsAltNode.listAdd(r, stringNode); 21.446 + } 21.447 21.448 } 21.449 21.450 - stringNode.cat(chars, p, p + 1); 21.451 + stringNode.cat(chars1, pt, pt + 1); 21.452 } else { 21.453 altNum *= (items.length + 1); 21.454 - if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break; 21.455 - 21.456 - if (root == null && prevNode.p != null) { 21.457 - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); 21.458 + if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) { 21.459 + break; 21.460 } 21.461 21.462 - expandCaseFoldStringAlt(items.length, items, chars, p, 1, end, prevNode); 21.463 - if (root != null) ConsAltNode.listAdd(root, prevNode.p); 21.464 + if (r == null && prevNode.p != null) { 21.465 + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); 21.466 + } 21.467 + 21.468 + expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode); 21.469 + if (r != null) { 21.470 + ConsAltNode.listAdd(r, prevNode.p); 21.471 + } 21.472 stringNode = null; 21.473 } 21.474 - p++; 21.475 + pt++; 21.476 } 21.477 21.478 - if (p < end) { 21.479 - final Node srem = expandCaseFoldMakeRemString(chars, p, end); 21.480 + if (pt < end) { 21.481 + final Node srem = expandCaseFoldMakeRemString(chars1, pt, end); 21.482 21.483 - if (prevNode.p != null && root == null) { 21.484 - topRoot = root = ConsAltNode.listAdd(null, prevNode.p); 21.485 + if (prevNode.p != null && r == null) { 21.486 + topRoot = r = ConsAltNode.listAdd(null, prevNode.p); 21.487 } 21.488 21.489 - if (root == null) { 21.490 + if (r == null) { 21.491 prevNode.p = srem; 21.492 } else { 21.493 - ConsAltNode.listAdd(root, srem); 21.494 + ConsAltNode.listAdd(r, srem); 21.495 } 21.496 } 21.497 /* ending */ 21.498 @@ -909,7 +982,10 @@ 21.499 5. find invalid patterns in look-behind. 21.500 6. expand repeated string. 21.501 */ 21.502 - protected final Node setupTree(Node node, int state) { 21.503 + protected final Node setupTree(final Node nodep, final int statep) { 21.504 + Node node = nodep; 21.505 + int state = statep; 21.506 + 21.507 restart: while (true) { 21.508 switch (node.getType()) { 21.509 case NodeType.LIST: 21.510 @@ -958,7 +1034,9 @@ 21.511 final QuantifierNode qn = (QuantifierNode)node; 21.512 Node target = qn.target; 21.513 21.514 - if ((state & IN_REPEAT) != 0) qn.setInRepeat(); 21.515 + if ((state & IN_REPEAT) != 0) { 21.516 + qn.setInRepeat(); 21.517 + } 21.518 21.519 if (isRepeatInfinite(qn.upper) || qn.lower >= 1) { 21.520 final int d = getMinMatchLength(target); 21.521 @@ -966,14 +1044,18 @@ 21.522 qn.targetEmptyInfo = TargetInfo.IS_EMPTY; 21.523 if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) { 21.524 final int info = quantifiersMemoryInfo(target); 21.525 - if (info > 0) qn.targetEmptyInfo = info; 21.526 + if (info > 0) { 21.527 + qn.targetEmptyInfo = info; 21.528 + } 21.529 } // USE_INFINITE_REPEAT_MONOMANIAC_MEM_STATUS_CHECK 21.530 // strange stuff here (turned off) 21.531 } 21.532 } 21.533 21.534 state |= IN_REPEAT; 21.535 - if (qn.lower != qn.upper) state |= IN_VAR_REPEAT; 21.536 + if (qn.lower != qn.upper) { 21.537 + state |= IN_VAR_REPEAT; 21.538 + } 21.539 21.540 target = setupTree(target, state); 21.541 21.542 @@ -1035,11 +1117,16 @@ 21.543 final QuantifierNode tqn = (QuantifierNode)en.target; 21.544 if (isRepeatInfinite(tqn.upper) && tqn.lower <= 1 && tqn.greedy) { 21.545 /* (?>a*), a*+ etc... */ 21.546 - if (tqn.target.isSimple()) en.setStopBtSimpleRepeat(); 21.547 + if (tqn.target.isSimple()) { 21.548 + en.setStopBtSimpleRepeat(); 21.549 + } 21.550 } 21.551 } 21.552 break; 21.553 21.554 + default: 21.555 + break; 21.556 + 21.557 } // inner switch 21.558 break; 21.559 21.560 @@ -1059,7 +1146,9 @@ 21.561 throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 21.562 } 21.563 node = setupLookBehind(node); 21.564 - if (node.getType() != NodeType.ANCHOR) continue restart; 21.565 + if (node.getType() != NodeType.ANCHOR) { 21.566 + continue restart; 21.567 + } 21.568 setupTree(((AnchorNode)node).target, state); 21.569 break; 21.570 21.571 @@ -1068,12 +1157,19 @@ 21.572 throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 21.573 } 21.574 node = setupLookBehind(node); 21.575 - if (node.getType() != NodeType.ANCHOR) continue restart; 21.576 + if (node.getType() != NodeType.ANCHOR) { 21.577 + continue restart; 21.578 + } 21.579 setupTree(((AnchorNode)node).target, (state | IN_NOT)); 21.580 break; 21.581 21.582 + default: 21.583 + break; 21.584 + 21.585 } // inner switch 21.586 break; 21.587 + default: 21.588 + break; 21.589 } // switch 21.590 return node; 21.591 } // restart: while 21.592 @@ -1191,7 +1287,9 @@ 21.593 opt.expr.copy(nopt.exm); 21.594 } 21.595 opt.expr.reachEnd = false; 21.596 - if (nopt.map.value > 0) opt.map.copy(nopt.map); 21.597 + if (nopt.map.value > 0) { 21.598 + opt.map.copy(nopt.map); 21.599 + } 21.600 break; 21.601 21.602 case AnchorType.PREC_READ_NOT: 21.603 @@ -1199,6 +1297,9 @@ 21.604 case AnchorType.LOOK_BEHIND_NOT: 21.605 break; 21.606 21.607 + default: 21.608 + break; 21.609 + 21.610 } // inner switch 21.611 break; 21.612 } 21.613 @@ -1282,8 +1383,12 @@ 21.614 if (++en.optCount > MAX_NODE_OPT_INFO_REF_COUNT) { 21.615 int min = 0; 21.616 int max = MinMaxLen.INFINITE_DISTANCE; 21.617 - if (en.isMinFixed()) min = en.minLength; 21.618 - if (en.isMaxFixed()) max = en.maxLength; 21.619 + if (en.isMinFixed()) { 21.620 + min = en.minLength; 21.621 + } 21.622 + if (en.isMaxFixed()) { 21.623 + max = en.maxLength; 21.624 + } 21.625 opt.length.set(min, max); 21.626 } else { // USE_SUBEXP_CALL 21.627 optimizeNodeLeft(en.target, opt, oenv); 21.628 @@ -1298,6 +1403,9 @@ 21.629 case EncloseType.STOP_BACKTRACK: 21.630 optimizeNodeLeft(en.target, opt, oenv); 21.631 break; 21.632 + 21.633 + default: 21.634 + break; 21.635 } // inner switch 21.636 break; 21.637 } 21.638 @@ -1307,6 +1415,7 @@ 21.639 } // switch 21.640 } 21.641 21.642 + @SuppressWarnings("unused") 21.643 protected final void setOptimizedInfoFromTree(final Node node) { 21.644 final NodeOptInfo opt = new NodeOptInfo(); 21.645 final OptEnvironment oenv = new OptEnvironment(); 21.646 @@ -1347,7 +1456,9 @@ 21.647 regex.setSubAnchor(opt.map.anchor); 21.648 } else { 21.649 regex.subAnchor |= opt.anchor.leftAnchor & AnchorType.BEGIN_LINE; 21.650 - if (opt.length.max == 0) regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE; 21.651 + if (opt.length.max == 0) { 21.652 + regex.subAnchor |= opt.anchor.rightAnchor & AnchorType.END_LINE; 21.653 + } 21.654 } 21.655 21.656 if (Config.DEBUG_COMPILE || Config.DEBUG_MATCH) {
22.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Mon Nov 03 07:29:46 2014 +0100 22.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Mon Nov 03 11:47:41 2014 +0100 22.3 @@ -24,7 +24,7 @@ 22.4 final class ApplyCaseFold { 22.5 22.6 // i_apply_case_fold 22.7 - public void apply(final int from, final int to, final Object o) { 22.8 + public static void apply(final int from, final int to, final Object o) { 22.9 final ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o; 22.10 22.11 final ScanEnvironment env = arg.env; 22.12 @@ -45,7 +45,9 @@ 22.13 } else { 22.14 if (inCC) { 22.15 if (to >= BitSet.SINGLE_BYTE_SIZE) { 22.16 - if (cc.isNot()) cc.clearNotFlag(); 22.17 + if (cc.isNot()) { 22.18 + cc.clearNotFlag(); 22.19 + } 22.20 cc.addCodeRange(env, to, to); 22.21 } else { 22.22 if (cc.isNot()) {
23.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java Mon Nov 03 07:29:46 2014 +0100 23.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java Mon Nov 03 11:47:41 2014 +0100 23.3 @@ -22,6 +22,7 @@ 23.4 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; 23.5 import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode; 23.6 23.7 +@SuppressWarnings("javadoc") 23.8 public final class ApplyCaseFoldArg { 23.9 final ScanEnvironment env; 23.10 final CClassNode cc;
24.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java Mon Nov 03 07:29:46 2014 +0100 24.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java Mon Nov 03 11:47:41 2014 +0100 24.3 @@ -24,7 +24,6 @@ 24.4 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase; 24.5 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline; 24.6 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; 24.7 - 24.8 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode; 24.9 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode; 24.10 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; 24.11 @@ -98,15 +97,15 @@ 24.12 } while ((aln = aln.cdr) != null); 24.13 } 24.14 24.15 - private boolean isNeedStrLenOpExact(final int op) { 24.16 + private static boolean isNeedStrLenOpExact(final int op) { 24.17 return op == OPCode.EXACTN || op == OPCode.EXACTN_IC; 24.18 } 24.19 24.20 - private boolean opTemplated(final int op) { 24.21 + private static boolean opTemplated(final int op) { 24.22 return isNeedStrLenOpExact(op); 24.23 } 24.24 24.25 - private int selectStrOpcode(final int strLength, final boolean ignoreCase) { 24.26 + private static int selectStrOpcode(final int strLength, final boolean ignoreCase) { 24.27 int op; 24.28 24.29 if (ignoreCase) { 24.30 @@ -139,7 +138,7 @@ 24.31 compileTree(node); 24.32 24.33 if (emptyInfo != 0) { 24.34 - switch(emptyInfo) { 24.35 + switch (emptyInfo) { 24.36 case TargetInfo.IS_EMPTY: 24.37 addOpcode(OPCode.NULL_CHECK_END); 24.38 break; 24.39 @@ -149,13 +148,15 @@ 24.40 case TargetInfo.IS_EMPTY_REC: 24.41 addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH); 24.42 break; 24.43 + default: 24.44 + break; 24.45 } // switch 24.46 24.47 addMemNum(savedNumNullCheck); /* NULL CHECK ID */ 24.48 } 24.49 } 24.50 24.51 - private int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) { 24.52 + private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) { 24.53 final int op = selectStrOpcode(strLength, ignoreCase); 24.54 int len = OPSize.OPCODE; 24.55 24.56 @@ -163,7 +164,9 @@ 24.57 // string length, template index, template string pointer 24.58 len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX; 24.59 } else { 24.60 - if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH; 24.61 + if (isNeedStrLenOpExact(op)) { 24.62 + len += OPSize.LENGTH; 24.63 + } 24.64 len += strLength; 24.65 } 24.66 return len; 24.67 @@ -187,9 +190,11 @@ 24.68 } 24.69 } 24.70 24.71 - private int compileLengthStringNode(final Node node) { 24.72 + private static int compileLengthStringNode(final Node node) { 24.73 final StringNode sn = (StringNode)node; 24.74 - if (sn.length() <= 0) return 0; 24.75 + if (sn.length() <= 0) { 24.76 + return 0; 24.77 + } 24.78 final boolean ambig = sn.isAmbig(); 24.79 24.80 int p, prev; 24.81 @@ -210,8 +215,10 @@ 24.82 return rlen; 24.83 } 24.84 24.85 - private int compileLengthStringRawNode(final StringNode sn) { 24.86 - if (sn.length() <= 0) return 0; 24.87 + private static int compileLengthStringRawNode(final StringNode sn) { 24.88 + if (sn.length() <= 0) { 24.89 + return 0; 24.90 + } 24.91 return addCompileStringlength(sn.chars, sn.p, sn.length(), false); 24.92 } 24.93 24.94 @@ -220,8 +227,10 @@ 24.95 addInts(mbuf.p, mbuf.used); 24.96 } 24.97 24.98 - private int compileLengthCClassNode(final CClassNode cc) { 24.99 - if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER; 24.100 + private static int compileLengthCClassNode(final CClassNode cc) { 24.101 + if (cc.isShare()) { 24.102 + return OPSize.OPCODE + OPSize.POINTER; 24.103 + } 24.104 24.105 int len; 24.106 if (cc.mbuf == null) { 24.107 @@ -360,9 +369,8 @@ 24.108 if (qn.greedy && infinite) { 24.109 if (qn.nextHeadExact != null) { 24.110 return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower; 24.111 - } else { 24.112 - return OPSize.ANYCHAR_STAR + tlen * qn.lower; 24.113 } 24.114 + return OPSize.ANYCHAR_STAR + tlen * qn.lower; 24.115 } 24.116 } 24.117 24.118 @@ -425,14 +433,13 @@ 24.119 final StringNode sn = (StringNode)qn.nextHeadExact; 24.120 addChars(sn.chars, sn.p, 1); 24.121 return; 24.122 + } 24.123 + if (isMultiline(regex.options)) { 24.124 + addOpcode(OPCode.ANYCHAR_ML_STAR); 24.125 } else { 24.126 - if (isMultiline(regex.options)) { 24.127 - addOpcode(OPCode.ANYCHAR_ML_STAR); 24.128 - } else { 24.129 - addOpcode(OPCode.ANYCHAR_STAR); 24.130 - } 24.131 - return; 24.132 + addOpcode(OPCode.ANYCHAR_STAR); 24.133 } 24.134 + return; 24.135 } 24.136 24.137 int modTLen; 24.138 @@ -510,9 +517,8 @@ 24.139 24.140 if (isDynamic(prev ^ node.option)) { 24.141 return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION; 24.142 - } else { 24.143 - return tlen; 24.144 } 24.145 + return tlen; 24.146 } 24.147 24.148 @Override 24.149 @@ -675,13 +681,15 @@ 24.150 break; 24.151 24.152 case AnchorType.WORD_BEGIN: 24.153 - if (Config.USE_WORD_BEGIN_END) 24.154 + if (Config.USE_WORD_BEGIN_END) { 24.155 addOpcode(OPCode.WORD_BEGIN); 24.156 + } 24.157 break; 24.158 24.159 case AnchorType.WORD_END: 24.160 - if (Config.USE_WORD_BEGIN_END) 24.161 + if (Config.USE_WORD_BEGIN_END) { 24.162 addOpcode(OPCode.WORD_END); 24.163 + } 24.164 break; 24.165 24.166 case AnchorType.PREC_READ: 24.167 @@ -701,7 +709,9 @@ 24.168 addOpcode(OPCode.LOOK_BEHIND); 24.169 if (node.charLength < 0) { 24.170 n = analyser.getCharLengthTree(node.target); 24.171 - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 24.172 + if (analyser.returnCode != 0) { 24.173 + newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 24.174 + } 24.175 } else { 24.176 n = node.charLength; 24.177 } 24.178 @@ -714,7 +724,9 @@ 24.179 addOpcodeRelAddr(OPCode.PUSH_LOOK_BEHIND_NOT, len + OPSize.FAIL_LOOK_BEHIND_NOT); 24.180 if (node.charLength < 0) { 24.181 n = analyser.getCharLengthTree(node.target); 24.182 - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 24.183 + if (analyser.returnCode != 0) { 24.184 + newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); 24.185 + } 24.186 } else { 24.187 n = node.charLength; 24.188 } 24.189 @@ -796,7 +808,9 @@ 24.190 private void ensure(final int size) { 24.191 if (size >= code.length) { 24.192 int length = code.length << 1; 24.193 - while (length <= size) length <<= 1; 24.194 + while (length <= size) { 24.195 + length <<= 1; 24.196 + } 24.197 final int[]tmp = new int[length]; 24.198 System.arraycopy(code, 0, tmp, 0, code.length); 24.199 code = tmp; 24.200 @@ -829,11 +843,14 @@ 24.201 regex.operands[regex.operandLength++] = o; 24.202 } 24.203 24.204 - private void addChars(final char[] chars, int p ,final int length) { 24.205 + private void addChars(final char[] chars, final int pp ,final int length) { 24.206 ensure(codeLength + length); 24.207 + int p = pp; 24.208 final int end = p + length; 24.209 24.210 - while (p < end) code[codeLength++] = chars[p++]; 24.211 + while (p < end) { 24.212 + code[codeLength++] = chars[p++]; 24.213 + } 24.214 } 24.215 24.216 private void addInts(final int[]ints, final int length) { 24.217 @@ -876,6 +893,9 @@ 24.218 case OPCode.CALL: 24.219 case OPCode.RETURN: // it will appear only with CALL though 24.220 regex.stackNeeded = true; 24.221 + break; 24.222 + default: 24.223 + break; 24.224 } 24.225 } 24.226
25.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Mon Nov 03 07:29:46 2014 +0100 25.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Mon Nov 03 11:47:41 2014 +0100 25.3 @@ -19,6 +19,7 @@ 25.4 */ 25.5 package jdk.nashorn.internal.runtime.regexp.joni; 25.6 25.7 +@SuppressWarnings("javadoc") 25.8 public final class BitSet { 25.9 static final int BITS_PER_BYTE = 8; 25.10 public static final int SINGLE_BYTE_SIZE = (1 << BITS_PER_BYTE); 25.11 @@ -34,7 +35,9 @@ 25.12 final StringBuilder buffer = new StringBuilder(); 25.13 buffer.append("BitSet"); 25.14 for (int i=0; i<SINGLE_BYTE_SIZE; i++) { 25.15 - if ((i % (SINGLE_BYTE_SIZE / BITS_TO_STRING_WRAP)) == 0) buffer.append("\n "); 25.16 + if ((i % (SINGLE_BYTE_SIZE / BITS_TO_STRING_WRAP)) == 0) { 25.17 + buffer.append("\n "); 25.18 + } 25.19 buffer.append(at(i) ? "1" : "0"); 25.20 } 25.21 return buffer.toString(); 25.22 @@ -53,44 +56,62 @@ 25.23 } 25.24 25.25 public void clear() { 25.26 - for (int i=0; i<BITSET_SIZE; i++) bits[i]=0; 25.27 + for (int i=0; i<BITSET_SIZE; i++) { 25.28 + bits[i]=0; 25.29 + } 25.30 } 25.31 25.32 public boolean isEmpty() { 25.33 for (int i=0; i<BITSET_SIZE; i++) { 25.34 - if (bits[i] != 0) return false; 25.35 + if (bits[i] != 0) { 25.36 + return false; 25.37 + } 25.38 } 25.39 return true; 25.40 } 25.41 25.42 public void setRange(final int from, final int to) { 25.43 - for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) set(i); 25.44 + for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) { 25.45 + set(i); 25.46 + } 25.47 } 25.48 25.49 public void invert() { 25.50 - for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~bits[i]; 25.51 + for (int i=0; i<BITSET_SIZE; i++) { 25.52 + bits[i] = ~bits[i]; 25.53 + } 25.54 } 25.55 25.56 public void invertTo(final BitSet to) { 25.57 - for (int i=0; i<BITSET_SIZE; i++) to.bits[i] = ~bits[i]; 25.58 + for (int i=0; i<BITSET_SIZE; i++) { 25.59 + to.bits[i] = ~bits[i]; 25.60 + } 25.61 } 25.62 25.63 public void and(final BitSet other) { 25.64 - for (int i=0; i<BITSET_SIZE; i++) bits[i] &= other.bits[i]; 25.65 + for (int i=0; i<BITSET_SIZE; i++) { 25.66 + bits[i] &= other.bits[i]; 25.67 + } 25.68 } 25.69 25.70 public void or(final BitSet other) { 25.71 - for (int i=0; i<BITSET_SIZE; i++) bits[i] |= other.bits[i]; 25.72 + for (int i=0; i<BITSET_SIZE; i++) { 25.73 + bits[i] |= other.bits[i]; 25.74 + } 25.75 } 25.76 25.77 public void copy(final BitSet other) { 25.78 - for (int i=0; i<BITSET_SIZE; i++) bits[i] = other.bits[i]; 25.79 + for (int i=0; i<BITSET_SIZE; i++) { 25.80 + bits[i] = other.bits[i]; 25.81 + } 25.82 } 25.83 25.84 public int numOn() { 25.85 int num = 0; 25.86 for (int i=0; i<SINGLE_BYTE_SIZE; i++) { 25.87 - if (at(i)) num++; 25.88 + if (at(i)) { 25.89 + num++; 25.90 + } 25.91 } 25.92 return num; 25.93 } 25.94 @@ -99,9 +120,12 @@ 25.95 return 1 << (pos % SINGLE_BYTE_SIZE); 25.96 } 25.97 25.98 - private static int log2(int n){ 25.99 + private static int log2(final int np) { 25.100 int log = 0; 25.101 - while ((n >>>= 1) != 0) log++; 25.102 + int n = np; 25.103 + while ((n >>>= 1) != 0) { 25.104 + log++; 25.105 + } 25.106 return log; 25.107 } 25.108
26.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java Mon Nov 03 07:29:46 2014 +0100 26.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java Mon Nov 03 11:47:41 2014 +0100 26.3 @@ -34,7 +34,8 @@ 26.4 return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0; 26.5 } 26.6 26.7 - public static int bsOnAt(int stats, final int n) { 26.8 + public static int bsOnAt(final int statsp, final int n) { 26.9 + int stats = statsp; 26.10 if (n < BIT_STATUS_BITS_NUM) { 26.11 stats |= (1 << n); 26.12 } else { 26.13 @@ -43,12 +44,7 @@ 26.14 return stats; 26.15 } 26.16 26.17 - public static int bsOnOff(int v, final int f, final boolean negative) { 26.18 - if (negative) { 26.19 - v &= ~f; 26.20 - } else { 26.21 - v |= f; 26.22 - } 26.23 - return v; 26.24 + public static int bsOnOff(final int v, final int f, final boolean negative) { 26.25 + return negative ? (v & ~f) : (v | f); 26.26 } 26.27 }
27.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Mon Nov 03 07:29:46 2014 +0100 27.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Mon Nov 03 11:47:41 2014 +0100 27.3 @@ -27,10 +27,8 @@ 27.4 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotBol; 27.5 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isNotEol; 27.6 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isPosixRegion; 27.7 - 27.8 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; 27.9 import jdk.nashorn.internal.runtime.regexp.joni.constants.OPCode; 27.10 -import jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize; 27.11 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; 27.12 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; 27.13 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException; 27.14 @@ -52,8 +50,8 @@ 27.15 this.code = regex.code; 27.16 } 27.17 27.18 - private boolean stringCmpIC(final int caseFlodFlag, int s1, final IntHolder ps2, final int mbLen, final int textEnd) { 27.19 - 27.20 + private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) { 27.21 + int s1 = s1p; 27.22 int s2 = ps2.value; 27.23 final int end1 = s1 + mbLen; 27.24 27.25 @@ -83,12 +81,16 @@ 27.26 Config.log.printf("%4d", (s - str)).print("> \""); 27.27 int q, i; 27.28 for (i=0, q=s; i<7 && q<end && s>=0; i++) { 27.29 - if (q < end) Config.log.print(new String(new char[]{chars[q++]})); 27.30 + if (q < end) { 27.31 + Config.log.print(new String(new char[]{chars[q++]})); 27.32 + } 27.33 } 27.34 - final String str = q < end ? "...\"" : "\""; 27.35 - q += str.length(); 27.36 - Config.log.print(str); 27.37 - for (i=0; i<20-(q-s);i++) Config.log.print(" "); 27.38 + final String string = q < end ? "...\"" : "\""; 27.39 + q += string.length(); 27.40 + Config.log.print(string); 27.41 + for (i=0; i<20-(q-s);i++) { 27.42 + Config.log.print(" "); 27.43 + } 27.44 final StringBuilder sb = new StringBuilder(); 27.45 new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip); 27.46 Config.log.println(sb.toString()); 27.47 @@ -96,28 +98,34 @@ 27.48 } 27.49 27.50 @Override 27.51 - protected final int matchAt(final int range, final int sstart, final int sprev) { 27.52 - this.range = range; 27.53 - this.sstart = sstart; 27.54 - this.sprev = sprev; 27.55 + protected final int matchAt(final int r, final int ss, final int sp) { 27.56 + this.range = r; 27.57 + this.sstart = ss; 27.58 + this.sprev = sp; 27.59 27.60 stk = 0; 27.61 ip = 0; 27.62 27.63 - if (Config.DEBUG_MATCH) debugMatchBegin(); 27.64 + if (Config.DEBUG_MATCH) { 27.65 + debugMatchBegin(); 27.66 + } 27.67 27.68 init(); 27.69 27.70 bestLen = -1; 27.71 - s = sstart; 27.72 + s = ss; 27.73 27.74 - final int[]code = this.code; 27.75 + final int[] c = this.code; 27.76 while (true) { 27.77 - if (Config.DEBUG_MATCH) debugMatchLoop(); 27.78 + if (Config.DEBUG_MATCH) { 27.79 + debugMatchLoop(); 27.80 + } 27.81 27.82 sbegin = s; 27.83 - switch (code[ip++]) { 27.84 - case OPCode.END: if (opEnd()) return finish(); break; 27.85 + switch (c[ip++]) { 27.86 + case OPCode.END: if (opEnd()) { 27.87 + return finish(); 27.88 + } break; 27.89 case OPCode.EXACT1: opExact1(); break; 27.90 case OPCode.EXACT2: opExact2(); continue; 27.91 case OPCode.EXACT3: opExact3(); continue; 27.92 @@ -358,10 +366,14 @@ 27.93 final char[] bs = regex.templates[code[ip++]]; 27.94 int ps = code[ip++]; 27.95 27.96 - while (tlen-- > 0) if (bs[ps++] != chars[s++]) {opFail(); return;} 27.97 + while (tlen-- > 0) { 27.98 + if (bs[ps++] != chars[s++]) {opFail(); return;} 27.99 + } 27.100 27.101 } else { 27.102 - while (tlen-- > 0) if (code[ip++] != chars[s++]) {opFail(); return;} 27.103 + while (tlen-- > 0) { 27.104 + if (code[ip++] != chars[s++]) {opFail(); return;} 27.105 + } 27.106 } 27.107 sprev = s - 1; 27.108 } 27.109 @@ -380,10 +392,14 @@ 27.110 final char[] bs = regex.templates[code[ip++]]; 27.111 int ps = code[ip++]; 27.112 27.113 - while (tlen-- > 0) if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 27.114 + while (tlen-- > 0) { 27.115 + if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 27.116 + } 27.117 } else { 27.118 27.119 - while (tlen-- > 0) if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 27.120 + while (tlen-- > 0) { 27.121 + if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 27.122 + } 27.123 } 27.124 sprev = s - 1; 27.125 } 27.126 @@ -402,11 +418,15 @@ 27.127 27.128 private boolean isInClassMB() { 27.129 final int tlen = code[ip++]; 27.130 - if (s >= range) return false; 27.131 + if (s >= range) { 27.132 + return false; 27.133 + } 27.134 final int ss = s; 27.135 s++; 27.136 final int c = chars[ss]; 27.137 - if (!EncodingHelper.isInCodeRange(code, ip, c)) return false; 27.138 + if (!EncodingHelper.isInCodeRange(code, ip, c)) { 27.139 + return false; 27.140 + } 27.141 ip += tlen; 27.142 return true; 27.143 } 27.144 @@ -444,7 +464,9 @@ 27.145 final int tlen = code[ip++]; 27.146 27.147 if (!(s + 1 <= range)) { 27.148 - if (s >= range) return false; 27.149 + if (s >= range) { 27.150 + return false; 27.151 + } 27.152 s = end; 27.153 ip += tlen; 27.154 return true; 27.155 @@ -454,7 +476,9 @@ 27.156 s++; 27.157 final int c = chars[ss]; 27.158 27.159 - if (EncodingHelper.isInCodeRange(code, ip, c)) return false; 27.160 + if (EncodingHelper.isInCodeRange(code, ip, c)) { 27.161 + return false; 27.162 + } 27.163 ip += tlen; 27.164 return true; 27.165 } 27.166 @@ -511,10 +535,10 @@ 27.167 } 27.168 27.169 private void opAnyCharStar() { 27.170 - final char[] chars = this.chars; 27.171 + final char[] ch = this.chars; 27.172 while (s < range) { 27.173 pushAlt(ip, s, sprev); 27.174 - if (isNewLine(chars, s, end)) {opFail(); return;} 27.175 + if (isNewLine(ch, s, end)) {opFail(); return;} 27.176 sprev = s; 27.177 s++; 27.178 } 27.179 @@ -532,11 +556,13 @@ 27.180 27.181 private void opAnyCharStarPeekNext() { 27.182 final char c = (char)code[ip]; 27.183 - final char[] chars = this.chars; 27.184 + final char[] ch = this.chars; 27.185 27.186 while (s < range) { 27.187 - final char b = chars[s]; 27.188 - if (c == b) pushAlt(ip + 1, s, sprev); 27.189 + final char b = ch[s]; 27.190 + if (c == b) { 27.191 + pushAlt(ip + 1, s, sprev); 27.192 + } 27.193 if (isNewLine(b)) {opFail(); return;} 27.194 sprev = s; 27.195 s++; 27.196 @@ -547,10 +573,12 @@ 27.197 27.198 private void opAnyCharMLStarPeekNext() { 27.199 final char c = (char)code[ip]; 27.200 - final char[] chars = this.chars; 27.201 + final char[] ch = this.chars; 27.202 27.203 while (s < range) { 27.204 - if (c == chars[s]) pushAlt(ip + 1, s, sprev); 27.205 + if (c == ch[s]) { 27.206 + pushAlt(ip + 1, s, sprev); 27.207 + } 27.208 sprev = s; 27.209 s++; 27.210 } 27.211 @@ -592,29 +620,39 @@ 27.212 27.213 private void opWordBegin() { 27.214 if (s < range && EncodingHelper.isWord(chars[s])) { 27.215 - if (s == str || !EncodingHelper.isWord(chars[sprev])) return; 27.216 + if (s == str || !EncodingHelper.isWord(chars[sprev])) { 27.217 + return; 27.218 + } 27.219 } 27.220 opFail(); 27.221 } 27.222 27.223 private void opWordEnd() { 27.224 if (s != str && EncodingHelper.isWord(chars[sprev])) { 27.225 - if (s == end || !EncodingHelper.isWord(chars[s])) return; 27.226 + if (s == end || !EncodingHelper.isWord(chars[s])) { 27.227 + return; 27.228 + } 27.229 } 27.230 opFail(); 27.231 } 27.232 27.233 private void opBeginBuf() { 27.234 - if (s != str) opFail(); 27.235 + if (s != str) { 27.236 + opFail(); 27.237 + } 27.238 } 27.239 27.240 private void opEndBuf() { 27.241 - if (s != end) opFail(); 27.242 + if (s != end) { 27.243 + opFail(); 27.244 + } 27.245 } 27.246 27.247 private void opBeginLine() { 27.248 if (s == str) { 27.249 - if (isNotBol(msaOptions)) opFail(); 27.250 + if (isNotBol(msaOptions)) { 27.251 + opFail(); 27.252 + } 27.253 return; 27.254 } else if (isNewLine(chars, sprev, end) && s != end) { 27.255 return; 27.256 @@ -626,13 +664,16 @@ 27.257 if (s == end) { 27.258 if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { 27.259 if (str == end || !isNewLine(chars, sprev, end)) { 27.260 - if (isNotEol(msaOptions)) opFail(); 27.261 + if (isNotEol(msaOptions)) { 27.262 + opFail(); 27.263 + } 27.264 } 27.265 return; 27.266 - } else { 27.267 - if (isNotEol(msaOptions)) opFail(); 27.268 - return; 27.269 } 27.270 + if (isNotEol(msaOptions)) { 27.271 + opFail(); 27.272 + } 27.273 + return; 27.274 } else if (isNewLine(chars, s, end)) { 27.275 return; 27.276 } 27.277 @@ -643,13 +684,16 @@ 27.278 if (s == end) { 27.279 if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { 27.280 if (str == end || !isNewLine(chars, sprev, end)) { 27.281 - if (isNotEol(msaOptions)) opFail(); 27.282 + if (isNotEol(msaOptions)) { 27.283 + opFail(); 27.284 + } 27.285 } 27.286 return; 27.287 - } else { 27.288 - if (isNotEol(msaOptions)) opFail(); 27.289 - return; 27.290 } 27.291 + if (isNotEol(msaOptions)) { 27.292 + opFail(); 27.293 + } 27.294 + return; 27.295 } else if (isNewLine(chars, s, end) && s + 1 == end) { 27.296 return; 27.297 } 27.298 @@ -657,7 +701,9 @@ 27.299 } 27.300 27.301 private void opBeginPosition() { 27.302 - if (s != msaStart) opFail(); 27.303 + if (s != msaStart) { 27.304 + opFail(); 27.305 + } 27.306 } 27.307 27.308 private void opMemoryStartPush() { 27.309 @@ -726,11 +772,15 @@ 27.310 sprev = s; 27.311 27.312 // STRING_CMP 27.313 - while(n-- > 0) if (chars[pstart++] != chars[s++]) {opFail(); return;} 27.314 + while(n-- > 0) { 27.315 + if (chars[pstart++] != chars[s++]) {opFail(); return;} 27.316 + } 27.317 27.318 // beyond string check 27.319 if (sprev < range) { 27.320 - while (sprev + 1 < s) sprev++; 27.321 + while (sprev + 1 < s) { 27.322 + sprev++; 27.323 + } 27.324 } 27.325 } 27.326 27.327 @@ -764,7 +814,9 @@ 27.328 s = value; 27.329 27.330 // if (sprev < chars.length) 27.331 - while (sprev + 1 < s) sprev++; 27.332 + while (sprev + 1 < s) { 27.333 + sprev++; 27.334 + } 27.335 } 27.336 27.337 private void opBackRefMulti() { 27.338 @@ -773,7 +825,9 @@ 27.339 int i; 27.340 loop:for (i=0; i<tlen; i++) { 27.341 final int mem = code[ip++]; 27.342 - if (backrefInvalid(mem)) continue; 27.343 + if (backrefInvalid(mem)) { 27.344 + continue; 27.345 + } 27.346 27.347 int pstart = backrefStart(mem); 27.348 final int pend = backrefEnd(mem); 27.349 @@ -785,14 +839,18 @@ 27.350 int swork = s; 27.351 27.352 while (n-- > 0) { 27.353 - if (chars[pstart++] != chars[swork++]) continue loop; 27.354 + if (chars[pstart++] != chars[swork++]) { 27.355 + continue loop; 27.356 + } 27.357 } 27.358 27.359 s = swork; 27.360 27.361 // beyond string check 27.362 if (sprev < range) { 27.363 - while (sprev + 1 < s) sprev++; 27.364 + while (sprev + 1 < s) { 27.365 + sprev++; 27.366 + } 27.367 } 27.368 27.369 ip += tlen - i - 1; // * SIZE_MEMNUM (1) 27.370 @@ -807,7 +865,9 @@ 27.371 int i; 27.372 loop:for (i=0; i<tlen; i++) { 27.373 final int mem = code[ip++]; 27.374 - if (backrefInvalid(mem)) continue; 27.375 + if (backrefInvalid(mem)) { 27.376 + continue; 27.377 + } 27.378 27.379 final int pstart = backrefStart(mem); 27.380 final int pend = backrefEnd(mem); 27.381 @@ -818,11 +878,16 @@ 27.382 sprev = s; 27.383 27.384 value = s; 27.385 - if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC 27.386 + if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) 27.387 + { 27.388 + continue loop; // STRING_CMP_VALUE_IC 27.389 + } 27.390 s = value; 27.391 27.392 // if (sprev < chars.length) 27.393 - while (sprev + 1 < s) sprev++; 27.394 + while (sprev + 1 < s) { 27.395 + sprev++; 27.396 + } 27.397 27.398 ip += tlen - i - 1; // * SIZE_MEMNUM (1) 27.399 break; /* success */ 27.400 @@ -830,10 +895,12 @@ 27.401 if (i == tlen) {opFail(); return;} 27.402 } 27.403 27.404 - private boolean memIsInMemp(final int mem, final int num, int memp) { 27.405 - for (int i=0; i<num; i++) { 27.406 + private boolean memIsInMemp(final int mem, final int num, final int mempp) { 27.407 + for (int i=0, memp = mempp; i<num; i++) { 27.408 final int m = code[memp++]; 27.409 - if (mem == m) return true; 27.410 + if (mem == m) { 27.411 + return true; 27.412 + } 27.413 } 27.414 return false; 27.415 } 27.416 @@ -857,7 +924,9 @@ 27.417 if (memIsInMemp(e.getMemNum(), memNum, memp)) { 27.418 final int pstart = e.getMemPStr(); 27.419 if (pend != -1) { 27.420 - if (pend - pstart > end - s) return false; /* or goto next_mem; */ 27.421 + if (pend - pstart > end - s) { 27.422 + return false; /* or goto next_mem; */ 27.423 + } 27.424 int p = pstart; 27.425 27.426 value = s; 27.427 @@ -867,7 +936,9 @@ 27.428 } 27.429 } else { 27.430 while (p < pend) { 27.431 - if (chars[p++] != chars[value++]) return false; /* or goto next_mem; */ 27.432 + if (chars[p++] != chars[value++]) { 27.433 + return false; /* or goto next_mem; */ 27.434 + } 27.435 } 27.436 } 27.437 s = value; 27.438 @@ -893,24 +964,15 @@ 27.439 27.440 sprev = s; 27.441 if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit 27.442 - while (sprev + 1 < s) sprev++; 27.443 + while (sprev + 1 < s) { 27.444 + sprev++; 27.445 + } 27.446 ip += tlen; // * SIZE_MEMNUM 27.447 } else { 27.448 {opFail(); return;} 27.449 } 27.450 } 27.451 27.452 - /* no need: IS_DYNAMIC_OPTION() == 0 */ 27.453 - private void opSetOptionPush() { 27.454 - // option = code[ip++]; // final for now 27.455 - pushAlt(ip, s, sprev); 27.456 - ip += OPSize.SET_OPTION + OPSize.FAIL; 27.457 - } 27.458 - 27.459 - private void opSetOption() { 27.460 - // option = code[ip++]; // final for now 27.461 - } 27.462 - 27.463 private void opNullCheckStart() { 27.464 final int mem = code[ip++]; 27.465 pushNullCheckStart(mem, s); 27.466 @@ -1142,13 +1204,6 @@ 27.467 sprev = EncodingHelper.prevCharHead(str, s); 27.468 } 27.469 27.470 - private void opLookBehindSb() { 27.471 - final int tlen = code[ip++]; 27.472 - s -= tlen; 27.473 - if (s < str) {opFail(); return;} 27.474 - sprev = s == str ? -1 : s - 1; 27.475 - } 27.476 - 27.477 private void opPushLookBehindNot() { 27.478 final int addr = code[ip++]; 27.479 final int tlen = code[ip++];
28.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java Mon Nov 03 07:29:46 2014 +0100 28.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java Mon Nov 03 11:47:41 2014 +0100 28.3 @@ -236,16 +236,17 @@ 28.4 sb.append(new String(code, s, len)); 28.5 } 28.6 28.7 - private void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) { 28.8 + private static void pLenStringFromTemplate(final StringBuilder sb, final int len, final char[] tm, final int idx) { 28.9 sb.append(":T:").append(len).append(":"); 28.10 sb.append(tm, idx, len); 28.11 } 28.12 28.13 - public int compiledByteCodeToString(final StringBuilder sb, int bp) { 28.14 + public int compiledByteCodeToString(final StringBuilder sb, final int bptr) { 28.15 int len, n, mem, addr, scn, cod; 28.16 BitSet bs; 28.17 CClassNode cc; 28.18 int tm, idx; 28.19 + int bp = bptr; 28.20 28.21 sb.append("[").append(OpCodeNames[code[bp]]); 28.22 final int argType = OpCodeArgTypes[code[bp]]; 28.23 @@ -253,6 +254,7 @@ 28.24 if (argType != Arguments.SPECIAL) { 28.25 bp++; 28.26 switch (argType) { 28.27 + default: 28.28 case Arguments.NON: 28.29 break; 28.30 28.31 @@ -410,7 +412,9 @@ 28.32 for (int i=0; i<len; i++) { 28.33 mem = code[bp]; 28.34 bp += OPSize.MEMNUM; 28.35 - if (i > 0) sb.append(", "); 28.36 + if (i > 0) { 28.37 + sb.append(", "); 28.38 + } 28.39 sb.append(mem); 28.40 } 28.41 break; 28.42 @@ -428,7 +432,9 @@ 28.43 for (int i=0; i<len; i++) { 28.44 mem = code[bp]; 28.45 bp += OPSize.MEMNUM; 28.46 - if (i > 0) sb.append(", "); 28.47 + if (i > 0) { 28.48 + sb.append(", "); 28.49 + } 28.50 sb.append(mem); 28.51 } 28.52 break; 28.53 @@ -501,7 +507,9 @@ 28.54 while (bp < end) { 28.55 ncode++; 28.56 28.57 - if (bp > 0) sb.append(ncode % 5 == 0 ? "\n" : " "); 28.58 + if (bp > 0) { 28.59 + sb.append(ncode % 5 == 0 ? "\n" : " "); 28.60 + } 28.61 28.62 bp = compiledByteCodeToString(sb, bp); 28.63 }
29.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java Mon Nov 03 07:29:46 2014 +0100 29.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java Mon Nov 03 11:47:41 2014 +0100 29.3 @@ -22,6 +22,7 @@ 29.4 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; 29.5 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; 29.6 29.7 +@SuppressWarnings("javadoc") 29.8 public final class CodeRangeBuffer implements Cloneable { 29.9 private static final int INIT_MULTI_BYTE_RANGE_SIZE = 5; 29.10 private static final int ALL_MULTI_BYTE_RANGE = 0x7fffffff; 29.11 @@ -68,7 +69,9 @@ 29.12 29.13 for (int i=0; i<p[0]; i++) { 29.14 buf.append("[").append(rangeNumToString(p[i * 2 + 1])).append("..").append(rangeNumToString(p[i * 2 + 2])).append("]"); 29.15 - if (i > 0 && i % 6 == 0) buf.append("\n "); 29.16 + if (i > 0 && i % 6 == 0) { 29.17 + buf.append("\n "); 29.18 + } 29.19 } 29.20 29.21 return buf.toString(); 29.22 @@ -97,9 +100,13 @@ 29.23 } 29.24 29.25 private void moveRight(final int from, final int to, final int n) { 29.26 - if (to + n > p.length) expand(to + n); 29.27 + if (to + n > p.length) { 29.28 + expand(to + n); 29.29 + } 29.30 System.arraycopy(p, from, p, to, n); 29.31 - if (to + n > used) used = to + n; 29.32 + if (to + n > used) { 29.33 + used = to + n; 29.34 + } 29.35 } 29.36 29.37 protected void moveLeft(final int from, final int to, final int n) { 29.38 @@ -113,9 +120,13 @@ 29.39 29.40 public void writeCodePoint(final int pos, final int b) { 29.41 final int u = pos + 1; 29.42 - if (p.length < u) expand(u); 29.43 + if (p.length < u) { 29.44 + expand(u); 29.45 + } 29.46 p[pos] = b; 29.47 - if (used < u) used = u; 29.48 + if (used < u) { 29.49 + used = u; 29.50 + } 29.51 } 29.52 29.53 @Override 29.54 @@ -125,14 +136,19 @@ 29.55 29.56 // ugly part: these methods should be made OO 29.57 // add_code_range_to_buf 29.58 - public static CodeRangeBuffer addCodeRangeToBuff(CodeRangeBuffer pbuf, int from, int to) { 29.59 + public static CodeRangeBuffer addCodeRangeToBuff(final CodeRangeBuffer pbufp, final int fromp, final int top) { 29.60 + int from = fromp, to = top; 29.61 + CodeRangeBuffer pbuf = pbufp; 29.62 + 29.63 if (from > to) { 29.64 final int n = from; 29.65 from = to; 29.66 to = n; 29.67 } 29.68 29.69 - if (pbuf == null) pbuf = new CodeRangeBuffer(); // move to CClassNode 29.70 + if (pbuf == null) { 29.71 + pbuf = new CodeRangeBuffer(); // move to CClassNode 29.72 + } 29.73 29.74 final int[]p = pbuf.p; 29.75 int n = p[0]; 29.76 @@ -163,11 +179,17 @@ 29.77 29.78 final int incN = low + 1 - high; 29.79 29.80 - if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES); 29.81 + if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) { 29.82 + throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES); 29.83 + } 29.84 29.85 if (incN != 1) { 29.86 - if (from > p[low * 2 + 1]) from = p[low * 2 + 1]; 29.87 - if (to < p[(high - 1) * 2 + 2]) to = p[(high - 1) * 2 + 2]; 29.88 + if (from > p[low * 2 + 1]) { 29.89 + from = p[low * 2 + 1]; 29.90 + } 29.91 + if (to < p[(high - 1) * 2 + 2]) { 29.92 + to = p[(high - 1) * 2 + 2]; 29.93 + } 29.94 } 29.95 29.96 if (incN != 0 && high < n) { 29.97 @@ -197,9 +219,8 @@ 29.98 if (from > to) { 29.99 if (env.syntax.allowEmptyRangeInCC()) { 29.100 return pbuf; 29.101 - } else { 29.102 - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 29.103 } 29.104 + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 29.105 } 29.106 return addCodeRangeToBuff(pbuf, from, to); 29.107 } 29.108 @@ -218,12 +239,16 @@ 29.109 public static CodeRangeBuffer notCodeRangeBuff(final CodeRangeBuffer bbuf) { 29.110 CodeRangeBuffer pbuf = null; 29.111 29.112 - if (bbuf == null) return setAllMultiByteRange(pbuf); 29.113 + if (bbuf == null) { 29.114 + return setAllMultiByteRange(pbuf); 29.115 + } 29.116 29.117 final int[]p = bbuf.p; 29.118 final int n = p[0]; 29.119 29.120 - if (n <= 0) return setAllMultiByteRange(pbuf); 29.121 + if (n <= 0) { 29.122 + return setAllMultiByteRange(pbuf); 29.123 + } 29.124 29.125 int pre = EncodingHelper.mbcodeStartPosition(); 29.126 29.127 @@ -235,18 +260,26 @@ 29.128 if (pre <= from - 1) { 29.129 pbuf = addCodeRangeToBuff(pbuf, pre, from - 1); 29.130 } 29.131 - if (to == ALL_MULTI_BYTE_RANGE) break; 29.132 + if (to == ALL_MULTI_BYTE_RANGE) { 29.133 + break; 29.134 + } 29.135 pre = to + 1; 29.136 } 29.137 29.138 - if (to < ALL_MULTI_BYTE_RANGE) pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE); 29.139 + if (to < ALL_MULTI_BYTE_RANGE) { 29.140 + pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE); 29.141 + } 29.142 return pbuf; 29.143 } 29.144 29.145 // or_code_range_buf 29.146 - public static CodeRangeBuffer orCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1, 29.147 - CodeRangeBuffer bbuf2, boolean not2) { 29.148 + public static CodeRangeBuffer orCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p, 29.149 + final CodeRangeBuffer bbuf2p, final boolean not2p) { 29.150 CodeRangeBuffer pbuf = null; 29.151 + CodeRangeBuffer bbuf1 = bbuf1p; 29.152 + CodeRangeBuffer bbuf2 = bbuf2p; 29.153 + boolean not1 = not1p; 29.154 + boolean not2 = not2p; 29.155 29.156 if (bbuf1 == null && bbuf2 == null) { 29.157 if (not1 || not2) { 29.158 @@ -266,13 +299,11 @@ 29.159 if (bbuf1 == null) { 29.160 if (not1) { 29.161 return setAllMultiByteRange(pbuf); 29.162 - } else { 29.163 - if (!not2) { 29.164 - return bbuf2.clone(); 29.165 - } else { 29.166 - return notCodeRangeBuff(bbuf2); 29.167 - } 29.168 } 29.169 + if (!not2) { 29.170 + return bbuf2.clone(); 29.171 + } 29.172 + return notCodeRangeBuff(bbuf2); 29.173 } 29.174 29.175 if (not1) { 29.176 @@ -302,16 +333,18 @@ 29.177 } 29.178 29.179 // and_code_range1 29.180 - public static CodeRangeBuffer andCodeRange1(CodeRangeBuffer pbuf, int from1, int to1, final int[]data, final int n) { 29.181 + public static CodeRangeBuffer andCodeRange1(final CodeRangeBuffer pbufp, final int from1p, final int to1p, final int[]data, final int n) { 29.182 + CodeRangeBuffer pbuf = pbufp; 29.183 + int from1 = from1p, to1 = to1p; 29.184 + 29.185 for (int i=0; i<n; i++) { 29.186 final int from2 = data[i * 2 + 1]; 29.187 final int to2 = data[i * 2 + 2]; 29.188 if (from2 < from1) { 29.189 if (to2 < from1) { 29.190 continue; 29.191 - } else { 29.192 - from1 = to2 + 1; 29.193 } 29.194 + from1 = to2 + 1; 29.195 } else if (from2 <= to1) { 29.196 if (to2 < to1) { 29.197 if (from1 <= from2 - 1) { 29.198 @@ -324,7 +357,9 @@ 29.199 } else { 29.200 from1 = from2; 29.201 } 29.202 - if (from1 > to1) break; 29.203 + if (from1 > to1) { 29.204 + break; 29.205 + } 29.206 } 29.207 29.208 if (from1 <= to1) { 29.209 @@ -335,15 +370,22 @@ 29.210 } 29.211 29.212 // and_code_range_buf 29.213 - public static CodeRangeBuffer andCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1, 29.214 - CodeRangeBuffer bbuf2, boolean not2) { 29.215 + public static CodeRangeBuffer andCodeRangeBuff(final CodeRangeBuffer bbuf1p, final boolean not1p, 29.216 + final CodeRangeBuffer bbuf2p, final boolean not2p) { 29.217 CodeRangeBuffer pbuf = null; 29.218 + CodeRangeBuffer bbuf1 = bbuf1p; 29.219 + CodeRangeBuffer bbuf2 = bbuf2p; 29.220 + boolean not1 = not1p, not2 = not2p; 29.221 29.222 if (bbuf1 == null) { 29.223 - if (not1 && bbuf2 != null) return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */ 29.224 + if (not1 && bbuf2 != null) { 29.225 + return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */ 29.226 + } 29.227 return null; 29.228 } else if (bbuf2 == null) { 29.229 - if (not2) return bbuf1.clone(); 29.230 + if (not2) { 29.231 + return bbuf1.clone(); 29.232 + } 29.233 return null; 29.234 } 29.235 29.236 @@ -369,8 +411,12 @@ 29.237 final int from2 = p2[j * 2 + 1]; 29.238 final int to2 = p2[j * 2 + 2]; 29.239 29.240 - if (from2 > to1) break; 29.241 - if (to2 < from1) continue; 29.242 + if (from2 > to1) { 29.243 + break; 29.244 + } 29.245 + if (to2 < from1) { 29.246 + continue; 29.247 + } 29.248 final int from = from1 > from2 ? from1 : from2; 29.249 final int to = to1 < to2 ? to1 : to2; 29.250 pbuf = addCodeRangeToBuff(pbuf, from, to);
30.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java Mon Nov 03 07:29:46 2014 +0100 30.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java Mon Nov 03 11:47:41 2014 +0100 30.3 @@ -53,13 +53,17 @@ 30.4 protected abstract void compileAltNode(ConsAltNode node); 30.5 30.6 private void compileStringRawNode(final StringNode sn) { 30.7 - if (sn.length() <= 0) return; 30.8 + if (sn.length() <= 0) { 30.9 + return; 30.10 + } 30.11 addCompileString(sn.chars, sn.p, sn.length(), false); 30.12 } 30.13 30.14 private void compileStringNode(final StringNode node) { 30.15 final StringNode sn = node; 30.16 - if (sn.length() <= 0) return; 30.17 + if (sn.length() <= 0) { 30.18 + return; 30.19 + } 30.20 30.21 final boolean ambig = sn.isAmbig(); 30.22 30.23 @@ -145,7 +149,9 @@ 30.24 } 30.25 30.26 protected final void compileTreeNTimes(final Node node, final int n) { 30.27 - for (int i=0; i<n; i++) compileTree(node); 30.28 + for (int i=0; i<n; i++) { 30.29 + compileTree(node); 30.30 + } 30.31 } 30.32 30.33 protected void newSyntaxException(final String message) {
31.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java Mon Nov 03 07:29:46 2014 +0100 31.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java Mon Nov 03 11:47:41 2014 +0100 31.3 @@ -21,6 +21,7 @@ 31.4 31.5 import java.io.PrintStream; 31.6 31.7 +@SuppressWarnings("javadoc") 31.8 public interface Config { 31.9 final int CHAR_TABLE_SIZE = 256; 31.10
32.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java Mon Nov 03 07:29:46 2014 +0100 32.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java Mon Nov 03 11:47:41 2014 +0100 32.3 @@ -23,6 +23,7 @@ 32.4 import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType; 32.5 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; 32.6 32.7 +@SuppressWarnings("javadoc") 32.8 public final class EncodingHelper { 32.9 32.10 final static int NEW_LINE = 0x000a; 32.11 @@ -79,14 +80,19 @@ 32.12 32.13 /* onigenc_get_right_adjust_char_head_with_prev */ 32.14 public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) { 32.15 - if (prev != null) prev.value = -1; /* Sorry */ 32.16 + if (prev != null) { 32.17 + prev.value = -1; /* Sorry */ 32.18 + } 32.19 return s; 32.20 } 32.21 32.22 // Encoding.stepBack 32.23 - public static int stepBack(final int p, int s, int n) { 32.24 - while (s != -1 && n-- > 0) { 32.25 - if (s <= p) return -1; 32.26 + public static int stepBack(final int p, final int sp, final int np) { 32.27 + int s = sp, n = np; 32.28 + while (s != -1 && n-- > 0) { 32.29 + if (s <= p) { 32.30 + return -1; 32.31 + } 32.32 s--; 32.33 } 32.34 return s; 32.35 @@ -122,7 +128,7 @@ 32.36 final int upper = toUpperCase(c); 32.37 32.38 if (upper != c) { 32.39 - fun.apply(c, upper, arg); 32.40 + ApplyCaseFold.apply(c, upper, arg); 32.41 } 32.42 } 32.43 } 32.44 @@ -133,7 +139,7 @@ 32.45 final int upper = toUpperCase(c); 32.46 32.47 if (upper != c) { 32.48 - fun.apply(upper, c, arg); 32.49 + ApplyCaseFold.apply(upper, c, arg); 32.50 } 32.51 } 32.52 }
33.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java Mon Nov 03 07:29:46 2014 +0100 33.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java Mon Nov 03 11:47:41 2014 +0100 33.3 @@ -21,7 +21,6 @@ 33.4 33.5 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isSingleline; 33.6 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; 33.7 - 33.8 import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode; 33.9 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; 33.10 import jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar; 33.11 @@ -53,9 +52,8 @@ 33.12 if (!left()) { 33.13 if (synAllow) { 33.14 return 1; /* "....{" : OK! */ 33.15 - } else { 33.16 - throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); 33.17 } 33.18 + throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); 33.19 } 33.20 33.21 if (!synAllow) { 33.22 @@ -83,7 +81,9 @@ 33.23 } 33.24 } 33.25 33.26 - if (!left()) return invalidRangeQuantifier(synAllow); 33.27 + if (!left()) { 33.28 + return invalidRangeQuantifier(synAllow); 33.29 + } 33.30 33.31 fetch(); 33.32 int up; 33.33 @@ -99,25 +99,35 @@ 33.34 } 33.35 33.36 if (p == prev) { 33.37 - if (nonLow) return invalidRangeQuantifier(synAllow); 33.38 + if (nonLow) { 33.39 + return invalidRangeQuantifier(synAllow); 33.40 + } 33.41 up = QuantifierNode.REPEAT_INFINITE; /* {n,} : {n,infinite} */ 33.42 } 33.43 } else { 33.44 - if (nonLow) return invalidRangeQuantifier(synAllow); 33.45 + if (nonLow) { 33.46 + return invalidRangeQuantifier(synAllow); 33.47 + } 33.48 unfetch(); 33.49 up = low; /* {n} : exact n times */ 33.50 ret = 2; /* fixed */ 33.51 } 33.52 33.53 - if (!left()) return invalidRangeQuantifier(synAllow); 33.54 + if (!left()) { 33.55 + return invalidRangeQuantifier(synAllow); 33.56 + } 33.57 fetch(); 33.58 33.59 if (syntax.opEscBraceInterval()) { 33.60 - if (c != syntax.metaCharTable.esc) return invalidRangeQuantifier(synAllow); 33.61 + if (c != syntax.metaCharTable.esc) { 33.62 + return invalidRangeQuantifier(synAllow); 33.63 + } 33.64 fetch(); 33.65 } 33.66 33.67 - if (c != '}') return invalidRangeQuantifier(synAllow); 33.68 + if (c != '}') { 33.69 + return invalidRangeQuantifier(synAllow); 33.70 + } 33.71 33.72 if (!isRepeatInfinite(up) && low > up) { 33.73 throw new ValueException(ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); 33.74 @@ -134,9 +144,8 @@ 33.75 if (synAllow) { 33.76 restore(); 33.77 return 1; 33.78 - } else { 33.79 - throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); 33.80 } 33.81 + throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); 33.82 } 33.83 33.84 @SuppressWarnings("fallthrough") 33.85 @@ -218,17 +227,6 @@ 33.86 } 33.87 } 33.88 33.89 - private int nameEndCodePoint(final int start) { 33.90 - switch(start) { 33.91 - case '<': 33.92 - return '>'; 33.93 - case '\'': 33.94 - return '\''; 33.95 - default: 33.96 - return 0; 33.97 - } 33.98 - } 33.99 - 33.100 private void fetchTokenInCCFor_charType(final boolean flag, final int type) { 33.101 token.type = TokenType.CHAR_TYPE; 33.102 token.setPropCType(type); 33.103 @@ -236,7 +234,9 @@ 33.104 } 33.105 33.106 private void fetchTokenInCCFor_x() { 33.107 - if (!left()) return; 33.108 + if (!left()) { 33.109 + return; 33.110 + } 33.111 final int last = p; 33.112 33.113 if (peekIs('{') && syntax.opEscXBraceHex8()) { 33.114 @@ -274,7 +274,9 @@ 33.115 } 33.116 33.117 private void fetchTokenInCCFor_u() { 33.118 - if (!left()) return; 33.119 + if (!left()) { 33.120 + return; 33.121 + } 33.122 final int last = p; 33.123 33.124 if (syntax.op2EscUHex4()) { 33.125 @@ -329,7 +331,9 @@ 33.126 } else if (c == '-') { 33.127 token.type = TokenType.CC_RANGE; 33.128 } else if (c == syntax.metaCharTable.esc) { 33.129 - if (!syntax.backSlashEscapeInCC()) return token.type; 33.130 + if (!syntax.backSlashEscapeInCC()) { 33.131 + return token.type; 33.132 + } 33.133 if (!left()) { 33.134 throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE); 33.135 } 33.136 @@ -357,10 +361,14 @@ 33.137 fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); 33.138 break; 33.139 case 'h': 33.140 - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); 33.141 + if (syntax.op2EscHXDigit()) { 33.142 + fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); 33.143 + } 33.144 break; 33.145 case 'H': 33.146 - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); 33.147 + if (syntax.op2EscHXDigit()) { 33.148 + fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); 33.149 + } 33.150 break; 33.151 case 'x': 33.152 fetchTokenInCCFor_x(); 33.153 @@ -424,7 +432,9 @@ 33.154 } 33.155 33.156 private void fetchTokenFor_xBrace() { 33.157 - if (!left()) return; 33.158 + if (!left()) { 33.159 + return; 33.160 + } 33.161 33.162 final int last = p; 33.163 if (peekIs('{') && syntax.opEscXBraceHex8()) { 33.164 @@ -461,7 +471,9 @@ 33.165 } 33.166 33.167 private void fetchTokenFor_uHex() { 33.168 - if (!left()) return; 33.169 + if (!left()) { 33.170 + return; 33.171 + } 33.172 final int last = p; 33.173 33.174 if (syntax.op2EscUHex4()) { 33.175 @@ -562,79 +574,129 @@ 33.176 switch(c) { 33.177 33.178 case '*': 33.179 - if (syntax.opEscAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); 33.180 + if (syntax.opEscAsteriskZeroInf()) { 33.181 + fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); 33.182 + } 33.183 break; 33.184 case '+': 33.185 - if (syntax.opEscPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); 33.186 + if (syntax.opEscPlusOneInf()) { 33.187 + fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); 33.188 + } 33.189 break; 33.190 case '?': 33.191 - if (syntax.opEscQMarkZeroOne()) fetchTokenFor_repeat(0, 1); 33.192 + if (syntax.opEscQMarkZeroOne()) { 33.193 + fetchTokenFor_repeat(0, 1); 33.194 + } 33.195 break; 33.196 case '{': 33.197 - if (syntax.opEscBraceInterval()) fetchTokenFor_openBrace(); 33.198 + if (syntax.opEscBraceInterval()) { 33.199 + fetchTokenFor_openBrace(); 33.200 + } 33.201 break; 33.202 case '|': 33.203 - if (syntax.opEscVBarAlt()) token.type = TokenType.ALT; 33.204 + if (syntax.opEscVBarAlt()) { 33.205 + token.type = TokenType.ALT; 33.206 + } 33.207 break; 33.208 case '(': 33.209 - if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_OPEN; 33.210 + if (syntax.opEscLParenSubexp()) { 33.211 + token.type = TokenType.SUBEXP_OPEN; 33.212 + } 33.213 break; 33.214 case ')': 33.215 - if (syntax.opEscLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE; 33.216 + if (syntax.opEscLParenSubexp()) { 33.217 + token.type = TokenType.SUBEXP_CLOSE; 33.218 + } 33.219 break; 33.220 case 'w': 33.221 - if (syntax.opEscWWord()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); 33.222 + if (syntax.opEscWWord()) { 33.223 + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); 33.224 + } 33.225 break; 33.226 case 'W': 33.227 - if (syntax.opEscWWord()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); 33.228 + if (syntax.opEscWWord()) { 33.229 + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); 33.230 + } 33.231 break; 33.232 case 'b': 33.233 - if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.WORD_BOUND); 33.234 + if (syntax.opEscBWordBound()) { 33.235 + fetchTokenFor_anchor(AnchorType.WORD_BOUND); 33.236 + } 33.237 break; 33.238 case 'B': 33.239 - if (syntax.opEscBWordBound()) fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND); 33.240 + if (syntax.opEscBWordBound()) { 33.241 + fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND); 33.242 + } 33.243 break; 33.244 case '<': 33.245 - if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_BEGIN); 33.246 + if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { 33.247 + fetchTokenFor_anchor(AnchorType.WORD_BEGIN); 33.248 + } 33.249 break; 33.250 case '>': 33.251 - if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) fetchTokenFor_anchor(AnchorType.WORD_END); 33.252 + if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { 33.253 + fetchTokenFor_anchor(AnchorType.WORD_END); 33.254 + } 33.255 break; 33.256 case 's': 33.257 - if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); 33.258 + if (syntax.opEscSWhiteSpace()) { 33.259 + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); 33.260 + } 33.261 break; 33.262 case 'S': 33.263 - if (syntax.opEscSWhiteSpace()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); 33.264 + if (syntax.opEscSWhiteSpace()) { 33.265 + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); 33.266 + } 33.267 break; 33.268 case 'd': 33.269 - if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); 33.270 + if (syntax.opEscDDigit()) { 33.271 + fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); 33.272 + } 33.273 break; 33.274 case 'D': 33.275 - if (syntax.opEscDDigit()) fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); 33.276 + if (syntax.opEscDDigit()) { 33.277 + fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); 33.278 + } 33.279 break; 33.280 case 'h': 33.281 - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); 33.282 + if (syntax.op2EscHXDigit()) { 33.283 + fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); 33.284 + } 33.285 break; 33.286 case 'H': 33.287 - if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); 33.288 + if (syntax.op2EscHXDigit()) { 33.289 + fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); 33.290 + } 33.291 break; 33.292 case 'A': 33.293 - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF); 33.294 + if (syntax.opEscAZBufAnchor()) { 33.295 + fetchTokenFor_anchor(AnchorType.BEGIN_BUF); 33.296 + } 33.297 break; 33.298 case 'Z': 33.299 - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.SEMI_END_BUF); 33.300 + if (syntax.opEscAZBufAnchor()) { 33.301 + fetchTokenFor_anchor(AnchorType.SEMI_END_BUF); 33.302 + } 33.303 break; 33.304 case 'z': 33.305 - if (syntax.opEscAZBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF); 33.306 + if (syntax.opEscAZBufAnchor()) { 33.307 + fetchTokenFor_anchor(AnchorType.END_BUF); 33.308 + } 33.309 break; 33.310 case 'G': 33.311 - if (syntax.opEscCapitalGBeginAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_POSITION); 33.312 + if (syntax.opEscCapitalGBeginAnchor()) { 33.313 + fetchTokenFor_anchor(AnchorType.BEGIN_POSITION); 33.314 + } 33.315 break; 33.316 case '`': 33.317 - if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.BEGIN_BUF); 33.318 + if (syntax.op2EscGnuBufAnchor()) { 33.319 + fetchTokenFor_anchor(AnchorType.BEGIN_BUF); 33.320 + } 33.321 break; 33.322 case '\'': 33.323 - if (syntax.op2EscGnuBufAnchor()) fetchTokenFor_anchor(AnchorType.END_BUF); 33.324 + if (syntax.op2EscGnuBufAnchor()) { 33.325 + fetchTokenFor_anchor(AnchorType.END_BUF); 33.326 + } 33.327 break; 33.328 case 'x': 33.329 fetchTokenFor_xBrace(); 33.330 @@ -684,22 +746,34 @@ 33.331 { 33.332 switch(c) { 33.333 case '.': 33.334 - if (syntax.opDotAnyChar()) token.type = TokenType.ANYCHAR; 33.335 + if (syntax.opDotAnyChar()) { 33.336 + token.type = TokenType.ANYCHAR; 33.337 + } 33.338 break; 33.339 case '*': 33.340 - if (syntax.opAsteriskZeroInf()) fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); 33.341 + if (syntax.opAsteriskZeroInf()) { 33.342 + fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); 33.343 + } 33.344 break; 33.345 case '+': 33.346 - if (syntax.opPlusOneInf()) fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); 33.347 + if (syntax.opPlusOneInf()) { 33.348 + fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); 33.349 + } 33.350 break; 33.351 case '?': 33.352 - if (syntax.opQMarkZeroOne()) fetchTokenFor_repeat(0, 1); 33.353 + if (syntax.opQMarkZeroOne()) { 33.354 + fetchTokenFor_repeat(0, 1); 33.355 + } 33.356 break; 33.357 case '{': 33.358 - if (syntax.opBraceInterval()) fetchTokenFor_openBrace(); 33.359 + if (syntax.opBraceInterval()) { 33.360 + fetchTokenFor_openBrace(); 33.361 + } 33.362 break; 33.363 case '|': 33.364 - if (syntax.opVBarAlt()) token.type = TokenType.ALT; 33.365 + if (syntax.opVBarAlt()) { 33.366 + token.type = TokenType.ALT; 33.367 + } 33.368 break; 33.369 33.370 case '(': 33.371 @@ -713,9 +787,13 @@ 33.372 } 33.373 fetch(); 33.374 if (c == syntax.metaCharTable.esc) { 33.375 - if (left()) fetch(); 33.376 + if (left()) { 33.377 + fetch(); 33.378 + } 33.379 } else { 33.380 - if (c == ')') break; 33.381 + if (c == ')') { 33.382 + break; 33.383 + } 33.384 } 33.385 } 33.386 continue start; // goto start 33.387 @@ -723,19 +801,29 @@ 33.388 unfetch(); 33.389 } 33.390 33.391 - if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_OPEN; 33.392 + if (syntax.opLParenSubexp()) { 33.393 + token.type = TokenType.SUBEXP_OPEN; 33.394 + } 33.395 break; 33.396 case ')': 33.397 - if (syntax.opLParenSubexp()) token.type = TokenType.SUBEXP_CLOSE; 33.398 + if (syntax.opLParenSubexp()) { 33.399 + token.type = TokenType.SUBEXP_CLOSE; 33.400 + } 33.401 break; 33.402 case '^': 33.403 - if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE); 33.404 + if (syntax.opLineAnchor()) { 33.405 + fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE); 33.406 + } 33.407 break; 33.408 case '$': 33.409 - if (syntax.opLineAnchor()) fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE); 33.410 + if (syntax.opLineAnchor()) { 33.411 + fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE); 33.412 + } 33.413 break; 33.414 case '[': 33.415 - if (syntax.opBracketCC()) token.type = TokenType.CC_CC_OPEN; 33.416 + if (syntax.opBracketCC()) { 33.417 + token.type = TokenType.CC_CC_OPEN; 33.418 + } 33.419 break; 33.420 case ']': 33.421 //if (*src > env->pattern) /* /].../ is allowed. */ 33.422 @@ -745,7 +833,9 @@ 33.423 if (Option.isExtend(env.option)) { 33.424 while (left()) { 33.425 fetch(); 33.426 - if (EncodingHelper.isNewLine(c)) break; 33.427 + if (EncodingHelper.isNewLine(c)) { 33.428 + break; 33.429 + } 33.430 } 33.431 continue start; // goto start 33.432 } 33.433 @@ -756,7 +846,10 @@ 33.434 case '\n': 33.435 case '\r': 33.436 case '\f': 33.437 - if (Option.isExtend(env.option)) continue start; // goto start 33.438 + if (Option.isExtend(env.option)) 33.439 + { 33.440 + continue start; // goto start 33.441 + } 33.442 break; 33.443 33.444 default: // string 33.445 @@ -798,8 +891,8 @@ 33.446 } 33.447 } 33.448 33.449 - protected final void syntaxWarn(final String message, final char c) { 33.450 - syntaxWarn(message.replace("<%n>", Character.toString(c))); 33.451 + protected final void syntaxWarn(final String message, final char ch) { 33.452 + syntaxWarn(message.replace("<%n>", Character.toString(ch))); 33.453 } 33.454 33.455 protected final void syntaxWarn(final String message) {
34.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java Mon Nov 03 07:29:46 2014 +0100 34.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java Mon Nov 03 11:47:41 2014 +0100 34.3 @@ -21,10 +21,10 @@ 34.4 package jdk.nashorn.internal.runtime.regexp.joni; 34.5 34.6 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isFindLongest; 34.7 - 34.8 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; 34.9 import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; 34.10 34.11 +@SuppressWarnings("javadoc") 34.12 public abstract class Matcher extends IntHolder { 34.13 protected final Regex regex; 34.14 34.15 @@ -73,7 +73,9 @@ 34.16 protected final void msaInit(final int option, final int start) { 34.17 msaOptions = option; 34.18 msaStart = start; 34.19 - if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) msaBestLen = -1; 34.20 + if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { 34.21 + msaBestLen = -1; 34.22 + } 34.23 } 34.24 34.25 public final int match(final int at, final int range, final int option) { 34.26 @@ -83,20 +85,19 @@ 34.27 34.28 if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) { 34.29 return matchAt(end /*range*/, at, prev); 34.30 - } else { 34.31 - return matchAt(range /*range*/, at, prev); 34.32 } 34.33 + return matchAt(range /*range*/, at, prev); 34.34 } 34.35 34.36 int low, high; // these are the return values 34.37 - private boolean forwardSearchRange(final char[] chars, final int str, final int end, final int s, final int range, final IntHolder lowPrev) { 34.38 + private boolean forwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final IntHolder lowPrev) { 34.39 int pprev = -1; 34.40 int p = s; 34.41 34.42 if (Config.DEBUG_SEARCH) { 34.43 Config.log.println("forward_search_range: "+ 34.44 - "str: " + str + 34.45 - ", end: " + end + 34.46 + "str: " + string + 34.47 + ", end: " + e + 34.48 ", s: " + s + 34.49 ", range: " + range); 34.50 } 34.51 @@ -106,7 +107,7 @@ 34.52 } 34.53 34.54 retry:while (true) { 34.55 - p = regex.searchAlgorithm.search(regex, chars, p, end, range); 34.56 + p = regex.searchAlgorithm.search(regex, ch, p, e, range); 34.57 34.58 if (p != -1 && p < range) { 34.59 if (p - regex.dMin < s) { 34.60 @@ -119,9 +120,9 @@ 34.61 if (regex.subAnchor != 0) { 34.62 switch (regex.subAnchor) { 34.63 case AnchorType.BEGIN_LINE: 34.64 - if (p != str) { 34.65 - final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); 34.66 - if (!EncodingHelper.isNewLine(chars, prev, end)) { 34.67 + if (p != string) { 34.68 + final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); 34.69 + if (!EncodingHelper.isNewLine(ch, prev, e)) { 34.70 // goto retry_gate; 34.71 pprev = p; 34.72 p++; 34.73 @@ -131,17 +132,17 @@ 34.74 break; 34.75 34.76 case AnchorType.END_LINE: 34.77 - if (p == end) { 34.78 + if (p == e) { 34.79 if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { 34.80 - final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); 34.81 - if (prev != -1 && EncodingHelper.isNewLine(chars, prev, end)) { 34.82 + final int prev = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); 34.83 + if (prev != -1 && EncodingHelper.isNewLine(ch, prev, e)) { 34.84 // goto retry_gate; 34.85 pprev = p; 34.86 p++; 34.87 continue retry; 34.88 } 34.89 } 34.90 - } else if (!EncodingHelper.isNewLine(chars, p, end)) { 34.91 + } else if (!EncodingHelper.isNewLine(ch, p, e)) { 34.92 //if () break; 34.93 // goto retry_gate; 34.94 pprev = p; 34.95 @@ -149,6 +150,9 @@ 34.96 continue retry; 34.97 } 34.98 break; 34.99 + 34.100 + default: 34.101 + break; 34.102 } // switch 34.103 } 34.104 34.105 @@ -158,7 +162,7 @@ 34.106 if (low > s) { 34.107 lowPrev.value = EncodingHelper.prevCharHead(s, p); 34.108 } else { 34.109 - lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, p); 34.110 + lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, p); 34.111 } 34.112 } 34.113 } else { 34.114 @@ -172,7 +176,7 @@ 34.115 } 34.116 } else { 34.117 if (lowPrev != null) { 34.118 - lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : str, low); 34.119 + lowPrev.value = EncodingHelper.prevCharHead((pprev != -1) ? pprev : string, low); 34.120 } 34.121 } 34.122 } 34.123 @@ -182,8 +186,8 @@ 34.124 34.125 if (Config.DEBUG_SEARCH) { 34.126 Config.log.println("forward_search_range success: "+ 34.127 - "low: " + (low - str) + 34.128 - ", high: " + (high - str) + 34.129 + "low: " + (low - string) + 34.130 + ", high: " + (high - string) + 34.131 ", dmin: " + regex.dMin + 34.132 ", dmax: " + regex.dMax); 34.133 } 34.134 @@ -196,20 +200,21 @@ 34.135 } 34.136 34.137 // low, high 34.138 - private boolean backwardSearchRange(final char[] chars, final int str, final int end, final int s, int range, final int adjrange) { 34.139 - range += regex.dMin; 34.140 + private boolean backwardSearchRange(final char[] ch, final int string, final int e, final int s, final int range, final int adjrange) { 34.141 + int r = range; 34.142 + r += regex.dMin; 34.143 int p = s; 34.144 34.145 retry:while (true) { 34.146 - p = regex.searchAlgorithm.searchBackward(regex, chars, range, adjrange, end, p, s, range); 34.147 + p = regex.searchAlgorithm.searchBackward(regex, ch, r, adjrange, e, p, s, r); 34.148 34.149 if (p != -1) { 34.150 if (regex.subAnchor != 0) { 34.151 switch (regex.subAnchor) { 34.152 case AnchorType.BEGIN_LINE: 34.153 - if (p != str) { 34.154 - final int prev = EncodingHelper.prevCharHead(str, p); 34.155 - if (!EncodingHelper.isNewLine(chars, prev, end)) { 34.156 + if (p != string) { 34.157 + final int prev = EncodingHelper.prevCharHead(string, p); 34.158 + if (!EncodingHelper.isNewLine(ch, prev, e)) { 34.159 p = prev; 34.160 continue retry; 34.161 } 34.162 @@ -217,21 +222,28 @@ 34.163 break; 34.164 34.165 case AnchorType.END_LINE: 34.166 - if (p == end) { 34.167 + if (p == e) { 34.168 if (!Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) { 34.169 final int prev = EncodingHelper.prevCharHead(adjrange, p); 34.170 - if (prev == -1) return false; 34.171 - if (EncodingHelper.isNewLine(chars, prev, end)) { 34.172 + if (prev == -1) { 34.173 + return false; 34.174 + } 34.175 + if (EncodingHelper.isNewLine(ch, prev, e)) { 34.176 p = prev; 34.177 continue retry; 34.178 } 34.179 } 34.180 - } else if (!EncodingHelper.isNewLine(chars, p, end)) { 34.181 + } else if (!EncodingHelper.isNewLine(ch, p, e)) { 34.182 p = EncodingHelper.prevCharHead(adjrange, p); 34.183 - if (p == -1) return false; 34.184 + if (p == -1) { 34.185 + return false; 34.186 + } 34.187 continue retry; 34.188 } 34.189 break; 34.190 + 34.191 + default: 34.192 + break; 34.193 } // switch 34.194 } 34.195 34.196 @@ -243,14 +255,16 @@ 34.197 34.198 if (Config.DEBUG_SEARCH) { 34.199 Config.log.println("backward_search_range: "+ 34.200 - "low: " + (low - str) + 34.201 - ", high: " + (high - str)); 34.202 + "low: " + (low - string) + 34.203 + ", high: " + (high - string)); 34.204 } 34.205 34.206 return true; 34.207 } 34.208 34.209 - if (Config.DEBUG_SEARCH) Config.log.println("backward_search_range: fail."); 34.210 + if (Config.DEBUG_SEARCH) { 34.211 + Config.log.println("backward_search_range: fail."); 34.212 + } 34.213 return false; 34.214 } // while 34.215 } 34.216 @@ -261,27 +275,36 @@ 34.217 if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { 34.218 //range = upperRange; 34.219 if (matchAt(upperRange, s, prev) != -1) { 34.220 - if (!isFindLongest(regex.options)) return true; 34.221 + if (!isFindLongest(regex.options)) { 34.222 + return true; 34.223 + } 34.224 } 34.225 } else { 34.226 //range = upperRange; 34.227 - if (matchAt(upperRange, s, prev) != -1) return true; 34.228 + if (matchAt(upperRange, s, prev) != -1) { 34.229 + return true; 34.230 + } 34.231 } 34.232 } else { 34.233 if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) { 34.234 if (matchAt(end, s, prev) != -1) { 34.235 //range = upperRange; 34.236 - if (!isFindLongest(regex.options)) return true; 34.237 + if (!isFindLongest(regex.options)) { 34.238 + return true; 34.239 + } 34.240 } 34.241 } else { 34.242 //range = upperRange; 34.243 - if (matchAt(end, s, prev) != -1) return true; 34.244 + if (matchAt(end, s, prev) != -1) { 34.245 + return true; 34.246 + } 34.247 } 34.248 } 34.249 return false; 34.250 } 34.251 34.252 - public final int search(int start, int range, final int option) { 34.253 + public final int search(final int startp, final int rangep, final int option) { 34.254 + int start = startp, range = rangep; 34.255 int s, prev; 34.256 int origStart = start; 34.257 final int origRange = range; 34.258 @@ -294,7 +317,9 @@ 34.259 ", range " + (range - str)); 34.260 } 34.261 34.262 - if (start > end || start < str) return -1; 34.263 + if (start > end || start < str) { 34.264 + return -1; 34.265 + } 34.266 34.267 /* anchor optimize: resume search range */ 34.268 if (regex.anchor != 0 && str < end) { 34.269 @@ -311,7 +336,10 @@ 34.270 } else if ((regex.anchor & AnchorType.BEGIN_BUF) != 0) { 34.271 /* search str-position only */ 34.272 if (range > start) { 34.273 - if (start != str) return -1; // mismatch_no_msa; 34.274 + if (start != str) 34.275 + { 34.276 + return -1; // mismatch_no_msa; 34.277 + } 34.278 range = str + 1; 34.279 } else { 34.280 if (range <= str) { 34.281 @@ -324,7 +352,10 @@ 34.282 } else if ((regex.anchor & AnchorType.END_BUF) != 0) { 34.283 minSemiEnd = maxSemiEnd = end; 34.284 // !end_buf:! 34.285 - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; 34.286 + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) 34.287 + { 34.288 + return -1; // mismatch_no_msa; 34.289 + } 34.290 } else if ((regex.anchor & AnchorType.SEMI_END_BUF) != 0) { 34.291 final int preEnd = EncodingHelper.stepBack(str, end, 1); 34.292 maxSemiEnd = end; 34.293 @@ -332,12 +363,18 @@ 34.294 minSemiEnd = preEnd; 34.295 if (minSemiEnd > str && start <= minSemiEnd) { 34.296 // !goto end_buf;! 34.297 - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; 34.298 + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) 34.299 + { 34.300 + return -1; // mismatch_no_msa; 34.301 + } 34.302 } 34.303 } else { 34.304 minSemiEnd = end; 34.305 // !goto end_buf;! 34.306 - if (endBuf(start, range, minSemiEnd, maxSemiEnd)) return -1; // mismatch_no_msa; 34.307 + if (endBuf(start, range, minSemiEnd, maxSemiEnd)) 34.308 + { 34.309 + return -1; // mismatch_no_msa; 34.310 + } 34.311 } 34.312 } else if ((regex.anchor & AnchorType.ANYCHAR_STAR_ML) != 0) { 34.313 // goto !begin_position;! 34.314 @@ -359,7 +396,9 @@ 34.315 prev = -1; 34.316 msaInit(option, start); 34.317 34.318 - if (matchCheck(end, s, prev)) return match(s); 34.319 + if (matchCheck(end, s, prev)) { 34.320 + return match(s); 34.321 + } 34.322 return mismatch(); 34.323 } 34.324 return -1; // goto mismatch_no_msa; 34.325 @@ -389,49 +428,62 @@ 34.326 schRange = end; 34.327 } else { 34.328 schRange += regex.dMax; 34.329 - if (schRange > end) schRange = end; 34.330 + if (schRange > end) { 34.331 + schRange = end; 34.332 + } 34.333 } 34.334 } 34.335 - if ((end - start) < regex.thresholdLength) return mismatch(); 34.336 + if ((end - start) < regex.thresholdLength) { 34.337 + return mismatch(); 34.338 + } 34.339 34.340 if (regex.dMax != MinMaxLen.INFINITE_DISTANCE) { 34.341 do { 34.342 - if (!forwardSearchRange(chars, str, end, s, schRange, this)) return mismatch(); // low, high, lowPrev 34.343 + if (!forwardSearchRange(chars, str, end, s, schRange, this)) { 34.344 + return mismatch(); // low, high, lowPrev 34.345 + } 34.346 if (s < low) { 34.347 s = low; 34.348 prev = value; 34.349 } 34.350 while (s <= high) { 34.351 - if (matchCheck(origRange, s, prev)) return match(s); // ??? 34.352 + if (matchCheck(origRange, s, prev)) { 34.353 + return match(s); // ??? 34.354 + } 34.355 prev = s; 34.356 s++; 34.357 } 34.358 } while (s < range); 34.359 + } 34.360 + /* check only. */ 34.361 + if (!forwardSearchRange(chars, str, end, s, schRange, null)) { 34.362 return mismatch(); 34.363 + } 34.364 34.365 - } else { /* check only. */ 34.366 - if (!forwardSearchRange(chars, str, end, s, schRange, null)) return mismatch(); 34.367 - 34.368 - if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) { 34.369 - do { 34.370 - if (matchCheck(origRange, s, prev)) return match(s); 34.371 - prev = s; 34.372 - s++; 34.373 - } while (s < range); 34.374 - return mismatch(); 34.375 - } 34.376 - 34.377 + if ((regex.anchor & AnchorType.ANYCHAR_STAR) != 0) { 34.378 + do { 34.379 + if (matchCheck(origRange, s, prev)) { 34.380 + return match(s); 34.381 + } 34.382 + prev = s; 34.383 + s++; 34.384 + } while (s < range); 34.385 + return mismatch(); 34.386 } 34.387 } 34.388 34.389 do { 34.390 - if (matchCheck(origRange, s, prev)) return match(s); 34.391 + if (matchCheck(origRange, s, prev)) { 34.392 + return match(s); 34.393 + } 34.394 prev = s; 34.395 s++; 34.396 } while (s < range); 34.397 34.398 if (s == range) { /* because empty match with /$/. */ 34.399 - if (matchCheck(origRange, s, prev)) return match(s); 34.400 + if (matchCheck(origRange, s, prev)) { 34.401 + return match(s); 34.402 + } 34.403 } 34.404 } else { /* backward search */ 34.405 if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) { 34.406 @@ -450,37 +502,51 @@ 34.407 if (regex.dMax != MinMaxLen.INFINITE_DISTANCE && (end - range) >= regex.thresholdLength) { 34.408 do { 34.409 int schStart = s + regex.dMax; 34.410 - if (schStart > end) schStart = end; 34.411 - if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch(); // low, high 34.412 - if (s > high) s = high; 34.413 + if (schStart > end) { 34.414 + schStart = end; 34.415 + } 34.416 + if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) 34.417 + { 34.418 + return mismatch(); // low, high 34.419 + } 34.420 + if (s > high) { 34.421 + s = high; 34.422 + } 34.423 while (s != -1 && s >= low) { 34.424 prev = EncodingHelper.prevCharHead(str, s); 34.425 - if (matchCheck(origStart, s, prev)) return match(s); 34.426 + if (matchCheck(origStart, s, prev)) { 34.427 + return match(s); 34.428 + } 34.429 s = prev; 34.430 } 34.431 } while (s >= range); 34.432 return mismatch(); 34.433 - } else { /* check only. */ 34.434 - if ((end - range) < regex.thresholdLength) return mismatch(); 34.435 + } 34.436 + if ((end - range) < regex.thresholdLength) { 34.437 + return mismatch(); 34.438 + } 34.439 34.440 - int schStart = s; 34.441 - if (regex.dMax != 0) { 34.442 - if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) { 34.443 + int schStart = s; 34.444 + if (regex.dMax != 0) { 34.445 + if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) { 34.446 + schStart = end; 34.447 + } else { 34.448 + schStart += regex.dMax; 34.449 + if (schStart > end) { 34.450 schStart = end; 34.451 - } else { 34.452 - schStart += regex.dMax; 34.453 - if (schStart > end) { 34.454 - schStart = end; 34.455 - } 34.456 } 34.457 } 34.458 - if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) return mismatch(); 34.459 + } 34.460 + if (!backwardSearchRange(chars, str, end, schStart, range, adjrange)) { 34.461 + return mismatch(); 34.462 } 34.463 } 34.464 34.465 do { 34.466 prev = EncodingHelper.prevCharHead(str, s); 34.467 - if (matchCheck(origStart, s, prev)) return match(s); 34.468 + if (matchCheck(origStart, s, prev)) { 34.469 + return match(s); 34.470 + } 34.471 s = prev; 34.472 } while (s >= range); 34.473 34.474 @@ -488,8 +554,13 @@ 34.475 return mismatch(); 34.476 } 34.477 34.478 - private boolean endBuf(int start, int range, final int minSemiEnd, final int maxSemiEnd) { 34.479 - if ((maxSemiEnd - str) < regex.anchorDmin) return true; // mismatch_no_msa; 34.480 + private boolean endBuf(final int startp, final int rangep, final int minSemiEnd, final int maxSemiEnd) { 34.481 + int start = startp; 34.482 + int range = rangep; 34.483 + 34.484 + if ((maxSemiEnd - str) < regex.anchorDmin) { 34.485 + return true; // mismatch_no_msa; 34.486 + } 34.487 34.488 if (range > start) { 34.489 if ((minSemiEnd - start) > regex.anchorDmax) { 34.490 @@ -502,7 +573,10 @@ 34.491 if ((maxSemiEnd - (range - 1)) < regex.anchorDmin) { 34.492 range = maxSemiEnd - regex.anchorDmin + 1; 34.493 } 34.494 - if (start >= range) return true; // mismatch_no_msa; 34.495 + if (start >= range) 34.496 + { 34.497 + return true; // mismatch_no_msa; 34.498 + } 34.499 } else { 34.500 if ((minSemiEnd - range) > regex.anchorDmax) { 34.501 range = minSemiEnd - regex.anchorDmax; 34.502 @@ -510,7 +584,10 @@ 34.503 if ((maxSemiEnd - start) < regex.anchorDmin) { 34.504 start = maxSemiEnd - regex.anchorDmin; 34.505 } 34.506 - if (range > start) return true; // mismatch_no_msa; 34.507 + if (range > start) 34.508 + { 34.509 + return true; // mismatch_no_msa; 34.510 + } 34.511 } 34.512 return false; 34.513 }
35.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java Mon Nov 03 07:29:46 2014 +0100 35.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java Mon Nov 03 11:47:41 2014 +0100 35.3 @@ -19,6 +19,7 @@ 35.4 */ 35.5 package jdk.nashorn.internal.runtime.regexp.joni; 35.6 35.7 +@SuppressWarnings("javadoc") 35.8 public abstract class MatcherFactory { 35.9 public abstract Matcher create(Regex regex, char[] chars, int p, int end); 35.10
36.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java Mon Nov 03 07:29:46 2014 +0100 36.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java Mon Nov 03 11:47:41 2014 +0100 36.3 @@ -46,24 +46,40 @@ 36.4 }; 36.5 36.6 int distanceValue() { 36.7 - if (max == INFINITE_DISTANCE) return 0; 36.8 + if (max == INFINITE_DISTANCE) { 36.9 + return 0; 36.10 + } 36.11 final int d = max - min; 36.12 /* return dist_vals[d] * 16 / (mm->min + 12); */ 36.13 return d < distValues.length ? distValues[d] : 1; 36.14 } 36.15 36.16 - int compareDistanceValue(final MinMaxLen other, int v1, int v2) { 36.17 - if (v2 <= 0) return -1; 36.18 - if (v1 <= 0) return 1; 36.19 + int compareDistanceValue(final MinMaxLen other, final int v1p, final int v2p) { 36.20 + int v1 = v1p, v2 = v2p; 36.21 + 36.22 + if (v2 <= 0) { 36.23 + return -1; 36.24 + } 36.25 + if (v1 <= 0) { 36.26 + return 1; 36.27 + } 36.28 36.29 v1 *= distanceValue(); 36.30 v2 *= other.distanceValue(); 36.31 36.32 - if (v2 > v1) return 1; 36.33 - if (v2 < v1) return -1; 36.34 + if (v2 > v1) { 36.35 + return 1; 36.36 + } 36.37 + if (v2 < v1) { 36.38 + return -1; 36.39 + } 36.40 36.41 - if (other.min < min) return 1; 36.42 - if (other.min > min) return -1; 36.43 + if (other.min < min) { 36.44 + return 1; 36.45 + } 36.46 + if (other.min > min) { 36.47 + return -1; 36.48 + } 36.49 return 0; 36.50 } 36.51 36.52 @@ -96,27 +112,33 @@ 36.53 } 36.54 36.55 void altMerge(final MinMaxLen other) { 36.56 - if (min > other.min) min = other.min; 36.57 - if (max < other.max) max = other.max; 36.58 + if (min > other.min) { 36.59 + min = other.min; 36.60 + } 36.61 + if (max < other.max) { 36.62 + max = other.max; 36.63 + } 36.64 } 36.65 36.66 static final int INFINITE_DISTANCE = 0x7FFFFFFF; 36.67 static int distanceAdd(final int d1, final int d2) { 36.68 if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) { 36.69 return INFINITE_DISTANCE; 36.70 - } else { 36.71 - if (d1 <= INFINITE_DISTANCE - d2) return d1 + d2; 36.72 - else return INFINITE_DISTANCE; 36.73 } 36.74 + if (d1 <= INFINITE_DISTANCE - d2) { 36.75 + return d1 + d2; 36.76 + } 36.77 + return INFINITE_DISTANCE; 36.78 } 36.79 36.80 static int distanceMultiply(final int d, final int m) { 36.81 - if (m == 0) return 0; 36.82 + if (m == 0) { 36.83 + return 0; 36.84 + } 36.85 if (d < INFINITE_DISTANCE / m) { 36.86 return d * m; 36.87 - } else { 36.88 - return INFINITE_DISTANCE; 36.89 } 36.90 + return INFINITE_DISTANCE; 36.91 } 36.92 36.93 static String distanceRangeToString(final int a, final int b) {
37.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java Mon Nov 03 07:29:46 2014 +0100 37.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java Mon Nov 03 11:47:41 2014 +0100 37.3 @@ -19,6 +19,7 @@ 37.4 */ 37.5 package jdk.nashorn.internal.runtime.regexp.joni; 37.6 37.7 +@SuppressWarnings("javadoc") 37.8 public final class NodeOptInfo { 37.9 final MinMaxLen length = new MinMaxLen(); 37.10 final OptAnchorInfo anchor = new OptAnchorInfo(); 37.11 @@ -91,8 +92,12 @@ 37.12 if (other.length.max > 0) { 37.13 // TODO: make sure it is not an Oniguruma bug (casting unsigned int to int for arithmetic comparison) 37.14 int otherLengthMax = other.length.max; 37.15 - if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) otherLengthMax = -1; 37.16 - if (expr.length > otherLengthMax) expr.length = otherLengthMax; 37.17 + if (otherLengthMax == MinMaxLen.INFINITE_DISTANCE) { 37.18 + otherLengthMax = -1; 37.19 + } 37.20 + if (expr.length > otherLengthMax) { 37.21 + expr.length = otherLengthMax; 37.22 + } 37.23 if (expr.mmd.max == 0) { 37.24 exb.select(expr); 37.25 } else {
38.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java Mon Nov 03 07:29:46 2014 +0100 38.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java Mon Nov 03 11:47:41 2014 +0100 38.3 @@ -36,14 +36,20 @@ 38.4 38.5 void concat(final OptAnchorInfo left, final OptAnchorInfo right, final int leftLength, final int rightLength) { 38.6 leftAnchor = left.leftAnchor; 38.7 - if (leftLength == 0) leftAnchor |= right.leftAnchor; 38.8 + if (leftLength == 0) { 38.9 + leftAnchor |= right.leftAnchor; 38.10 + } 38.11 38.12 rightAnchor = right.rightAnchor; 38.13 - if (rightLength == 0) rightAnchor |= left.rightAnchor; 38.14 + if (rightLength == 0) { 38.15 + rightAnchor |= left.rightAnchor; 38.16 + } 38.17 } 38.18 38.19 boolean isSet(final int anchor) { 38.20 - if ((leftAnchor & anchor) != 0) return true; 38.21 + if ((leftAnchor & anchor) != 0) { 38.22 + return true; 38.23 + } 38.24 return (rightAnchor & anchor) != 0; 38.25 } 38.26 38.27 @@ -77,14 +83,30 @@ 38.28 static String anchorToString(final int anchor) { 38.29 final StringBuffer s = new StringBuffer("["); 38.30 38.31 - if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf "); 38.32 - if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line "); 38.33 - if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos "); 38.34 - if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf "); 38.35 - if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf "); 38.36 - if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line "); 38.37 - if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star "); 38.38 - if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl "); 38.39 + if ((anchor & AnchorType.BEGIN_BUF) !=0 ) { 38.40 + s.append("begin-buf "); 38.41 + } 38.42 + if ((anchor & AnchorType.BEGIN_LINE) !=0 ) { 38.43 + s.append("begin-line "); 38.44 + } 38.45 + if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) { 38.46 + s.append("begin-pos "); 38.47 + } 38.48 + if ((anchor & AnchorType.END_BUF) !=0 ) { 38.49 + s.append("end-buf "); 38.50 + } 38.51 + if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) { 38.52 + s.append("semi-end-buf "); 38.53 + } 38.54 + if ((anchor & AnchorType.END_LINE) !=0 ) { 38.55 + s.append("end-line "); 38.56 + } 38.57 + if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) { 38.58 + s.append("anychar-star "); 38.59 + } 38.60 + if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) { 38.61 + s.append("anychar-star-pl "); 38.62 + } 38.63 s.append("]"); 38.64 38.65 return s.toString();
39.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java Mon Nov 03 07:29:46 2014 +0100 39.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java Mon Nov 03 11:47:41 2014 +0100 39.3 @@ -56,7 +56,9 @@ 39.4 39.5 void concat(final OptExactInfo other) { 39.6 if (!ignoreCase && other.ignoreCase) { 39.7 - if (length >= other.length) return; /* avoid */ 39.8 + if (length >= other.length) { 39.9 + return; /* avoid */ 39.10 + } 39.11 ignoreCase = true; 39.12 } 39.13 39.14 @@ -65,7 +67,9 @@ 39.15 39.16 int i; 39.17 for (i = length; p < end;) { 39.18 - if (i + 1 > OPT_EXACT_MAXLEN) break; 39.19 + if (i + 1 > OPT_EXACT_MAXLEN) { 39.20 + break; 39.21 + } 39.22 chars[i++] = other.chars[p++]; 39.23 } 39.24 39.25 @@ -74,15 +78,20 @@ 39.26 39.27 final OptAnchorInfo tmp = new OptAnchorInfo(); 39.28 tmp.concat(anchor, other.anchor, 1, 1); 39.29 - if (!other.reachEnd) tmp.rightAnchor = 0; 39.30 + if (!other.reachEnd) { 39.31 + tmp.rightAnchor = 0; 39.32 + } 39.33 anchor.copy(tmp); 39.34 } 39.35 39.36 // ?? raw is not used here 39.37 - void concatStr(final char[] lchars, int p, final int end, final boolean raw) { 39.38 + void concatStr(final char[] lchars, final int pp, final int end, final boolean raw) { 39.39 int i; 39.40 + int p = pp; 39.41 for (i = length; p < end && i < OPT_EXACT_MAXLEN;) { 39.42 - if (i + 1 > OPT_EXACT_MAXLEN) break; 39.43 + if (i + 1 > OPT_EXACT_MAXLEN) { 39.44 + break; 39.45 + } 39.46 chars[i++] = lchars[p++]; 39.47 } 39.48 39.49 @@ -102,17 +111,23 @@ 39.50 39.51 int i; 39.52 for (i = 0; i < length && i < other.length; i++) { 39.53 - if (chars[i] != other.chars[i]) break; 39.54 + if (chars[i] != other.chars[i]) { 39.55 + break; 39.56 + } 39.57 } 39.58 39.59 - if (!other.reachEnd || i<other.length || i<length) reachEnd = false; 39.60 + if (!other.reachEnd || i<other.length || i<length) { 39.61 + reachEnd = false; 39.62 + } 39.63 39.64 length = i; 39.65 ignoreCase |= other.ignoreCase; 39.66 39.67 anchor.altMerge(other.anchor); 39.68 39.69 - if (!reachEnd) anchor.rightAnchor = 0; 39.70 + if (!reachEnd) { 39.71 + anchor.rightAnchor = 0; 39.72 + } 39.73 } 39.74 39.75 39.76 @@ -130,20 +145,32 @@ 39.77 v2 = OptMapInfo.positionValue(chars[0] & 0xff); 39.78 v1 = OptMapInfo.positionValue(alt.chars[0] & 0xff); 39.79 39.80 - if (length > 1) v1 += 5; 39.81 - if (alt.length > 1) v2 += 5; 39.82 + if (length > 1) { 39.83 + v1 += 5; 39.84 + } 39.85 + if (alt.length > 1) { 39.86 + v2 += 5; 39.87 + } 39.88 } 39.89 39.90 - if (!ignoreCase) v1 *= 2; 39.91 - if (!alt.ignoreCase) v2 *= 2; 39.92 + if (!ignoreCase) { 39.93 + v1 *= 2; 39.94 + } 39.95 + if (!alt.ignoreCase) { 39.96 + v2 *= 2; 39.97 + } 39.98 39.99 - if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); 39.100 + if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) { 39.101 + copy(alt); 39.102 + } 39.103 } 39.104 39.105 // comp_opt_exact_or_map_info 39.106 private static final int COMP_EM_BASE = 20; 39.107 int compare(final OptMapInfo m) { 39.108 - if (m.value <= 0) return -1; 39.109 + if (m.value <= 0) { 39.110 + return -1; 39.111 + } 39.112 39.113 final int ve = COMP_EM_BASE * length * (ignoreCase ? 1 : 2); 39.114 final int vm = COMP_EM_BASE * 5 * 2 / m.value;
40.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java Mon Nov 03 07:29:46 2014 +0100 40.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java Mon Nov 03 11:47:41 2014 +0100 40.3 @@ -31,7 +31,9 @@ 40.4 mmd.clear(); 40.5 anchor.clear(); 40.6 value = 0; 40.7 - for (int i=0; i<map.length; i++) map[i] = 0; 40.8 + for (int i=0; i<map.length; i++) { 40.9 + map[i] = 0; 40.10 + } 40.11 } 40.12 40.13 void copy(final OptMapInfo other) { 40.14 @@ -50,11 +52,10 @@ 40.15 } 40.16 } 40.17 40.18 - void addCharAmb(final char[] chars, final int p, final int end, int caseFoldFlag) { 40.19 + void addCharAmb(final char[] chars, final int p, final int end, final int caseFoldFlag) { 40.20 addChar(chars[p]); 40.21 40.22 - caseFoldFlag &= ~Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR; 40.23 - final char[]items = EncodingHelper.caseFoldCodesByString(caseFoldFlag, chars[p]); 40.24 + final char[]items = EncodingHelper.caseFoldCodesByString(caseFoldFlag & ~Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR, chars[p]); 40.25 40.26 for (int i=0; i<items.length; i++) { 40.27 addChar(items[i]); 40.28 @@ -64,7 +65,9 @@ 40.29 // select_opt_map_info 40.30 private static final int z = 1<<15; /* 32768: something big value */ 40.31 void select(final OptMapInfo alt) { 40.32 - if (alt.value == 0) return; 40.33 + if (alt.value == 0) { 40.34 + return; 40.35 + } 40.36 if (value == 0) { 40.37 copy(alt); 40.38 return; 40.39 @@ -73,13 +76,17 @@ 40.40 final int v1 = z / value; 40.41 final int v2 = z /alt.value; 40.42 40.43 - if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); 40.44 + if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) { 40.45 + copy(alt); 40.46 + } 40.47 } 40.48 40.49 // alt_merge_opt_map_info 40.50 void altMerge(final OptMapInfo other) { 40.51 /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ 40.52 - if (value == 0) return; 40.53 + if (value == 0) { 40.54 + return; 40.55 + } 40.56 if (other.value == 0 || mmd.max < other.mmd.max) { 40.57 clear(); 40.58 return; 40.59 @@ -89,8 +96,12 @@ 40.60 40.61 int val = 0; 40.62 for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { 40.63 - if (other.map[i] != 0) map[i] = 1; 40.64 - if (map[i] != 0) val += positionValue(i); 40.65 + if (other.map[i] != 0) { 40.66 + map[i] = 1; 40.67 + } 40.68 + if (map[i] != 0) { 40.69 + val += positionValue(i); 40.70 + } 40.71 } 40.72 40.73 value = val; 40.74 @@ -112,9 +123,8 @@ 40.75 static int positionValue(final int i) { 40.76 if (i < ByteValTable.length) { 40.77 return ByteValTable[i]; 40.78 - } else { 40.79 - return 4; /* Take it easy. */ 40.80 } 40.81 + return 4; /* Take it easy. */ 40.82 } 40.83 40.84 }
41.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Option.java Mon Nov 03 07:29:46 2014 +0100 41.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Option.java Mon Nov 03 11:47:41 2014 +0100 41.3 @@ -19,6 +19,7 @@ 41.4 */ 41.5 package jdk.nashorn.internal.runtime.regexp.joni; 41.6 41.7 +@SuppressWarnings("javadoc") 41.8 public class Option { 41.9 41.10 /* options */ 41.11 @@ -43,19 +44,43 @@ 41.12 41.13 public static String toString(final int option) { 41.14 String options = ""; 41.15 - if (isIgnoreCase(option)) options += "IGNORECASE "; 41.16 - if (isExtend(option)) options += "EXTEND "; 41.17 - if (isMultiline(option)) options += "MULTILINE "; 41.18 - if (isSingleline(option)) options += "SINGLELINE "; 41.19 - if (isFindLongest(option)) options += "FIND_LONGEST "; 41.20 - if (isFindNotEmpty(option)) options += "FIND_NOT_EMPTY "; 41.21 - if (isNegateSingleline(option)) options += "NEGATE_SINGLELINE "; 41.22 - if (isDontCaptureGroup(option)) options += "DONT_CAPTURE_GROUP "; 41.23 - if (isCaptureGroup(option)) options += "CAPTURE_GROUP "; 41.24 + if (isIgnoreCase(option)) { 41.25 + options += "IGNORECASE "; 41.26 + } 41.27 + if (isExtend(option)) { 41.28 + options += "EXTEND "; 41.29 + } 41.30 + if (isMultiline(option)) { 41.31 + options += "MULTILINE "; 41.32 + } 41.33 + if (isSingleline(option)) { 41.34 + options += "SINGLELINE "; 41.35 + } 41.36 + if (isFindLongest(option)) { 41.37 + options += "FIND_LONGEST "; 41.38 + } 41.39 + if (isFindNotEmpty(option)) { 41.40 + options += "FIND_NOT_EMPTY "; 41.41 + } 41.42 + if (isNegateSingleline(option)) { 41.43 + options += "NEGATE_SINGLELINE "; 41.44 + } 41.45 + if (isDontCaptureGroup(option)) { 41.46 + options += "DONT_CAPTURE_GROUP "; 41.47 + } 41.48 + if (isCaptureGroup(option)) { 41.49 + options += "CAPTURE_GROUP "; 41.50 + } 41.51 41.52 - if (isNotBol(option)) options += "NOTBOL "; 41.53 - if (isNotEol(option)) options += "NOTEOL "; 41.54 - if (isPosixRegion(option)) options += "POSIX_REGION "; 41.55 + if (isNotBol(option)) { 41.56 + options += "NOTBOL "; 41.57 + } 41.58 + if (isNotEol(option)) { 41.59 + options += "NOTEOL "; 41.60 + } 41.61 + if (isPosixRegion(option)) { 41.62 + options += "POSIX_REGION "; 41.63 + } 41.64 41.65 return options; 41.66 }
42.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java Mon Nov 03 07:29:46 2014 +0100 42.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java Mon Nov 03 11:47:41 2014 +0100 42.3 @@ -22,7 +22,6 @@ 42.4 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnOff; 42.5 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup; 42.6 import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase; 42.7 - 42.8 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode; 42.9 import jdk.nashorn.internal.runtime.regexp.joni.ast.AnyCharNode; 42.10 import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode; 42.11 @@ -77,7 +76,9 @@ 42.12 restore(); 42.13 return true; 42.14 } 42.15 - if (c == syntax.metaCharTable.esc) inEsc = true; 42.16 + if (c == syntax.metaCharTable.esc) { 42.17 + inEsc = true; 42.18 + } 42.19 } 42.20 } 42.21 42.22 @@ -165,7 +166,9 @@ 42.23 arg.vIsRaw = false; 42.24 fetchTokenInCC(); 42.25 fetched = true; 42.26 - if (token.type == TokenType.CC_RANGE || andStart) env.ccEscWarn("-"); /* [--x] or [a&&-x] is warned. */ 42.27 + if (token.type == TokenType.CC_RANGE || andStart) { 42.28 + env.ccEscWarn("-"); /* [--x] or [a&&-x] is warned. */ 42.29 + } 42.30 parseCharClassValEntry(cc, arg); // goto val_entry 42.31 break; 42.32 } else if (arg.state == CCSTATE.RANGE) { 42.33 @@ -214,7 +217,9 @@ 42.34 prevCC.and(cc); 42.35 } else { 42.36 prevCC = cc; 42.37 - if (workCC == null) workCC = new CClassNode(); 42.38 + if (workCC == null) { 42.39 + workCC = new CClassNode(); 42.40 + } 42.41 cc = workCC; 42.42 } 42.43 cc.clear(); 42.44 @@ -227,7 +232,9 @@ 42.45 throw new InternalException(ERR_PARSER_BUG); 42.46 } // switch 42.47 42.48 - if (!fetched) fetchTokenInCC(); 42.49 + if (!fetched) { 42.50 + fetchTokenInCC(); 42.51 + } 42.52 42.53 } // while 42.54 42.55 @@ -443,7 +450,10 @@ 42.56 } 42.57 42.58 private Node parseExp(final TokenType term) { 42.59 - if (token.type == term) return StringNode.EMPTY; // goto end_of_token 42.60 + if (token.type == term) 42.61 + { 42.62 + return StringNode.EMPTY; // goto end_of_token 42.63 + } 42.64 42.65 Node node = null; 42.66 boolean group = false; 42.67 @@ -474,9 +484,8 @@ 42.68 } 42.69 if (token.escaped) { 42.70 return parseExpTkRawByte(group); // goto tk_raw_byte 42.71 - } else { 42.72 - return parseExpTkByte(group); // goto tk_byte 42.73 } 42.74 + return parseExpTkByte(group); // goto tk_byte 42.75 case STRING: 42.76 return parseExpTkByte(group); // tk_byte: 42.77 42.78 @@ -496,7 +505,9 @@ 42.79 if (Config.NON_UNICODE_SDW) { 42.80 final CClassNode cc = new CClassNode(); 42.81 cc.addCType(token.getPropCType(), false, env, this); 42.82 - if (token.getPropNot()) cc.setNot(); 42.83 + if (token.getPropNot()) { 42.84 + cc.setNot(); 42.85 + } 42.86 node = cc; 42.87 } 42.88 break; 42.89 @@ -507,7 +518,9 @@ 42.90 // #ifdef USE_SHARED_CCLASS_TABLE ... #endif 42.91 final CClassNode ccn = new CClassNode(); 42.92 ccn.addCType(token.getPropCType(), false, env, this); 42.93 - if (token.getPropNot()) ccn.setNot(); 42.94 + if (token.getPropNot()) { 42.95 + ccn.setNot(); 42.96 + } 42.97 node = ccn; 42.98 break; 42.99 42.100 @@ -555,9 +568,8 @@ 42.101 if (syntax.contextIndepRepeatOps()) { 42.102 if (syntax.contextInvalidRepeatOps()) { 42.103 throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); 42.104 - } else { 42.105 - node = StringNode.EMPTY; // node_new_empty 42.106 } 42.107 + node = StringNode.EMPTY; // node_new_empty 42.108 } else { 42.109 return parseExpTkByte(group); // goto tk_byte 42.110 } 42.111 @@ -578,7 +590,9 @@ 42.112 final StringNode node = new StringNode(chars, token.backP, p); // tk_byte: 42.113 while (true) { 42.114 fetchToken(); 42.115 - if (token.type != TokenType.STRING) break; 42.116 + if (token.type != TokenType.STRING) { 42.117 + break; 42.118 + } 42.119 42.120 if (token.backP == node.end) { 42.121 node.end = p; // non escaped character, remain shared, just increase shared range 42.122 @@ -605,7 +619,8 @@ 42.123 return parseExpRepeat(node, group); 42.124 } 42.125 42.126 - private Node parseExpRepeat(Node target, final boolean group) { 42.127 + private Node parseExpRepeat(final Node targetp, final boolean group) { 42.128 + Node target = targetp; 42.129 while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: 42.130 if (target.isInvalidQuantifier()) { 42.131 throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); 42.132 @@ -674,24 +689,25 @@ 42.133 42.134 if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) { 42.135 return node; 42.136 - } else { 42.137 - final ConsAltNode top = ConsAltNode.newListNode(node, null); 42.138 - ConsAltNode t = top; 42.139 + } 42.140 + final ConsAltNode top = ConsAltNode.newListNode(node, null); 42.141 + ConsAltNode t = top; 42.142 42.143 - while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) { 42.144 - node = parseExp(term); 42.145 - if (node.getType() == NodeType.LIST) { 42.146 - t.setCdr((ConsAltNode)node); 42.147 - while (((ConsAltNode)node).cdr != null ) node = ((ConsAltNode)node).cdr; 42.148 + while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) { 42.149 + node = parseExp(term); 42.150 + if (node.getType() == NodeType.LIST) { 42.151 + t.setCdr((ConsAltNode)node); 42.152 + while (((ConsAltNode)node).cdr != null ) { 42.153 + node = ((ConsAltNode)node).cdr; 42.154 + } 42.155 42.156 - t = ((ConsAltNode)node); 42.157 - } else { 42.158 - t.setCdr(ConsAltNode.newListNode(node, null)); 42.159 - t = t.cdr; 42.160 - } 42.161 + t = ((ConsAltNode)node); 42.162 + } else { 42.163 + t.setCdr(ConsAltNode.newListNode(node, null)); 42.164 + t = t.cdr; 42.165 } 42.166 - return top; 42.167 } 42.168 + return top; 42.169 } 42.170 42.171 /* term_tok: TK_EOT or TK_SUBEXP_CLOSE */ 42.172 @@ -711,7 +727,9 @@ 42.173 t = t.cdr; 42.174 } 42.175 42.176 - if (token.type != term) parseSubExpError(term); 42.177 + if (token.type != term) { 42.178 + parseSubExpError(term); 42.179 + } 42.180 return top; 42.181 } else { 42.182 parseSubExpError(term); 42.183 @@ -719,12 +737,11 @@ 42.184 } 42.185 } 42.186 42.187 - private void parseSubExpError(final TokenType term) { 42.188 + private static void parseSubExpError(final TokenType term) { 42.189 if (term == TokenType.SUBEXP_CLOSE) { 42.190 throw new SyntaxException(ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); 42.191 - } else { 42.192 - throw new InternalException(ERR_PARSER_BUG); 42.193 } 42.194 + throw new InternalException(ERR_PARSER_BUG); 42.195 } 42.196 42.197 private Node parseRegexp() {
43.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java Mon Nov 03 07:29:46 2014 +0100 43.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java Mon Nov 03 11:47:41 2014 +0100 43.3 @@ -24,6 +24,7 @@ 43.4 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; 43.5 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; 43.6 43.7 +@SuppressWarnings("javadoc") 43.8 public final class Regex implements RegexState { 43.9 43.10 int[] code; /* compiled pattern */ 43.11 @@ -107,7 +108,8 @@ 43.12 } 43.13 43.14 // onig_alloc_init 43.15 - public Regex(final char[] chars, final int p, final int end, int option, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) { 43.16 + public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) { 43.17 + int option = optionp; 43.18 43.19 if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) == 43.20 (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) { 43.21 @@ -169,19 +171,33 @@ 43.22 43.23 if (len < Config.CHAR_TABLE_SIZE) { 43.24 // map/skip 43.25 - if (map == null) map = new byte[Config.CHAR_TABLE_SIZE]; 43.26 + if (map == null) { 43.27 + map = new byte[Config.CHAR_TABLE_SIZE]; 43.28 + } 43.29 43.30 - for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) map[i] = (byte)len; 43.31 - for (int i=0; i<len-1; i++) map[chars[p + i] & 0xff] = (byte)(len - 1 -i); // oxff ?? 43.32 + for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { 43.33 + map[i] = (byte)len; 43.34 + } 43.35 + for (int i=0; i<len-1; i++) 43.36 + { 43.37 + map[chars[p + i] & 0xff] = (byte)(len - 1 -i); // oxff ?? 43.38 + } 43.39 } else { 43.40 - if (intMap == null) intMap = new int[Config.CHAR_TABLE_SIZE]; 43.41 + if (intMap == null) { 43.42 + intMap = new int[Config.CHAR_TABLE_SIZE]; 43.43 + } 43.44 43.45 - for (int i=0; i<len-1; i++) intMap[chars[p + i] & 0xff] = len - 1 - i; // oxff ?? 43.46 + for (int i=0; i<len-1; i++) 43.47 + { 43.48 + intMap[chars[p + i] & 0xff] = len - 1 - i; // oxff ?? 43.49 + } 43.50 } 43.51 } 43.52 43.53 void setExactInfo(final OptExactInfo e) { 43.54 - if (e.length == 0) return; 43.55 + if (e.length == 0) { 43.56 + return; 43.57 + } 43.58 43.59 // shall we copy that ? 43.60 exact = e.chars; 43.61 @@ -257,7 +273,11 @@ 43.62 s.append("exact: [").append(exact, exactP, exactEnd - exactP).append("]: length: ").append(exactEnd - exactP).append("\n"); 43.63 } else if (searchAlgorithm == SearchAlgorithm.MAP) { 43.64 int n=0; 43.65 - for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) if (map[i] != 0) n++; 43.66 + for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { 43.67 + if (map[i] != 0) { 43.68 + n++; 43.69 + } 43.70 + } 43.71 43.72 s.append("map: n = ").append(n).append("\n"); 43.73 if (n > 0) {
44.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java Mon Nov 03 07:29:46 2014 +0100 44.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java Mon Nov 03 11:47:41 2014 +0100 44.3 @@ -19,6 +19,7 @@ 44.4 */ 44.5 package jdk.nashorn.internal.runtime.regexp.joni; 44.6 44.7 +@SuppressWarnings("javadoc") 44.8 public final class Region { 44.9 static final int REGION_NOTPOS = -1; 44.10 44.11 @@ -36,7 +37,9 @@ 44.12 public String toString() { 44.13 final StringBuilder sb = new StringBuilder(); 44.14 sb.append("Region: \n"); 44.15 - for (int i=0; i<beg.length; i++) sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")"); 44.16 + for (int i=0; i<beg.length; i++) { 44.17 + sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")"); 44.18 + } 44.19 return sb.toString(); 44.20 } 44.21
45.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java Mon Nov 03 07:29:46 2014 +0100 45.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java Mon Nov 03 11:47:41 2014 +0100 45.3 @@ -20,11 +20,11 @@ 45.4 package jdk.nashorn.internal.runtime.regexp.joni; 45.5 45.6 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsClear; 45.7 - 45.8 import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; 45.9 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; 45.10 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException; 45.11 45.12 +@SuppressWarnings("javadoc") 45.13 public final class ScanEnvironment { 45.14 45.15 private static final int SCANENV_MEMNODES_SIZE = 8; 45.16 @@ -92,7 +92,10 @@ 45.17 case 'b': return '\010'; 45.18 case 'e': return '\033'; 45.19 case 'v': 45.20 - if (syntax.op2EscVVtab()) return 11; // ??? 45.21 + if (syntax.op2EscVVtab()) 45.22 + { 45.23 + return 11; // ??? 45.24 + } 45.25 break; 45.26 default: 45.27 break;
46.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java Mon Nov 03 07:29:46 2014 +0100 46.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java Mon Nov 03 11:47:41 2014 +0100 46.3 @@ -60,7 +60,9 @@ 46.4 if (Character.isDigit(c)) { 46.5 final int onum = num; 46.6 num = num * 10 + EncodingHelper.digitVal(c); 46.7 - if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1; 46.8 + if (((onum ^ num) & INT_SIGN_BIT) != 0) { 46.9 + return -1; 46.10 + } 46.11 } else { 46.12 unfetch(); 46.13 break; 46.14 @@ -70,16 +72,19 @@ 46.15 return num; 46.16 } 46.17 46.18 - protected final int scanUnsignedHexadecimalNumber(int maxLength) { 46.19 + protected final int scanUnsignedHexadecimalNumber(final int maxLength) { 46.20 final int last = c; 46.21 int num = 0; 46.22 - while(left() && maxLength-- != 0) { 46.23 + int ml = maxLength; 46.24 + while(left() && ml-- != 0) { 46.25 fetch(); 46.26 if (EncodingHelper.isXDigit(c)) { 46.27 final int onum = num; 46.28 final int val = EncodingHelper.xdigitVal(c); 46.29 num = (num << 4) + val; 46.30 - if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1; 46.31 + if (((onum ^ num) & INT_SIGN_BIT) != 0) { 46.32 + return -1; 46.33 + } 46.34 } else { 46.35 unfetch(); 46.36 break; 46.37 @@ -89,16 +94,19 @@ 46.38 return num; 46.39 } 46.40 46.41 - protected final int scanUnsignedOctalNumber(int maxLength) { 46.42 + protected final int scanUnsignedOctalNumber(final int maxLength) { 46.43 final int last = c; 46.44 int num = 0; 46.45 - while(left() && maxLength-- != 0) { 46.46 + int ml = maxLength; 46.47 + while(left() && ml-- != 0) { 46.48 fetch(); 46.49 if (Character.isDigit(c) && c < '8') { 46.50 final int onum = num; 46.51 final int val = EncodingHelper.odigitVal(c); 46.52 num = (num << 3) + val; 46.53 - if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1; 46.54 + if (((onum ^ num) & INT_SIGN_BIT) != 0) { 46.55 + return -1; 46.56 + } 46.57 } else { 46.58 unfetch(); 46.59 break; 46.60 @@ -144,8 +152,8 @@ 46.61 return p < stop ? chars[p] : 0; 46.62 } 46.63 46.64 - protected final boolean peekIs(final int c) { 46.65 - return peek() == c; 46.66 + protected final boolean peekIs(final int ch) { 46.67 + return peek() == ch; 46.68 } 46.69 46.70 protected final boolean left() {
47.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java Mon Nov 03 07:29:46 2014 +0100 47.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java Mon Nov 03 11:47:41 2014 +0100 47.3 @@ -19,6 +19,7 @@ 47.4 */ 47.5 package jdk.nashorn.internal.runtime.regexp.joni; 47.6 47.7 +@SuppressWarnings("javadoc") 47.8 public abstract class SearchAlgorithm { 47.9 47.10 public abstract String getName(); 47.11 @@ -62,7 +63,9 @@ 47.12 int end = textEnd; 47.13 end -= targetEnd - targetP - 1; 47.14 47.15 - if (end > textRange) end = textRange; 47.16 + if (end > textRange) { 47.17 + end = textRange; 47.18 + } 47.19 47.20 int s = textP; 47.21 47.22 @@ -71,11 +74,15 @@ 47.23 int p = s + 1; 47.24 int t = targetP + 1; 47.25 while (t < targetEnd) { 47.26 - if (target[t] != text[p++]) break; 47.27 + if (target[t] != text[p++]) { 47.28 + break; 47.29 + } 47.30 t++; 47.31 } 47.32 47.33 - if (t == targetEnd) return s; 47.34 + if (t == targetEnd) { 47.35 + return s; 47.36 + } 47.37 } 47.38 s++; 47.39 } 47.40 @@ -101,10 +108,14 @@ 47.41 int p = s + 1; 47.42 int t = targetP + 1; 47.43 while (t < targetEnd) { 47.44 - if (target[t] != text[p++]) break; 47.45 + if (target[t] != text[p++]) { 47.46 + break; 47.47 + } 47.48 t++; 47.49 } 47.50 - if (t == targetEnd) return s; 47.51 + if (t == targetEnd) { 47.52 + return s; 47.53 + } 47.54 } 47.55 // s = enc.prevCharHead or s = s <= adjustText ? -1 : s - 1; 47.56 s--; 47.57 @@ -114,10 +125,8 @@ 47.58 }; 47.59 47.60 public static final class SLOW_IC extends SearchAlgorithm { 47.61 - private final int caseFoldFlag; 47.62 - 47.63 public SLOW_IC(final Regex regex) { 47.64 - this.caseFoldFlag = regex.caseFoldFlag; 47.65 + //empty 47.66 } 47.67 47.68 @Override 47.69 @@ -134,11 +143,15 @@ 47.70 int end = textEnd; 47.71 end -= targetEnd - targetP - 1; 47.72 47.73 - if (end > textRange) end = textRange; 47.74 + if (end > textRange) { 47.75 + end = textRange; 47.76 + } 47.77 int s = textP; 47.78 47.79 while (s < end) { 47.80 - if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s; 47.81 + if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) { 47.82 + return s; 47.83 + } 47.84 s++; 47.85 } 47.86 return -1; 47.87 @@ -158,17 +171,21 @@ 47.88 } 47.89 47.90 while (s >= textP) { 47.91 - if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) return s; 47.92 + if (lowerCaseMatch(target, targetP, targetEnd, text, s, textEnd)) { 47.93 + return s; 47.94 + } 47.95 s = EncodingHelper.prevCharHead(adjustText, s); 47.96 } 47.97 return -1; 47.98 } 47.99 47.100 - private boolean lowerCaseMatch(final char[] t, int tP, final int tEnd, 47.101 - final char[] chars, int p, final int end) { 47.102 + private static boolean lowerCaseMatch(final char[] t, final int tPp, final int tEnd, 47.103 + final char[] chars, final int pp, final int end) { 47.104 47.105 - while (tP < tEnd) { 47.106 - if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) return false; 47.107 + for (int tP = tPp, p = pp; tP < tEnd; ) { 47.108 + if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) { 47.109 + return false; 47.110 + } 47.111 } 47.112 return true; 47.113 } 47.114 @@ -188,7 +205,9 @@ 47.115 final int targetEnd = regex.exactEnd; 47.116 47.117 int end = textRange + (targetEnd - targetP) - 1; 47.118 - if (end > textEnd) end = textEnd; 47.119 + if (end > textEnd) { 47.120 + end = textEnd; 47.121 + } 47.122 47.123 final int tail = targetEnd - 1; 47.124 int s = textP + (targetEnd - targetP) - 1; 47.125 @@ -199,7 +218,9 @@ 47.126 int t = tail; 47.127 47.128 while (text[p] == target[t]) { 47.129 - if (t == targetP) return p; 47.130 + if (t == targetP) { 47.131 + return p; 47.132 + } 47.133 p--; t--; 47.134 } 47.135 47.136 @@ -211,7 +232,9 @@ 47.137 int t = tail; 47.138 47.139 while (text[p] == target[t]) { 47.140 - if (t == targetP) return p; 47.141 + if (t == targetP) { 47.142 + return p; 47.143 + } 47.144 p--; t--; 47.145 } 47.146 47.147 @@ -249,7 +272,9 @@ 47.148 while (t < targetEnd && text[p] == target[t]) { 47.149 p++; t++; 47.150 } 47.151 - if (t == targetEnd) return s; 47.152 + if (t == targetEnd) { 47.153 + return s; 47.154 + } 47.155 47.156 s -= regex.intMapBackward[text[s] & 0xff]; 47.157 } 47.158 @@ -268,8 +293,12 @@ 47.159 47.160 final int len = end - p; 47.161 47.162 - for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) skip[i] = len; 47.163 - for (int i=len-1; i>0; i--) skip[chars[i] & 0xff] = i; 47.164 + for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { 47.165 + skip[i] = len; 47.166 + } 47.167 + for (int i=len-1; i>0; i--) { 47.168 + skip[chars[i] & 0xff] = i; 47.169 + } 47.170 } 47.171 }; 47.172 47.173 @@ -286,7 +315,9 @@ 47.174 int s = textP; 47.175 47.176 while (s < textRange) { 47.177 - if (text[s] > 0xff || map[text[s]] != 0) return s; 47.178 + if (text[s] > 0xff || map[text[s]] != 0) { 47.179 + return s; 47.180 + } 47.181 s++; 47.182 } 47.183 return -1; 47.184 @@ -297,9 +328,13 @@ 47.185 final byte[] map = regex.map; 47.186 int s = textStart; 47.187 47.188 - if (s >= textEnd) s = textEnd - 1; 47.189 + if (s >= textEnd) { 47.190 + s = textEnd - 1; 47.191 + } 47.192 while (s >= textP) { 47.193 - if (text[s] > 0xff || map[text[s]] != 0) return s; 47.194 + if (text[s] > 0xff || map[text[s]] != 0) { 47.195 + return s; 47.196 + } 47.197 s--; 47.198 } 47.199 return -1;
48.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java Mon Nov 03 07:29:46 2014 +0100 48.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java Mon Nov 03 11:47:41 2014 +0100 48.3 @@ -20,7 +20,6 @@ 48.4 package jdk.nashorn.internal.runtime.regexp.joni; 48.5 48.6 import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt; 48.7 - 48.8 import java.lang.ref.WeakReference; 48.9 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel; 48.10 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType; 48.11 @@ -61,12 +60,14 @@ 48.12 48.13 static final ThreadLocal<WeakReference<StackEntry[]>> stacks 48.14 = new ThreadLocal<WeakReference<StackEntry[]>>() { 48.15 + @SuppressWarnings("unused") 48.16 @Override 48.17 protected WeakReference<StackEntry[]> initialValue() { 48.18 return new WeakReference<StackEntry[]>(allocateStack()); 48.19 } 48.20 }; 48.21 48.22 + @SuppressWarnings("unused") 48.23 private static StackEntry[] fetchStack() { 48.24 WeakReference<StackEntry[]> ref = stacks.get(); 48.25 StackEntry[] stack = ref.get(); 48.26 @@ -78,7 +79,9 @@ 48.27 } 48.28 48.29 protected final void init() { 48.30 - if (stack != null) pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */ 48.31 + if (stack != null) { 48.32 + pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */ 48.33 + } 48.34 if (repeatStk != null) { 48.35 for (int i=1; i<=regex.numMem; i++) { 48.36 repeatStk[i + memStartStk] = repeatStk[i + memEndStk] = INVALID_INDEX; 48.37 @@ -87,9 +90,13 @@ 48.38 } 48.39 48.40 protected final StackEntry ensure1() { 48.41 - if (stk >= stack.length) doubleStack(); 48.42 + if (stk >= stack.length) { 48.43 + doubleStack(); 48.44 + } 48.45 StackEntry e = stack[stk]; 48.46 - if (e == null) stack[stk] = e = new StackEntry(); 48.47 + if (e == null) { 48.48 + stack[stk] = e = new StackEntry(); 48.49 + } 48.50 return e; 48.51 } 48.52 48.53 @@ -190,7 +197,9 @@ 48.54 if ((e.type & MASK_MEM_END_OR_MARK) != 0 && e.getMemNum() == mnum) { 48.55 level++; 48.56 } else if (e.type == MEM_START && e.getMemNum() == mnum) { 48.57 - if (level == 0) break; 48.58 + if (level == 0) { 48.59 + break; 48.60 + } 48.61 level--; 48.62 } 48.63 } 48.64 @@ -371,9 +380,8 @@ 48.65 if (e.getNullCheckNum() == id) { 48.66 if (level == 0) { 48.67 return e.getNullCheckPStr() == s ? 1 : 0; 48.68 - } else { 48.69 - level--; 48.70 } 48.71 + level--; 48.72 } 48.73 } else if (e.type == NULL_CHECK_END) { 48.74 level++; 48.75 @@ -393,7 +401,52 @@ 48.76 if (e.getNullCheckPStr() != s) { 48.77 isNull = 0; 48.78 break; 48.79 - } else { 48.80 + } 48.81 + int endp; 48.82 + isNull = 1; 48.83 + while (k < stk) { 48.84 + if (e.type == MEM_START) { 48.85 + if (e.getMemEnd() == INVALID_INDEX) { 48.86 + isNull = 0; 48.87 + break; 48.88 + } 48.89 + if (bsAt(regex.btMemEnd, e.getMemNum())) { 48.90 + endp = stack[e.getMemEnd()].getMemPStr(); 48.91 + } else { 48.92 + endp = e.getMemEnd(); 48.93 + } 48.94 + if (stack[e.getMemStart()].getMemPStr() != endp) { 48.95 + isNull = 0; 48.96 + break; 48.97 + } else if (endp != s) { 48.98 + isNull = -1; /* empty, but position changed */ 48.99 + } 48.100 + } 48.101 + k++; 48.102 + e = stack[k]; // !! 48.103 + } 48.104 + break; 48.105 + } 48.106 + } 48.107 + } 48.108 + return isNull; 48.109 + } 48.110 + 48.111 + protected final int nullCheckMemStRec(final int id, final int s) { 48.112 + int level = 0; 48.113 + int k = stk; 48.114 + int isNull; 48.115 + while (true) { 48.116 + k--; 48.117 + StackEntry e = stack[k]; 48.118 + 48.119 + if (e.type == NULL_CHECK_START) { 48.120 + if (e.getNullCheckNum() == id) { 48.121 + if (level == 0) { 48.122 + if (e.getNullCheckPStr() != s) { 48.123 + isNull = 0; 48.124 + break; 48.125 + } 48.126 int endp; 48.127 isNull = 1; 48.128 while (k < stk) { 48.129 @@ -415,62 +468,16 @@ 48.130 } 48.131 } 48.132 k++; 48.133 - e = stack[k]; // !! 48.134 + e = stack[k]; 48.135 } 48.136 break; 48.137 } 48.138 - } 48.139 - } 48.140 - } 48.141 - return isNull; 48.142 - } 48.143 - 48.144 - protected final int nullCheckMemStRec(final int id, final int s) { 48.145 - int level = 0; 48.146 - int k = stk; 48.147 - int isNull; 48.148 - while (true) { 48.149 - k--; 48.150 - StackEntry e = stack[k]; 48.151 - 48.152 - if (e.type == NULL_CHECK_START) { 48.153 - if (e.getNullCheckNum() == id) { 48.154 - if (level == 0) { 48.155 - if (e.getNullCheckPStr() != s) { 48.156 - isNull = 0; 48.157 - break; 48.158 - } else { 48.159 - int endp; 48.160 - isNull = 1; 48.161 - while (k < stk) { 48.162 - if (e.type == MEM_START) { 48.163 - if (e.getMemEnd() == INVALID_INDEX) { 48.164 - isNull = 0; 48.165 - break; 48.166 - } 48.167 - if (bsAt(regex.btMemEnd, e.getMemNum())) { 48.168 - endp = stack[e.getMemEnd()].getMemPStr(); 48.169 - } else { 48.170 - endp = e.getMemEnd(); 48.171 - } 48.172 - if (stack[e.getMemStart()].getMemPStr() != endp) { 48.173 - isNull = 0; 48.174 - break; 48.175 - } else if (endp != s) { 48.176 - isNull = -1; /* empty, but position changed */ 48.177 - } 48.178 - } 48.179 - k++; 48.180 - e = stack[k]; 48.181 - } 48.182 - break; 48.183 - } 48.184 - } else { 48.185 - level--; 48.186 - } 48.187 + level--; 48.188 } 48.189 } else if (e.type == NULL_CHECK_END) { 48.190 - if (e.getNullCheckNum() == id) level++; 48.191 + if (e.getNullCheckNum() == id) { 48.192 + level++; 48.193 + } 48.194 } 48.195 } 48.196 return isNull; 48.197 @@ -485,7 +492,9 @@ 48.198 48.199 if (e.type == REPEAT) { 48.200 if (level == 0) { 48.201 - if (e.getRepeatNum() == id) return k; 48.202 + if (e.getRepeatNum() == id) { 48.203 + return k; 48.204 + } 48.205 } 48.206 } else if (e.type == CALL_FRAME) { 48.207 level--; 48.208 @@ -505,9 +514,8 @@ 48.209 if (e.type == CALL_FRAME) { 48.210 if (level == 0) { 48.211 return e.getCallFrameRetAddr(); 48.212 - } else { 48.213 - level--; 48.214 } 48.215 + level--; 48.216 } else if (e.type == RETURN) { 48.217 level++; 48.218 }
49.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java Mon Nov 03 07:29:46 2014 +0100 49.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java Mon Nov 03 11:47:41 2014 +0100 49.3 @@ -20,10 +20,10 @@ 49.4 package jdk.nashorn.internal.runtime.regexp.joni; 49.5 49.6 import static jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar.INEFFECTIVE_META_CHAR; 49.7 - 49.8 import jdk.nashorn.internal.runtime.regexp.joni.constants.SyntaxProperties; 49.9 49.10 -public final class Syntax implements SyntaxProperties{ 49.11 +@SuppressWarnings("javadoc") 49.12 +public final class Syntax implements SyntaxProperties { 49.13 private final int op; 49.14 private final int op2; 49.15 private final int behavior;
50.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java Mon Nov 03 07:29:46 2014 +0100 50.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java Mon Nov 03 11:47:41 2014 +0100 50.3 @@ -22,6 +22,7 @@ 50.4 /** 50.5 * @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a> 50.6 */ 50.7 +@SuppressWarnings("javadoc") 50.8 public interface WarnCallback { 50.9 WarnCallback DEFAULT = new WarnCallback() { 50.10 @Override
51.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java Mon Nov 03 07:29:46 2014 +0100 51.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java Mon Nov 03 11:47:41 2014 +0100 51.3 @@ -19,6 +19,7 @@ 51.4 */ 51.5 package jdk.nashorn.internal.runtime.regexp.joni; 51.6 51.7 +@SuppressWarnings("javadoc") 51.8 public interface Warnings { 51.9 final String INVALID_BACKREFERENCE = "invalid back reference"; 51.10 final String INVALID_SUBEXP_CALL = "invalid subexp call";
52.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Mon Nov 03 07:29:46 2014 +0100 52.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Mon Nov 03 11:47:41 2014 +0100 52.3 @@ -21,6 +21,7 @@ 52.4 52.5 import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; 52.6 52.7 +@SuppressWarnings("javadoc") 52.8 public final class AnchorNode extends Node implements AnchorType { 52.9 public int type; 52.10 public Node target; 52.11 @@ -65,28 +66,60 @@ 52.12 } 52.13 52.14 public String typeToString() { 52.15 - final StringBuilder type = new StringBuilder(); 52.16 - if (isType(BEGIN_BUF)) type.append("BEGIN_BUF "); 52.17 - if (isType(BEGIN_LINE)) type.append("BEGIN_LINE "); 52.18 - if (isType(BEGIN_POSITION)) type.append("BEGIN_POSITION "); 52.19 - if (isType(END_BUF)) type.append("END_BUF "); 52.20 - if (isType(SEMI_END_BUF)) type.append("SEMI_END_BUF "); 52.21 - if (isType(END_LINE)) type.append("END_LINE "); 52.22 - if (isType(WORD_BOUND)) type.append("WORD_BOUND "); 52.23 - if (isType(NOT_WORD_BOUND)) type.append("NOT_WORD_BOUND "); 52.24 - if (isType(WORD_BEGIN)) type.append("WORD_BEGIN "); 52.25 - if (isType(WORD_END)) type.append("WORD_END "); 52.26 - if (isType(PREC_READ)) type.append("PREC_READ "); 52.27 - if (isType(PREC_READ_NOT)) type.append("PREC_READ_NOT "); 52.28 - if (isType(LOOK_BEHIND)) type.append("LOOK_BEHIND "); 52.29 - if (isType(LOOK_BEHIND_NOT)) type.append("LOOK_BEHIND_NOT "); 52.30 - if (isType(ANYCHAR_STAR)) type.append("ANYCHAR_STAR "); 52.31 - if (isType(ANYCHAR_STAR_ML)) type.append("ANYCHAR_STAR_ML "); 52.32 - return type.toString(); 52.33 + final StringBuilder sb = new StringBuilder(); 52.34 + if (isType(BEGIN_BUF)) { 52.35 + sb.append("BEGIN_BUF "); 52.36 + } 52.37 + if (isType(BEGIN_LINE)) { 52.38 + sb.append("BEGIN_LINE "); 52.39 + } 52.40 + if (isType(BEGIN_POSITION)) { 52.41 + sb.append("BEGIN_POSITION "); 52.42 + } 52.43 + if (isType(END_BUF)) { 52.44 + sb.append("END_BUF "); 52.45 + } 52.46 + if (isType(SEMI_END_BUF)) { 52.47 + sb.append("SEMI_END_BUF "); 52.48 + } 52.49 + if (isType(END_LINE)) { 52.50 + sb.append("END_LINE "); 52.51 + } 52.52 + if (isType(WORD_BOUND)) { 52.53 + sb.append("WORD_BOUND "); 52.54 + } 52.55 + if (isType(NOT_WORD_BOUND)) { 52.56 + sb.append("NOT_WORD_BOUND "); 52.57 + } 52.58 + if (isType(WORD_BEGIN)) { 52.59 + sb.append("WORD_BEGIN "); 52.60 + } 52.61 + if (isType(WORD_END)) { 52.62 + sb.append("WORD_END "); 52.63 + } 52.64 + if (isType(PREC_READ)) { 52.65 + sb.append("PREC_READ "); 52.66 + } 52.67 + if (isType(PREC_READ_NOT)) { 52.68 + sb.append("PREC_READ_NOT "); 52.69 + } 52.70 + if (isType(LOOK_BEHIND)) { 52.71 + sb.append("LOOK_BEHIND "); 52.72 + } 52.73 + if (isType(LOOK_BEHIND_NOT)) { 52.74 + sb.append("LOOK_BEHIND_NOT "); 52.75 + } 52.76 + if (isType(ANYCHAR_STAR)) { 52.77 + sb.append("ANYCHAR_STAR "); 52.78 + } 52.79 + if (isType(ANYCHAR_STAR_ML)) { 52.80 + sb.append("ANYCHAR_STAR_ML "); 52.81 + } 52.82 + return sb.toString(); 52.83 } 52.84 52.85 - private boolean isType(final int type) { 52.86 - return (this.type & type) != 0; 52.87 + private boolean isType(final int t) { 52.88 + return (this.type & t) != 0; 52.89 } 52.90 52.91 }
53.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java Mon Nov 03 07:29:46 2014 +0100 53.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java Mon Nov 03 11:47:41 2014 +0100 53.3 @@ -19,6 +19,7 @@ 53.4 */ 53.5 package jdk.nashorn.internal.runtime.regexp.joni.ast; 53.6 53.7 +@SuppressWarnings("javadoc") 53.8 public final class AnyCharNode extends Node { 53.9 public AnyCharNode(){} 53.10
54.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java Mon Nov 03 07:29:46 2014 +0100 54.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java Mon Nov 03 11:47:41 2014 +0100 54.3 @@ -21,6 +21,7 @@ 54.4 54.5 import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment; 54.6 54.7 +@SuppressWarnings("javadoc") 54.8 public final class BackRefNode extends StateNode { 54.9 public final int backRef; 54.10
55.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Mon Nov 03 07:29:46 2014 +0100 55.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Mon Nov 03 11:47:41 2014 +0100 55.3 @@ -34,6 +34,7 @@ 55.4 import jdk.nashorn.internal.runtime.regexp.joni.exception.SyntaxException; 55.5 import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; 55.6 55.7 +@SuppressWarnings("javadoc") 55.8 public final class CClassNode extends Node { 55.9 private static final int FLAG_NCCLASS_NOT = 1<<0; 55.10 private static final int FLAG_NCCLASS_SHARE = 1<<1; 55.11 @@ -100,7 +101,9 @@ 55.12 55.13 @Override 55.14 public boolean equals(final Object other) { 55.15 - if (!(other instanceof CClassNode)) return false; 55.16 + if (!(other instanceof CClassNode)) { 55.17 + return false; 55.18 + } 55.19 final CClassNode cc = (CClassNode)other; 55.20 return ctype == cc.ctype && isNot() == cc.isNot(); 55.21 } 55.22 @@ -110,11 +113,12 @@ 55.23 if (Config.USE_SHARED_CCLASS_TABLE) { 55.24 int hash = 0; 55.25 hash += ctype; 55.26 - if (isNot()) hash++; 55.27 + if (isNot()) { 55.28 + hash++; 55.29 + } 55.30 return hash + (hash >> 5); 55.31 - } else { 55.32 - return super.hashCode(); 55.33 } 55.34 + return super.hashCode(); 55.35 } 55.36 55.37 @Override 55.38 @@ -128,10 +132,14 @@ 55.39 } 55.40 55.41 public String flagsToString() { 55.42 - final StringBuilder flags = new StringBuilder(); 55.43 - if (isNot()) flags.append("NOT "); 55.44 - if (isShare()) flags.append("SHARE "); 55.45 - return flags.toString(); 55.46 + final StringBuilder f = new StringBuilder(); 55.47 + if (isNot()) { 55.48 + f.append("NOT "); 55.49 + } 55.50 + if (isShare()) { 55.51 + f.append("SHARE "); 55.52 + } 55.53 + return f.toString(); 55.54 } 55.55 55.56 public boolean isEmpty() { 55.57 @@ -251,7 +259,7 @@ 55.58 } 55.59 55.60 // add_ctype_to_cc_by_range // Encoding out! 55.61 - public void addCTypeByRange(final int ctype, final boolean not, final int sbOut, final int mbr[]) { 55.62 + public void addCTypeByRange(final int ct, final boolean not, final int sbOut, final int mbr[]) { 55.63 final int n = mbr[0]; 55.64 55.65 if (!not) { 55.66 @@ -294,10 +302,14 @@ 55.67 // !goto sb_end2!, remove duplication 55.68 prev = sbOut; 55.69 for (i=0; i<n; i++) { 55.70 - if (prev < mbr[2 * i + 1]) addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1); 55.71 + if (prev < mbr[2 * i + 1]) { 55.72 + addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1); 55.73 + } 55.74 prev = mbr[i * 2 + 2] + 1; 55.75 } 55.76 - if (prev < 0x7fffffff/*!!!*/) addCodeRangeToBuf(prev, 0x7fffffff); 55.77 + if (prev < 0x7fffffff/*!!!*/) { 55.78 + addCodeRangeToBuf(prev, 0x7fffffff); 55.79 + } 55.80 return; 55.81 } 55.82 bs.set(j); 55.83 @@ -312,22 +324,27 @@ 55.84 // !sb_end2:! 55.85 prev = sbOut; 55.86 for (int i=0; i<n; i++) { 55.87 - if (prev < mbr[2 * i + 1]) addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1); 55.88 + if (prev < mbr[2 * i + 1]) { 55.89 + addCodeRangeToBuf(prev, mbr[i * 2 + 1] - 1); 55.90 + } 55.91 prev = mbr[i * 2 + 2] + 1; 55.92 } 55.93 - if (prev < 0x7fffffff/*!!!*/) addCodeRangeToBuf(prev, 0x7fffffff); 55.94 + if (prev < 0x7fffffff/*!!!*/) { 55.95 + addCodeRangeToBuf(prev, 0x7fffffff); 55.96 + } 55.97 } 55.98 } 55.99 55.100 - public void addCType(int ctype, final boolean not, final ScanEnvironment env, final IntHolder sbOut) { 55.101 + public void addCType(final int ctp, final boolean not, final ScanEnvironment env, final IntHolder sbOut) { 55.102 + int ct = ctp; 55.103 if (Config.NON_UNICODE_SDW) { 55.104 - switch(ctype) { 55.105 + switch (ct) { 55.106 case CharacterType.D: 55.107 case CharacterType.S: 55.108 case CharacterType.W: 55.109 - ctype ^= CharacterType.SPECIAL_MASK; 55.110 + ct ^= CharacterType.SPECIAL_MASK; 55.111 55.112 - if (env.syntax == Syntax.JAVASCRIPT && ctype == CharacterType.SPACE) { 55.113 + if (env.syntax == Syntax.JAVASCRIPT && ct == CharacterType.SPACE) { 55.114 // \s in JavaScript includes unicode characters. 55.115 break; 55.116 } 55.117 @@ -335,26 +352,32 @@ 55.118 if (not) { 55.119 for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) { 55.120 // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c); 55.121 - if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c); 55.122 + if ((AsciiCtypeTable[c] & (1 << ct)) == 0) { 55.123 + bs.set(c); 55.124 + } 55.125 } 55.126 addAllMultiByteRange(); 55.127 } else { 55.128 for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) { 55.129 // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c); 55.130 - if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c); 55.131 + if ((AsciiCtypeTable[c] & (1 << ct)) != 0) { 55.132 + bs.set(c); 55.133 + } 55.134 } 55.135 } 55.136 return; 55.137 + default: 55.138 + break; 55.139 } 55.140 } 55.141 55.142 - final int[] ranges = EncodingHelper.ctypeCodeRange(ctype, sbOut); 55.143 + final int[] ranges = EncodingHelper.ctypeCodeRange(ct, sbOut); 55.144 if (ranges != null) { 55.145 - addCTypeByRange(ctype, not, sbOut.value, ranges); 55.146 + addCTypeByRange(ct, not, sbOut.value, ranges); 55.147 return; 55.148 } 55.149 55.150 - switch(ctype) { 55.151 + switch(ct) { 55.152 case CharacterType.ALPHA: 55.153 case CharacterType.BLANK: 55.154 case CharacterType.CNTRL: 55.155 @@ -368,12 +391,16 @@ 55.156 case CharacterType.ALNUM: 55.157 if (not) { 55.158 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.159 - if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c); 55.160 + if (!EncodingHelper.isCodeCType(c, ct)) { 55.161 + bs.set(c); 55.162 + } 55.163 } 55.164 addAllMultiByteRange(); 55.165 } else { 55.166 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.167 - if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c); 55.168 + if (EncodingHelper.isCodeCType(c, ct)) { 55.169 + bs.set(c); 55.170 + } 55.171 } 55.172 } 55.173 break; 55.174 @@ -382,11 +409,15 @@ 55.175 case CharacterType.PRINT: 55.176 if (not) { 55.177 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.178 - if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c); 55.179 + if (!EncodingHelper.isCodeCType(c, ct)) { 55.180 + bs.set(c); 55.181 + } 55.182 } 55.183 } else { 55.184 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.185 - if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c); 55.186 + if (EncodingHelper.isCodeCType(c, ct)) { 55.187 + bs.set(c); 55.188 + } 55.189 } 55.190 addAllMultiByteRange(); 55.191 } 55.192 @@ -395,13 +426,17 @@ 55.193 case CharacterType.WORD: 55.194 if (!not) { 55.195 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.196 - if (EncodingHelper.isWord(c)) bs.set(c); 55.197 + if (EncodingHelper.isWord(c)) { 55.198 + bs.set(c); 55.199 + } 55.200 } 55.201 55.202 addAllMultiByteRange(); 55.203 } else { 55.204 for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) { 55.205 - if (!EncodingHelper.isWord(c)) bs.set(c); 55.206 + if (!EncodingHelper.isWord(c)) { 55.207 + bs.set(c); 55.208 + } 55.209 } 55.210 } 55.211 break; 55.212 @@ -422,7 +457,9 @@ 55.213 } 55.214 55.215 public void nextStateClass(final CCStateArg arg, final ScanEnvironment env) { 55.216 - if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE); 55.217 + if (arg.state == CCSTATE.RANGE) { 55.218 + throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE); 55.219 + } 55.220 55.221 if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) { 55.222 if (arg.type == CCVALTYPE.SB) { 55.223 @@ -440,7 +477,9 @@ 55.224 switch(arg.state) { 55.225 case VALUE: 55.226 if (arg.type == CCVALTYPE.SB) { 55.227 - if (arg.vs > 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); 55.228 + if (arg.vs > 0xff) { 55.229 + throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); 55.230 + } 55.231 bs.set(arg.vs); 55.232 } else if (arg.type == CCVALTYPE.CODE_POINT) { 55.233 addCodeRange(env, arg.vs, arg.vs); 55.234 @@ -450,16 +489,17 @@ 55.235 case RANGE: 55.236 if (arg.inType == arg.type) { 55.237 if (arg.inType == CCVALTYPE.SB) { 55.238 - if (arg.vs > 0xff || arg.v > 0xff) throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); 55.239 + if (arg.vs > 0xff || arg.v > 0xff) { 55.240 + throw new ValueException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); 55.241 + } 55.242 55.243 if (arg.vs > arg.v) { 55.244 if (env.syntax.allowEmptyRangeInCC()) { 55.245 // goto ccs_range_end 55.246 arg.state = CCSTATE.COMPLETE; 55.247 break; 55.248 - } else { 55.249 - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 55.250 } 55.251 + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 55.252 } 55.253 bs.setRange(arg.vs, arg.v); 55.254 } else { 55.255 @@ -471,9 +511,8 @@ 55.256 // goto ccs_range_end 55.257 arg.state = CCSTATE.COMPLETE; 55.258 break; 55.259 - } else { 55.260 - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 55.261 } 55.262 + throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); 55.263 } 55.264 bs.setRange(arg.vs, arg.v < 0xff ? arg.v : 0xff); 55.265 addCodeRange(env, arg.vs, arg.v); 55.266 @@ -509,9 +548,8 @@ 55.267 55.268 if (isNot()) { 55.269 return !found; 55.270 - } else { 55.271 - return found; 55.272 } 55.273 + return found; 55.274 } 55.275 55.276 // onig_is_code_in_cc
56.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Mon Nov 03 07:29:46 2014 +0100 56.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Mon Nov 03 11:47:41 2014 +0100 56.3 @@ -24,6 +24,7 @@ 56.4 import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; 56.5 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException; 56.6 56.7 +@SuppressWarnings("javadoc") 56.8 public final class ConsAltNode extends Node { 56.9 public Node car; 56.10 public ConsAltNode cdr; 56.11 @@ -31,9 +32,13 @@ 56.12 56.13 private ConsAltNode(final Node car, final ConsAltNode cdr, final int type) { 56.14 this.car = car; 56.15 - if (car != null) car.parent = this; 56.16 + if (car != null) { 56.17 + car.parent = this; 56.18 + } 56.19 this.cdr = cdr; 56.20 - if (cdr != null) cdr.parent = this; 56.21 + if (cdr != null) { 56.22 + cdr.parent = this; 56.23 + } 56.24 56.25 this.type = type; 56.26 } 56.27 @@ -46,8 +51,9 @@ 56.28 return new ConsAltNode(left, right, LIST); 56.29 } 56.30 56.31 - public static ConsAltNode listAdd(ConsAltNode list, final Node x) { 56.32 + public static ConsAltNode listAdd(final ConsAltNode listp, final Node x) { 56.33 final ConsAltNode n = newListNode(x, null); 56.34 + ConsAltNode list = listp; 56.35 56.36 if (list != null) { 56.37 while (list.cdr != null) {
57.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Mon Nov 03 07:29:46 2014 +0100 57.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Mon Nov 03 11:47:41 2014 +0100 57.3 @@ -22,6 +22,7 @@ 57.4 import jdk.nashorn.internal.runtime.regexp.joni.Option; 57.5 import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType; 57.6 57.7 +@SuppressWarnings("javadoc") 57.8 public final class EncloseNode extends StateNode implements EncloseType { 57.9 57.10 public final int type; // enclose type
58.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Mon Nov 03 07:29:46 2014 +0100 58.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Mon Nov 03 11:47:41 2014 +0100 58.3 @@ -24,6 +24,7 @@ 58.4 import jdk.nashorn.internal.runtime.regexp.joni.WarnCallback; 58.5 import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType; 58.6 58.7 +@SuppressWarnings("javadoc") 58.8 public abstract class Node implements NodeType { 58.9 public Node parent; 58.10 58.11 @@ -33,8 +34,12 @@ 58.12 return 1 << getType(); 58.13 } 58.14 58.15 - protected void setChild(final Node tgt){} // default definition 58.16 - protected Node getChild(){return null;} // default definition 58.17 + protected void setChild(final Node tgt) { 58.18 + //empty, default definition 58.19 + } 58.20 + protected Node getChild() { 58.21 + return null; // default definition 58.22 + } 58.23 58.24 public void swap(final Node with) { 58.25 Node tmp; 58.26 @@ -46,9 +51,13 @@ 58.27 //setChild(with.getChild()); 58.28 //with.setChild(tmp); 58.29 58.30 - if (parent != null) parent.setChild(with); 58.31 + if (parent != null) { 58.32 + parent.setChild(with); 58.33 + } 58.34 58.35 - if (with.parent != null) with.parent.setChild(this); 58.36 + if (with.parent != null) { 58.37 + with.parent.setChild(this); 58.38 + } 58.39 58.40 tmp = parent; 58.41 parent = with.parent; 58.42 @@ -81,16 +90,22 @@ 58.43 } 58.44 58.45 protected static String pad(final Object value, final int level) { 58.46 - if (value == null) return "NULL"; 58.47 + if (value == null) { 58.48 + return "NULL"; 58.49 + } 58.50 58.51 final StringBuilder pad = new StringBuilder(" "); 58.52 - for (int i=0; i<level; i++) pad.append(pad); 58.53 + for (int i=0; i<level; i++) { 58.54 + pad.append(pad); 58.55 + } 58.56 58.57 return value.toString().replace("\n", "\n" + pad); 58.58 } 58.59 58.60 public final boolean isInvalidQuantifier() { 58.61 - if (!Config.VANILLA) return false; 58.62 + if (!Config.VANILLA) { 58.63 + return false; 58.64 + } 58.65 58.66 ConsAltNode node; 58.67 58.68 @@ -107,14 +122,18 @@ 58.69 case LIST: 58.70 node = (ConsAltNode)this; 58.71 do { 58.72 - if (!node.car.isInvalidQuantifier()) return false; 58.73 + if (!node.car.isInvalidQuantifier()) { 58.74 + return false; 58.75 + } 58.76 } while ((node = node.cdr) != null); 58.77 return false; 58.78 58.79 case ALT: 58.80 node = (ConsAltNode)this; 58.81 do { 58.82 - if (node.car.isInvalidQuantifier()) return true; 58.83 + if (node.car.isInvalidQuantifier()) { 58.84 + return true; 58.85 + } 58.86 } while ((node = node.cdr) != null); 58.87 break; 58.88
59.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java Mon Nov 03 07:29:46 2014 +0100 59.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java Mon Nov 03 11:47:41 2014 +0100 59.3 @@ -26,11 +26,11 @@ 59.4 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.PQ_Q; 59.5 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.P_QQ; 59.6 import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.QQ; 59.7 - 59.8 import jdk.nashorn.internal.runtime.regexp.joni.Config; 59.9 import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment; 59.10 import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo; 59.11 59.12 +@SuppressWarnings("javadoc") 59.13 public final class QuantifierNode extends StateNode { 59.14 59.15 public Node target; 59.16 @@ -78,7 +78,9 @@ 59.17 greedy = true; 59.18 targetEmptyInfo = TargetInfo.ISNOT_EMPTY; 59.19 59.20 - if (byNumber) setByNumber(); 59.21 + if (byNumber) { 59.22 + setByNumber(); 59.23 + } 59.24 } 59.25 59.26 @Override 59.27 @@ -136,17 +138,27 @@ 59.28 protected int popularNum() { 59.29 if (greedy) { 59.30 if (lower == 0) { 59.31 - if (upper == 1) return 0; 59.32 - else if (isRepeatInfinite(upper)) return 1; 59.33 + if (upper == 1) { 59.34 + return 0; 59.35 + } else if (isRepeatInfinite(upper)) { 59.36 + return 1; 59.37 + } 59.38 } else if (lower == 1) { 59.39 - if (isRepeatInfinite(upper)) return 2; 59.40 + if (isRepeatInfinite(upper)) { 59.41 + return 2; 59.42 + } 59.43 } 59.44 } else { 59.45 if (lower == 0) { 59.46 - if (upper == 1) return 3; 59.47 - else if (isRepeatInfinite(upper)) return 4; 59.48 + if (upper == 1) { 59.49 + return 3; 59.50 + } else if (isRepeatInfinite(upper)) { 59.51 + return 4; 59.52 + } 59.53 } else if (lower == 1) { 59.54 - if (isRepeatInfinite(upper)) return 5; 59.55 + if (isRepeatInfinite(upper)) { 59.56 + return 5; 59.57 + } 59.58 } 59.59 } 59.60 return -1; 59.61 @@ -171,7 +183,9 @@ 59.62 final int pnum = popularNum(); 59.63 final int cnum = other.popularNum(); 59.64 59.65 - if (pnum < 0 || cnum < 0) return; 59.66 + if (pnum < 0 || cnum < 0) { 59.67 + return; 59.68 + } 59.69 59.70 switch(REDUCE_TABLE[cnum][pnum]) { 59.71 case DEL: 59.72 @@ -224,6 +238,9 @@ 59.73 case ASIS: 59.74 setTarget(other); 59.75 return; 59.76 + 59.77 + default: 59.78 + break; 59.79 } 59.80 // ??? remove the parent from target ??? 59.81 other.target = null; // remove target from reduced quantifier 59.82 @@ -231,7 +248,9 @@ 59.83 59.84 @SuppressWarnings("fallthrough") 59.85 public int setQuantifier(final Node tgt, final boolean group, final ScanEnvironment env, final char[] chars, final int p, final int end) { 59.86 - if (lower == 1 && upper == 1) return 1; 59.87 + if (lower == 1 && upper == 1) { 59.88 + return 1; 59.89 + } 59.90 59.91 switch(tgt.getType()) { 59.92
60.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java Mon Nov 03 07:29:46 2014 +0100 60.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java Mon Nov 03 11:47:41 2014 +0100 60.3 @@ -21,6 +21,7 @@ 60.4 60.5 import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeStatus; 60.6 60.7 +@SuppressWarnings("javadoc") 60.8 public abstract class StateNode extends Node implements NodeStatus { 60.9 protected int state; 60.10
61.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java Mon Nov 03 07:29:46 2014 +0100 61.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java Mon Nov 03 11:47:41 2014 +0100 61.3 @@ -22,6 +22,7 @@ 61.4 import jdk.nashorn.internal.runtime.regexp.joni.EncodingHelper; 61.5 import jdk.nashorn.internal.runtime.regexp.joni.constants.StringType; 61.6 61.7 +@SuppressWarnings("javadoc") 61.8 public final class StringNode extends Node implements StringType { 61.9 61.10 private static final int NODE_STR_MARGIN = 16;
62.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java Mon Nov 03 07:29:46 2014 +0100 62.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java Mon Nov 03 11:47:41 2014 +0100 62.3 @@ -19,6 +19,7 @@ 62.4 */ 62.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 62.6 62.7 +@SuppressWarnings("javadoc") 62.8 public interface AnchorType { 62.9 final int BEGIN_BUF = (1<<0); 62.10 final int BEGIN_LINE = (1<<1);
63.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java Mon Nov 03 07:29:46 2014 +0100 63.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java Mon Nov 03 11:47:41 2014 +0100 63.3 @@ -19,6 +19,7 @@ 63.4 */ 63.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 63.6 63.7 +@SuppressWarnings("javadoc") 63.8 public interface Arguments { 63.9 final int SPECIAL = -1; 63.10 final int NON = 0;
64.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java Mon Nov 03 07:29:46 2014 +0100 64.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java Mon Nov 03 11:47:41 2014 +0100 64.3 @@ -19,6 +19,7 @@ 64.4 */ 64.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 64.6 64.7 +@SuppressWarnings("javadoc") 64.8 public interface AsmConstants { 64.9 final int THIS = 0; 64.10
65.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java Mon Nov 03 07:29:46 2014 +0100 65.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java Mon Nov 03 11:47:41 2014 +0100 65.3 @@ -19,6 +19,7 @@ 65.4 */ 65.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 65.6 65.7 +@SuppressWarnings("javadoc") 65.8 public enum CCSTATE { 65.9 VALUE, 65.10 RANGE,
66.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java Mon Nov 03 07:29:46 2014 +0100 66.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java Mon Nov 03 11:47:41 2014 +0100 66.3 @@ -19,6 +19,7 @@ 66.4 */ 66.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 66.6 66.7 +@SuppressWarnings("javadoc") 66.8 public enum CCVALTYPE { 66.9 SB, 66.10 CODE_POINT,
67.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java Mon Nov 03 07:29:46 2014 +0100 67.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java Mon Nov 03 11:47:41 2014 +0100 67.3 @@ -19,6 +19,7 @@ 67.4 */ 67.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 67.6 67.7 +@SuppressWarnings("javadoc") 67.8 public interface EncloseType { 67.9 final int MEMORY = 1<<0; 67.10 final int OPTION = 1<<1;
68.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java Mon Nov 03 07:29:46 2014 +0100 68.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java Mon Nov 03 11:47:41 2014 +0100 68.3 @@ -19,6 +19,7 @@ 68.4 */ 68.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 68.6 68.7 +@SuppressWarnings("javadoc") 68.8 public interface MetaChar { 68.9 final int ESCAPE = 0; 68.10 final int ANYCHAR = 1;
69.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java Mon Nov 03 07:29:46 2014 +0100 69.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java Mon Nov 03 11:47:41 2014 +0100 69.3 @@ -19,6 +19,7 @@ 69.4 */ 69.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 69.6 69.7 +@SuppressWarnings("javadoc") 69.8 public interface NodeStatus { 69.9 /* status bits */ 69.10 final int NST_MIN_FIXED = (1<<0);
70.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java Mon Nov 03 07:29:46 2014 +0100 70.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java Mon Nov 03 11:47:41 2014 +0100 70.3 @@ -19,6 +19,7 @@ 70.4 */ 70.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 70.6 70.7 +@SuppressWarnings("javadoc") 70.8 public interface NodeType { 70.9 /* node type */ 70.10 final int STR = 0;
71.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java Mon Nov 03 07:29:46 2014 +0100 71.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java Mon Nov 03 11:47:41 2014 +0100 71.3 @@ -19,6 +19,7 @@ 71.4 */ 71.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 71.6 71.7 +@SuppressWarnings("javadoc") 71.8 public interface OPCode { 71.9 final int FINISH = 0; /* matching process terminator (no more alternative) */ 71.10 final int END = 1; /* pattern code terminator (success end) */
72.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java Mon Nov 03 07:29:46 2014 +0100 72.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java Mon Nov 03 11:47:41 2014 +0100 72.3 @@ -19,6 +19,7 @@ 72.4 */ 72.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 72.6 72.7 +@SuppressWarnings("javadoc") 72.8 public interface OPSize { 72.9 72.10 // this might be helpful for potential byte[] migration
73.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java Mon Nov 03 07:29:46 2014 +0100 73.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java Mon Nov 03 11:47:41 2014 +0100 73.3 @@ -20,6 +20,7 @@ 73.4 package jdk.nashorn.internal.runtime.regexp.joni.constants; 73.5 73.6 // we dont need this ATM 73.7 +@SuppressWarnings("javadoc") 73.8 public interface RegexState { 73.9 final int NORMAL = 0; 73.10 final int SEARCHING = 1;
74.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java Mon Nov 03 07:29:46 2014 +0100 74.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java Mon Nov 03 11:47:41 2014 +0100 74.3 @@ -19,6 +19,7 @@ 74.4 */ 74.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 74.6 74.7 +@SuppressWarnings("javadoc") 74.8 public interface StackPopLevel { 74.9 final int FREE = 0; 74.10 final int MEM_START = 1;
75.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java Mon Nov 03 07:29:46 2014 +0100 75.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java Mon Nov 03 11:47:41 2014 +0100 75.3 @@ -19,6 +19,7 @@ 75.4 */ 75.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 75.6 75.7 +@SuppressWarnings("javadoc") 75.8 public interface StackType { 75.9 /** stack **/ 75.10 final int INVALID_STACK_INDEX = -1;
76.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java Mon Nov 03 07:29:46 2014 +0100 76.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java Mon Nov 03 11:47:41 2014 +0100 76.3 @@ -19,6 +19,7 @@ 76.4 */ 76.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 76.6 76.7 +@SuppressWarnings("javadoc") 76.8 public interface StringType { 76.9 final int NSTR_RAW = 1<<0; 76.10 final int NSTR_AMBIG = 1<<1;
77.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java Mon Nov 03 07:29:46 2014 +0100 77.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java Mon Nov 03 11:47:41 2014 +0100 77.3 @@ -19,6 +19,7 @@ 77.4 */ 77.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 77.6 77.7 +@SuppressWarnings("javadoc") 77.8 public interface SyntaxProperties { 77.9 /* syntax (operators); */ 77.10 final int OP_VARIABLE_META_CHARACTERS = (1<<0);
78.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java Mon Nov 03 07:29:46 2014 +0100 78.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java Mon Nov 03 11:47:41 2014 +0100 78.3 @@ -19,6 +19,7 @@ 78.4 */ 78.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 78.6 78.7 +@SuppressWarnings("javadoc") 78.8 public interface TargetInfo { 78.9 final int ISNOT_EMPTY = 0; 78.10 final int IS_EMPTY = 1;
79.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java Mon Nov 03 07:29:46 2014 +0100 79.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java Mon Nov 03 11:47:41 2014 +0100 79.3 @@ -19,6 +19,7 @@ 79.4 */ 79.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 79.6 79.7 +@SuppressWarnings("javadoc") 79.8 public enum TokenType { 79.9 EOT, /* end of token */ 79.10 RAW_BYTE,
80.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java Mon Nov 03 07:29:46 2014 +0100 80.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java Mon Nov 03 11:47:41 2014 +0100 80.3 @@ -19,6 +19,7 @@ 80.4 */ 80.5 package jdk.nashorn.internal.runtime.regexp.joni.constants; 80.6 80.7 +@SuppressWarnings("javadoc") 80.8 public interface Traverse { 80.9 final int TRAVERSE_CALLBACK_AT_FIRST = 1; 80.10 final int TRAVERSE_CALLBACK_AT_LAST = 2;
81.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java Mon Nov 03 07:29:46 2014 +0100 81.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java Mon Nov 03 11:47:41 2014 +0100 81.3 @@ -19,6 +19,7 @@ 81.4 */ 81.5 package jdk.nashorn.internal.runtime.regexp.joni.encoding; 81.6 81.7 +@SuppressWarnings("javadoc") 81.8 public interface CharacterType { 81.9 81.10 final int NEWLINE = 0;
82.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java Mon Nov 03 07:29:46 2014 +0100 82.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java Mon Nov 03 11:47:41 2014 +0100 82.3 @@ -19,6 +19,7 @@ 82.4 */ 82.5 package jdk.nashorn.internal.runtime.regexp.joni.encoding; 82.6 82.7 +@SuppressWarnings("javadoc") 82.8 public class IntHolder { 82.9 public int value; 82.10 }
83.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java Mon Nov 03 07:29:46 2014 +0100 83.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java Mon Nov 03 11:47:41 2014 +0100 83.3 @@ -19,6 +19,7 @@ 83.4 */ 83.5 package jdk.nashorn.internal.runtime.regexp.joni.encoding; 83.6 83.7 +@SuppressWarnings("javadoc") 83.8 public final class ObjPtr<T> { 83.9 public ObjPtr() { 83.10 this(null);
84.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Mon Nov 03 07:29:46 2014 +0100 84.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Mon Nov 03 11:47:41 2014 +0100 84.3 @@ -19,6 +19,7 @@ 84.4 */ 84.5 package jdk.nashorn.internal.runtime.regexp.joni.exception; 84.6 84.7 +@SuppressWarnings("javadoc") 84.8 public interface ErrorMessages { 84.9 84.10 /* from jcodings */
85.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java Mon Nov 03 07:29:46 2014 +0100 85.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java Mon Nov 03 11:47:41 2014 +0100 85.3 @@ -19,6 +19,7 @@ 85.4 */ 85.5 package jdk.nashorn.internal.runtime.regexp.joni.exception; 85.6 85.7 +@SuppressWarnings("javadoc") 85.8 public class InternalException extends JOniException{ 85.9 private static final long serialVersionUID = -3871816465397927992L; 85.10
86.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java Mon Nov 03 07:29:46 2014 +0100 86.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java Mon Nov 03 11:47:41 2014 +0100 86.3 @@ -19,6 +19,7 @@ 86.4 */ 86.5 package jdk.nashorn.internal.runtime.regexp.joni.exception; 86.6 86.7 +@SuppressWarnings("javadoc") 86.8 public class JOniException extends RuntimeException{ 86.9 private static final long serialVersionUID = -6027192180014164667L; 86.10
87.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java Mon Nov 03 07:29:46 2014 +0100 87.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java Mon Nov 03 11:47:41 2014 +0100 87.3 @@ -19,6 +19,7 @@ 87.4 */ 87.5 package jdk.nashorn.internal.runtime.regexp.joni.exception; 87.6 87.7 +@SuppressWarnings("javadoc") 87.8 public class SyntaxException extends JOniException{ 87.9 private static final long serialVersionUID = 7862720128961874288L; 87.10
88.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java Mon Nov 03 07:29:46 2014 +0100 88.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java Mon Nov 03 11:47:41 2014 +0100 88.3 @@ -19,7 +19,8 @@ 88.4 */ 88.5 package jdk.nashorn.internal.runtime.regexp.joni.exception; 88.6 88.7 -public class ValueException extends SyntaxException{ 88.8 +@SuppressWarnings("javadoc") 88.9 +public class ValueException extends SyntaxException { 88.10 private static final long serialVersionUID = -196013852479929134L; 88.11 88.12 public ValueException(final String message) {
89.1 --- a/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java Mon Nov 03 07:29:46 2014 +0100 89.2 +++ b/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java Mon Nov 03 11:47:41 2014 +0100 89.3 @@ -29,7 +29,6 @@ 89.4 import static org.testng.AssertJUnit.assertFalse; 89.5 import static org.testng.AssertJUnit.assertNull; 89.6 import static org.testng.AssertJUnit.assertTrue; 89.7 - 89.8 import java.util.Arrays; 89.9 import java.util.List; 89.10 import javax.script.ScriptContext; 89.11 @@ -41,6 +40,7 @@ 89.12 import org.testng.annotations.BeforeClass; 89.13 import org.testng.annotations.Test; 89.14 89.15 +@SuppressWarnings("javadoc") 89.16 public class ArrayConversionTest { 89.17 private static ScriptEngine e = null; 89.18 89.19 @@ -49,7 +49,7 @@ 89.20 } 89.21 89.22 @BeforeClass 89.23 - public static void setUpClass() throws ScriptException { 89.24 + public static void setUpClass() { 89.25 e = new ScriptEngineManager().getEngineByName("nashorn"); 89.26 } 89.27 89.28 @@ -205,7 +205,7 @@ 89.29 assertEquals(Arrays.asList("apple", "orange"), array[1]); 89.30 } 89.31 89.32 - public static void assertVarArg_42_17(final Object... args) throws ScriptException { 89.33 + public static void assertVarArg_42_17(final Object... args) { 89.34 assertEquals(2, args.length); 89.35 assertEquals(42, ((Number)args[0]).intValue()); 89.36 assertEquals(17, ((Number)args[1]).intValue());
90.1 --- a/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java Mon Nov 03 07:29:46 2014 +0100 90.2 +++ b/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java Mon Nov 03 11:47:41 2014 +0100 90.3 @@ -27,7 +27,6 @@ 90.4 90.5 import static org.testng.AssertJUnit.assertEquals; 90.6 import static org.testng.AssertJUnit.assertTrue; 90.7 - 90.8 import java.util.Arrays; 90.9 import javax.script.ScriptEngine; 90.10 import javax.script.ScriptEngineManager; 90.11 @@ -42,6 +41,7 @@ 90.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest 90.13 * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest 90.14 */ 90.15 +@SuppressWarnings("javadoc") 90.16 public class BooleanAccessTest { 90.17 90.18 private static ScriptEngine e = null;
91.1 --- a/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java Mon Nov 03 07:29:46 2014 +0100 91.2 +++ b/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java Mon Nov 03 11:47:41 2014 +0100 91.3 @@ -26,7 +26,6 @@ 91.4 package jdk.nashorn.api.javaaccess; 91.5 91.6 import static org.testng.AssertJUnit.assertEquals; 91.7 - 91.8 import java.util.HashMap; 91.9 import java.util.Map; 91.10 import javax.script.Bindings; 91.11 @@ -40,6 +39,7 @@ 91.12 import org.testng.annotations.BeforeClass; 91.13 import org.testng.annotations.Test; 91.14 91.15 +@SuppressWarnings("javadoc") 91.16 public class ConsStringTest { 91.17 private static ScriptEngine e = null; 91.18 91.19 @@ -48,7 +48,7 @@ 91.20 } 91.21 91.22 @BeforeClass 91.23 - public static void setUpClass() throws ScriptException { 91.24 + public static void setUpClass() { 91.25 e = new ScriptEngineManager().getEngineByName("nashorn"); 91.26 } 91.27 91.28 @@ -69,7 +69,7 @@ 91.29 @Test 91.30 public void testConsStringFromMirror() throws ScriptException { 91.31 final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE); 91.32 - final Map<Object, Object> m = new HashMap<>(); 91.33 + //final Map<Object, Object> m = new HashMap<>(); 91.34 e.eval("var x = 'f'; x += 'oo'; var obj = {x: x};"); 91.35 assertEquals("foo", ((JSObject)b.get("obj")).getMember("x")); 91.36 }
92.1 --- a/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java Mon Nov 03 07:29:46 2014 +0100 92.2 +++ b/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java Mon Nov 03 11:47:41 2014 +0100 92.3 @@ -28,7 +28,6 @@ 92.4 import static org.testng.AssertJUnit.assertEquals; 92.5 import static org.testng.AssertJUnit.assertTrue; 92.6 import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; 92.7 - 92.8 import java.util.Arrays; 92.9 import java.util.Calendar; 92.10 import java.util.Locale; 92.11 @@ -45,6 +44,7 @@ 92.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest 92.13 * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest 92.14 */ 92.15 +@SuppressWarnings("javadoc") 92.16 public class MethodAccessTest { 92.17 92.18 private static ScriptEngine e = null;
93.1 --- a/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java Mon Nov 03 07:29:46 2014 +0100 93.2 +++ b/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java Mon Nov 03 11:47:41 2014 +0100 93.3 @@ -28,7 +28,6 @@ 93.4 import static org.testng.AssertJUnit.assertEquals; 93.5 import static org.testng.AssertJUnit.assertTrue; 93.6 import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; 93.7 - 93.8 import javax.script.ScriptEngine; 93.9 import javax.script.ScriptEngineManager; 93.10 import javax.script.ScriptException; 93.11 @@ -42,6 +41,7 @@ 93.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest 93.13 * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest 93.14 */ 93.15 +@SuppressWarnings("javadoc") 93.16 public class NumberAccessTest { 93.17 93.18 private static ScriptEngine e;
94.1 --- a/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java Mon Nov 03 07:29:46 2014 +0100 94.2 +++ b/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java Mon Nov 03 11:47:41 2014 +0100 94.3 @@ -27,7 +27,6 @@ 94.4 94.5 import static org.testng.AssertJUnit.assertEquals; 94.6 import static org.testng.AssertJUnit.assertTrue; 94.7 - 94.8 import javax.script.ScriptEngine; 94.9 import javax.script.ScriptEngineManager; 94.10 import javax.script.ScriptException; 94.11 @@ -41,6 +40,7 @@ 94.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest 94.13 * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest 94.14 */ 94.15 +@SuppressWarnings("javadoc") 94.16 public class NumberBoxingTest { 94.17 94.18 private static ScriptEngine e;
95.1 --- a/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java Mon Nov 03 07:29:46 2014 +0100 95.2 +++ b/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java Mon Nov 03 11:47:41 2014 +0100 95.3 @@ -27,7 +27,6 @@ 95.4 95.5 import static org.testng.AssertJUnit.assertEquals; 95.6 import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; 95.7 - 95.8 import javax.script.ScriptEngine; 95.9 import javax.script.ScriptEngineManager; 95.10 import javax.script.ScriptException; 95.11 @@ -41,6 +40,7 @@ 95.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest 95.13 * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest 95.14 */ 95.15 +@SuppressWarnings("javadoc") 95.16 public class ObjectAccessTest { 95.17 95.18 private static ScriptEngine e = null;
96.1 --- a/test/src/jdk/nashorn/api/javaaccess/Person.java Mon Nov 03 07:29:46 2014 +0100 96.2 +++ b/test/src/jdk/nashorn/api/javaaccess/Person.java Mon Nov 03 11:47:41 2014 +0100 96.3 @@ -25,6 +25,7 @@ 96.4 96.5 package jdk.nashorn.api.javaaccess; 96.6 96.7 +@SuppressWarnings("javadoc") 96.8 public class Person { 96.9 96.10 public int id = 0;
97.1 --- a/test/src/jdk/nashorn/api/javaaccess/SharedObject.java Mon Nov 03 07:29:46 2014 +0100 97.2 +++ b/test/src/jdk/nashorn/api/javaaccess/SharedObject.java Mon Nov 03 11:47:41 2014 +0100 97.3 @@ -29,6 +29,7 @@ 97.4 import javax.script.ScriptEngine; 97.5 import javax.script.ScriptException; 97.6 97.7 +@SuppressWarnings("javadoc") 97.8 public class SharedObject { 97.9 97.10 // Public fields
98.1 --- a/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java Mon Nov 03 07:29:46 2014 +0100 98.2 +++ b/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java Mon Nov 03 11:47:41 2014 +0100 98.3 @@ -27,7 +27,6 @@ 98.4 98.5 import static org.testng.AssertJUnit.assertEquals; 98.6 import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; 98.7 - 98.8 import javax.script.ScriptEngine; 98.9 import javax.script.ScriptEngineManager; 98.10 import javax.script.ScriptException; 98.11 @@ -41,6 +40,7 @@ 98.12 * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest 98.13 * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest 98.14 */ 98.15 +@SuppressWarnings("javadoc") 98.16 public class StringAccessTest { 98.17 98.18 private static ScriptEngine e = null;
99.1 --- a/test/src/jdk/nashorn/api/scripting/InvocableTest.java Mon Nov 03 07:29:46 2014 +0100 99.2 +++ b/test/src/jdk/nashorn/api/scripting/InvocableTest.java Mon Nov 03 11:47:41 2014 +0100 99.3 @@ -27,7 +27,6 @@ 99.4 99.5 import static org.testng.Assert.assertEquals; 99.6 import static org.testng.Assert.fail; 99.7 - 99.8 import java.util.Objects; 99.9 import java.util.function.Function; 99.10 import javax.script.Invocable; 99.11 @@ -42,9 +41,10 @@ 99.12 /** 99.13 * Tests for javax.script.Invocable implementation of nashorn. 99.14 */ 99.15 +@SuppressWarnings("javadoc") 99.16 public class InvocableTest { 99.17 99.18 - private void log(final String msg) { 99.19 + private static void log(final String msg) { 99.20 org.testng.Reporter.log(msg, true); 99.21 } 99.22 99.23 @@ -100,7 +100,7 @@ 99.24 99.25 try { 99.26 final Object obj = e.eval("({})"); 99.27 - final Object res = ((Invocable) e).invokeMethod(obj, null); 99.28 + ((Invocable) e).invokeMethod(obj, null); 99.29 fail("should have thrown NPE"); 99.30 } catch (final Exception exp) { 99.31 if (!(exp instanceof NullPointerException)) { 99.32 @@ -120,7 +120,7 @@ 99.33 99.34 try { 99.35 final Object obj = e.eval("({})"); 99.36 - final Object res = ((Invocable) e).invokeMethod(obj, "nonExistentMethod"); 99.37 + ((Invocable) e).invokeMethod(obj, "nonExistentMethod"); 99.38 fail("should have thrown NoSuchMethodException"); 99.39 } catch (final Exception exp) { 99.40 if (!(exp instanceof NoSuchMethodException)) { 99.41 @@ -398,7 +398,7 @@ 99.42 final ScriptEngine e = m.getEngineByName("nashorn"); 99.43 99.44 try { 99.45 - final Object res = ((Invocable) e).invokeFunction(null); 99.46 + ((Invocable)e).invokeFunction(null); 99.47 fail("should have thrown NPE"); 99.48 } catch (final Exception exp) { 99.49 if (!(exp instanceof NullPointerException)) { 99.50 @@ -418,7 +418,7 @@ 99.51 final ScriptEngine e = m.getEngineByName("nashorn"); 99.52 99.53 try { 99.54 - final Object res = ((Invocable) e).invokeFunction("NonExistentFunc"); 99.55 + ((Invocable)e).invokeFunction("NonExistentFunc"); 99.56 fail("should have thrown NoSuchMethodException"); 99.57 } catch (final Exception exp) { 99.58 if (!(exp instanceof NoSuchMethodException)) { 99.59 @@ -439,7 +439,7 @@ 99.60 99.61 try { 99.62 // define an object with method on it 99.63 - final Object obj = e.eval("function hello() { return 'Hello World!'; }"); 99.64 + e.eval("function hello() { return 'Hello World!'; }"); 99.65 final ScriptContext ctxt = new SimpleScriptContext(); 99.66 ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE); 99.67 // change engine's current context 99.68 @@ -526,13 +526,13 @@ 99.69 } 99.70 99.71 @Test 99.72 - @SuppressWarnings("unchecked") 99.73 public void defaultMethodTest() throws ScriptException { 99.74 final ScriptEngineManager m = new ScriptEngineManager(); 99.75 final ScriptEngine e = m.getEngineByName("nashorn"); 99.76 final Invocable inv = (Invocable) e; 99.77 99.78 final Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})"); 99.79 + @SuppressWarnings("unchecked") 99.80 final Function<String, String> func = inv.getInterface(obj, Function.class); 99.81 assertEquals(func.apply("hello"), "HELLO"); 99.82 }
100.1 --- a/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java Mon Nov 03 07:29:46 2014 +0100 100.2 +++ b/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java Mon Nov 03 11:47:41 2014 +0100 100.3 @@ -37,7 +37,7 @@ 100.4 * @test 100.5 * @run testng jdk.nashorn.api.scripting.MultipleEngineTest 100.6 */ 100.7 - 100.8 +@SuppressWarnings("javadoc") 100.9 public class MultipleEngineTest { 100.10 @Test 100.11 public void createAndUseManyEngine() throws ScriptException {
101.1 --- a/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java Mon Nov 03 07:29:46 2014 +0100 101.2 +++ b/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java Mon Nov 03 11:47:41 2014 +0100 101.3 @@ -44,6 +44,7 @@ 101.4 * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external 101.5 * JSObject implementations. 101.6 */ 101.7 +@SuppressWarnings("javadoc") 101.8 public class PluggableJSObjectTest { 101.9 public static class MapWrapperObject extends AbstractJSObject { 101.10 private final HashMap<String, Object> map = new LinkedHashMap<>(); 101.11 @@ -202,6 +203,7 @@ 101.12 } 101.13 101.14 public static class Factory extends AbstractJSObject { 101.15 + @SuppressWarnings("unused") 101.16 @Override 101.17 public Object newObject(final Object... args) { 101.18 return new HashMap<Object, Object>();
102.1 --- a/test/src/jdk/nashorn/api/scripting/ScopeTest.java Mon Nov 03 07:29:46 2014 +0100 102.2 +++ b/test/src/jdk/nashorn/api/scripting/ScopeTest.java Mon Nov 03 11:47:41 2014 +0100 102.3 @@ -28,7 +28,6 @@ 102.4 import static org.testng.Assert.assertNotNull; 102.5 import static org.testng.Assert.assertTrue; 102.6 import static org.testng.Assert.fail; 102.7 - 102.8 import javax.script.Bindings; 102.9 import javax.script.ScriptContext; 102.10 import javax.script.ScriptEngine; 102.11 @@ -42,6 +41,7 @@ 102.12 /** 102.13 * Tests for jsr223 Bindings "scope" (engine, global scopes) 102.14 */ 102.15 +@SuppressWarnings("javadoc") 102.16 public class ScopeTest { 102.17 102.18 @Test 102.19 @@ -655,6 +655,8 @@ 102.20 102.21 /** 102.22 * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals. 102.23 + * @throws ScriptException 102.24 + * @throws InterruptedException 102.25 */ 102.26 @Test 102.27 public static void testSlowScope() throws ScriptException, InterruptedException {
103.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 07:29:46 2014 +0100 103.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Mon Nov 03 11:47:41 2014 +0100 103.3 @@ -26,12 +26,9 @@ 103.4 package jdk.nashorn.api.scripting; 103.5 103.6 import static org.testng.Assert.fail; 103.7 - 103.8 import java.lang.reflect.InvocationHandler; 103.9 import java.lang.reflect.Method; 103.10 import java.lang.reflect.Proxy; 103.11 -import java.util.Objects; 103.12 -import javax.script.Invocable; 103.13 import javax.script.ScriptEngine; 103.14 import javax.script.ScriptEngineManager; 103.15 import javax.script.ScriptException; 103.16 @@ -40,9 +37,10 @@ 103.17 /** 103.18 * jsr223 tests for security access checks. 103.19 */ 103.20 +@SuppressWarnings("javadoc") 103.21 public class ScriptEngineSecurityTest { 103.22 103.23 - private void log(final String msg) { 103.24 + private static void log(final String msg) { 103.25 org.testng.Reporter.log(msg, true); 103.26 } 103.27 103.28 @@ -169,6 +167,7 @@ 103.29 } 103.30 103.31 // @bug 8032948: Nashorn linkages awry 103.32 + @SuppressWarnings("serial") 103.33 public static class FakeProxy extends Proxy { 103.34 public FakeProxy(final InvocationHandler ih) { 103.35 super(ih); 103.36 @@ -180,7 +179,7 @@ 103.37 } 103.38 103.39 @Test 103.40 - public void fakeProxySubclassAccessCheckTest() throws ScriptException { 103.41 + public void fakeProxySubclassAccessCheckTest() { 103.42 if (System.getSecurityManager() == null) { 103.43 // pass vacuously 103.44 return; 103.45 @@ -197,7 +196,7 @@ 103.46 103.47 // Should not be able to call static methods of Proxy via fake subclass 103.48 try { 103.49 - final Class<?> c = (Class<?>)e.eval(getClass); 103.50 + e.eval(getClass); 103.51 fail("should have thrown SecurityException"); 103.52 } catch (final Exception exp) { 103.53 if (! (exp instanceof SecurityException)) { 103.54 @@ -207,7 +206,7 @@ 103.55 } 103.56 103.57 @Test 103.58 - public void fakeProxySubclassAccessCheckTest2() throws ScriptException { 103.59 + public void fakeProxySubclassAccessCheckTest2() { 103.60 if (System.getSecurityManager() == null) { 103.61 // pass vacuously 103.62 return; 103.63 @@ -224,7 +223,7 @@ 103.64 103.65 // Should not be able to call static methods of Proxy via fake subclass 103.66 try { 103.67 - final Class<?> c = (Class<?>)e.eval(getClass); 103.68 + e.eval(getClass); 103.69 fail("should have thrown SecurityException"); 103.70 } catch (final Exception exp) { 103.71 if (! (exp instanceof SecurityException)) { 103.72 @@ -234,7 +233,7 @@ 103.73 } 103.74 103.75 @Test 103.76 - public static void proxyStaticAccessCheckTest() throws ScriptException { 103.77 + public static void proxyStaticAccessCheckTest() { 103.78 if (System.getSecurityManager() == null) { 103.79 // pass vacuously 103.80 return; 103.81 @@ -247,7 +246,7 @@ 103.82 new Class[] { Runnable.class }, 103.83 new InvocationHandler() { 103.84 @Override 103.85 - public Object invoke(final Object p, final Method m, final Object[] a) { 103.86 + public Object invoke(final Object p, final Method mtd, final Object[] a) { 103.87 return null; 103.88 } 103.89 }); 103.90 @@ -284,7 +283,9 @@ 103.91 } 103.92 }); 103.93 fail("SecurityException should have been thrown"); 103.94 - } catch (final SecurityException exp) {} 103.95 + } catch (final SecurityException e) { 103.96 + //empty 103.97 + } 103.98 } 103.99 103.100 @Test 103.101 @@ -303,6 +304,8 @@ 103.102 } 103.103 }); 103.104 fail("SecurityException should have been thrown"); 103.105 - } catch (final SecurityException exp) {} 103.106 + } catch (final SecurityException e) { 103.107 + //empty 103.108 + } 103.109 } 103.110 }
104.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Nov 03 07:29:46 2014 +0100 104.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Nov 03 11:47:41 2014 +0100 104.3 @@ -29,7 +29,6 @@ 104.4 import static org.testng.Assert.assertNotNull; 104.5 import static org.testng.Assert.assertTrue; 104.6 import static org.testng.Assert.fail; 104.7 - 104.8 import java.io.StringReader; 104.9 import java.io.StringWriter; 104.10 import java.lang.reflect.InvocationHandler; 104.11 @@ -54,9 +53,10 @@ 104.12 * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest 104.13 * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest 104.14 */ 104.15 +@SuppressWarnings("javadoc") 104.16 public class ScriptEngineTest { 104.17 104.18 - private void log(final String msg) { 104.19 + private static void log(final String msg) { 104.20 org.testng.Reporter.log(msg, true); 104.21 } 104.22 104.23 @@ -145,6 +145,8 @@ 104.24 case "nashorn": seenNashorn = true; break; 104.25 case "javascript": seenJavaScript = true; break; 104.26 case "ECMAScript": seenECMAScript = true; break; 104.27 + default: 104.28 + break; 104.29 } 104.30 } 104.31 104.32 @@ -159,6 +161,8 @@ 104.33 case "application/ecmascript": seenAppECMA = true; break; 104.34 case "text/javascript": seenTextJS = true; break; 104.35 case "text/ecmascript": seenTextECMA = true; break; 104.36 + default: 104.37 + break; 104.38 } 104.39 } 104.40 104.41 @@ -548,7 +552,7 @@ 104.42 new Class[] { Runnable.class }, 104.43 new InvocationHandler() { 104.44 @Override 104.45 - public Object invoke(final Object p, final Method m, final Object[] a) { 104.46 + public Object invoke(final Object p, final Method mtd, final Object[] a) { 104.47 reached[0] = true; 104.48 return null; 104.49 } 104.50 @@ -633,7 +637,7 @@ 104.51 public static class Context { 104.52 private Object myobj; 104.53 104.54 - public void set(Object o) { 104.55 + public void set(final Object o) { 104.56 myobj = o; 104.57 } 104.58
105.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Mon Nov 03 07:29:46 2014 +0100 105.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Mon Nov 03 11:47:41 2014 +0100 105.3 @@ -46,6 +46,7 @@ 105.4 /** 105.5 * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API. 105.6 */ 105.7 +@SuppressWarnings("javadoc") 105.8 public class ScriptObjectMirrorTest { 105.9 105.10 @SuppressWarnings("unchecked") 105.11 @@ -343,14 +344,13 @@ 105.12 assertEquals(ScriptObjectMirror.class, value3.getClass()); 105.13 assertEquals(ScriptObjectMirror.class, value4.getClass()); 105.14 assertTrue((boolean)invocable.invokeFunction("compare", value1, value1)); 105.15 - assertTrue((boolean)example.compare(value1, value1)); 105.16 + assertTrue(example.compare(value1, value1)); 105.17 assertTrue((boolean)invocable.invokeFunction("compare", value3, value4)); 105.18 - assertTrue((boolean)example.compare(value3, value4)); 105.19 + assertTrue(example.compare(value3, value4)); 105.20 } 105.21 105.22 // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface 105.23 @Test 105.24 - @SuppressWarnings("unchecked") 105.25 public void mirrorUnwrapInterfaceMethod() throws Exception { 105.26 final ScriptEngineManager engineManager = new ScriptEngineManager(); 105.27 final ScriptEngine engine = engineManager.getEngineByName("nashorn"); 105.28 @@ -358,6 +358,7 @@ 105.29 engine.eval("function apply(obj) { " + 105.30 " return obj instanceof Packages.jdk.nashorn.api.scripting.ScriptObjectMirror; " + 105.31 "}"); 105.32 + @SuppressWarnings("unchecked") 105.33 final Function<Object,Object> func = invocable.getInterface(Function.class); 105.34 assertFalse((boolean)func.apply(engine.eval("({ x: 2 })"))); 105.35 }
106.1 --- a/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java Mon Nov 03 07:29:46 2014 +0100 106.2 +++ b/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java Mon Nov 03 11:47:41 2014 +0100 106.3 @@ -25,6 +25,7 @@ 106.4 106.5 package jdk.nashorn.api.scripting; 106.6 106.7 +@SuppressWarnings("javadoc") 106.8 public interface VariableArityTestInterface { 106.9 public String test1(int i, String... strings); 106.10 public String test2(int i, String... strings);
107.1 --- a/test/src/jdk/nashorn/api/scripting/Window.java Mon Nov 03 07:29:46 2014 +0100 107.2 +++ b/test/src/jdk/nashorn/api/scripting/Window.java Mon Nov 03 11:47:41 2014 +0100 107.3 @@ -28,6 +28,7 @@ 107.4 import java.util.Map; 107.5 import javax.script.Bindings; 107.6 107.7 +@SuppressWarnings("javadoc") 107.8 public class Window { 107.9 107.10 private String location = "http://localhost:8080/window";
108.1 --- a/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java Mon Nov 03 07:29:46 2014 +0100 108.2 +++ b/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java Mon Nov 03 11:47:41 2014 +0100 108.3 @@ -25,8 +25,7 @@ 108.4 108.5 package jdk.nashorn.api.scripting; 108.6 108.7 +@SuppressWarnings("javadoc") 108.8 public interface WindowEventHandler { 108.9 - 108.10 public boolean loaded(); 108.11 - 108.12 }
109.1 --- a/test/src/jdk/nashorn/internal/codegen/CompilerTest.java Mon Nov 03 07:29:46 2014 +0100 109.2 +++ b/test/src/jdk/nashorn/internal/codegen/CompilerTest.java Mon Nov 03 11:47:41 2014 +0100 109.3 @@ -27,7 +27,6 @@ 109.4 109.5 import static jdk.nashorn.internal.runtime.Source.readFully; 109.6 import static jdk.nashorn.internal.runtime.Source.sourceFor; 109.7 - 109.8 import java.io.File; 109.9 import java.io.PrintWriter; 109.10 import java.io.StringWriter; 109.11 @@ -45,6 +44,7 @@ 109.12 /** 109.13 * Tests to check Nashorn JS compiler - just compiler and not execution of scripts. 109.14 */ 109.15 +@SuppressWarnings("javadoc") 109.16 public class CompilerTest { 109.17 private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("compilertest.verbose")); 109.18 private static final boolean TEST262 = Boolean.valueOf(System.getProperty("compilertest.test262")); 109.19 @@ -56,7 +56,7 @@ 109.20 public boolean exclude(File file, String content); 109.21 } 109.22 109.23 - private void log(final String msg) { 109.24 + private static void log(final String msg) { 109.25 org.testng.Reporter.log(msg, true); 109.26 } 109.27
110.1 --- a/test/src/jdk/nashorn/internal/parser/ParserTest.java Mon Nov 03 07:29:46 2014 +0100 110.2 +++ b/test/src/jdk/nashorn/internal/parser/ParserTest.java Mon Nov 03 11:47:41 2014 +0100 110.3 @@ -27,7 +27,6 @@ 110.4 110.5 import static jdk.nashorn.internal.runtime.Source.readFully; 110.6 import static jdk.nashorn.internal.runtime.Source.sourceFor; 110.7 - 110.8 import java.io.File; 110.9 import jdk.nashorn.internal.runtime.Context; 110.10 import jdk.nashorn.internal.runtime.ErrorManager; 110.11 @@ -41,6 +40,7 @@ 110.12 /** 110.13 * Run tests to check Nashorn's parser. 110.14 */ 110.15 +@SuppressWarnings("javadoc") 110.16 public class ParserTest { 110.17 private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("parsertest.verbose")); 110.18 private static final boolean TEST262 = Boolean.valueOf(System.getProperty("parsertest.test262"));
111.1 --- a/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java Mon Nov 03 07:29:46 2014 +0100 111.2 +++ b/test/src/jdk/nashorn/internal/performance/AuroraWrapper.java Mon Nov 03 11:47:41 2014 +0100 111.3 @@ -43,6 +43,7 @@ 111.4 import org.w3c.dom.NodeList; 111.5 import org.xml.sax.SAXException; 111.6 111.7 +@SuppressWarnings("javadoc") 111.8 public class AuroraWrapper { 111.9 111.10 public static String fileName = "report.xml";
112.1 --- a/test/src/jdk/nashorn/internal/performance/OctaneTest.java Mon Nov 03 07:29:46 2014 +0100 112.2 +++ b/test/src/jdk/nashorn/internal/performance/OctaneTest.java Mon Nov 03 11:47:41 2014 +0100 112.3 @@ -40,6 +40,7 @@ 112.4 import java.util.List; 112.5 import org.testng.annotations.Test; 112.6 112.7 +@SuppressWarnings("javadoc") 112.8 public class OctaneTest { 112.9 112.10 @Test 112.11 @@ -72,7 +73,7 @@ 112.12 genericTest("GBEMU"); 112.13 } 112.14 112.15 - /* @Test 112.16 +/* @Test 112.17 public void mandreelTest() { 112.18 genericTest("Mandreel"); 112.19 }*/ 112.20 @@ -107,10 +108,20 @@ 112.21 genericTest("Splay"); 112.22 } 112.23 112.24 + @Test 112.25 +/* public void typeScriptTest() { 112.26 + genericTest("TypeScript"); 112.27 + } 112.28 + 112.29 + @Test 112.30 + public void zlibTest() { 112.31 + genericTest("zlib"); 112.32 + }/*/ 112.33 + 112.34 public void genericTest(final String benchmark) { 112.35 try { 112.36 final String mainScript = "test/script/basic/run-octane.js"; 112.37 - final String benchmarkScript = "test/script/external/octane/benchmarks/"+benchmark.toLowerCase() + ".js"; 112.38 + final String benchmarkScript = "test/script/external/octane/benchmarks/" + benchmark.toLowerCase() + ".js"; 112.39 final String[] args = { 112.40 "--", 112.41 benchmarkScript,
113.1 --- a/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java Mon Nov 03 07:29:46 2014 +0100 113.2 +++ b/test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java Mon Nov 03 11:47:41 2014 +0100 113.3 @@ -36,10 +36,7 @@ 113.4 import jdk.nashorn.internal.runtime.ScriptFunction; 113.5 import jdk.nashorn.internal.runtime.ScriptRuntime; 113.6 113.7 -/** 113.8 - * 113.9 - * @author Pavel Stepanov 113.10 - */ 113.11 +@SuppressWarnings("javadoc") 113.12 public class PerformanceWrapper extends jdk.nashorn.tools.Shell { 113.13 113.14 int _numberOfIterations;
114.1 --- a/test/src/jdk/nashorn/internal/performance/SplayTest.java Mon Nov 03 07:29:46 2014 +0100 114.2 +++ b/test/src/jdk/nashorn/internal/performance/SplayTest.java Mon Nov 03 11:47:41 2014 +0100 114.3 @@ -27,10 +27,7 @@ 114.4 114.5 import org.testng.annotations.Test; 114.6 114.7 -/** 114.8 - * 114.9 - * @author Pavel Stepanov 114.10 - */ 114.11 +@SuppressWarnings("javadoc") 114.12 public class SplayTest { 114.13 114.14 @Test
115.1 --- a/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java Mon Nov 03 07:29:46 2014 +0100 115.2 +++ b/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java Mon Nov 03 11:47:41 2014 +0100 115.3 @@ -25,18 +25,17 @@ 115.4 115.5 package jdk.nashorn.internal.runtime; 115.6 115.7 +import static org.testng.Assert.fail; 115.8 +import java.io.File; 115.9 +import javax.script.ScriptEngine; 115.10 +import javax.script.ScriptException; 115.11 import jdk.nashorn.api.scripting.ClassFilter; 115.12 import jdk.nashorn.api.scripting.NashornScriptEngineFactory; 115.13 import jdk.nashorn.api.scripting.URLReader; 115.14 import jdk.nashorn.internal.test.framework.TestFinder; 115.15 import org.testng.annotations.Test; 115.16 115.17 -import javax.script.ScriptEngine; 115.18 -import javax.script.ScriptException; 115.19 -import java.io.File; 115.20 - 115.21 -import static org.testng.Assert.fail; 115.22 - 115.23 +@SuppressWarnings("javadoc") 115.24 public class ClassFilterTest { 115.25 private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache"; 115.26 private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache"; 115.27 @@ -48,7 +47,7 @@ 115.28 // test contributes much. We need faster "ant clean test" cycle for 115.29 // developers. 115.30 public void runExternalJsTest() { 115.31 - String[] paths = new String[]{ 115.32 + final String[] paths = new String[]{ 115.33 "test/script/basic/compile-octane.js", 115.34 "test/script/basic/jquery.js", 115.35 "test/script/basic/prototype.js", 115.36 @@ -57,12 +56,12 @@ 115.37 "test/script/basic/yui.js", 115.38 "test/script/basic/run-octane.js" 115.39 }; 115.40 - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.41 - for (String path : paths) { 115.42 - ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter()); 115.43 + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.44 + for (final String path : paths) { 115.45 + final ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter()); 115.46 try { 115.47 engine.eval(new URLReader(new File(path).toURI().toURL())); 115.48 - } catch (Exception e) { 115.49 + } catch (final Exception e) { 115.50 fail("Script " + path + " fails with exception :" + e.getMessage()); 115.51 } 115.52 } 115.53 @@ -70,12 +69,13 @@ 115.54 115.55 @Test 115.56 public void noJavaOptionTest() { 115.57 - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.58 - ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter()); 115.59 + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.60 + final ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter()); 115.61 try { 115.62 engine.eval("var str = Java.type('java.lang.String');"); 115.63 fail("TypeError should have been thrown"); 115.64 - } catch (ScriptException exc) { 115.65 + } catch (final ScriptException e) { 115.66 + //emtpy 115.67 } 115.68 } 115.69 115.70 @@ -85,27 +85,31 @@ 115.71 return; 115.72 } 115.73 115.74 - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.75 - ScriptEngine engine = factory.getScriptEngine(getClassFilter()); 115.76 + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.77 + final ScriptEngine engine = factory.getScriptEngine(getClassFilter()); 115.78 try { 115.79 engine.eval("var thread = Java.type('sun.misc.Unsafe')"); 115.80 fail("SecurityException should have been thrown"); 115.81 - } catch (final Exception exc) { 115.82 + } catch (final Exception e) { 115.83 + //empty 115.84 } 115.85 try { 115.86 engine.eval("var thread = new sun.misc.Unsafe()"); 115.87 fail("SecurityException should have been thrown"); 115.88 - } catch (final Exception exc) { 115.89 + } catch (final Exception e) { 115.90 + //empty 115.91 } 115.92 try { 115.93 engine.eval("var thread = Java.extend(sun.misc.Unsafe, {})"); 115.94 fail("TypeError should have been thrown"); 115.95 - } catch (final Exception exc) { 115.96 + } catch (final Exception e) { 115.97 + //empty 115.98 } 115.99 try { 115.100 engine.eval("java.lang.System.exit(0)"); 115.101 fail("SecurityException should have been thrown"); 115.102 - } catch (final Exception exc) { 115.103 + } catch (final Exception e) { 115.104 + //empty 115.105 } 115.106 115.107 } 115.108 @@ -124,24 +128,24 @@ 115.109 } 115.110 115.111 private void persistentCacheTestImpl() { 115.112 - NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.113 - ScriptEngine engine = factory.getScriptEngine( 115.114 + final NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); 115.115 + final ScriptEngine engine = factory.getScriptEngine( 115.116 TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}), 115.117 getClass().getClassLoader(), 115.118 getClassFilter() 115.119 ); 115.120 - String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore(); 115.121 + final String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore(); 115.122 try { 115.123 engine.eval(testScript); 115.124 } catch (final ScriptException exc) { 115.125 fail(exc.getMessage()); 115.126 } 115.127 - ScriptEngine engineSafe = factory.getScriptEngine( 115.128 + final ScriptEngine engineSafe = factory.getScriptEngine( 115.129 TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}), 115.130 getClass().getClassLoader(), 115.131 new ClassFilter() { 115.132 @Override 115.133 - public boolean exposeToScripts(String s) { 115.134 + public boolean exposeToScripts(final String s) { 115.135 return false; 115.136 } 115.137 } 115.138 @@ -156,8 +160,8 @@ 115.139 } 115.140 } 115.141 115.142 - private String generateCodeForPersistentStore() { 115.143 - StringBuilder stringBuilder = new StringBuilder(); 115.144 + private static String generateCodeForPersistentStore() { 115.145 + final StringBuilder stringBuilder = new StringBuilder(); 115.146 for (int i=0; i < 100; i++) { 115.147 stringBuilder.append("function i") 115.148 .append(i) 115.149 @@ -170,10 +174,10 @@ 115.150 return stringBuilder.toString(); 115.151 } 115.152 115.153 - private ClassFilter getClassFilter() { 115.154 + private static ClassFilter getClassFilter() { 115.155 return new ClassFilter() { 115.156 @Override 115.157 - public boolean exposeToScripts(String s) { 115.158 + public boolean exposeToScripts(final String s) { 115.159 return true; 115.160 } 115.161 };
116.1 --- a/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java Mon Nov 03 07:29:46 2014 +0100 116.2 +++ b/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java Mon Nov 03 11:47:41 2014 +0100 116.3 @@ -26,7 +26,6 @@ 116.4 116.5 import static org.testng.Assert.assertEquals; 116.6 import static org.testng.Assert.assertFalse; 116.7 - 116.8 import java.io.File; 116.9 import java.io.IOException; 116.10 import java.nio.file.DirectoryStream; 116.11 @@ -44,7 +43,7 @@ 116.12 * @summary Test for persistent code cache and path handling 116.13 * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest 116.14 */ 116.15 - 116.16 +@SuppressWarnings("javadoc") 116.17 public class CodeStoreAndPathTest { 116.18 116.19 final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; " 116.20 @@ -98,19 +97,22 @@ 116.21 116.22 private static final String[] ENGINE_OPTIONS = new String[]{"--persistent-code-cache", "--optimistic-types=false", "--lazy-compilation=false"}; 116.23 116.24 - public void checkCompiledScripts(final DirectoryStream<Path> stream, int numberOfScripts) throws IOException { 116.25 - for (final Path file : stream) { 116.26 - numberOfScripts--; 116.27 + public void checkCompiledScripts(final DirectoryStream<Path> stream, final int numberOfScripts) throws IOException { 116.28 + int n = numberOfScripts; 116.29 + for (@SuppressWarnings("unused") final Path file : stream) { 116.30 + n--; 116.31 } 116.32 stream.close(); 116.33 - assertEquals(numberOfScripts,0); 116.34 + assertEquals(n, 0); 116.35 } 116.36 116.37 @Test 116.38 - public void pathHandlingTest() throws ScriptException, IOException { 116.39 + public void pathHandlingTest() { 116.40 System.setProperty("nashorn.persistent.code.cache", codeCache); 116.41 final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); 116.42 - final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS); 116.43 + 116.44 + fac.getScriptEngine(ENGINE_OPTIONS); 116.45 + 116.46 final Path expectedCodeCachePath = FileSystems.getDefault().getPath(oldUserDir + File.separator + codeCache); 116.47 final Path actualCodeCachePath = FileSystems.getDefault().getPath(System.getProperty( 116.48 "nashorn.persistent.code.cache")).toAbsolutePath();
117.1 --- a/test/src/jdk/nashorn/internal/runtime/ContextTest.java Mon Nov 03 07:29:46 2014 +0100 117.2 +++ b/test/src/jdk/nashorn/internal/runtime/ContextTest.java Mon Nov 03 11:47:41 2014 +0100 117.3 @@ -29,7 +29,6 @@ 117.4 import static org.testng.Assert.assertEquals; 117.5 import static org.testng.Assert.assertTrue; 117.6 import static org.testng.Assert.fail; 117.7 - 117.8 import java.util.Map; 117.9 import jdk.nashorn.internal.objects.Global; 117.10 import jdk.nashorn.internal.runtime.options.Options; 117.11 @@ -41,6 +40,7 @@ 117.12 * @test 117.13 * @run testng jdk.nashorn.internal.runtime.ContextTest 117.14 */ 117.15 +@SuppressWarnings("javadoc") 117.16 public class ContextTest { 117.17 // basic context eval test 117.18 @Test 117.19 @@ -96,7 +96,7 @@ 117.20 final String code = "var obj = { x: 344, y: 42 }"; 117.21 eval(cx, "<reflectionTest>", code); 117.22 117.23 - final Object obj = cx.getGlobal().get("obj"); 117.24 + final Object obj = Context.getGlobal().get("obj"); 117.25 117.26 assertTrue(obj instanceof ScriptObject); 117.27 117.28 @@ -129,7 +129,7 @@ 117.29 } 117.30 } 117.31 117.32 - private Object eval(final Context cx, final String name, final String code) { 117.33 + private static Object eval(final Context cx, final String name, final String code) { 117.34 final Source source = sourceFor(name, code); 117.35 final ScriptObject global = Context.getGlobal(); 117.36 final ScriptFunction func = cx.compileScript(source, global);
118.1 --- a/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java Mon Nov 03 07:29:46 2014 +0100 118.2 +++ b/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java Mon Nov 03 11:47:41 2014 +0100 118.3 @@ -27,7 +27,6 @@ 118.4 118.5 import static org.testng.Assert.assertEquals; 118.6 import static org.testng.Assert.fail; 118.7 - 118.8 import java.io.ByteArrayOutputStream; 118.9 import java.io.IOException; 118.10 import java.io.NotSerializableException; 118.11 @@ -43,6 +42,7 @@ 118.12 * @test 118.13 * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable 118.14 */ 118.15 +@SuppressWarnings("javadoc") 118.16 public class ExceptionsNotSerializable { 118.17 @Test 118.18 public void rewriteExceptionNotSerializable() throws ScriptException { 118.19 @@ -59,7 +59,7 @@ 118.20 } 118.21 118.22 @Test 118.23 - public void unwarrantedOptimismExceptionNotSerializable() throws IOException { 118.24 + public void unwarrantedOptimismExceptionNotSerializable() { 118.25 tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128)); 118.26 } 118.27
119.1 --- a/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java Mon Nov 03 07:29:46 2014 +0100 119.2 +++ b/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java Mon Nov 03 11:47:41 2014 +0100 119.3 @@ -25,7 +25,6 @@ 119.4 package jdk.nashorn.internal.runtime; 119.5 119.6 import static org.testng.Assert.fail; 119.7 - 119.8 import java.io.ByteArrayOutputStream; 119.9 import java.io.PrintStream; 119.10 import java.util.regex.Matcher; 119.11 @@ -46,6 +45,7 @@ 119.12 * @summary Sanity tests for no persistence caching 119.13 * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest 119.14 */ 119.15 +@SuppressWarnings("javadoc") 119.16 public class NoPersistenceCachingTest { 119.17 119.18 private ScriptEngine engine; 119.19 @@ -102,6 +102,8 @@ 119.20 engine.eval(scriptThreeContexts, context2); 119.21 engine.eval(scriptThreeContexts, context3); 119.22 break; 119.23 + default: 119.24 + break; 119.25 } 119.26 } catch (final Exception se) { 119.27 se.printStackTrace();
120.1 --- a/test/src/jdk/nashorn/internal/runtime/SourceTest.java Mon Nov 03 07:29:46 2014 +0100 120.2 +++ b/test/src/jdk/nashorn/internal/runtime/SourceTest.java Mon Nov 03 11:47:41 2014 +0100 120.3 @@ -29,7 +29,6 @@ 120.4 import static org.testng.Assert.assertEquals; 120.5 import static org.testng.Assert.assertTrue; 120.6 import static org.testng.Assert.fail; 120.7 - 120.8 import java.io.File; 120.9 import java.io.IOException; 120.10 import java.io.InputStreamReader; 120.11 @@ -42,6 +41,7 @@ 120.12 /** 120.13 * Tests different Source representations. 120.14 */ 120.15 +@SuppressWarnings("javadoc") 120.16 public class SourceTest { 120.17 120.18 final private static String SOURCE_NAME = "source.js"; 120.19 @@ -104,11 +104,11 @@ 120.20 } 120.21 } 120.22 120.23 - private Reader getReader(final String path) { 120.24 + private static Reader getReader(final String path) { 120.25 return new InputStreamReader(SourceTest.class.getResourceAsStream(path)); 120.26 } 120.27 120.28 - private void testSources(final Source source1, final Source source2) { 120.29 + private static void testSources(final Source source1, final Source source2) { 120.30 final char[] chars1 = source1.getContent(); 120.31 final char[] chars2 = source2.getContent(); 120.32 final String str1 = source1.getString();
121.1 --- a/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java Mon Nov 03 07:29:46 2014 +0100 121.2 +++ b/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java Mon Nov 03 11:47:41 2014 +0100 121.3 @@ -28,7 +28,6 @@ 121.4 import static org.testng.Assert.assertEquals; 121.5 import static org.testng.Assert.assertTrue; 121.6 import static org.testng.Assert.fail; 121.7 - 121.8 import javax.script.ScriptContext; 121.9 import javax.script.ScriptEngine; 121.10 import javax.script.ScriptEngineFactory; 121.11 @@ -42,6 +41,7 @@ 121.12 /** 121.13 * Tests for trusted client usage of nashorn script engine factory extension API 121.14 */ 121.15 +@SuppressWarnings("javadoc") 121.16 public class TrustedScriptEngineTest { 121.17 @Test 121.18 public void versionTest() { 121.19 @@ -64,7 +64,7 @@ 121.20 public boolean reached() { 121.21 return reached[0]; 121.22 } 121.23 - }; 121.24 + } 121.25 121.26 // These are for "private" extension API of NashornScriptEngineFactory that 121.27 // accepts a ClassLoader and/or command line options. 121.28 @@ -140,7 +140,8 @@ 121.29 // try nashorn specific extension 121.30 e.eval("var f = funtion(x) 2*x;"); 121.31 fail("should have thrown exception!"); 121.32 - } catch (final ScriptException se) { 121.33 + } catch (final Exception ex) { 121.34 + //empty 121.35 } 121.36 return; 121.37 } 121.38 @@ -276,7 +277,9 @@ 121.39 try { 121.40 fac.getScriptEngine((ClassFilter)null); 121.41 fail("should have thrown NPE"); 121.42 - } catch (NullPointerException npe) {} 121.43 + } catch (final NullPointerException e) { 121.44 + //empty 121.45 + } 121.46 } 121.47 121.48 @Test 121.49 @@ -285,7 +288,9 @@ 121.50 try { 121.51 fac.getScriptEngine(new String[0], null, null); 121.52 fail("should have thrown NPE"); 121.53 - } catch (NullPointerException npe) {} 121.54 + } catch (final NullPointerException e) { 121.55 + //empty 121.56 + } 121.57 } 121.58 121.59 @Test 121.60 @@ -294,7 +299,9 @@ 121.61 try { 121.62 fac.getScriptEngine((String[])null); 121.63 fail("should have thrown NPE"); 121.64 - } catch (NullPointerException npe) {} 121.65 + } catch (final NullPointerException e) { 121.66 + //empty 121.67 + } 121.68 } 121.69 121.70 @Test 121.71 @@ -308,7 +315,9 @@ 121.72 } 121.73 }); 121.74 fail("should have thrown NPE"); 121.75 - } catch (NullPointerException npe) {} 121.76 + } catch (final NullPointerException e) { 121.77 + //empty 121.78 + } 121.79 } 121.80 121.81 @Test
122.1 --- a/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java Mon Nov 03 07:29:46 2014 +0100 122.2 +++ b/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java Mon Nov 03 11:47:41 2014 +0100 122.3 @@ -33,6 +33,7 @@ 122.4 * @test 122.5 * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest 122.6 */ 122.7 +@SuppressWarnings("javadoc") 122.8 public class JoniTest { 122.9 122.10 @Test
123.1 --- a/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Mon Nov 03 07:29:46 2014 +0100 123.2 +++ b/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Mon Nov 03 11:47:41 2014 +0100 123.3 @@ -34,7 +34,6 @@ 123.4 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN; 123.5 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FAIL_LIST; 123.6 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_SHARED_CONTEXT; 123.7 - 123.8 import java.io.BufferedReader; 123.9 import java.io.File; 123.10 import java.io.IOException; 123.11 @@ -50,6 +49,7 @@ 123.12 /** 123.13 * Abstract class to compile and run one .js script file. 123.14 */ 123.15 +@SuppressWarnings("javadoc") 123.16 public abstract class AbstractScriptRunnable { 123.17 // some test scripts need a "framework" script - whose features are used 123.18 // in the test script. This optional framework script can be null. 123.19 @@ -274,14 +274,14 @@ 123.20 // compile and run this script 123.21 protected abstract void execute(); 123.22 123.23 - private boolean equalsCompilerMsgs(final String es, final String as) { 123.24 + private static boolean equalsCompilerMsgs(final String es, final String as) { 123.25 final int split = es.indexOf(':'); 123.26 // Replace both types of separators ('/' and '\') with the one from 123.27 // current environment 123.28 return (split >= 0) && as.equals(es.substring(0, split).replaceAll("[/\\\\]", Matcher.quoteReplacement(File.separator)) + es.substring(split)); 123.29 } 123.30 123.31 - private void escape(final String value, final StringBuilder out) { 123.32 + private static void escape(final String value, final StringBuilder out) { 123.33 final int len = value.length(); 123.34 for (int i = 0; i < len; i++) { 123.35 final char ch = value.charAt(i); 123.36 @@ -297,7 +297,7 @@ 123.37 } 123.38 } 123.39 123.40 - private String escape(final String value) { 123.41 + private static String escape(final String value) { 123.42 final StringBuilder sb = new StringBuilder(); 123.43 escape(value, sb); 123.44 return sb.toString();
124.1 --- a/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java Mon Nov 03 07:29:46 2014 +0100 124.2 +++ b/test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java Mon Nov 03 11:47:41 2014 +0100 124.3 @@ -34,6 +34,7 @@ 124.4 * Test case used by JSCompilerTest to complain if test files are marked as 124.5 * neither test nor subtest. 124.6 */ 124.7 +@SuppressWarnings("javadoc") 124.8 public final class OrphanTestFinder implements ITest { 124.9 private final Set<String> orphanFiles; 124.10
125.1 --- a/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java Mon Nov 03 07:29:46 2014 +0100 125.2 +++ b/test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java Mon Nov 03 11:47:41 2014 +0100 125.3 @@ -31,7 +31,6 @@ 125.4 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_EXCLUDE_LIST; 125.5 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FRAMEWORK; 125.6 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS; 125.7 - 125.8 import java.io.BufferedReader; 125.9 import java.io.ByteArrayOutputStream; 125.10 import java.io.File; 125.11 @@ -73,6 +72,7 @@ 125.12 * Parallel test runner runs tests in multiple threads - but avoids any dependency 125.13 * on third-party test framework library such as TestNG. 125.14 */ 125.15 +@SuppressWarnings("javadoc") 125.16 public class ParallelTestRunner { 125.17 125.18 // ParallelTestRunner-specific 125.19 @@ -247,7 +247,7 @@ 125.20 } 125.21 } 125.22 125.23 - private void compare(final String outputFileName, final String expected, final boolean compareCompilerMsg) throws IOException { 125.24 + private void compare(final String fileName, final String expected, final boolean compareCompilerMsg) throws IOException { 125.25 final File expectedFile = new File(expected); 125.26 125.27 BufferedReader expectedReader; 125.28 @@ -257,7 +257,7 @@ 125.29 expectedReader = new BufferedReader(new StringReader("")); 125.30 } 125.31 125.32 - final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(outputFileName))); 125.33 + final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); 125.34 125.35 compare(actual, expectedReader, compareCompilerMsg); 125.36 } 125.37 @@ -434,8 +434,8 @@ 125.38 public static void main(final String[] args) throws Exception { 125.39 parseArgs(args); 125.40 125.41 - while(new ParallelTestRunner().run()) { 125.42 - ; 125.43 + while (new ParallelTestRunner().run()) { 125.44 + //empty 125.45 } 125.46 } 125.47
126.1 --- a/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Mon Nov 03 07:29:46 2014 +0100 126.2 +++ b/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Mon Nov 03 11:47:41 2014 +0100 126.3 @@ -52,6 +52,7 @@ 126.4 * class. Optionally, output from running the script is compared against the 126.5 * corresponding .EXPECTED file. 126.6 */ 126.7 +@SuppressWarnings("javadoc") 126.8 public final class ScriptRunnable extends AbstractScriptRunnable implements ITest { 126.9 public ScriptRunnable(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) { 126.10 super(framework, testFile, engineOptions, testOptions, scriptArguments);
127.1 --- a/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java Mon Nov 03 07:29:46 2014 +0100 127.2 +++ b/test/src/jdk/nashorn/internal/test/framework/ScriptTest.java Mon Nov 03 11:47:41 2014 +0100 127.3 @@ -26,7 +26,6 @@ 127.4 package jdk.nashorn.internal.test.framework; 127.5 127.6 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_INCLUDES; 127.7 - 127.8 import java.io.File; 127.9 import java.util.ArrayList; 127.10 import java.util.List; 127.11 @@ -48,7 +47,9 @@ 127.12 * Creates a test factory for the set of .js source tests. 127.13 * 127.14 * @return a Object[] of test objects. 127.15 + * @throws Exception upon failure 127.16 */ 127.17 + @SuppressWarnings("static-method") 127.18 @Factory 127.19 public Object[] suite() throws Exception { 127.20 Locale.setDefault(new Locale(""));
128.1 --- a/test/src/jdk/nashorn/internal/test/framework/TestConfig.java Mon Nov 03 07:29:46 2014 +0100 128.2 +++ b/test/src/jdk/nashorn/internal/test/framework/TestConfig.java Mon Nov 03 11:47:41 2014 +0100 128.3 @@ -28,6 +28,7 @@ 128.4 /** 128.5 * Configuration info for script tests. 128.6 */ 128.7 +@SuppressWarnings("javadoc") 128.8 public interface TestConfig { 128.9 // Test options inferred from various test @foo tags and passed to test factory. 128.10 public static final String OPTIONS_RUN = "run";
129.1 --- a/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Mon Nov 03 07:29:46 2014 +0100 129.2 +++ b/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Mon Nov 03 11:47:41 2014 +0100 129.3 @@ -42,7 +42,6 @@ 129.4 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_LIST; 129.5 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_ROOTS; 129.6 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_UNCHECKED_DIR; 129.7 - 129.8 import java.io.BufferedReader; 129.9 import java.io.File; 129.10 import java.io.FileReader; 129.11 @@ -76,6 +75,7 @@ 129.12 * Utility class to find/parse script test files and to create 'test' instances. 129.13 * Actual 'test' object type is decided by clients of this class. 129.14 */ 129.15 +@SuppressWarnings("javadoc") 129.16 public final class TestFinder { 129.17 private TestFinder() {} 129.18 129.19 @@ -299,6 +299,8 @@ 129.20 case "@fork": 129.21 fork = true; 129.22 break; 129.23 + default: 129.24 + break; 129.25 } 129.26 129.27 // negative tests are expected to fail at runtime only 129.28 @@ -377,7 +379,7 @@ 129.29 * 129.30 * @args new argument list array 129.31 */ 129.32 - public static String[] addExplicitOptimisticTypes(String[] args) { 129.33 + public static String[] addExplicitOptimisticTypes(final String[] args) { 129.34 if (hasOptimisticOverride()) { 129.35 final List<String> newList = new ArrayList<>(Arrays.asList(args)); 129.36 newList.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE)); 129.37 @@ -392,7 +394,7 @@ 129.38 * 129.39 * @args argument list 129.40 */ 129.41 - public static void addExplicitOptimisticTypes(List<String> args) { 129.42 + public static void addExplicitOptimisticTypes(final List<String> args) { 129.43 if (hasOptimisticOverride()) { 129.44 args.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE)); 129.45 }
130.1 --- a/test/src/jdk/nashorn/internal/test/framework/TestHelper.java Mon Nov 03 07:29:46 2014 +0100 130.2 +++ b/test/src/jdk/nashorn/internal/test/framework/TestHelper.java Mon Nov 03 11:47:41 2014 +0100 130.3 @@ -36,6 +36,7 @@ 130.4 /** 130.5 * Simple utilities to deal with build-dir, read/dump files etc. 130.6 */ 130.7 +@SuppressWarnings("javadoc") 130.8 public abstract class TestHelper { 130.9 130.10 public static final String TEST_ROOT = "test";
131.1 --- a/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java Mon Nov 03 07:29:46 2014 +0100 131.2 +++ b/test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java Mon Nov 03 11:47:41 2014 +0100 131.3 @@ -47,10 +47,9 @@ 131.4 final Object o2 = mi2.getInstance(); 131.5 if (o1 instanceof ITest && o2 instanceof ITest) { 131.6 return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName()); 131.7 - } else { 131.8 - // something else, don't care about the order 131.9 - return 0; 131.10 } 131.11 + // something else, don't care about the order 131.12 + return 0; 131.13 } 131.14 }); 131.15
132.1 --- a/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java Mon Nov 03 07:29:46 2014 +0100 132.2 +++ b/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java Mon Nov 03 11:47:41 2014 +0100 132.3 @@ -28,6 +28,7 @@ 132.4 import java.io.PrintWriter; 132.5 import java.io.StringWriter; 132.6 132.7 +@SuppressWarnings("javadoc") 132.8 public class InternalRunnable implements Runnable, RestrictedRunnable { 132.9 132.10 // This is a public field in a restricted class; scripts should not see it.
133.1 --- a/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java Mon Nov 03 07:29:46 2014 +0100 133.2 +++ b/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java Mon Nov 03 11:47:41 2014 +0100 133.3 @@ -27,8 +27,8 @@ 133.4 133.5 /** 133.6 * Acts as a restricted interface implemented by a restricted class. 133.7 - * 133.8 */ 133.9 +@SuppressWarnings("javadoc") 133.10 public interface RestrictedRunnable { 133.11 public void restrictedRun(); 133.12 }
134.1 --- a/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Mon Nov 03 07:29:46 2014 +0100 134.2 +++ b/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Mon Nov 03 11:47:41 2014 +0100 134.3 @@ -25,7 +25,10 @@ 134.4 134.5 package jdk.nashorn.test.models; 134.6 134.7 +@SuppressWarnings("javadoc") 134.8 public class ClassWithFinalFinalizer { 134.9 + @Override 134.10 protected final void finalize() { 134.11 + //empty 134.12 } 134.13 }
135.1 --- a/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java Mon Nov 03 07:29:46 2014 +0100 135.2 +++ b/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java Mon Nov 03 11:47:41 2014 +0100 135.3 @@ -25,5 +25,7 @@ 135.4 135.5 package jdk.nashorn.test.models; 135.6 135.7 +@SuppressWarnings("javadoc") 135.8 public class ClassWithInheritedFinalFinalizer extends ClassWithFinalFinalizer { 135.9 + //empty 135.10 }
136.1 --- a/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java Mon Nov 03 07:29:46 2014 +0100 136.2 +++ b/test/src/jdk/nashorn/test/models/ConstructorWithArgument.java Mon Nov 03 11:47:41 2014 +0100 136.3 @@ -25,6 +25,7 @@ 136.4 136.5 package jdk.nashorn.test.models; 136.6 136.7 +@SuppressWarnings("javadoc") 136.8 public abstract class ConstructorWithArgument { 136.9 private final String token; 136.10
137.1 --- a/test/src/jdk/nashorn/test/models/DessertTopping.java Mon Nov 03 07:29:46 2014 +0100 137.2 +++ b/test/src/jdk/nashorn/test/models/DessertTopping.java Mon Nov 03 11:47:41 2014 +0100 137.3 @@ -25,6 +25,7 @@ 137.4 137.5 package jdk.nashorn.test.models; 137.6 137.7 +@SuppressWarnings("javadoc") 137.8 public interface DessertTopping { 137.9 public String pourOnDessert(); 137.10 }
138.1 --- a/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java Mon Nov 03 07:29:46 2014 +0100 138.2 +++ b/test/src/jdk/nashorn/test/models/DessertToppingFloorWaxDriver.java Mon Nov 03 11:47:41 2014 +0100 138.3 @@ -25,6 +25,7 @@ 138.4 138.5 package jdk.nashorn.test.models; 138.6 138.7 +@SuppressWarnings("javadoc") 138.8 public class DessertToppingFloorWaxDriver { 138.9 public void decorateDessert(final DessertTopping dt) { 138.10 dt.pourOnDessert();
139.1 --- a/test/src/jdk/nashorn/test/models/FinalClass.java Mon Nov 03 07:29:46 2014 +0100 139.2 +++ b/test/src/jdk/nashorn/test/models/FinalClass.java Mon Nov 03 11:47:41 2014 +0100 139.3 @@ -25,6 +25,7 @@ 139.4 139.5 package jdk.nashorn.test.models; 139.6 139.7 +@SuppressWarnings("javadoc") 139.8 public final class FinalClass { 139.9 //empty 139.10 }
140.1 --- a/test/src/jdk/nashorn/test/models/FloorWax.java Mon Nov 03 07:29:46 2014 +0100 140.2 +++ b/test/src/jdk/nashorn/test/models/FloorWax.java Mon Nov 03 11:47:41 2014 +0100 140.3 @@ -25,6 +25,7 @@ 140.4 140.5 package jdk.nashorn.test.models; 140.6 140.7 +@SuppressWarnings("javadoc") 140.8 public interface FloorWax { 140.9 public String shineUpTheFloor(); 140.10 }
141.1 --- a/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java Mon Nov 03 07:29:46 2014 +0100 141.2 +++ b/test/src/jdk/nashorn/test/models/IntFloatOverloadSelection.java Mon Nov 03 11:47:41 2014 +0100 141.3 @@ -24,6 +24,7 @@ 141.4 */ 141.5 package jdk.nashorn.test.models; 141.6 141.7 +@SuppressWarnings("javadoc") 141.8 public class IntFloatOverloadSelection { 141.9 141.10 public static String overloadedMethod(final int i) {
142.1 --- a/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java Mon Nov 03 07:29:46 2014 +0100 142.2 +++ b/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java Mon Nov 03 11:47:41 2014 +0100 142.3 @@ -30,8 +30,9 @@ 142.4 142.5 /** 142.6 * Acts as a non-restricted superclass for a restricted class. 142.7 - * 142.8 */ 142.9 + 142.10 +@SuppressWarnings("javadoc") 142.11 public class InternalRunnableSuperclass { 142.12 public final int canSeeThisField = 19; 142.13
143.1 --- a/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java Mon Nov 03 07:29:46 2014 +0100 143.2 +++ b/test/src/jdk/nashorn/test/models/Jdk8011362TestSubject.java Mon Nov 03 11:47:41 2014 +0100 143.3 @@ -26,8 +26,9 @@ 143.4 package jdk.nashorn.test.models; 143.5 143.6 /** 143.7 - * Test class used by JDK-8011362.js. 143.8 + * Test class used by JDK-8011362.js 143.9 */ 143.10 +@SuppressWarnings("javadoc") 143.11 public class Jdk8011362TestSubject { 143.12 // This is selected for overloaded("", null) 143.13 public String overloaded(final String a, final String b) {
144.1 --- a/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java Mon Nov 03 07:29:46 2014 +0100 144.2 +++ b/test/src/jdk/nashorn/test/models/Nashorn401TestSubject.java Mon Nov 03 11:47:41 2014 +0100 144.3 @@ -25,6 +25,7 @@ 144.4 144.5 package jdk.nashorn.test.models; 144.6 144.7 +@SuppressWarnings("javadoc") 144.8 public class Nashorn401TestSubject { 144.9 public String method2(final int arg) { 144.10 return "int method 2";
145.1 --- a/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java Mon Nov 03 07:29:46 2014 +0100 145.2 +++ b/test/src/jdk/nashorn/test/models/NoAccessibleConstructorClass.java Mon Nov 03 11:47:41 2014 +0100 145.3 @@ -25,6 +25,7 @@ 145.4 145.5 package jdk.nashorn.test.models; 145.6 145.7 +@SuppressWarnings("javadoc") 145.8 public class NoAccessibleConstructorClass { 145.9 NoAccessibleConstructorClass() { } 145.10 }
146.1 --- a/test/src/jdk/nashorn/test/models/OuterClass.java Mon Nov 03 07:29:46 2014 +0100 146.2 +++ b/test/src/jdk/nashorn/test/models/OuterClass.java Mon Nov 03 11:47:41 2014 +0100 146.3 @@ -25,6 +25,7 @@ 146.4 146.5 package jdk.nashorn.test.models; 146.6 146.7 +@SuppressWarnings("javadoc") 146.8 public class OuterClass { 146.9 private final String value; 146.10 146.11 @@ -35,6 +36,7 @@ 146.12 public static class InnerStaticClass { 146.13 146.14 public static class InnerInnerStaticClass { 146.15 + //empty 146.16 } 146.17 146.18 private final String value; 146.19 @@ -50,15 +52,15 @@ 146.20 } 146.21 146.22 public class InnerNonStaticClass { 146.23 - private final String value; 146.24 + private final String val; 146.25 146.26 public InnerNonStaticClass(final String value) { 146.27 - this.value = value; 146.28 + this.val = value; 146.29 } 146.30 146.31 @Override 146.32 public String toString() { 146.33 - return "InnerNonStaticClass[value=" + value + ", outer=" + OuterClass.this + "]"; 146.34 + return "InnerNonStaticClass[value=" + val + ", outer=" + OuterClass.this + "]"; 146.35 } 146.36 } 146.37
147.1 --- a/test/src/jdk/nashorn/test/models/OverloadedSam.java Mon Nov 03 07:29:46 2014 +0100 147.2 +++ b/test/src/jdk/nashorn/test/models/OverloadedSam.java Mon Nov 03 11:47:41 2014 +0100 147.3 @@ -25,6 +25,7 @@ 147.4 147.5 package jdk.nashorn.test.models; 147.6 147.7 +@SuppressWarnings("javadoc") 147.8 public interface OverloadedSam { 147.9 public void sam(String s); 147.10 public void sam(String s1, String s2);
148.1 --- a/test/src/jdk/nashorn/test/models/OverrideObject.java Mon Nov 03 07:29:46 2014 +0100 148.2 +++ b/test/src/jdk/nashorn/test/models/OverrideObject.java Mon Nov 03 11:47:41 2014 +0100 148.3 @@ -25,6 +25,7 @@ 148.4 148.5 package jdk.nashorn.test.models; 148.6 148.7 +@SuppressWarnings("javadoc") 148.8 public class OverrideObject { 148.9 @Override 148.10 public int hashCode() {
149.1 --- a/test/src/jdk/nashorn/test/models/PropertyBind.java Mon Nov 03 07:29:46 2014 +0100 149.2 +++ b/test/src/jdk/nashorn/test/models/PropertyBind.java Mon Nov 03 11:47:41 2014 +0100 149.3 @@ -25,6 +25,7 @@ 149.4 149.5 package jdk.nashorn.test.models; 149.6 149.7 +@SuppressWarnings("javadoc") 149.8 public class PropertyBind { 149.9 public static int publicStaticInt; 149.10 public static final int publicStaticFinalInt = 2112;
150.1 --- a/test/src/jdk/nashorn/test/models/SourceHelper.java Mon Nov 03 07:29:46 2014 +0100 150.2 +++ b/test/src/jdk/nashorn/test/models/SourceHelper.java Mon Nov 03 11:47:41 2014 +0100 150.3 @@ -34,6 +34,7 @@ 150.4 /** 150.5 * Helper class to facilitate script access of nashorn Source class. 150.6 */ 150.7 +@SuppressWarnings("javadoc") 150.8 public final class SourceHelper { 150.9 private SourceHelper() {} 150.10
151.1 --- a/test/src/jdk/nashorn/test/models/StringArgs.java Mon Nov 03 07:29:46 2014 +0100 151.2 +++ b/test/src/jdk/nashorn/test/models/StringArgs.java Mon Nov 03 11:47:41 2014 +0100 151.3 @@ -27,6 +27,7 @@ 151.4 151.5 import java.util.List; 151.6 151.7 +@SuppressWarnings("javadoc") 151.8 public class StringArgs { 151.9 151.10 public static void checkString(final List<?> list) {
152.1 --- a/test/src/jdk/nashorn/test/models/Toothpaste.java Mon Nov 03 07:29:46 2014 +0100 152.2 +++ b/test/src/jdk/nashorn/test/models/Toothpaste.java Mon Nov 03 11:47:41 2014 +0100 152.3 @@ -25,6 +25,7 @@ 152.4 152.5 package jdk.nashorn.test.models; 152.6 152.7 +@SuppressWarnings("javadoc") 152.8 public abstract class Toothpaste { 152.9 public void applyToBrush() { 152.10 applyToBrushImpl();
153.1 --- a/test/src/jdk/nashorn/test/models/VarArgConstructor.java Mon Nov 03 07:29:46 2014 +0100 153.2 +++ b/test/src/jdk/nashorn/test/models/VarArgConstructor.java Mon Nov 03 11:47:41 2014 +0100 153.3 @@ -27,6 +27,7 @@ 153.4 153.5 import java.util.List; 153.6 153.7 +@SuppressWarnings("javadoc") 153.8 public class VarArgConstructor { 153.9 private final String indicator; 153.10
154.1 --- a/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java Mon Nov 03 07:29:46 2014 +0100 154.2 +++ b/test/src/jdk/nashorn/test/tools/StaticTypeInspector.java Mon Nov 03 11:47:41 2014 +0100 154.3 @@ -26,6 +26,7 @@ 154.4 154.5 import jdk.nashorn.internal.runtime.Undefined; 154.6 154.7 +@SuppressWarnings("javadoc") 154.8 public class StaticTypeInspector { 154.9 154.10 public static String inspect(final boolean x, final String w) {