This commit is contained in:
compile_success 2019-12-09 16:00:24 +08:00
parent e7b3e4ec11
commit 3e719a7585
3 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From c6497b79ee766206ba27c6b33391e1d5e572e662 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Wed, 2 May 2018 15:22:08 +0200
Subject: [PATCH] Avoid presizing arrays
Backported version of:
https://github.com/google/guava/commit/f89ece5721b2f637fe754937ff1f3c86d80bb196
Ignoring GWT, as we don't ship it. Using ArrayList, because
ImmutableLongArray is not available.
---
.../common/util/concurrent/AtomicDoubleArray.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java
index e939672..23a2535 100644
--- a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java
+++ b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java
@@ -17,7 +17,10 @@ import static java.lang.Double.doubleToRawLongBits;
import static java.lang.Double.longBitsToDouble;
import com.google.common.annotations.GwtIncompatible;
+import com.google.common.primitives.Longs;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.atomic.AtomicLongArray;
/**
@@ -261,13 +264,11 @@ public class AtomicDoubleArray implements java.io.Serializable {
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
- // Read in array length and allocate array
int length = s.readInt();
- this.longs = new AtomicLongArray(length);
-
- // Read in all elements in the proper order.
+ List<Long> builder = new ArrayList<Long>();
for (int i = 0; i < length; i++) {
- set(i, s.readDouble());
+ builder.add(doubleToRawLongBits(s.readDouble()));
}
+ this.longs = new AtomicLongArray(Longs.toArray(builder));
}
}
--
2.17.0

67
guava20.spec Normal file
View File

@ -0,0 +1,67 @@
Name: guava20
Version: 20.0
Release: 9
Summary: Google Libraries for Java
License: ASL 2.0 and CC0
URL: https://github.com/google/guava
Source0: https://github.com/google/guava/archive/v%{version}.tar.gz
BuildArch: noarch
Patch0000: 0001-Avoid-presizing-arrays.patch
BuildRequires: maven-local mvn(com.google.code.findbugs:jsr305) mvn(junit:junit)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
Provides: guava20-testlib = %{version}-%{release}
Obsoletes: guava20-testlib < %{version}-%{release}
%description
Guava is a set of core libraries that includes new collection types ,immutable collections,
a graph library, and utilities for concurrency, I/O, hashing, primitives, strings, and more.
%package help
Summary: API documentation for guava20
Provides: guava20-javadoc = %{version}-%{release}
Obsoletes: guava20-javadoc < %{version}-%{release}
%description help
Javadoc document for guava20.
%prep
%autosetup -n guava-%{version} -p1
find . -name '*.jar' -delete
%pom_disable_module guava-gwt
%pom_remove_plugin -r :animal-sniffer-maven-plugin
%pom_remove_plugin :maven-gpg-plugin
%pom_remove_dep jdk:srczip guava
%pom_remove_dep :caliper guava-tests
%mvn_package :guava-parent guava
%mvn_package :guava-tests __noinstall
%pom_remove_plugin -r :maven-javadoc-plugin
%pom_xpath_inject /pom:project/pom:build/pom:plugins/pom:plugin/pom:configuration/pom:instructions "<_nouses>true</_nouses>" guava/pom.xml
%pom_remove_dep -r :animal-sniffer-annotations
%pom_remove_dep -r :error_prone_annotations
%pom_remove_dep -r :j2objc-annotations
annotations=$(fgrep -hr -e com.google.j2objc.annotations -e com.google.errorprone.annotation -e org.codehaus.mojo.animal_sniffer \
| sort -u | sed 's/.*\.\([^.]*\);/\1/' | paste -sd\|)
find -name '*.java' | xargs sed -ri "s/^import .*\.($annotations);//;s/@($annotations)"'\>\s*(\((("[^"]*")|([^)]*))\))?//'
%build
%mvn_compat_version : 20.0 19.0 18.0 17.0 16.0.1 16.0 15.0 14.0.1 14.0 13.0.1 13.0 12.0.1 12.0 11.0.2 11.0.1 11.0 10.0.1 10.0
%mvn_alias :guava com.google.collections:google-collections com.google.guava:guava-jdk5
%mvn_build -s -f
%install
%mvn_install
%files -f .mfiles-guava -f .mfiles-guava-testlib
%license COPYING
%files help -f .mfiles-javadoc
%doc CONTRIBUTORS README*
%changelog
* Thu Dec 5 2019 zhujunhao <zhujunhao5@huawei.com> 20.0-9
- Package init

BIN
v20.0.tar.gz Normal file

Binary file not shown.