Skip to content

Commit

Permalink
bump master (3.0-snapshot) to java 8
Browse files Browse the repository at this point in the history
Closes #13314

Squashed commit of the following:

commit 0e2d6c8
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 12:49:51 2015 -0400

    re-enable the rest of this test, as its one method that hangs

commit 04dc6b6
Merge: 2b12805 52945b2
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 12:48:55 2015 -0400

    Merge branch 'master' into java8

commit 2b12805
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 12:28:07 2015 -0400

    more jsr166e removal

commit 5826feb
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 12:15:13 2015 -0400

    disable broken test

commit aabd88b
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 12:11:12 2015 -0400

    Disable broken test

commit 8634633
Author: Robert Muir <rmuir@apache.org>
Date:   Thu Sep 3 11:38:32 2015 -0400

    bump master (3.0-snapshot) to java 8
  • Loading branch information
rmuir committed Sep 3, 2015
1 parent 52945b2 commit 1131433
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 1,138 deletions.
7 changes: 0 additions & 7 deletions core/pom.xml
Expand Up @@ -191,13 +191,6 @@
<optional>true</optional>
</dependency>

<!-- remove this for java 8 -->
<dependency>
<groupId>com.twitter</groupId>
<artifactId>jsr166e</artifactId>
<version>1.1.0</version>
</dependency>

