Remove JDK 9 workarounds etc

See gh-17778
This commit is contained in:
Juergen Hoeller
2021-09-17 08:58:19 +02:00
parent e0a4b05142
commit b74e93807e
15 changed files with 36 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.springframework.messaging.simp.stomp;
import java.io.ByteArrayOutputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -134,11 +133,7 @@ public class StompDecoder {
private Message<byte[]> decodeMessage(ByteBuffer byteBuffer, @Nullable MultiValueMap<String, String> headers) {
Message<byte[]> decodedMessage = null;
skipEol(byteBuffer);
// Explicit mark/reset access via Buffer base type for compatibility
// with covariant return type on JDK 9's ByteBuffer...
Buffer buffer = byteBuffer;
buffer.mark();
byteBuffer.mark();
String command = readCommand(byteBuffer);
if (command.length() > 0) {
@@ -176,7 +171,7 @@ public class StompDecoder {
headers.putAll(map);
}
}
buffer.reset();
byteBuffer.reset();
}
}
else {
@@ -357,8 +352,7 @@ public class StompDecoder {
throw new StompConversionException("'\\r' must be followed by '\\n'");
}
}
// Explicit cast for compatibility with covariant return type on JDK 9's ByteBuffer
((Buffer) byteBuffer).position(byteBuffer.position() - 1);
byteBuffer.position(byteBuffer.position() - 1);
}
return false;
}