Skip to content

An alts release built with JDK 9+ wouldn't work under Java 7 or 8 #7348

@cpovirk

Description

@cpovirk

From #6829 (comment), I gather that your process may be to build releases with JDK 8. If so, then this is more about convenience for anyone else who might do a local build. (Compare #6839, which dealt with similar calls in core.)

My attempt to turn up other such calls shows some in alts:

$ ./gradlew publishToMavenLocal $ printf '%s\n' ~/.m2/repository/io/grpc/*/1.32.0-SNAPSHOT/*-SNAPSHOT.jar | parallel -q --gnu --will-cite -k bash -c 'jar -tf $1 | grep -oP ".*(?=[.]class$)" | xargs -r javap -private -v -cp $1' - > /tmp/allclasses $ ( R='Method java/nio/\w+Buffer[.](clear|flip|limit:[(]I|mark|position:[(]I|reset|rewind).*[)]Ljava/nio/\w+Buffer;'; grep -P "$R|^Classfile" /tmp/allclasses | grep -P -B 1 "$R" ) Classfile jar:file:///usr/local/google/home/cpovirk/.m2/repository/io/grpc/grpc-alts/1.32.0-SNAPSHOT/grpc-alts-1.32.0-SNAPSHOT.jar!/io/grpc/alts/internal/AltsTsiHandshaker.class 66: invokevirtual #163 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 84: invokevirtual #168 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; -- Classfile jar:file:///usr/local/google/home/cpovirk/.m2/repository/io/grpc/grpc-alts/1.32.0-SNAPSHOT/grpc-alts-1.32.0-SNAPSHOT.jar!/io/grpc/alts/internal/AltsFraming.class 38: invokevirtual #59 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 57: invokevirtual #68 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; 53: invokevirtual #59 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 70: invokevirtual #68 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; -- Classfile jar:file:///usr/local/google/home/cpovirk/.m2/repository/io/grpc/grpc-alts/1.32.0-SNAPSHOT/grpc-alts-1.32.0-SNAPSHOT.jar!/io/grpc/alts/internal/AltsHandshakerClient.class 70: invokevirtual #399 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; 83: invokevirtual #399 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; -- Classfile jar:file:///usr/local/google/home/cpovirk/.m2/repository/io/grpc/grpc-alts/1.32.0-SNAPSHOT/grpc-alts-1.32.0-SNAPSHOT.jar!/io/grpc/alts/internal/AltsFraming$Parser.class 74: invokevirtual #72 // Method java/nio/ByteBuffer.flip:()Ljava/nio/ByteBuffer; 184: invokevirtual #118 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 210: invokevirtual #72 // Method java/nio/ByteBuffer.flip:()Ljava/nio/ByteBuffer; 4: invokevirtual #132 // Method java/nio/ByteBuffer.clear:()Ljava/nio/ByteBuffer; -- Classfile jar:file:///usr/local/google/home/cpovirk/.m2/repository/io/grpc/grpc-alts/1.32.0-SNAPSHOT/grpc-alts-1.32.0-SNAPSHOT.jar!/io/grpc/alts/internal/AltsFraming$Producer.class 25: invokevirtual #78 // Method java/nio/ByteBuffer.flip:()Ljava/nio/ByteBuffer; 45: invokevirtual #83 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 88: invokevirtual #98 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; 4: invokevirtual #103 // Method java/nio/ByteBuffer.clear:()Ljava/nio/ByteBuffer; 16: invokevirtual #98 // Method java/nio/ByteBuffer.position:(I)Ljava/nio/ByteBuffer; 36: invokevirtual #83 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer; 

Again, there is no problem with 1.31.1, which I assume you built with JDK 8:

$ wget https://repo1.maven.org/maven2/io/grpc/grpc-alts/1.31.1/grpc-alts-1.31.1.jar $ javap -private -v -cp grpc-alts-1.31.1.jar 'io.grpc.alts.internal.AltsFraming' | grep limit ... 38: invokevirtual #59 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/Buffer; 

Still, after a bad protobuf release (protocolbuffers/protobuf#7827) and a near miss with Guava (google/guava#3994), I figured it was worth bringing this up again in case you want to take additional measures.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions