• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 package com.google.protobuf;
9 
10 import java.nio.Buffer;
11 
12 /**
13  * Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See
14  * https://github.com/protocolbuffers/protobuf/issues/11393
15  *
16  * <p>TODO remove when Java 8 support is no longer needed.
17  */
18 final class Java8Compatibility {
clear(Buffer b)19   static void clear(Buffer b) {
20     b.clear();
21   }
22 
flip(Buffer b)23   static void flip(Buffer b) {
24     b.flip();
25   }
26 
limit(Buffer b, int limit)27   static void limit(Buffer b, int limit) {
28     b.limit(limit);
29   }
30 
mark(Buffer b)31   static void mark(Buffer b) {
32     b.mark();
33   }
34 
position(Buffer b, int position)35   static void position(Buffer b, int position) {
36     b.position(position);
37   }
38 
reset(Buffer b)39   static void reset(Buffer b) {
40     b.reset();
41   }
42 
Java8Compatibility()43   private Java8Compatibility() {}
44 }
45