Skip to content

Commit 63eb558

Browse files
committed
Remove Java 8 workaround in EncodingErrorMsg.
1 parent 5c4fe0a commit 63eb558

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/src/main/java/com/diffplug/spotless/EncodingErrorMsg.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2022 DiffPlug
2+
* Copyright 2016-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
1515
*/
1616
package com.diffplug.spotless;
1717

18-
import java.nio.Buffer;
1918
import java.nio.ByteBuffer;
2019
import java.nio.CharBuffer;
2120
import java.nio.charset.Charset;
@@ -116,8 +115,8 @@ private static void addIfAvailable(Collection<Charset> charsets, String name) {
116115
}
117116

118117
private void appendExample(Charset charset, boolean must) {
119-
java8fix(byteBuf).clear();
120-
java8fix(charBuf).clear();
118+
byteBuf.clear();
119+
charBuf.clear();
121120

122121
CharsetDecoder decoder = charset.newDecoder();
123122
if (!must) {
@@ -135,7 +134,7 @@ private void appendExample(Charset charset, boolean must) {
135134
.onUnmappableCharacter(CodingErrorAction.REPLACE)
136135
.decode(byteBuf, charBuf, true);
137136
}
138-
java8fix(charBuf).flip();
137+
charBuf.flip();
139138

140139
int start = Math.max(unrepresentable - CONTEXT, 0);
141140
int end = Math.min(charBuf.limit(), unrepresentable + CONTEXT + 1);
@@ -147,9 +146,4 @@ private void appendExample(Charset charset, boolean must) {
147146
message.append(" <- ");
148147
message.append(charset.name());
149148
}
150-
151-
/** Fixes https://jira.mongodb.org/browse/JAVA-2559, as reported in https://github.com/diffplug/spotless/issues/1081 */
152-
private static Buffer java8fix(Buffer b) {
153-
return b;
154-
}
155149
}

0 commit comments

Comments
 (0)