[Git][java-team/guava-mini][debian/sid] 8 commits: New upstream version 0.1.4

Mechtilde Stehmann (@mechtilde) gitlab at salsa.debian.org
Sun Dec 11 19:46:28 GMT 2022



Mechtilde Stehmann pushed to branch debian/sid at Debian Java Maintainers / guava-mini


Commits:
3c95659c by Mechtilde at 2022-10-14T16:42:33+02:00
New upstream version 0.1.4
- - - - -
31162dd6 by Mechtilde at 2022-10-14T16:42:40+02:00
Update upstream source from tag 'upstream/0.1.4'

Update to upstream version '0.1.4'
with Debian dir 77795bc711e8b5f426d9406d92b4442049e9c737
- - - - -
7fc7f558 by Mechtilde at 2022-11-16T19:51:32+01:00
Added Muilti-Arch

- - - - -
78a8ff92 by Mechtilde at 2022-11-16T19:52:41+01:00
Bumped standard version - no changes needed

- - - - -
c9db5c80 by Mechtilde at 2022-12-11T14:38:37+01:00
Added d/changelog before patching

- - - - -
9b4997e0 by Mechtilde at 2022-12-11T18:03:56+01:00
Subject: Disabled plug-ins

- - - - -
f0bc7ff9 by Mechtilde at 2022-12-11T20:29:06+01:00
Subject: Replace-bundle-by-jar

- - - - -
c375e9fb by Mechtilde at 2022-12-11T20:44:45+01:00
Prepared for uploading version 0.1.4

- - - - -


14 changed files:

- + .github/dependabot.yml
- + .github/workflows/ci.yml
- − .travis.yml
- README.md
- debian/changelog
- debian/control
- debian/maven.properties
- + debian/patches/01-Subject-Disabled-plug-ins.patch
- + debian/patches/02-Subject-Replace-bundle-by-jar.patch
- + debian/patches/series
- pom.xml
- src/main/java/com/github/davidmoten/guavamini/Lists.java
- + src/main/java/com/github/davidmoten/guavamini/Maps.java
- + src/test/java/com/github/davidmoten/guavamini/MapsTest.java


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+  - package-ecosystem: "maven" # See documentation for possible values
+    directory: "/" # Location of package manifests
+    schedule:
+      interval: "daily"


=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,23 @@
+name: Java CI
+
+on: [push]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy: 
+     matrix:
+      java: ['8', '11'] 
+    steps:
+      - uses: actions/checkout at v2
+      - name: Set up JDK ${{ matrix.java }} 
+        uses: actions/setup-java at v2
+        with:
+          java-version: ${{ matrix.java }} 
+          distribution: 'adopt'
+      - name: Build with Maven
+        run: mvn --batch-mode --update-snapshots verify
+      - uses: codecov/codecov-action at v1
+        with:
+          file: ./**/target/site/jacoco/jacoco.xml
+          name: codecov


=====================================
.travis.yml deleted
=====================================
@@ -1,3 +0,0 @@
-language: java
-jdk:
-  - openjdk8


=====================================
README.md
=====================================
@@ -1,10 +1,10 @@
 # guava-mini
