diff --git a/src/module-info.java b/src/module-info.java index 915833c..a8b9e86 100644 --- a/src/module-info.java +++ b/src/module-info.java @@ -3,5 +3,5 @@ exports org.joni.constants; exports org.joni.exception; - requires org.jruby.jcodings; + requires transitive org.jruby.jcodings; } \ No newline at end of file diff --git a/src/org/joni/ApplyCaseFold.java b/src/org/joni/ApplyCaseFold.java index 32a1fd1..ca10da1 100644 --- a/src/org/joni/ApplyCaseFold.java +++ b/src/org/joni/ApplyCaseFold.java @@ -28,6 +28,7 @@ final class ApplyCaseFold implements ApplyAllCaseFoldFunction { // i_apply_case_fold + @Override public void apply(int from, int[]to, int length, Object o) { ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o; diff --git a/src/org/joni/BitSet.java b/src/org/joni/BitSet.java index d3108f6..fe8d3c1 100644 --- a/src/org/joni/BitSet.java +++ b/src/org/joni/BitSet.java @@ -110,6 +110,7 @@ private static int log2(int n){ } private static final int BITS_TO_STRING_WRAP = 4; + @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("BitSet"); diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java index a360520..d25ea6d 100644 --- a/src/org/joni/ByteCodeMachine.java +++ b/src/org/joni/ByteCodeMachine.java @@ -57,6 +57,7 @@ class ByteCodeMachine extends StackMachine { this.code = regex.code; } + @Override public void interrupt() { interrupted = true; // might have no effect on the executing thread but worth a try @@ -153,6 +154,7 @@ private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, return true; } + @Override protected final int matchAt(int _range, int _sstart, int _sprev, boolean interrupt) throws InterruptedException { range = _range; sstart = _sstart; @@ -444,7 +446,7 @@ private final int executeSb(final boolean checkThreadInterrupt) throws Interrupt private void handleInterrupted(final boolean checkThreadInterrupt) throws InterruptedException { if (interrupted || (checkThreadInterrupt && Thread.currentThread().isInterrupted())) { - Thread.currentThread().interrupted(); + Thread.interrupted(); throw new InterruptedException(); } interruptCheckEvery = Math.min(interruptCheckEvery << 1, MAX_INTERRUPT_CHECK_EVERY); diff --git a/src/org/joni/CodeRangeBuffer.java b/src/org/joni/CodeRangeBuffer.java index 2eebb6e..fc6d908 100644 --- a/src/org/joni/CodeRangeBuffer.java +++ b/src/org/joni/CodeRangeBuffer.java @@ -89,6 +89,7 @@ public void writeCodePoint(int pos, int b) { if (used < u) used = u; } + @Override public CodeRangeBuffer clone() { return new CodeRangeBuffer(this); } @@ -374,6 +375,7 @@ public static CodeRangeBuffer andCodeRangeBuff(CodeRangeBuffer bbuf1, boolean no return pbuf; } + @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append("CodeRange"); diff --git a/src/org/joni/MultiRegion.java b/src/org/joni/MultiRegion.java index 46e925b..baf0eb4 100644 --- a/src/org/joni/MultiRegion.java +++ b/src/org/joni/MultiRegion.java @@ -32,10 +32,12 @@ public MultiRegion(int begin, int end) { this.begEnd = new int[]{begin, end}; } + @Override public final int getNumRegs() { return begEnd.length / 2; } + @Override public MultiRegion clone() { MultiRegion region = new MultiRegion(getNumRegs()); System.arraycopy(begEnd, 0, region.begEnd, 0, begEnd.length); @@ -43,22 +45,27 @@ public MultiRegion clone() { return region; } + @Override public int getBeg(int index) { return begEnd[index * 2]; } + @Override public int setBeg(int index, int value) { return begEnd[index * 2] = value; } + @Override public int getEnd(int index) { return begEnd[index * 2 + 1]; } + @Override public int setEnd(int index, int value) { return begEnd[index * 2 + 1] = value; } + @Override void clear() { Arrays.fill(begEnd, REGION_NOTPOS); } diff --git a/src/org/joni/NameEntry.java b/src/org/joni/NameEntry.java index 55c34b3..40caaea 100644 --- a/src/org/joni/NameEntry.java +++ b/src/org/joni/NameEntry.java @@ -79,6 +79,7 @@ public void addBackref(int backRef) { } } + @Override public String toString() { StringBuilder buff = new StringBuilder(new String(name, nameP, nameEnd - nameP) + " "); if (backNum == 0) { diff --git a/src/org/joni/Region.java b/src/org/joni/Region.java index ace0442..4507c45 100644 --- a/src/org/joni/Region.java +++ b/src/org/joni/Region.java @@ -33,6 +33,7 @@ public static Region newRegion(int begin, int end) { return new SingleRegion(begin, end); } + @Override public abstract Region clone(); public abstract int getNumRegs(); @@ -45,6 +46,7 @@ public static Region newRegion(int begin, int end) { public abstract int setEnd(int index, int value); + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Region: \n"); diff --git a/src/org/joni/Search.java b/src/org/joni/Search.java index 5c729fd..9616d5a 100644 --- a/src/org/joni/Search.java +++ b/src/org/joni/Search.java @@ -297,7 +297,7 @@ final int search(Matcher matcher, byte[]text, int textP, int adjustText, int tex s--; } return -1; - }; + } }; static final Forward BM_FORWARD = new Forward() { diff --git a/src/org/joni/SingleRegion.java b/src/org/joni/SingleRegion.java index a99bf3b..3064264 100644 --- a/src/org/joni/SingleRegion.java +++ b/src/org/joni/SingleRegion.java @@ -32,36 +32,43 @@ public SingleRegion(int begin, int end) { this.end = end; } + @Override public int getNumRegs() { return 1; } + @Override public SingleRegion clone() { SingleRegion region = new SingleRegion(beg, end); if (getCaptureTree() != null) region.setCaptureTree(getCaptureTree().cloneTree()); return region; } + @Override public int getBeg(int index) { if (index != 0) throw new IndexOutOfBoundsException(""+index); return beg; } + @Override public int setBeg(int index, int value) { if (index != 0) throw new IndexOutOfBoundsException(""+index); return beg = value; } + @Override public int getEnd(int index) { if (index != 0) throw new IndexOutOfBoundsException(""+index); return end; } + @Override public int setEnd(int index, int value) { if (index != 0) throw new IndexOutOfBoundsException(""+index); return end = value; } + @Override void clear() { beg = end = REGION_NOTPOS; } diff --git a/src/org/joni/StackMachine.java b/src/org/joni/StackMachine.java index 2782600..71adff2 100644 --- a/src/org/joni/StackMachine.java +++ b/src/org/joni/StackMachine.java @@ -132,6 +132,7 @@ private void stateCheckMark() { // STATE_CHECK_BUFF_INIT private static final int STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE = 16; + @Override protected final void stateCheckBuffInit(int strLength, int offset, int stateNum) { if (stateNum > 0 && strLength >= Config.CHECK_STRING_THRESHOLD_LEN) { int size = ((strLength + 1) * stateNum + 7) >>> 3; @@ -156,6 +157,7 @@ protected final void stateCheckBuffInit(int strLength, int offset, int stateNum) } } + @Override protected final void stateCheckBuffClear() { stateCheckBuff = null; stateCheckBuffSize = 0; @@ -549,7 +551,7 @@ protected final int nullCheckMemStRec(int id, int s) { isNull = 0; break; } else if (endp != s) { - isNull = -1;; /* empty, but position changed */ + isNull = -1; /* empty, but position changed */ } } k++; diff --git a/src/org/joni/UnsetAddrList.java b/src/org/joni/UnsetAddrList.java index eb0bf64..c0b64f7 100644 --- a/src/org/joni/UnsetAddrList.java +++ b/src/org/joni/UnsetAddrList.java @@ -55,6 +55,7 @@ public void fix(Regex regex) { } } + @Override public String toString() { StringBuilder value = new StringBuilder(); if (num > 0) { diff --git a/src/org/joni/WarnCallback.java b/src/org/joni/WarnCallback.java index 60bf578..d79d6a1 100644 --- a/src/org/joni/WarnCallback.java +++ b/src/org/joni/WarnCallback.java @@ -24,12 +24,14 @@ */ public interface WarnCallback { WarnCallback DEFAULT = new WarnCallback() { - public void warn(String message) { + @Override + public void warn(String message) { System.err.println(message); } }; WarnCallback NONE = new WarnCallback() { + @Override public void warn(String message) { } }; diff --git a/src/org/joni/ast/Node.java b/src/org/joni/ast/Node.java index fc3b50e..759f091 100644 --- a/src/org/joni/ast/Node.java +++ b/src/org/joni/ast/Node.java @@ -44,7 +44,7 @@ protected void setChild(Node tgt){ protected Node getChild(){ // default definition return null; - }; + } public void replaceWith(Node with) { with.parent = parent; @@ -59,6 +59,7 @@ public String getAddressName() { return getName() + ":0x" + Integer.toHexString(System.identityHashCode(this)); } + @Override public final String toString() { StringBuilder s = new StringBuilder(); s.append("<" + getAddressName() + " (" + (parent == null ? "NULL" : parent.getAddressName()) + ")>"); diff --git a/test/org/joni/test/TestInterrupt.java b/test/org/joni/test/TestInterrupt.java index 0656dc4..48034ec 100755 --- a/test/org/joni/test/TestInterrupt.java +++ b/test/org/joni/test/TestInterrupt.java @@ -58,8 +58,10 @@ public Syntax syntax() { } @org.junit.Test + @Override public void test() throws Exception { interruptAfter(new InterruptibleRunnable() { + @Override public void run() throws InterruptedException { x2s("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0); @@ -69,6 +71,7 @@ public void run() throws InterruptedException { final int status[] = new int[1]; interruptAfter(new InterruptibleRunnable() { + @Override public void run() throws InterruptedException { try { x2s("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", diff --git a/test/org/joni/test/TestU.java b/test/org/joni/test/TestU.java index f0ca360..f8b027f 100755 --- a/test/org/joni/test/TestU.java +++ b/test/org/joni/test/TestU.java @@ -69,13 +69,16 @@ private String uconv(byte []bytes, int len) { return sb.toString(); } + @Override protected String repr(byte[]bytes) { return uconv(bytes, ulen(bytes)); } + @Override protected int length(byte[]bytes) { return ulen(bytes); } + @Override public void test() throws Exception { x2s("\000\000", "\000\000", 0, 0);