</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/assemblies/common-bin.xml
@@ -1,5 +1,6 @@
<component>
<dependencySets>
<!-- TODO: wtf is this file doing, is it still used? must we list all deps here? -->
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useTransitiveFiltering>true</useTransitiveFiltering>
Expand All @@ -24,7 +25,6 @@
<include>com.github.spullara.mustache.java:compiler</include>
<include>com.tdunning:t-digest</include>
<include>commons-cli:commons-cli</include>
<include>com.twitter:jsr166e</include>
<include>org.hdrhistogram:HdrHistogram</include>
</includes>
</dependencySet>
Expand Down
Expand Up @@ -122,7 +122,6 @@ public void checkExit(int status) {
static {
Map<Pattern,String> m = new IdentityHashMap<>();
m.put(Pattern.compile(".*lucene-core-.*\\.jar$"), "es.security.jar.lucene.core");
m.put(Pattern.compile(".*jsr166e-.*\\.jar$"), "es.security.jar.twitter.jsr166e");
m.put(Pattern.compile(".*securemock-.*\\.jar$"), "es.security.jar.elasticsearch.securemock");
SPECIAL_JARS = Collections.unmodifiableMap(m);
}
Expand Down
Expand Up @@ -107,7 +107,7 @@ public static Iterable<String> files(SegmentInfos infos) throws IOException {
for (SegmentCommitInfo info : infos) {
list.add(info.files());
}
return Iterables.concat(list.toArray(new Collection[0]));
return Iterables.concat(list);
}

/**
Expand Down
Expand Up @@ -19,7 +19,7 @@

package org.elasticsearch.common.metrics;

import com.twitter.jsr166e.LongAdder;
import java.util.concurrent.atomic.LongAdder;

/**
*/
Expand Down
Expand Up @@ -19,7 +19,7 @@

package org.elasticsearch.common.metrics;

import com.twitter.jsr166e.LongAdder;
import java.util.concurrent.atomic.LongAdder;

import java.util.concurrent.TimeUnit;

Expand Down
Expand Up @@ -19,7 +19,7 @@

package org.elasticsearch.common.metrics;

import com.twitter.jsr166e.LongAdder;
import java.util.concurrent.atomic.LongAdder;

/**
*/
Expand Down
Expand Up @@ -19,9 +19,9 @@

package org.elasticsearch.common.metrics;

import com.twitter.jsr166e.LongAdder;
import org.elasticsearch.common.util.concurrent.FutureUtils;

import java.util.concurrent.atomic.LongAdder;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down
Expand Up @@ -470,7 +470,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(Fields._SCORE, score);
}
for (SearchHitField field : metaFields) {
builder.field(field.name(), field.value());
builder.field(field.name(), (Object) field.value());
}
if (source != null) {
XContentHelper.writeRawField("_source", source, builder, params);
Expand Down
Expand Up @@ -112,6 +112,7 @@ public void readFrom(StreamInput in) throws IOException {
final int size = in.readVInt();
suggestions = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
// TODO: remove these complicated generics
Suggestion<? extends Entry<? extends Option>> suggestion;
final int type = in.readVInt();
switch (type) {
Expand All @@ -125,7 +126,7 @@ public void readFrom(StreamInput in) throws IOException {
suggestion = new PhraseSuggestion();
break;
default:
suggestion = new Suggestion<>();
suggestion = new Suggestion<Entry<? extends Option>>();
break;
}
suggestion.readFrom(in);
Expand Down
Expand Up @@ -36,12 +36,6 @@ grant codeBase "${es.security.jar.lucene.core}" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
};

grant codeBase "${es.security.jar.twitter.jsr166e}" {
// needed for LongAdder etc
// TODO: remove this in java 8!
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
};

grant codeBase "${es.security.jar.elasticsearch.securemock}" {
// needed to support creation of mocks
permission java.lang.RuntimePermission "reflectionFactoryAccess";
Expand Down
Expand Up @@ -21,6 +21,7 @@

import com.google.common.base.Predicate;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
Expand Down
Expand Up @@ -85,7 +85,7 @@ public void testBasic() throws Exception {
client().prepareIndex("test", "doc", "1").setSource("foo", 4).setRefresh(true).get();
SearchResponse rsp = buildRequest("doc['foo'] + 1").get();
assertEquals(1, rsp.getHits().getTotalHits());
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue());
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
}

public void testBasicUsingDotValue() throws Exception {
Expand All @@ -94,7 +94,7 @@ public void testBasicUsingDotValue() throws Exception {
client().prepareIndex("test", "doc", "1").setSource("foo", 4).setRefresh(true).get();
SearchResponse rsp = buildRequest("doc['foo'].value + 1").get();
assertEquals(1, rsp.getHits().getTotalHits());
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue());
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
}

public void testScore() throws Exception {
Expand Down Expand Up @@ -126,23 +126,23 @@ public void testDateMethods() throws Exception {
SearchResponse rsp = buildRequest("doc['date0'].getSeconds() - doc['date0'].getMinutes()").get();
assertEquals(2, rsp.getHits().getTotalHits());
SearchHits hits = rsp.getHits();
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
assertEquals(-11.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(-11.0, hits.getAt(1).field("foo").getValue(), 0.0D);
rsp = buildRequest("doc['date0'].getHourOfDay() + doc['date1'].getDayOfMonth()").get();
assertEquals(2, rsp.getHits().getTotalHits());
hits = rsp.getHits();
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
assertEquals(24.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(24.0, hits.getAt(1).field("foo").getValue(), 0.0D);
rsp = buildRequest("doc['date1'].getMonth() + 1").get();
assertEquals(2, rsp.getHits().getTotalHits());
hits = rsp.getHits();
assertEquals(9.0, hits.getAt(0).field("foo").getValue());
assertEquals(10.0, hits.getAt(1).field("foo").getValue());
assertEquals(9.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(10.0, hits.getAt(1).field("foo").getValue(), 0.0D);
rsp = buildRequest("doc['date1'].getYear()").get();
assertEquals(2, rsp.getHits().getTotalHits());
hits = rsp.getHits();
assertEquals(1985.0, hits.getAt(0).field("foo").getValue());
assertEquals(1983.0, hits.getAt(1).field("foo").getValue());
assertEquals(1985.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(1983.0, hits.getAt(1).field("foo").getValue(), 0.0D);
}

public void testMultiValueMethods() throws Exception {
Expand All @@ -158,57 +158,57 @@ public void testMultiValueMethods() throws Exception {
assertSearchResponse(rsp);
SearchHits hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
assertEquals(2.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.0, hits.getAt(2).field("foo").getValue());
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(2.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].sum()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(7.5, hits.getAt(0).field("foo").getValue());
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
assertEquals(6.0, hits.getAt(2).field("foo").getValue());
assertEquals(7.5, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(6.0, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].avg() + doc['double1'].avg()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(4.3, hits.getAt(0).field("foo").getValue());
assertEquals(8.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.5, hits.getAt(2).field("foo").getValue());
assertEquals(4.3, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(8.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(5.5, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].median()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(1.5, hits.getAt(0).field("foo").getValue());
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
assertEquals(1.25, hits.getAt(2).field("foo").getValue());
assertEquals(1.5, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(1.25, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].min()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(1.0, hits.getAt(0).field("foo").getValue());
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
assertEquals(-1.5, hits.getAt(2).field("foo").getValue());
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(-1.5, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].max()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.0, hits.getAt(2).field("foo").getValue());
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);

rsp = buildRequest("doc['double0'].sum()/doc['double0'].count()").get();
assertSearchResponse(rsp);
hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(2.5, hits.getAt(0).field("foo").getValue());
assertEquals(5.0, hits.getAt(1).field("foo").getValue());
assertEquals(1.5, hits.getAt(2).field("foo").getValue());
assertEquals(2.5, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(5.0, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
}

public void testInvalidDateMethodCall() throws Exception {
Expand Down Expand Up @@ -236,8 +236,8 @@ public void testSparseField() throws Exception {
ElasticsearchAssertions.assertSearchResponse(rsp);
SearchHits hits = rsp.getHits();
assertEquals(2, rsp.getHits().getTotalHits());
assertEquals(5.0, hits.getAt(0).field("foo").getValue());
assertEquals(1.0, hits.getAt(1).field("foo").getValue());
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(1.0, hits.getAt(1).field("foo").getValue(), 0.0D);
}

public void testMissingField() throws Exception {
Expand Down Expand Up @@ -267,9 +267,9 @@ public void testParams() throws Exception {
SearchResponse rsp = buildRequest(script, "a", 2, "b", 3.5, "c", 5000000000L).get();
SearchHits hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals(24.5, hits.getAt(0).field("foo").getValue());
assertEquals(9.5, hits.getAt(1).field("foo").getValue());
assertEquals(13.5, hits.getAt(2).field("foo").getValue());
assertEquals(24.5, hits.getAt(0).field("foo").getValue(), 0.0D);
assertEquals(9.5, hits.getAt(1).field("foo").getValue(), 0.0D);
assertEquals(13.5, hits.getAt(2).field("foo").getValue(), 0.0D);
}

public void testCompileFailure() {
Expand Down
Expand Up @@ -47,8 +47,11 @@
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
import static org.hamcrest.Matchers.*;

import org.apache.lucene.util.LuceneTestCase.AwaitsFix;

/**
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/13315")
public class InnerHitsIT extends ESIntegTestCase {

@Test
Expand Down
1 change: 0 additions & 1 deletion distribution/licenses/jsr166e-1.1.0.jar.sha1

This file was deleted.

0 comments on commit 1131433

Please sign in to comment.