-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't directly call ByteBuffer, etc. methods that have covariant retu…
…rns in Java 9+. Doing so produces a jar that doesn't work under Java 8. This CL addresses the currently existing problematic calls (by calling the methods on the supertype Buffer instead), but we should also add safeguards. The normal solution to this general problem is to use --release, but doing so here is complicated. For more information, see #3990 RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=327654073
- Loading branch information
Showing
20 changed files
with
220 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
android/guava/src/com/google/common/hash/Java8Compatibility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2020 The Guava Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.common.hash; | ||
|
||
import com.google.common.annotations.GwtIncompatible; | ||
import java.nio.Buffer; | ||
|
||
/** | ||
* Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See | ||
* https://github.com/google/guava/issues/3990 | ||
*/ | ||
@GwtIncompatible | ||
final class Java8Compatibility { | ||
static void clear(Buffer b) { | ||
b.clear(); | ||
} | ||
|
||
static void flip(Buffer b) { | ||
b.flip(); | ||
} | ||
|
||
static void limit(Buffer b, int limit) { | ||
b.limit(limit); | ||
} | ||
|
||
static void position(Buffer b, int position) { | ||
b.position(position); | ||
} | ||
|
||
private Java8Compatibility() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
android/guava/src/com/google/common/io/Java8Compatibility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2020 The Guava Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.common.io; | ||
|
||
import com.google.common.annotations.GwtIncompatible; | ||
import java.nio.Buffer; | ||
|
||
/** | ||
* Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See | ||
* https://github.com/google/guava/issues/3990 | ||
*/ | ||
@GwtIncompatible | ||
final class Java8Compatibility { | ||
static void clear(Buffer b) { | ||
b.clear(); | ||
} | ||
|
||
static void flip(Buffer b) { | ||
b.flip(); | ||
} | ||
|
||
static void limit(Buffer b, int limit) { | ||
b.limit(limit); | ||
} | ||
|
||
static void position(Buffer b, int position) { | ||
b.position(position); | ||
} | ||
|
||
private Java8Compatibility() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2020 The Guava Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.common.hash; | ||
|
||
import com.google.common.annotations.GwtIncompatible; | ||
import java.nio.Buffer; | ||
|
||
/** | ||
* Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See | ||
* https://github.com/google/guava/issues/3990 | ||
*/ | ||
@GwtIncompatible | ||
final class Java8Compatibility { | ||
static void clear(Buffer b) { | ||
b.clear(); | ||
} | ||
|
||
static void flip(Buffer b) { | ||
b.flip(); | ||
} | ||
|
||
static void limit(Buffer b, int limit) { | ||
b.limit(limit); | ||
} | ||
|
||
static void position(Buffer b, int position) { | ||
b.position(position); | ||
} | ||
|
||
private Java8Compatibility() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.