-[![Travis CI](https://travis-ci.org/davidmoten/guava-mini.svg)](https://travis-ci.org/davidmoten/guava-mini)<br/>
+<a href="https://github.com/davidmoten/guava-mini/actions/workflows/ci.yml"><img src="https://github.com/davidmoten/guava-mini/actions/workflows/ci.yml/badge.svg"/></a><br/>
 [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.davidmoten/guava-mini/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.github.davidmoten/guava-mini)<br/>
+[![codecov](https://codecov.io/gh/davidmoten/guava-mini/branch/master/graph/badge.svg)](https://codecov.io/gh/davidmoten/guava-mini)<br/>
+Some popular utilities from Guava repackaged (with different package names but same class names and method names) into a little jar (15K) available on Maven Central.
 
-Some popular utilities from Guava repackaged (with different package names but same class names and method names) into a little jar (11K) available on Maven Central.
-
-Compatible with java 6 and later.
+Compatible with java 8 and later.
 
 Status: *on Maven Central*
 
@@ -21,6 +21,13 @@ Taken from Guava:
 * `Lists`: `newArrayList`
 * `Sets`: `newHashSet`
 
+Non-guava:
+
+* `Maps`: `hashMap`, `treeMap`, `linkedHashMap`
+```java
+Map<Integer, String> map = Maps.put(1, "hi").put(2, "there").build();
+```
+
 Getting started
 ------------------
 Add this dependency to your pom.xml:
@@ -28,6 +35,6 @@ Add this dependency to your pom.xml:
 <dependency>
   <groupId>com.github.davidmoten</groupId>
   <artifactId>guava-mini</artifactId>
-  <version>0.1.1</version>
+  <version>VERSION_HERE</version>
 </dependency>
 ```


=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+guava-mini (0.1.4-1) unstable; urgency=medium
+
+  [ Mechtilde ]
+  * [3c95659] New upstream version 0.1.4
+  * [7fc7f55] Added Muilti-Arch
+  * [78a8ff9] Bumped standard version - no changes needed
+  * [9b4997e] Subject: Disabled plug-ins
+  * [f0bc7ff] Subject: Replace-bundle-by-jar
+
+ -- Mechtilde Stehmann <mechtilde at debian.org>  Sun, 11 Dec 2022 20:44:12 +0100
+
 guava-mini (0.1.3-1) unstable; urgency=medium
 
   [ Mechtilde ]


=====================================
debian/control
=====================================
@@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 13)
  , default-jdk
  , maven-debian-helper (>= 2.1)
  , libmaven-bundle-plugin-java
-Standards-Version: 4.5.0
+Standards-Version: 4.6.1
 Rules-Requires-Root: no
 Vcs-Git: https://salsa.debian.org/java-team/guava-mini.git
 Vcs-Browser: https://salsa.debian.org/java-team/guava-mini
@@ -15,6 +15,7 @@ Homepage: https://github.com/davidmoten/guava-mini
 
 Package: libguava-mini-java
 Architecture: all
+Multi-Arch: foreign
 Depends: ${misc:Depends}, ${maven:Depends}
 Suggests: ${maven:OptionalDepends}
 Description: utilities from Guava


=====================================
debian/maven.properties
=====================================
@@ -2,5 +2,5 @@
 # For example:
 # maven.test.skip=true
 # project.build.sourceEncoding=UTF-8
-
+maven.compiler.source=8
 maven.test.skip=true


=====================================
debian/patches/01-Subject-Disabled-plug-ins.patch
=====================================
@@ -0,0 +1,31 @@
+From: Mechtilde <mechtilde at debian.org>
+Date: Sun, 11 Dec 2022 17:53:11 +0100
+Subject: Subject: Disabled plug-ins
+
+Forwarded: No
+---
+ pom.xml | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pom.xml b/pom.xml
+index b3516f8..9bde7da 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -105,7 +105,7 @@
+ 
+ 
+     <build>
+-        <plugins>
++<!--        <plugins>
+             <plugin>
+                 <artifactId>maven-compiler-plugin</artifactId>
+                 <version>3.8.1</version>
+@@ -160,7 +160,7 @@
+                 </executions>
+             </plugin>
+ 
+-        </plugins>
++        </plugins> -->
+     </build>
+     <reporting>
+         <excludeDefaults>true</excludeDefaults>


=====================================
debian/patches/02-Subject-Replace-bundle-by-jar.patch
=====================================
@@ -0,0 +1,22 @@
+From: Mechtilde <mechtilde at debian.org>
+Date: Sun, 11 Dec 2022 20:25:38 +0100
+Subject: Subject: Replace-bundle-by-jar
+
+Forwarded: No
+---
+ pom.xml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pom.xml b/pom.xml
+index 9bde7da..98857d0 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -14,7 +14,7 @@
+ 
+     <name>${project.artifactId}</name>
+     <description>Classes taken from Guava</description>
+-    <packaging>bundle</packaging>
++    <packaging>jar</packaging>
+ 
+     <url>http://github.com/davidmoten/guava-mini</url>
+ 


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,2 @@
+01-Subject-Disabled-plug-ins.patch
+02-Subject-Replace-bundle-by-jar.patch


=====================================
pom.xml
=====================================
@@ -10,7 +10,7 @@
     </parent>
 
     <artifactId>guava-mini</artifactId>
-    <version>0.1.3</version>
+    <version>0.1.4</version>
 
     <name>${project.artifactId}</name>
     <description>Classes taken from Guava</description>
@@ -21,22 +21,18 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <maven.compiler.target>1.6</maven.compiler.target>
+        <maven.compiler.target>1.8</maven.compiler.target>
         <scm.url>scm:git:https://github.com/davidmoten/guava-mini.git</scm.url>
 
-        <cobertura.version>2.7</cobertura.version>
-        <checkstyle.version>2.13</checkstyle.version>
-        <findbugs.version>3.0.1</findbugs.version>
-        <javadoc.version>2.10.3</javadoc.version>
-        <pmd.version>3.4</pmd.version>
-        <jdepend.version>2.0-beta-2</jdepend.version>
-        <javancss.version>2.1</javancss.version>
-        <project.info.version>2.7</project.info.version>
-        <jxr.version>2.5</jxr.version>
+        <checkstyle.version>3.1.2</checkstyle.version>
+        <javadoc.version>3.2.0</javadoc.version>
+        <pmd.version>3.15.0</pmd.version>
+        <project.info.version>3.1.1</project.info.version>
+        <jxr.version>3.0.0</jxr.version>
         <taglist.version>2.4</taglist.version>
-        <m3.site.version>3.4</m3.site.version>
+        <m3.site.version>3.9.1</m3.site.version>
         <changelog.version>2.2</changelog.version>
-        <bundle.plugin.version>4.2.1</bundle.plugin.version>
+        <bundle.plugin.version>5.1.1</bundle.plugin.version>
         <coverage.reports.dir>${project.build.directory}/target/coverage-reports</coverage.reports.dir>
 
     </properties>
@@ -78,7 +74,7 @@
         <connection>${scm.url}</connection>
         <developerConnection>${scm.url}</developerConnection>
         <url>${scm.url}</url>
-        <tag>0.1.3</tag>
+        <tag>0.1.4</tag>
     </scm>
 
     <dependencies>
@@ -87,21 +83,21 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.12</version>
+            <version>4.13.2</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
-            <version>1.10.8</version>
+            <version>4.0.0</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>com.github.davidmoten</groupId>
             <artifactId>junit-extras</artifactId>
-            <version>0.3</version>
+            <version>0.4</version>
             <scope>test</scope>
         </dependency>
 
@@ -112,7 +108,7 @@
         <plugins>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.5.1</version>
+                <version>3.8.1</version>
                 <configuration>
                     <source>${maven.compiler.target}</source>
                     <target>${maven.compiler.target}</target>
@@ -130,19 +126,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>cobertura-maven-plugin</artifactId>
-                <version>${cobertura.version}</version>
-                <configuration>
-                    <aggregate>false</aggregate>
-                    <instrumentation>
-                        <excludes>
-                            <exclude>com/github/davidmoten/guava-mini/ImageSaver.class</exclude>
-                        </excludes>
-                    </instrumentation>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -152,6 +135,31 @@
                     <obrRepository>NONE</obrRepository>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.8.7</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>report</id>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                        <configuration>
+                            <excludes>
+                                <exclude>**/FileBasedSPSCQueueMemoryMapped*</exclude>
+                            </excludes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
         </plugins>
     </build>
     <reporting>
@@ -167,11 +175,6 @@
                     <aggregate>true</aggregate>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>cobertura-maven-plugin</artifactId>
-                <version>${cobertura.version}</version>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
@@ -189,26 +192,6 @@
                     <aggregate>true</aggregate>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>findbugs-maven-plugin</artifactId>
-                <version>${findbugs.version}</version>
-                <configuration>
-                    <xmlOutput>true</xmlOutput>
-                    <effort>Max</effort>
-                    <!--<excludeFilterFile>findbugs-exclude-filter-amsa.xml</excludeFilterFile> -->
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>jdepend-maven-plugin</artifactId>
-                <version>${jdepend.version}</version>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>javancss-maven-plugin</artifactId>
-                <version>${javancss.version}</version>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-project-info-reports-plugin</artifactId>
@@ -231,10 +214,6 @@
                     <aggregate>true</aggregate>
                 </configuration>
             </plugin>
-            <!-- commented this plugin out because cannot run offline (e.g. at home) -->
-            <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> 
-                <version>${changelog.version}</version> <configuration> <username>${svn.username}</username> <password>${svn.password}</password> 
-                </configuration> </plugin> -->
         </plugins>
     </reporting>
 


=====================================
src/main/java/com/github/davidmoten/guavamini/Lists.java
=====================================
@@ -13,7 +13,7 @@ public final class Lists {
         // cannot instantiate
     }
 
-    public static <E> ArrayList<E> newArrayList(E... elements) {
+    public static <E> ArrayList<E> newArrayList(@SuppressWarnings("unchecked") E... elements) {
         Preconditions.checkNotNull(elements);
         // Avoid integer overflow when a large array is passed in
         int capacity = computeArrayListCapacity(elements.length);


=====================================
src/main/java/com/github/davidmoten/guavamini/Maps.java
=====================================
@@ -0,0 +1,92 @@
+package com.github.davidmoten.guavamini;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.function.Function;
+
+public final class Maps {
+    
+    private Maps() {
+        // prevent instantiation
+    }
+
+    private static final int DEFAULT_INITIAL_SIZE = 16;
+    private static final Function<Integer, Map<Object, Object>> FACTORY_HASHMAP = //
+            size -> new HashMap<Object, Object>(size);
+    private static final Function<Integer, Map<Object, Object>> FACTORY_TREEMAP = //
+            size -> new TreeMap<Object, Object>();
+    private static final Function<Integer, Map<Object, Object>> FACTORY_LINKEDHASHMAP = //
+            size -> new LinkedHashMap<Object, Object>(size);
+
+    public static <K, V> Map<K, V> empty() {
+        return Collections.emptyMap();
+    }
+            
+    public static <K, V> MapBuilder<K, V> put(K key, V value) {
+        return hashMap().put(key, value);
+    }
+            
+    public static Builder treeMap() {
+        return new Builder(FACTORY_TREEMAP);
+    }
+    
+    public static Builder hashMap() {
+        return new Builder(FACTORY_HASHMAP);
+    }
+
+    public static Builder linkedHashMap() {
+        return new Builder(FACTORY_LINKEDHASHMAP);
+    }
+
+    public static Builder factory(
+            Function<? super Integer, ? extends Map<Object, Object>> factory) {
+        Preconditions.checkNotNull(factory, "factory cannot be null");
+        return new Builder(factory);
+    }
+
+    public static final class Builder {
+
+        private final Function<? super Integer, ? extends Map<Object, Object>> factory;
+        private int initialSize = DEFAULT_INITIAL_SIZE;
+
+        Builder(Function<? super Integer, ? extends Map<Object, Object>> factory) {
+            this.factory = factory;
+        }
+
+        public Builder initialSize(int initialSize) {
+            Preconditions.checkArgument(initialSize > 0, "initialSize must be greater than 0");
+            this.initialSize = initialSize;
+            return this;
+        }
+
+        @SuppressWarnings("unchecked")
+        public <K, V> MapBuilder<K, V> put(K key, V value) {
+            return new MapBuilder<K, V>((Map<K, V>) factory.apply(initialSize)).put(key, value);
+        }
+    }
+
+    public static final class MapBuilder<K, V> {
+        private final Map<K, V> map;
+
+        MapBuilder(Map<K, V> map) {
+            this.map = map;
+        }
+
+        public MapBuilder<K, V> put(K key, V value) {
+            map.put(key, value);
+            return this;
+        }
+
+        public Map<K, V> build() {
+            return map;
+        }
+
+        public Map<K, V> buildImmutable() {
+            return Collections.unmodifiableMap(map);
+        }
+    }
+
+}


=====================================
src/test/java/com/github/davidmoten/guavamini/MapsTest.java
=====================================
@@ -0,0 +1,90 @@
+package com.github.davidmoten.guavamini;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.junit.Test;
+
+import com.github.davidmoten.junit.Asserts;
+
+public class MapsTest {
+
+    @Test
+    public void isUtilityClass() {
+        Asserts.assertIsUtilityClass(Maps.class);
+    }
+
+    @Test
+    public void testHashMapSize1() {
+        Map<Integer, String> map = Maps.put(1, "hi").build();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        assertTrue(map instanceof HashMap);
+    }
+
+    @Test
+    public void testHashMapSize2() {
+        Map<Integer, String> map = Maps.put(1, "hi").put(2, "there").build();
+        assertEquals("hi", map.get(1));
+        assertEquals("there", map.get(2));
+        assertEquals(2, map.size());
+    }
+
+    @Test
+    public void testHashMapEmpty() {
+        Map<Integer, String> map = Maps.empty();
+        assertTrue(map.isEmpty());
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void testHashMapImmutable() {
+        Map<Integer, String> map = Maps.put(1, "hi").buildImmutable();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        map.put(2, "there");
+    }
+
+    @Test
+    public void testHashMapWithInitialSize() {
+        Map<Integer, String> map = Maps.hashMap().initialSize(4).put(1, "hi").build();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        assertTrue(map instanceof HashMap);
+    }
+
+    @Test
+    public void testCustomMapWithInitialSize() {
+        Map<Integer, String> map = Maps.factory(size -> new HashMap<Object, Object>(size))
+                .initialSize(4).put(1, "hi").build();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        assertTrue(map instanceof HashMap);
+    }
+
+    @Test
+    public void testTreeMapSize1() {
+        Map<Integer, String> map = Maps.treeMap().put(1, "hi").build();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        assertTrue(map instanceof TreeMap);
+    }
+
+    @Test
+    public void testLinkedHashMapMapSize1() {
+        Map<Integer, String> map = Maps.linkedHashMap().put(1, "hi").build();
+        assertEquals("hi", map.get(1));
+        assertEquals(1, map.size());
+        assertTrue(map instanceof LinkedHashMap);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testMapWithInitialSizeInvalid() {
+        Maps.hashMap().initialSize(0);
+    }
+
+}



View it on GitLab: https://salsa.debian.org/java-team/guava-mini/-/compare/87ed7adfebacc31a7eb6f9eb740b22762baa5e5c...c375e9fb8f7679dbe67134059765029130b3348f

-- 
View it on GitLab: https://salsa.debian.org/java-team/guava-mini/-/compare/87ed7adfebacc31a7eb6f9eb740b22762baa5e5c...c375e9fb8f7679dbe67134059765029130b3348f
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/20221211/9952c7e1/attachment.htm>


More information about the pkg-java-commits mailing list