[Git][java-team/jruby-joni][debian/sid] 11 commits: [maven-release-plugin] prepare for next development iteration

Hideki Yamane (@henrich) gitlab at salsa.debian.org
Tue Mar 7 13:50:37 GMT 2023



Hideki Yamane pushed to branch debian/sid at Debian Java Maintainers / jruby-joni


Commits:
99ea1930 by Thomas E. Enebo at 2023-01-27T10:26:54-06:00
[maven-release-plugin] prepare for next development iteration

- - - - -
6925301e by Charles Oliver Nutter at 2023-02-04T11:25:48-06:00
Add a CI action
- - - - -
ad492d4c by Charles Oliver Nutter at 2023-02-04T12:26:19-05:00
Encapsulate fields of Region

There are optimizations we could make here if the beg and end
fields were encapsulated that are impossible with them public. The
other fields should just be encapsulated as good practice.

- - - - -
a826018e by Charles Oliver Nutter at 2023-02-04T13:52:04-05:00
Merge pull request #58 from headius/encapsulate_region

Encapsulate fields of Region
- - - - -
f9e3936c by Charles Oliver Nutter at 2023-02-04T13:19:47-06:00
[maven-release-plugin] prepare release joni-2.1.47

- - - - -
43adfb96 by Charles Oliver Nutter at 2023-02-04T13:19:49-06:00
[maven-release-plugin] prepare for next development iteration

- - - - -
0afc3069 by Charles Oliver Nutter at 2023-02-05T08:33:01+01:00
Move to a factory method for Region instances

In order to specialize Region based on width, we need consumers to
stop instantiating it directly. This commit deprecates the two
Region constructors, replacing them with newRegion factory methods
we can use in the future to construct specialized Region shapes.

This feature will have to be in the wild for some time to allow
JRuby and libraries like strscan to move to the updated API. At
some point in the future, we can major rev joni and remove the
deprecated constructors and public fields.

- - - - -
9a702c66 by Charles Oliver Nutter at 2023-02-05T02:35:46-05:00
Merge pull request #60 from headius/region_factory

Move to a factory method for Region instances
- - - - -
aee63322 by Charles Oliver Nutter at 2023-02-06T08:54:13-06:00
[maven-release-plugin] prepare release joni-2.1.48

- - - - -
61fb8081 by Hideki Yamane at 2023-03-07T22:42:04+09:00
Merge tag 'joni-2.1.48' into debian/sid

[maven-release-plugin]  copy for tag joni-2.1.48

- - - - -
54cb0099 by Hideki Yamane at 2023-03-07T22:43:32+09:00
new upstream release

- - - - -


8 changed files:

- + .github/workflows/maven.yml
- debian/changelog
- pom.xml
- src/org/joni/ByteCodeMachine.java
- src/org/joni/Matcher.java
- src/org/joni/Regex.java
- src/org/joni/Region.java
- test/org/joni/test/Test.java


Changes:

=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,31 @@
+# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Java CI with Maven
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout at v3
+    - name: Set up JDK 11
+      uses: actions/setup-java at v3
+      with:
+        java-version: '11'
+        distribution: 'temurin'
+        cache: maven
+    - name: Build with Maven
+      run: mvn -B package --file pom.xml


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+jruby-joni (2.1.48-1) unstable; urgency=medium
+
+  * New upstream release
+
+ -- Hideki Yamane <henrich at debian.org>  Tue, 07 Mar 2023 22:43:26 +0900
+
 jruby-joni (2.1.46-1) unstable; urgency=medium
 
   * New upstream release


=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
   <groupId>org.jruby.joni</groupId>
   <artifactId>joni</artifactId>
   <packaging>jar</packaging>
-  <version>2.1.46</version>
+  <version>2.1.48</version>
   <name>Joni</name>
   <description>
     Java port of Oniguruma: http://www.geocities.jp/kosako3/oniguruma


