Skip to content
Snippets Groups Projects
Commit 93115a87 authored by Jan Henning's avatar Jan Henning
Browse files

Bug 1485439 - Upgrade to Java 8. r=nalexander,jchen

Doing so allow to use try-with-resources on all API levels supported by us, not
just starting from API19.

Unfortunately this step also introduces some additional ambiguities in overload
resolution, which means that one of GeckoResult's "then" overloads needs to be
renamed.

Differential Revision: https://phabricator.services.mozilla.com/D4887

--HG--
extra : rebase_source : 7173395484a9616ce739e9d2ba3aa0b8410be386
extra : source : 66955d05bb86c25b1fcb81d60b38be95018d09ca
parent 449ca95b
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,7 @@ apply plugin: 'idea'
idea {
project {
languageLevel = '1.7'
languageLevel = '1.8'
}
module {
......
......@@ -36,8 +36,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
......@@ -71,6 +71,7 @@ android {
// shrinkResources true
minifyEnabled true
proguardFile "${topsrcdir}/mobile/android/config/proguard/proguard.cfg"
testProguardFile "${topsrcdir}/mobile/android/config/proguard/proguard-robocop.cfg"
}
release configureMinifyClosure
if (mozconfig.substs.MOZILLA_OFFICIAL) {
......
# Android issue #77785017: Desugar runtime not in Proguard libraryjars for test variants
-dontwarn com.google.devtools.build.android.desugar.runtime.**
......@@ -113,8 +113,8 @@ android {
project.configureProductFlavors()
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
......
......@@ -208,7 +208,7 @@ public class GeckoResultTest {
}
};
deferred.then(new OnExceptionListener<Void>() {
deferred.exceptionally(new OnExceptionListener<Void>() {
@Override
public GeckoResult<Void> onException(Throwable error) {
assertThat("Exception should match", error, equalTo(boom));
......@@ -246,13 +246,13 @@ public class GeckoResultTest {
assertThat("Value should match", value, equalTo(42.0f));
return GeckoResult.fromException(new Exception("boom"));
}
}).then(new OnExceptionListener<Void>() {
}).exceptionally(new OnExceptionListener<Void>() {
@Override
public GeckoResult<Void> onException(Throwable error) {
assertThat("Error message should match", error.getMessage(), equalTo("boom"));
throw new MockException();
}
}).then(new OnExceptionListener<Void>() {
}).exceptionally(new OnExceptionListener<Void>() {
@Override
public GeckoResult<Void> onException(Throwable exception) {
assertThat("Exception should be MockException", exception, instanceOf(MockException.class));
......@@ -269,7 +269,7 @@ public class GeckoResultTest {
public void then_propagatedValue() {
// The first GeckoResult only has an exception listener, so when the value 42 is
// propagated to subsequent GeckoResult instances, the propagated value is coerced to null.
GeckoResult.fromValue(42).then(new OnExceptionListener<String>() {
GeckoResult.fromValue(42).exceptionally(new OnExceptionListener<String>() {
@Override
public GeckoResult<String> onException(Throwable exception) throws Throwable {
return null;
......@@ -330,7 +330,7 @@ public class GeckoResultTest {
public GeckoResult<Void> onValue(String value) throws Throwable {
return null;
}
}).then(new OnExceptionListener<Void>() {
}).exceptionally(new OnExceptionListener<Void>() {
@Override
public GeckoResult<Void> onException(Throwable exception) throws Throwable {
assertThat("Exception should be expected",
......
......@@ -251,7 +251,7 @@ public class GeckoResult<T> {
* @param <U> Type of the new result that is returned by the listener.
* @return A new {@link GeckoResult} that the listener will complete.
*/
public @NonNull <U> GeckoResult<U> then(@NonNull final OnExceptionListener<U> exceptionListener) {
public @NonNull <U> GeckoResult<U> exceptionally(@NonNull final OnExceptionListener<U> exceptionListener) {
return then(null, exceptionListener);
}
......
......@@ -17,6 +17,11 @@ android {
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
......
......@@ -12,8 +12,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment