Message12680

Author jeff.allen
Recipients adamburke, jeff.allen
Date 2019-10-05.13:50:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570283410.18.0.972428388996.issue2810@roundup.psfhosted.org>
In-reply-to
Content
I've seen this when compiling on 9 and running on something earlier, but I don't see why this would happen compiling on 8 and running on something later. It's not so much deprecation as an unfortunate specialisation. (I've done similar things myself.)

A suspicious element is that we're looking for clear() returning ByteBuffer while the signature (both in Buffer and ByteBuffer) returns Buffer. When I look at org.python.core.io.BufferedReader.clear() with Oracle 1.8.0_211-b12, I see:

public void clear();
  Code:
     0: aload_0
     1: getfield      #5                  // Field buffer:Ljava/nio/ByteBuffer;
     4: invokevirtual #13                 // Method java/nio/ByteBuffer.clear:()Ljava/nio/Buffer;
     7: iconst_0
     8: invokevirtual #29                 // Method java/nio/Buffer.limit:(I)Ljava/nio/Buffer;
    11: pop
    12: return

I wonder if this is an openjdk thing? Possibly: http://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/java.base/share/classes/java/nio/X-Buffer.java.template#l1137

Maybe the answer here is to cast ((Buffer) buffer).clear() so as to seek the right one?
History
Date User Action Args
2019-10-05 13:50:10jeff.allensetmessageid: <1570283410.18.0.972428388996.issue2810@roundup.psfhosted.org>
2019-10-05 13:50:10jeff.allensetrecipients: + jeff.allen, adamburke
2019-10-05 13:50:10jeff.allenlinkissue2810 messages
2019-10-05 13:50:10jeff.allencreate