提交 25f094b1 编写于 作者: L lagergren

8023550: -d option was broken for any dir but '.'. Fixed Java warnings.

Reviewed-by: jlaskey, sundar
上级 1e5a0a50
...@@ -27,7 +27,6 @@ package jdk.nashorn.internal.tools.nasgen; ...@@ -27,7 +27,6 @@ package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC; import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.V1_7; import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.CONSTRUCTOR_SUFFIX; import static jdk.nashorn.internal.tools.nasgen.StringConstants.CONSTRUCTOR_SUFFIX;
......
...@@ -27,7 +27,6 @@ package jdk.nashorn.internal.tools.nasgen; ...@@ -27,7 +27,6 @@ package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.DUP; import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC; import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.NEW; import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
......
...@@ -121,7 +121,6 @@ public class ChainedCallSite extends AbstractRelinkableCallSite { ...@@ -121,7 +121,6 @@ public class ChainedCallSite extends AbstractRelinkableCallSite {
* to change the value. If your override returns a value less than 1, the code will break. * to change the value. If your override returns a value less than 1, the code will break.
* @return the maximum number of method handles in the chain. * @return the maximum number of method handles in the chain.
*/ */
@SuppressWarnings("static-method")
protected int getMaxChainLength() { protected int getMaxChainLength() {
return 8; return 8;
} }
......
...@@ -133,7 +133,7 @@ public class DefaultBootstrapper { ...@@ -133,7 +133,7 @@ public class DefaultBootstrapper {
* @param type the method signature at the call site * @param type the method signature at the call site
* @return a new {@link MonomorphicCallSite} linked with the default dynamic linker. * @return a new {@link MonomorphicCallSite} linked with the default dynamic linker.
*/ */
public static CallSite publicBootstrap(@SuppressWarnings("unused") MethodHandles.Lookup caller, String name, MethodType type) { public static CallSite publicBootstrap(MethodHandles.Lookup caller, String name, MethodType type) {
return bootstrapInternal(MethodHandles.publicLookup(), name, type); return bootstrapInternal(MethodHandles.publicLookup(), name, type);
} }
......
...@@ -97,6 +97,7 @@ import java.util.Collections; ...@@ -97,6 +97,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType; import jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType;
import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.GuardedInvocation;
......
...@@ -148,6 +148,7 @@ class OverloadedDynamicMethod extends DynamicMethod { ...@@ -148,6 +148,7 @@ class OverloadedDynamicMethod extends DynamicMethod {
} }
} }
@SuppressWarnings("fallthrough")
@Override @Override
public MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) { public MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) {
final MethodType callSiteType = callSiteDescriptor.getMethodType(); final MethodType callSiteType = callSiteDescriptor.getMethodType();
......
...@@ -124,6 +124,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C ...@@ -124,6 +124,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
} }
// load engine.js and return content as a char[] // load engine.js and return content as a char[]
@SuppressWarnings("resource")
private static char[] loadEngineJSSource() { private static char[] loadEngineJSSource() {
final String script = "resources/engine.js"; final String script = "resources/engine.js";
try { try {
...@@ -212,9 +213,8 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C ...@@ -212,9 +213,8 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
// just create normal SimpleBindings. // just create normal SimpleBindings.
// We use same 'global' for all Bindings. // We use same 'global' for all Bindings.
return new SimpleBindings(); return new SimpleBindings();
} else {
return createGlobalMirror(null);
} }
return createGlobalMirror(null);
} }
// Compilable methods // Compilable methods
......
...@@ -414,30 +414,34 @@ enum CompilationPhase { ...@@ -414,30 +414,34 @@ enum CompilationPhase {
compiler.getCodeInstaller().verify(bytecode); compiler.getCodeInstaller().verify(bytecode);
} }
// should code be dumped to disk - only valid in compile_only // should code be dumped to disk - only valid in compile_only mode?
// mode?
if (env._dest_dir != null && env._compile_only) { if (env._dest_dir != null && env._compile_only) {
final String fileName = className.replace('.', File.separatorChar) + ".class"; final String fileName = className.replace('.', File.separatorChar) + ".class";
final int index = fileName.lastIndexOf(File.separatorChar); final int index = fileName.lastIndexOf(File.separatorChar);
final File dir;
if (index != -1) { if (index != -1) {
final File dir = new File(fileName.substring(0, index)); dir = new File(env._dest_dir, fileName.substring(0, index));
try { } else {
if (!dir.exists() && !dir.mkdirs()) { dir = new File(env._dest_dir);
throw new IOException(dir.toString()); }
}
final File file = new File(env._dest_dir, fileName); try {
try (final FileOutputStream fos = new FileOutputStream(file)) { if (!dir.exists() && !dir.mkdirs()) {
fos.write(bytecode); throw new IOException(dir.toString());
} }
} catch (final IOException e) { final File file = new File(env._dest_dir, fileName);
Compiler.LOG.warning("Skipping class dump for ", try (final FileOutputStream fos = new FileOutputStream(file)) {
className, fos.write(bytecode);
": ",
ECMAErrors.getMessage(
"io.error.cant.write",
dir.toString()));
} }
Compiler.LOG.info("Wrote class to '" + file.getAbsolutePath() + '\'');
} catch (final IOException e) {
Compiler.LOG.warning("Skipping class dump for ",
className,
": ",
ECMAErrors.getMessage(
"io.error.cant.write",
dir.toString()));
} }
} }
} }
......
...@@ -40,6 +40,7 @@ import java.util.Comparator; ...@@ -40,6 +40,7 @@ import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import jdk.nashorn.api.scripting.ScriptObjectMirror; import jdk.nashorn.api.scripting.ScriptObjectMirror;
import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Constructor;
...@@ -632,6 +633,7 @@ public final class NativeArray extends ScriptObject { ...@@ -632,6 +633,7 @@ public final class NativeArray extends ScriptObject {
return new NativeArray(list.toArray()); return new NativeArray(list.toArray());
} }
@SuppressWarnings("null")
private static void concatToList(final ArrayList<Object> list, final Object obj) { private static void concatToList(final ArrayList<Object> list, final Object obj) {
final boolean isScriptArray = isArray(obj); final boolean isScriptArray = isArray(obj);
final boolean isScriptObject = isScriptArray || obj instanceof ScriptObject; final boolean isScriptObject = isScriptArray || obj instanceof ScriptObject;
......
...@@ -65,10 +65,9 @@ public final class NativeRegExp extends ScriptObject { ...@@ -65,10 +65,9 @@ public final class NativeRegExp extends ScriptObject {
private RegExp regexp; private RegExp regexp;
// Reference to global object needed to support static RegExp properties // Reference to global object needed to support static RegExp properties
private Global globalObject; private final Global globalObject;
// initialized by nasgen // initialized by nasgen
@SuppressWarnings("unused")
private static PropertyMap $nasgenmap$; private static PropertyMap $nasgenmap$;
static PropertyMap getInitialMap() { static PropertyMap getInitialMap() {
......
...@@ -894,7 +894,6 @@ public final class Context { ...@@ -894,7 +894,6 @@ public final class Context {
return script; return script;
} }
@SuppressWarnings("static-method")
private ScriptLoader createNewLoader() { private ScriptLoader createNewLoader() {
return AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedAction<ScriptLoader>() { new PrivilegedAction<ScriptLoader>() {
......
...@@ -44,6 +44,7 @@ final class DebuggerSupport { ...@@ -44,6 +44,7 @@ final class DebuggerSupport {
* Hook to force the loading of the DebuggerValueDesc class so that it is * Hook to force the loading of the DebuggerValueDesc class so that it is
* available to external debuggers. * available to external debuggers.
*/ */
@SuppressWarnings("unused")
DebuggerValueDesc forceLoad = new DebuggerValueDesc(null, false, null, null); DebuggerValueDesc forceLoad = new DebuggerValueDesc(null, false, null, null);
} }
...@@ -111,9 +112,8 @@ final class DebuggerSupport { ...@@ -111,9 +112,8 @@ final class DebuggerSupport {
if (value instanceof ScriptObject && !(value instanceof ScriptFunction)) { if (value instanceof ScriptObject && !(value instanceof ScriptFunction)) {
final ScriptObject object = (ScriptObject)value; final ScriptObject object = (ScriptObject)value;
return new DebuggerValueDesc(name, !object.isEmpty(), value, objectAsString(object, all, duplicates)); return new DebuggerValueDesc(name, !object.isEmpty(), value, objectAsString(object, all, duplicates));
} else {
return new DebuggerValueDesc(name, false, value, valueAsString(value));
} }
return new DebuggerValueDesc(name, false, value, valueAsString(value));
} }
/** /**
...@@ -199,7 +199,7 @@ final class DebuggerSupport { ...@@ -199,7 +199,7 @@ final class DebuggerSupport {
final String valueAsString = descs[i].valueAsString; final String valueAsString = descs[i].valueAsString;
sb.append(descs[i].key); sb.append(descs[i].key);
sb.append(": "); sb.append(": ");
sb.append(descs[i].valueAsString); sb.append(valueAsString);
} }
} }
...@@ -239,9 +239,8 @@ final class DebuggerSupport { ...@@ -239,9 +239,8 @@ final class DebuggerSupport {
case FUNCTION: case FUNCTION:
if (value instanceof ScriptFunction) { if (value instanceof ScriptFunction) {
return ((ScriptFunction)value).toSource(); return ((ScriptFunction)value).toSource();
} else {
return value.toString();
} }
return value.toString();
default: default:
return value.toString(); return value.toString();
......
...@@ -52,6 +52,7 @@ import java.util.LinkedHashSet; ...@@ -52,6 +52,7 @@ import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.linker.LinkRequest;
...@@ -1149,12 +1150,12 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr ...@@ -1149,12 +1150,12 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
if (newProto == null || newProto instanceof ScriptObject) { if (newProto == null || newProto instanceof ScriptObject) {
// check for circularity // check for circularity
ScriptObject proto = (ScriptObject)newProto; ScriptObject p = (ScriptObject)newProto;
while (proto != null) { while (p != null) {
if (proto == this) { if (p == this) {
throw typeError("circular.__proto__.set", ScriptRuntime.safeToString(this)); throw typeError("circular.__proto__.set", ScriptRuntime.safeToString(this));
} }
proto = proto.getProto(); p = p.getProto();
} }
setProto((ScriptObject)newProto); setProto((ScriptObject)newProto);
} else { } else {
...@@ -2017,6 +2018,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr ...@@ -2017,6 +2018,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
* @param request the link request * @param request the link request
* @return GuardedInvocation to be invoked at call site. * @return GuardedInvocation to be invoked at call site.
*/ */
@SuppressWarnings("null")
public GuardedInvocation noSuchProperty(final CallSiteDescriptor desc, final LinkRequest request) { public GuardedInvocation noSuchProperty(final CallSiteDescriptor desc, final LinkRequest request) {
final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true); final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true);
......
...@@ -39,7 +39,6 @@ import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType; ...@@ -39,7 +39,6 @@ import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType;
import jdk.nashorn.internal.runtime.regexp.joni.constants.OPCode; import jdk.nashorn.internal.runtime.regexp.joni.constants.OPCode;
import jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize; import jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize;
import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo; import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo;
import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
final class ArrayCompiler extends Compiler { final class ArrayCompiler extends Compiler {
private int[] code; private int[] code;
...@@ -345,6 +344,7 @@ final class ArrayCompiler extends Compiler { ...@@ -345,6 +344,7 @@ final class ArrayCompiler extends Compiler {
private static final int QUANTIFIER_EXPAND_LIMIT_SIZE = 50; // was 50 private static final int QUANTIFIER_EXPAND_LIMIT_SIZE = 50; // was 50
@SuppressWarnings("unused")
private static boolean cknOn(int ckn) { private static boolean cknOn(int ckn) {
return ckn > 0; return ckn > 0;
} }
...@@ -879,6 +879,7 @@ final class ArrayCompiler extends Compiler { ...@@ -879,6 +879,7 @@ final class ArrayCompiler extends Compiler {
} }
} }
@SuppressWarnings("unused")
private void addStateCheckNum(int num) { private void addStateCheckNum(int num) {
addInt(num); addInt(num);
} }
...@@ -887,6 +888,7 @@ final class ArrayCompiler extends Compiler { ...@@ -887,6 +888,7 @@ final class ArrayCompiler extends Compiler {
addInt(addr); addInt(addr);
} }
@SuppressWarnings("unused")
private void addAbsAddr(int addr) { private void addAbsAddr(int addr) {
addInt(addr); addInt(addr);
} }
......
...@@ -29,6 +29,7 @@ public final class BitSet { ...@@ -29,6 +29,7 @@ public final class BitSet {
final int[] bits = new int[BITSET_SIZE]; final int[] bits = new int[BITSET_SIZE];
private static final int BITS_TO_STRING_WRAP = 4; private static final int BITS_TO_STRING_WRAP = 4;
@Override
public String toString() { public String toString() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("BitSet"); buffer.append("BitSet");
......
...@@ -96,6 +96,7 @@ class ByteCodeMachine extends StackMachine { ...@@ -96,6 +96,7 @@ class ByteCodeMachine extends StackMachine {
} }
} }
@Override
protected final int matchAt(int range, int sstart, int sprev) { protected final int matchAt(int range, int sstart, int sprev) {
this.range = range; this.range = range;
this.sstart = sstart; this.sstart = sstart;
...@@ -731,8 +732,6 @@ class ByteCodeMachine extends StackMachine { ...@@ -731,8 +732,6 @@ class ByteCodeMachine extends StackMachine {
// STRING_CMP // STRING_CMP
while(n-- > 0) if (chars[pstart++] != chars[s++]) {opFail(); return;} while(n-- > 0) if (chars[pstart++] != chars[s++]) {opFail(); return;}
int len;
// beyond string check // beyond string check
if (sprev < range) { if (sprev < range) {
while (sprev + 1 < s) sprev++; while (sprev + 1 < s) sprev++;
...@@ -768,7 +767,6 @@ class ByteCodeMachine extends StackMachine { ...@@ -768,7 +767,6 @@ class ByteCodeMachine extends StackMachine {
if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) {opFail(); return;} if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) {opFail(); return;}
s = value; s = value;
int len;
// if (sprev < chars.length) // if (sprev < chars.length)
while (sprev + 1 < s) sprev++; while (sprev + 1 < s) sprev++;
} }
...@@ -796,8 +794,6 @@ class ByteCodeMachine extends StackMachine { ...@@ -796,8 +794,6 @@ class ByteCodeMachine extends StackMachine {
s = swork; s = swork;
int len;
// beyond string check // beyond string check
if (sprev < range) { if (sprev < range) {
while (sprev + 1 < s) sprev++; while (sprev + 1 < s) sprev++;
...@@ -829,7 +825,6 @@ class ByteCodeMachine extends StackMachine { ...@@ -829,7 +825,6 @@ class ByteCodeMachine extends StackMachine {
if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) continue loop; // STRING_CMP_VALUE_IC
s = value; s = value;
int len;
// if (sprev < chars.length) // if (sprev < chars.length)
while (sprev + 1 < s) sprev++; while (sprev + 1 < s) sprev++;
...@@ -902,7 +897,6 @@ class ByteCodeMachine extends StackMachine { ...@@ -902,7 +897,6 @@ class ByteCodeMachine extends StackMachine {
sprev = s; sprev = s;
if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit
int len;
while (sprev + 1 < s) sprev++; while (sprev + 1 < s) sprev++;
ip += tlen; // * SIZE_MEMNUM ip += tlen; // * SIZE_MEMNUM
} else { } else {
......
...@@ -58,6 +58,7 @@ public final class CodeRangeBuffer implements Cloneable { ...@@ -58,6 +58,7 @@ public final class CodeRangeBuffer implements Cloneable {
used = orig.used; used = orig.used;
} }
@Override
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
buf.append("CodeRange"); buf.append("CodeRange");
......
...@@ -139,6 +139,7 @@ class Lexer extends ScannerSupport { ...@@ -139,6 +139,7 @@ class Lexer extends ScannerSupport {
} }
} }
@SuppressWarnings("fallthrough")
/* \M-, \C-, \c, or \... */ /* \M-, \C-, \c, or \... */
private int fetchEscapedValue() { private int fetchEscapedValue() {
if (!left()) { if (!left()) {
......
...@@ -297,8 +297,6 @@ class Parser extends Lexer { ...@@ -297,8 +297,6 @@ class Parser extends Lexer {
throw new SyntaxException(ERR_END_PATTERN_IN_GROUP); throw new SyntaxException(ERR_END_PATTERN_IN_GROUP);
} }
boolean listCapture = false;
fetch(); fetch();
switch(c) { switch(c) {
case ':': /* (?:...) grouping only */ case ':': /* (?:...) grouping only */
......
...@@ -32,6 +32,7 @@ public final class Region { ...@@ -32,6 +32,7 @@ public final class Region {
this.end = new int[num]; this.end = new int[num];
} }
@Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Region: \n"); sb.append("Region: \n");
......
...@@ -21,9 +21,6 @@ package jdk.nashorn.internal.runtime.regexp.joni; ...@@ -21,9 +21,6 @@ package jdk.nashorn.internal.runtime.regexp.joni;
import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder; import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder;
import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
import jdk.nashorn.internal.runtime.regexp.joni.exception.SyntaxException;
import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException;
abstract class ScannerSupport extends IntHolder implements ErrorMessages { abstract class ScannerSupport extends IntHolder implements ErrorMessages {
......
...@@ -28,14 +28,17 @@ public abstract class SearchAlgorithm { ...@@ -28,14 +28,17 @@ public abstract class SearchAlgorithm {
public static final SearchAlgorithm NONE = new SearchAlgorithm() { public static final SearchAlgorithm NONE = new SearchAlgorithm() {
@Override
public final String getName() { public final String getName() {
return "NONE"; return "NONE";
} }
@Override
public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) { public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) {
return textP; return textP;
} }
@Override
public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) { public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) {
return textP; return textP;
} }
...@@ -44,10 +47,12 @@ public abstract class SearchAlgorithm { ...@@ -44,10 +47,12 @@ public abstract class SearchAlgorithm {
public static final SearchAlgorithm SLOW = new SearchAlgorithm() { public static final SearchAlgorithm SLOW = new SearchAlgorithm() {
@Override
public final String getName() { public final String getName() {
return "EXACT"; return "EXACT";
} }
@Override
public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) { public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -78,6 +83,7 @@ public abstract class SearchAlgorithm { ...@@ -78,6 +83,7 @@ public abstract class SearchAlgorithm {
return -1; return -1;
} }
@Override
public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) { public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -114,10 +120,12 @@ public abstract class SearchAlgorithm { ...@@ -114,10 +120,12 @@ public abstract class SearchAlgorithm {
this.caseFoldFlag = regex.caseFoldFlag; this.caseFoldFlag = regex.caseFoldFlag;
} }
@Override
public final String getName() { public final String getName() {
return "EXACT_IC"; return "EXACT_IC";
} }
@Override
public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) { public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -136,6 +144,7 @@ public abstract class SearchAlgorithm { ...@@ -136,6 +144,7 @@ public abstract class SearchAlgorithm {
return -1; return -1;
} }
@Override
public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) { public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -163,14 +172,16 @@ public abstract class SearchAlgorithm { ...@@ -163,14 +172,16 @@ public abstract class SearchAlgorithm {
} }
return true; return true;
} }
}; }
public static final SearchAlgorithm BM = new SearchAlgorithm() { public static final SearchAlgorithm BM = new SearchAlgorithm() {
@Override
public final String getName() { public final String getName() {
return "EXACT_BM"; return "EXACT_BM";
} }
@Override
public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) { public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -212,6 +223,7 @@ public abstract class SearchAlgorithm { ...@@ -212,6 +223,7 @@ public abstract class SearchAlgorithm {
private static final int BM_BACKWARD_SEARCH_LENGTH_THRESHOLD = 100; private static final int BM_BACKWARD_SEARCH_LENGTH_THRESHOLD = 100;
@Override
public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) { public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) {
char[] target = regex.exact; char[] target = regex.exact;
int targetP = regex.exactP; int targetP = regex.exactP;
...@@ -263,10 +275,12 @@ public abstract class SearchAlgorithm { ...@@ -263,10 +275,12 @@ public abstract class SearchAlgorithm {
public static final SearchAlgorithm MAP = new SearchAlgorithm() { public static final SearchAlgorithm MAP = new SearchAlgorithm() {
@Override
public final String getName() { public final String getName() {
return "MAP"; return "MAP";
} }
@Override
public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) { public final int search(Regex regex, char[] text, int textP, int textEnd, int textRange) {
byte[] map = regex.map; byte[] map = regex.map;
int s = textP; int s = textP;
...@@ -278,6 +292,7 @@ public abstract class SearchAlgorithm { ...@@ -278,6 +292,7 @@ public abstract class SearchAlgorithm {
return -1; return -1;
} }
@Override
public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) { public final int searchBackward(Regex regex, char[] text, int textP, int adjustText, int textEnd, int textStart, int s_, int range_) {
byte[] map = regex.map; byte[] map = regex.map;
int s = textStart; int s = textStart;
......
...@@ -458,7 +458,7 @@ abstract class StackMachine extends Matcher implements StackType { ...@@ -458,7 +458,7 @@ abstract class StackMachine extends Matcher implements StackType {
isNull = 0; isNull = 0;
break; break;
} else if (endp != s) { } else if (endp != s) {
isNull = -1;; /* empty, but position changed */ isNull = -1; /* empty, but position changed */
} }
} }
k++; k++;
......
...@@ -24,6 +24,7 @@ package jdk.nashorn.internal.runtime.regexp.joni; ...@@ -24,6 +24,7 @@ package jdk.nashorn.internal.runtime.regexp.joni;
*/ */
public interface WarnCallback { public interface WarnCallback {
WarnCallback DEFAULT = new WarnCallback() { WarnCallback DEFAULT = new WarnCallback() {
@Override
public void warn(String message) { public void warn(String message) {
System.err.println(message); System.err.println(message);
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
*/ */
package jdk.nashorn.internal.runtime.regexp.joni.ast; package jdk.nashorn.internal.runtime.regexp.joni.ast;
import jdk.nashorn.internal.runtime.regexp.joni.Config;
import jdk.nashorn.internal.runtime.regexp.joni.Option; import jdk.nashorn.internal.runtime.regexp.joni.Option;
import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType; import jdk.nashorn.internal.runtime.regexp.joni.constants.EncloseType;
......
...@@ -35,7 +35,7 @@ public abstract class Node implements NodeType { ...@@ -35,7 +35,7 @@ public abstract class Node implements NodeType {
} }
protected void setChild(Node tgt){} // default definition protected void setChild(Node tgt){} // default definition
protected Node getChild(){return null;}; // default definition protected Node getChild(){return null;} // default definition
public void swap(Node with) { public void swap(Node with) {
Node tmp; Node tmp;
...@@ -74,6 +74,7 @@ public abstract class Node implements NodeType { ...@@ -74,6 +74,7 @@ public abstract class Node implements NodeType {
return getName() + ":0x" + Integer.toHexString(System.identityHashCode(this)); return getName() + ":0x" + Integer.toHexString(System.identityHashCode(this));
} }
@Override
public final String toString() { public final String toString() {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append("<" + getAddressName() + " (" + (parent == null ? "NULL" : parent.getAddressName()) + ")>"); s.append("<" + getAddressName() + " (" + (parent == null ? "NULL" : parent.getAddressName()) + ")>");
......
...@@ -223,6 +223,7 @@ public final class QuantifierNode extends StateNode { ...@@ -223,6 +223,7 @@ public final class QuantifierNode extends StateNode {
other.target = null; // remove target from reduced quantifier other.target = null; // remove target from reduced quantifier
} }
@SuppressWarnings("fallthrough")
public int setQuantifier(Node tgt, boolean group, ScanEnvironment env, char[] chars, int p, int end) { public int setQuantifier(Node tgt, boolean group, ScanEnvironment env, char[] chars, int p, int end) {
if (lower == 1 && upper == 1) return 1; if (lower == 1 && upper == 1) return 1;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
*/ */
package jdk.nashorn.internal.runtime.regexp.joni.exception; package jdk.nashorn.internal.runtime.regexp.joni.exception;
import jdk.nashorn.internal.runtime.regexp.joni.Config;
public interface ErrorMessages { public interface ErrorMessages {
/* from jcodings */ /* from jcodings */
......
...@@ -32,13 +32,9 @@ import java.io.UnsupportedEncodingException; ...@@ -32,13 +32,9 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application; import javafx.application.Application;
import javafx.stage.Stage; import javafx.stage.Stage;
import javax.script.Invocable; import javax.script.Invocable;
import javax.script.ScriptContext;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory; import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager; import javax.script.ScriptEngineManager;
...@@ -180,6 +176,7 @@ public class FXShell extends Application { ...@@ -180,6 +176,7 @@ public class FXShell extends Application {
* *
* @return Last evaluation result (discarded.) * @return Last evaluation result (discarded.)
*/ */
@SuppressWarnings("resource")
private Object load(String path) { private Object load(String path) {
try { try {
FileInputStream file = new FileInputStream(path); FileInputStream file = new FileInputStream(path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册