Skip to content

Commit

Permalink
test: add case for StackMapTable difference
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 committed Aug 9, 2024
1 parent 410d108 commit 6fa3a69
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,23 @@ void shouldOnlyShowBytecodeMajorVersionUpdate() throws IOException {
List<Action> rootOperations = diff.getRootOperations();
assertThat(rootOperations).size().isEqualTo(1);
}

@Test
void shouldShowDiffInStackMapTable() throws IOException {
Path oldClass = EQ.resolve("SameMjCompVer")
.resolve("161860")
.resolve("ecj-3.15.1_openjdk-11.0.19")
.resolve("SimpleCharStream.class");
Path newClass = EQ.resolve("SameMjCompVer")
.resolve("161860")
.resolve("ecj-3.24.0_openjdk-11.0.19")
.resolve("SimpleCharStream.class");
DiffImpl diff = getDiff(oldClass, newClass);

// assert
List<Action> rootOperations = diff.getRootOperations();
assertThat(rootOperations).size().isEqualTo(1);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test/resources/EQ/SameMjCompVer/161860/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Not sure is StackMapTable should be a part of bytecode.
47 changes: 47 additions & 0 deletions src/test/resources/EQ/SameMjCompVer/161860/diffoscope.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- ecj-3.15.1_openjdk-11.0.19/SimpleCharStream.class
+++ ecj-3.24.0_openjdk-11.0.19/SimpleCharStream.class
├── javap -verbose -constants -s -l -private {}
│ @@ -1,8 +1,8 @@
│ - SHA-256 checksum 23939ef0f2da4a74ecf589194401750a02b00a0c51eed6c67895f9483ba4a343
│ + SHA-256 checksum 8a868c0faef291598791f7f2be7141509cd353ee3b26e9bf9ef5e57cbc8035e7
│ Compiled from "SimpleCharStream.java"
│ public class org.apache.commons.configuration2.plist.SimpleCharStream
│ minor version: 0
│ major version: 52
│ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
│ this_class: #1 // org/apache/commons/configuration2/plist/SimpleCharStream
│ super_class: #3 // java/lang/Object
│ @@ -1433,15 +1433,15 @@
│ 0 34 5 buffersize I
│ StackMapTable: number_of_entries = 2
│ frame_type = 80 /* same_locals_1_stack_item */
│ stack = [ this ]
│ frame_type = 255 /* full_frame */
│ offset_delta = 8
│ locals = [ this, class java/io/InputStream, class java/lang/String, int, int, int ]
│ - stack = [ this, class java/io/Reader ]
│ + stack = [ this, class java/io/InputStreamReader ]
│ public org.apache.commons.configuration2.plist.SimpleCharStream(java.io.InputStream, int, int, int);
│ descriptor: (Ljava/io/InputStream;III)V
│ flags: (0x0001) ACC_PUBLIC
│ Code:
│ stack=5, locals=5, args_size=5
│ 0: aload_0
│ @@ -1595,15 +1595,15 @@
│ 0 34 5 buffersize I
│ StackMapTable: number_of_entries = 2
│ frame_type = 80 /* same_locals_1_stack_item */
│ stack = [ class org/apache/commons/configuration2/plist/SimpleCharStream ]
│ frame_type = 255 /* full_frame */
│ offset_delta = 8
│ locals = [ class org/apache/commons/configuration2/plist/SimpleCharStream, class java/io/InputStream, class java/lang/String, int, int, int ]
│ - stack = [ class org/apache/commons/configuration2/plist/SimpleCharStream, class java/io/Reader ]
│ + stack = [ class org/apache/commons/configuration2/plist/SimpleCharStream, class java/io/InputStreamReader ]
│ public void ReInit(java.io.InputStream, int, int, int);
│ descriptor: (Ljava/io/InputStream;III)V
│ flags: (0x0001) ACC_PUBLIC
│ Code:
│ stack=5, locals=5, args_size=5
│ 0: aload_0
Binary file not shown.
Binary file not shown.
Empty file.

0 comments on commit 6fa3a69

Please sign in to comment.