=====================================
src/org/joni/ByteCodeMachine.java
=====================================
@@ -98,10 +98,10 @@ class ByteCodeMachine extends StackMachine {
 
     private void checkCaptureHistory(Region region) {
         CaptureTreeNode node;
-        if (region.historyRoot == null) {
-            node = region.historyRoot = new CaptureTreeNode();
+        if (region.getCaptureTree() == null) {
+            node = region.setCaptureTree(new CaptureTreeNode());
         } else {
-            node = region.historyRoot;
+            node = region.getCaptureTree();
             node.clear();
         }
 
@@ -111,7 +111,7 @@ class ByteCodeMachine extends StackMachine {
         node.end = s      - str;
 
         stkp = 0;
-        makeCaptureHistoryTree(region.historyRoot);
+        makeCaptureHistoryTree(region.getCaptureTree());
     }
 
     private byte[]cfbuf;
@@ -470,16 +470,17 @@ class ByteCodeMachine extends StackMachine {
             final Region region = msaRegion;
             if (region != null) {
                 // USE_POSIX_REGION_OPTION ... else ...
-                region.beg[0] = msaBegin = ((pkeep > s) ? s : pkeep) - str;
-                region.end[0] = msaEnd   = s      - str;
+                region.setBeg(0, msaBegin = ((pkeep > s) ? s : pkeep) - str);
+                region.setEnd(0, msaEnd   = s      - str);
                 for (int i = 1; i <= regex.numMem; i++) {
                     int me = repeatStk[memEndStk + i];
                     if (me != INVALID_INDEX) {
                         int ms = repeatStk[memStartStk + i];
-                        region.beg[i] = (bsAt(regex.btMemStart, i) ? stack[ms].getMemPStr() : ms) - str;
-                        region.end[i] = (bsAt(regex.btMemEnd, i) ? stack[me].getMemPStr() : me) - str;
+                        region.setBeg(i, (bsAt(regex.btMemStart, i) ? stack[ms].getMemPStr() : ms) - str);
+                        region.setEnd(i, (bsAt(regex.btMemEnd, i) ? stack[me].getMemPStr() : me) - str);
                     } else {
-                        region.beg[i] = region.end[i] = Region.REGION_NOTPOS;
+                        region.setBeg(i, Region.REGION_NOTPOS);
+                        region.setEnd(i, Region.REGION_NOTPOS);
                     }
                 }
 


=====================================
src/org/joni/Matcher.java
=====================================
@@ -71,7 +71,7 @@ public abstract class Matcher extends IntHolder {
     }
 
     public final Region getEagerRegion() {
-        return msaRegion != null ? msaRegion : new Region(msaBegin, msaEnd);
+        return msaRegion != null ? msaRegion : Region.newRegion(msaBegin, msaEnd);
     }
 
     public final int getBegin() {


=====================================
src/org/joni/Regex.java
=====================================
@@ -164,7 +164,7 @@ public final class Regex {
     }
 
     public Matcher matcher(byte[]bytes, int p, int end) {
-        return factory.create(this, numMem == 0 ? null : new Region(numMem + 1), bytes, p, end);
+        return factory.create(this, numMem == 0 ? null : Region.newRegion(numMem + 1), bytes, p, end);
     }
 
     public Matcher matcherNoRegion(byte[]bytes, int p, int end) {
@@ -244,7 +244,7 @@ public final class Regex {
         default:
             if (region != null) {
                 for (int i = e.backNum - 1; i >= 0; i--) {
-                    if (region.beg[e.backRefs[i]] != Region.REGION_NOTPOS) return e.backRefs[i];
+                    if (region.getBeg(e.backRefs[i]) != Region.REGION_NOTPOS) return e.backRefs[i];
                 }
             }
             return e.backRefs[e.backNum - 1];


=====================================
src/org/joni/Region.java
=====================================
@@ -22,23 +22,42 @@ package org.joni;
 public final class Region {
     static final int REGION_NOTPOS = -1;
 
+    @Deprecated
     public final int numRegs;
-    public final int[]beg;
-    public final int[]end;
+    @Deprecated
+    public final int[] beg;
+    @Deprecated
+    public final int[] end;
+    @Deprecated
     public CaptureTreeNode historyRoot;
 
+    @SuppressWarnings("deprecation")
+    public static Region newRegion(int num) {
+        return new Region(num);
+    }
+
+    @SuppressWarnings("deprecation")
+    public static Region newRegion(int begin, int end) {
+        return new Region(begin, end);
+    }
+
+    @Deprecated
+    @SuppressWarnings("deprecation")
     public Region(int num) {
         this.numRegs = num;
         this.beg = new int[num];
         this.end = new int[num];
     }
 
+    @Deprecated
+    @SuppressWarnings("deprecation")
     public Region(int begin, int end) {
         this.numRegs = 1;
         this.beg = new int[]{begin};
         this.end = new int[]{end};
     }
 
+    @SuppressWarnings("deprecation")
     public Region clone() {
         Region region = new Region(numRegs);
         System.arraycopy(beg, 0, region.beg, 0, beg.length);
@@ -47,6 +66,32 @@ public final class Region {
         return region;
     }
 
+    @SuppressWarnings("deprecation")
+    public int getNumRegs() {
+        return numRegs;
+    }
+
+    @SuppressWarnings("deprecation")
+    public int getBeg(int index) {
+        return beg[index];
+    }
+
+    @SuppressWarnings("deprecation")
+    public int setBeg(int index, int value) {
+        return beg[index] = value;
+    }
+
+    @SuppressWarnings("deprecation")
+    public int getEnd(int index) {
+        return end[index];
+    }
+
+    @SuppressWarnings("deprecation")
+    public int setEnd(int index, int value) {
+        return end[index] = value;
+    }
+
+    @SuppressWarnings("deprecation")
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("Region: \n");
@@ -54,10 +99,17 @@ public final class Region {
         return sb.toString();
     }
 
+    @SuppressWarnings("deprecation")
     CaptureTreeNode getCaptureTree() {
         return historyRoot;
     }
 
+    @SuppressWarnings("deprecation")
+    CaptureTreeNode setCaptureTree(CaptureTreeNode ctn) {
+        return this.historyRoot = ctn;
+    }
+
+    @SuppressWarnings("deprecation")
     void clear() {
         for (int i=0; i<beg.length; i++) {
             beg[i] = end[i] = REGION_NOTPOS;


=====================================
test/org/joni/test/Test.java
=====================================
@@ -177,13 +177,13 @@ public abstract class Test {
                 Config.log.println("FAIL(NOT): " + reprTest(pattern, str, option));
                 nfail++;
             } else {
-                if (region.beg[mem] == from && region.end[mem] == to) {
+                if (region.getBeg(mem) == from && region.getEnd(mem) == to) {
                     if (VERBOSE) Config.log.println("OK: " + reprTest(pattern, str, option));
                     nsucc++;
                 } else {
                     Config.log.println("FAIL: " + reprTest(pattern, str, option) + " GPOS: " + gpos + " Start: "
-                            + searchStart + " Groups: [Exp " + from + "-" + to + ", Act " + region.beg[mem] + "-"
-                            + region.end[mem] + "]");
+                            + searchStart + " Groups: [Exp " + from + "-" + to + ", Act " + region.getBeg(mem) + "-"
+                            + region.getEnd(mem) + "]");
                     nfail++;
                 }
             }



View it on GitLab: https://salsa.debian.org/java-team/jruby-joni/-/compare/15f40c705113bef780e0c01cffa2536743a7815e...54cb0099c729c6e8ab413ea7f86cf65ed338737e

-- 
View it on GitLab: https://salsa.debian.org/java-team/jruby-joni/-/compare/15f40c705113bef780e0c01cffa2536743a7815e...54cb0099c729c6e8ab413ea7f86cf65ed338737e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230307/d66abed6/attachment.htm>


More information about the pkg-java-commits mailing list