Fix compilation in Java 9

This commit is contained in:
Eric Anderson 2018-03-28 17:13:39 -07:00 committed by GitHub
parent bdecdaea22
commit 4e82e62eaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 5 deletions

View File

@ -36,12 +36,17 @@ script:
- ./gradlew check :grpc-all:jacocoTestReport
after_success:
- if \[ "$TRAVIS_OS_NAME" = linux \]; then ./gradlew :grpc-all:coveralls; fi
# Upload to coveralls once, instead of for each job in the matrix
- if \[\[ "$TRAVIS_JOB_NUMBER" == *.1 \]\]; then ./gradlew :grpc-all:coveralls; fi
- bash <(curl -s https://codecov.io/bash)
os:
- linux
jdk:
- oraclejdk8
- oraclejdk9
notifications:
email: false

View File

@ -37,6 +37,7 @@ dependencies {
libraries.netty_tcnative,
libraries.netty_epoll,
libraries.math
compileOnly libraries.javax_annotation
}
compileJava {

View File

@ -192,6 +192,7 @@ subprojects {
gson: "com.google.code.gson:gson:2.7",
guava: "com.google.guava:guava:${guavaVersion}",
hpack: 'com.twitter:hpack:0.10.1',
javax_annotation: 'javax.annotation:javax.annotation-api:1.2',
jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.9.0',
google_api_protos: 'com.google.api.grpc:proto-google-common-protos:1.0.0',

View File

@ -53,11 +53,20 @@ public class AttributesTest {
}
@Test
@SuppressWarnings("BoxedPrimitiveConstructor")
public void valueEquality() {
Attributes.Key<Integer> key = Attributes.Key.of("ints");
Integer v1 = new Integer(100000);
Integer v2 = new Integer(100000);
class EqualObject {
@Override public boolean equals(Object o) {
return o instanceof EqualObject;
}
@Override public int hashCode() {
return 42;
}
}
Attributes.Key<EqualObject> key = Attributes.Key.of("ints");
EqualObject v1 = new EqualObject();
EqualObject v2 = new EqualObject();
assertNotSame(v1, v2);
assertEquals(v1, v2);

View File

@ -37,6 +37,7 @@ dependencies {
compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
compileOnly "javax.annotation:javax.annotation-api:1.2"
// Used for TLS in HelloWorldServerTls
compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"

View File

@ -17,6 +17,7 @@ dependencies {
project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.protobuf
compileOnly libraries.javax_annotation
testCompile libraries.truth,
project(':grpc-core').sourceSets.test.output
}

View File

@ -29,6 +29,7 @@ dependencies {
libraries.mockito,
libraries.oauth_client,
libraries.truth
compileOnly libraries.javax_annotation
runtime libraries.opencensus_impl,
libraries.netty_tcnative
testCompile project(':grpc-context').sourceSets.test.output

View File

@ -24,6 +24,7 @@ dependencies {
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
compileOnly libraries.javax_annotation
testCompile project(':grpc-testing'),
libraries.netty_epoll // for DomainSocketAddress
signature "org.codehaus.mojo.signature:java16:1.1@signature"

View File

@ -16,6 +16,7 @@ buildscript {
dependencies {
compile project(':grpc-protobuf'),
project(':grpc-stub')
compileOnly libraries.javax_annotation
testCompile libraries.truth
}