Commit 0ed02877 authored by Eric Bruneton's avatar Eric Bruneton

Merge branch '316345-non-regression-test'

parents 5260a9b6 ed3c3590
Pipeline #727 passed with stage
in 5 minutes and 56 seconds
......@@ -33,9 +33,17 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.test.AsmTest;
/**
* Textifier tests.
......@@ -43,7 +51,7 @@ import org.objectweb.asm.Opcodes;
* @author Eugene Kuleshov
* @author Eric Bruneton
*/
public class TextifierTest {
public class TextifierTest extends AsmTest {
@Test
public void testConstructor() {
......@@ -92,4 +100,29 @@ public class TextifierTest {
System.setOut(out);
}
}
/**
* Tests that the text produced with a Textifier is equal to the expected text.
*
* @throws Exception
*/
@ParameterizedTest
@MethodSource(ALL_CLASSES_AND_LATEST_API)
public void testTextify(final PrecompiledClass classParameter, final Api apiParameter)
throws Exception {
byte[] classFile = classParameter.getBytes();
if (classFile.length >= 32768) {
return;
}
StringWriter stringWriter = new StringWriter();
new ClassReader(classFile).accept(new TraceClassVisitor(new PrintWriter(stringWriter)), 0);
stringWriter.close();
String expectedText =
new String(
Files.readAllBytes(
Paths.get("src/test/resources/" + classParameter.getName() + ".txt")));
assertEquals(expectedText, stringWriter.toString());
}
}
// class version 45.0 (45)
// access flags 0x600
abstract interface DefaultPackage {
// compiled from: DefaultPackage.java
}
This diff is collapsed.
// class version 45.3 (196653)
// access flags 0x20
class jdk3/AllStructures$1 implements java/lang/Runnable {
// compiled from: AllStructures.java
// access flags 0x0
INNERCLASS jdk3/AllStructures$1 null null
// access flags 0x2
private INNERCLASS jdk3/AllStructures$InnerClass jdk3/AllStructures InnerClass
// access flags 0x1012
private final synthetic Ljdk3/AllStructures; this$0
// access flags 0x0
<init>(Ljdk3/AllStructures;)V
L0
LINENUMBER 41 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
ALOAD 0
ALOAD 1
PUTFIELD jdk3/AllStructures$1.this$0 : Ljdk3/AllStructures;
RETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures$1; L0 L1 0
LOCALVARIABLE this$0 Ljdk3/AllStructures; L0 L1 1
MAXSTACK = 2
MAXLOCALS = 2
// access flags 0x1
public run()V
L0
LINENUMBER 42 L0
NEW jdk3/AllStructures$InnerClass
DUP
ALOAD 0
GETFIELD jdk3/AllStructures$1.this$0 : Ljdk3/AllStructures;
NEW jdk3/AllStructures$InnerClass
DUP
ALOAD 0
GETFIELD jdk3/AllStructures$1.this$0 : Ljdk3/AllStructures;
ALOAD 0
GETFIELD jdk3/AllStructures$1.this$0 : Ljdk3/AllStructures;
INVOKESTATIC jdk3/AllStructures.access$000 (Ljdk3/AllStructures;)D
ALOAD 0
GETFIELD jdk3/AllStructures$1.this$0 : Ljdk3/AllStructures;
INVOKESTATIC jdk3/AllStructures.access$100 (Ljdk3/AllStructures;)D
DADD
ACONST_NULL
INVOKESPECIAL jdk3/AllStructures$InnerClass.<init> (Ljdk3/AllStructures;DLjdk3/AllStructures$1;)V
INVOKESTATIC jdk3/AllStructures$InnerClass.access$300 (Ljdk3/AllStructures$InnerClass;)D
ACONST_NULL
INVOKESPECIAL jdk3/AllStructures$InnerClass.<init> (Ljdk3/AllStructures;DLjdk3/AllStructures$1;)V
POP
L1
LINENUMBER 43 L1
RETURN
L2
LOCALVARIABLE this Ljdk3/AllStructures$1; L0 L2 0
MAXSTACK = 10
MAXLOCALS = 1
}
// class version 45.3 (196653)
// access flags 0x20
class jdk3/AllStructures$InnerClass {
// compiled from: AllStructures.java
// access flags 0x2
private INNERCLASS jdk3/AllStructures$InnerClass jdk3/AllStructures InnerClass
// access flags 0x0
INNERCLASS jdk3/AllStructures$1 null null
// access flags 0x12
private final D f0
// access flags 0x1012
private final synthetic Ljdk3/AllStructures; this$0
// access flags 0x2
private <init>(Ljdk3/AllStructures;D)V
L0
LINENUMBER 49 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
ALOAD 0
ALOAD 1
PUTFIELD jdk3/AllStructures$InnerClass.this$0 : Ljdk3/AllStructures;
L1
LINENUMBER 50 L1
ALOAD 0
DLOAD 2
PUTFIELD jdk3/AllStructures$InnerClass.f0 : D
L2
LINENUMBER 51 L2
RETURN
L3
LOCALVARIABLE this Ljdk3/AllStructures$InnerClass; L0 L3 0
LOCALVARIABLE this$0 Ljdk3/AllStructures; L0 L3 1
LOCALVARIABLE f0 D L0 L3 2
MAXSTACK = 3
MAXLOCALS = 4
// access flags 0x1000
synthetic <init>(Ljdk3/AllStructures;DLjdk3/AllStructures$1;)V
L0
LINENUMBER 47 L0
ALOAD 0
ALOAD 1
DLOAD 2
INVOKESPECIAL jdk3/AllStructures$InnerClass.<init> (Ljdk3/AllStructures;D)V
RETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures$InnerClass; L0 L1 0
LOCALVARIABLE x0 Ljdk3/AllStructures; L0 L1 1
LOCALVARIABLE x1 D L0 L1 2
LOCALVARIABLE x2 Ljdk3/AllStructures$1; L0 L1 4
MAXSTACK = 4
MAXLOCALS = 5
// access flags 0x1008
static synthetic access$300(Ljdk3/AllStructures$InnerClass;)D
L0
LINENUMBER 47 L0
ALOAD 0
GETFIELD jdk3/AllStructures$InnerClass.f0 : D
DRETURN
L1
LOCALVARIABLE x0 Ljdk3/AllStructures$InnerClass; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
}
// class version 45.3 (196653)
// access flags 0x420
abstract class jdk3/AllStructures implements java/lang/Runnable java/lang/Cloneable java/io/Serializable {
// compiled from: AllStructures.java
// access flags 0x2
private INNERCLASS jdk3/AllStructures$InnerClass jdk3/AllStructures InnerClass
// access flags 0x0
INNERCLASS jdk3/AllStructures$1 null null
// access flags 0x1A
private final static Ljava/lang/String; UTF8 = "€ࠀ耀"
// access flags 0x1A
private final static J serialVersionUID = 123456
// access flags 0x1
public I f0
// access flags 0x4
protected F f1
// access flags 0x0
J f2
// access flags 0x2
private D f3
// access flags 0x8
static Ljdk3/AllStructures; f4
// access flags 0x10
final B f5 = 1
// access flags 0x80
transient C f6
// access flags 0x40
volatile S f7
// access flags 0x0
Z f8
// access flags 0x0
<init>()V
L0
LINENUMBER 7 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
L1
LINENUMBER 17 L1
ALOAD 0
ICONST_1
PUTFIELD jdk3/AllStructures.f5 : B
L2
LINENUMBER 7 L2
RETURN
L3
LOCALVARIABLE this Ljdk3/AllStructures; L0 L3 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x1
public m0()I
L0
LINENUMBER 27 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f0 : I
IRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x4
protected m1()F
L0
LINENUMBER 31 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f1 : F
FRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x0
m2()J
L0
LINENUMBER 35 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f2 : J
LRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x2
private m3()D
L0
LINENUMBER 39 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f3 : D
DRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x8
static m4()Ljdk3/AllStructures;
L0
LINENUMBER 43 L0
GETSTATIC jdk3/AllStructures.f4 : Ljdk3/AllStructures;
ARETURN
MAXSTACK = 1
MAXLOCALS = 0
// access flags 0x10
final m5()B
L0
LINENUMBER 47 L0
ICONST_1
IRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x800
strictfp m6()C
L0
LINENUMBER 51 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f6 : C
IRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x0
m7()S
L0
LINENUMBER 55 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f7 : S
IRETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x400
abstract m8()Z
// access flags 0x9
public static main([Ljava/lang/String;)V
L0
LINENUMBER 60 L0
RETURN
L1
LOCALVARIABLE args [Ljava/lang/String; L0 L1 0
MAXSTACK = 0
MAXLOCALS = 1
// access flags 0x1
public run()V
L0
LINENUMBER 62 L0
RETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 0
MAXLOCALS = 1
// access flags 0x21
public synchronized clone()Ljava/lang/Object;
L0
LINENUMBER 65 L0
ALOAD 0
ARETURN
L1
LOCALVARIABLE this Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x102
private native nativeMethod()V
// access flags 0x2
private anonymousInnerClass()Ljava/lang/Runnable; throws java/lang/Exception
L0
LINENUMBER 71 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f0 : I
IFLE L1
L2
LINENUMBER 72 L2
NEW java/lang/Exception
DUP
INVOKESPECIAL java/lang/Exception.<init> ()V
ATHROW
L1
LINENUMBER 73 L1
NEW jdk3/AllStructures$1
DUP
ALOAD 0
INVOKESPECIAL jdk3/AllStructures$1.<init> (Ljdk3/AllStructures;)V
ARETURN
L3
LOCALVARIABLE this Ljdk3/AllStructures; L0 L3 0
MAXSTACK = 3
MAXLOCALS = 1
// access flags 0x1008
static synthetic access$000(Ljdk3/AllStructures;)D
L0
LINENUMBER 7 L0
ALOAD 0
GETFIELD jdk3/AllStructures.f3 : D
DRETURN
L1
LOCALVARIABLE x0 Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x1008
static synthetic access$100(Ljdk3/AllStructures;)D
L0
LINENUMBER 7 L0
ALOAD 0
INVOKESPECIAL jdk3/AllStructures.m3 ()D
DRETURN
L1
LOCALVARIABLE x0 Ljdk3/AllStructures; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x8
static <clinit>()V
L0
LINENUMBER 23 L0
ACONST_NULL
PUTSTATIC jdk3/AllStructures.f4 : Ljdk3/AllStructures;
L1
LINENUMBER 22 L1
RETURN
MAXSTACK = 1
MAXLOCALS = 0
}
// class version 47.0 (47)
// access flags 0x21
public class jdk3/ArtificialStructures {
// compiled from: ArtificialStructures.java
// debug info: source-debug
ATTRIBUTE Comment : unknown
// access flags 0x1001
public synthetic I f
ATTRIBUTE Comment : unknown
// access flags 0x1001
public synthetic <init>(Ljava/lang/String;)V
ATTRIBUTE Comment : unknown
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
NOP
RETURN
ATTRIBUTE CodeComment : unknown
MAXSTACK = 1
MAXLOCALS = 2
// access flags 0x0
<init>(Z)V
ILOAD 1
ALOAD 0
SWAP
IFEQ L0
LDC "1"
GOTO L1
L0
LINENUMBER 1 L0
LINENUMBER 3 L0
FRAME FULL [U I] [U]
LDC "0"
L1
LINENUMBER 5 L1
LINENUMBER 7 L1
LINENUMBER 11 L1
LINENUMBER 13 L1
LINENUMBER 17 L1
FRAME FULL [U I] [U java/lang/String]
INVOKESPECIAL jdk3/ArtificialStructures.<init> (Ljava/lang/String;)V
RETURN
MAXSTACK = 2
MAXLOCALS = 2
// access flags 0x8
static dup_x2(IJ)V
LLOAD 1
ILOAD 0
DUP_X2
I2L
LADD
INVOKESTATIC jdk3/ArtificialStructures.dup_x2 (IJ)V
RETURN
MAXSTACK = 5
MAXLOCALS = 3
// access flags 0x8
static dup2_x2(IIII)V
ILOAD 3
ILOAD 2
ILOAD 1
ILOAD 0
DUP2_X2
IADD
IADD
INVOKESTATIC jdk3/ArtificialStructures.dup2_x2 (IIII)V
RETURN
MAXSTACK = 6
MAXLOCALS = 4
// access flags 0x8
static dup2_x2(IIJ)V
LLOAD 2
ILOAD 1
ILOAD 0
DUP2_X2
IADD
I2L
LADD
INVOKESTATIC jdk3/ArtificialStructures.dup2_x2 (IIJ)V
RETURN
MAXSTACK = 6
MAXLOCALS = 4
// access flags 0x8
static dup2_x2(JD)V
DLOAD 2
LLOAD 0
DUP2_X2
L2D
DADD
INVOKESTATIC jdk3/ArtificialStructures.dup2_x2 (JD)V
RETURN
MAXSTACK = 6
MAXLOCALS = 4
}
This diff is collapsed.
// class version 49.0 (49)
// access flags 0x20
class jdk5/AllStructures$1LocalClass {
// compiled from: AllStructures.java
OUTERCLASS jdk5/AllStructures localClassConstructor (Ljava/lang/String;)V
// access flags 0x0
INNERCLASS jdk5/AllStructures$1LocalClass null LocalClass
// access flags 0x1010
final synthetic Ljava/lang/String; val$name
// access flags 0x1010
final synthetic Ljdk5/AllStructures; this$0
// access flags 0x0
// signature (I)V
// declaration: void (int)
<init>(Ljdk5/AllStructures;ILjava/lang/String;)V
// annotable parameter count: 1 (visible)
@Ljava/lang/Deprecated;() // parameter 0
L0
LINENUMBER 140 L0
ALOAD 0
ALOAD 1
PUTFIELD jdk5/AllStructures$1LocalClass.this$0 : Ljdk5/AllStructures;
ALOAD 0
ALOAD 3
PUTFIELD jdk5/AllStructures$1LocalClass.val$name : Ljava/lang/String;
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
L1
LINENUMBER 141 L1
GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
NEW java/lang/StringBuilder
DUP
INVOKESPECIAL java/lang/StringBuilder.<init> ()V
ALOAD 0
GETFIELD jdk5/AllStructures$1LocalClass.val$name : Ljava/lang/String;
INVOKEVIRTUAL java/lang/StringBuilder.append (Ljava/lang/String;)Ljava/lang/StringBuilder;
ILOAD 2
INVOKEVIRTUAL java/lang/StringBuilder.append (I)Ljava/lang/StringBuilder;
INVOKEVIRTUAL java/lang/StringBuilder.toString ()Ljava/lang/String;
INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
L2
LINENUMBER 142 L2
RETURN
L3
LOCALVARIABLE this Ljdk5/AllStructures$1LocalClass; L0 L3 0
// signature Ljdk5/AllStructures.1LocalClass;
// declaration: extends jdk5.AllStructures.1LocalClass
LOCALVARIABLE value I L0 L3 2
MAXSTACK = 3
MAXLOCALS = 4
}
// class version 49.0 (49)
// access flags 0x4030
// signature Ljava/lang/Enum<Ljdk5/AllStructures$EnumClass;>;
// declaration: extends java.lang.Enum<jdk5.AllStructures$EnumClass>
final enum jdk5/AllStructures$EnumClass extends java/lang/Enum {
// compiled from: AllStructures.java
// access flags 0x4018
final static enum INNERCLASS jdk5/AllStructures$EnumClass jdk5/AllStructures EnumClass
// access flags 0x4019
public final static enum Ljdk5/AllStructures$EnumClass; VALUE0
// access flags 0x4019
public final static enum Ljdk5/AllStructures$EnumClass; VALUE1
// access flags 0x4019
public final static enum Ljdk5/AllStructures$EnumClass; VALUE2
// access flags 0x2
private I value
// access flags 0x101A
private final static synthetic [Ljdk5/AllStructures$EnumClass; $VALUES
// access flags 0x19
public final static values()[Ljdk5/AllStructures$EnumClass;
L0
LINENUMBER 200 L0
GETSTATIC jdk5/AllStructures$EnumClass.$VALUES : [Ljdk5/AllStructures$EnumClass;
INVOKEVIRTUAL [Ljdk5/AllStructures$EnumClass;.clone ()Ljava/lang/Object;
CHECKCAST [Ljdk5/AllStructures$EnumClass;
ARETURN
MAXSTACK = 1
MAXLOCALS = 0
// access flags 0x9
public static valueOf(Ljava/lang/String;)Ljdk5/AllStructures$EnumClass;
L0
LINENUMBER 200 L0
LDC Ljdk5/AllStructures$EnumClass;.class
ALOAD 0
INVOKESTATIC java/lang/Enum.valueOf (Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
CHECKCAST jdk5/AllStructures$EnumClass
ARETURN
L1
LOCALVARIABLE name Ljava/lang/String; L0 L1 0
MAXSTACK = 2
MAXLOCALS = 1
// access flags 0x2
// signature (I)V
// declaration: void (int)
private <init>(Ljava/lang/String;II)V
L0
LINENUMBER 207 L0
ALOAD 0
ALOAD 1
ILOAD 2
INVOKESPECIAL java/lang/Enum.<init> (Ljava/lang/String;I)V
L1
LINENUMBER 208 L1
ALOAD 0
ILOAD 3
PUTFIELD jdk5/AllStructures$EnumClass.value : I
L2
LINENUMBER 209 L2
RETURN
L3
LOCALVARIABLE this Ljdk5/AllStructures$EnumClass; L0 L3 0
LOCALVARIABLE value I L0 L3 3
MAXSTACK = 3
MAXLOCALS = 4
// access flags 0x1
public getValue()I
L0
LINENUMBER 212 L0
ALOAD 0
GETFIELD jdk5/AllStructures$EnumClass.value : I
IRETURN
L1
LOCALVARIABLE this Ljdk5/AllStructures$EnumClass; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x8
static <clinit>()V
L0
LINENUMBER 201 L0
NEW jdk5/AllStructures$EnumClass
DUP
LDC "VALUE0"
ICONST_0
ICONST_0
INVOKESPECIAL jdk5/AllStructures$EnumClass.<init> (Ljava/lang/String;II)V
PUTSTATIC jdk5/AllStructures$EnumClass.VALUE0 : Ljdk5/AllStructures$EnumClass;
L1
LINENUMBER 202 L1
NEW jdk5/AllStructures$EnumClass
DUP
LDC "VALUE1"
ICONST_1
ICONST_1
INVOKESPECIAL jdk5/AllStructures$EnumClass.<init> (Ljava/lang/String;II)V
PUTSTATIC jdk5/AllStructures$EnumClass.VALUE1 : Ljdk5/AllStructures$EnumClass;
L2
LINENUMBER 203 L2
NEW jdk5/AllStructures$EnumClass
DUP
LDC "VALUE2"
ICONST_2
ICONST_2
INVOKESPECIAL jdk5/AllStructures$EnumClass.<init> (Ljava/lang/String;II)V
PUTSTATIC jdk5/AllStructures$EnumClass.VALUE2 : Ljdk5/AllStructures$EnumClass;
L3
LINENUMBER 200 L3
ICONST_3
ANEWARRAY jdk5/AllStructures$EnumClass
DUP
ICONST_0
GETSTATIC jdk5/AllStructures$EnumClass.VALUE0 : Ljdk5/AllStructures$EnumClass;
AASTORE
DUP
ICONST_1
GETSTATIC jdk5/AllStructures$EnumClass.VALUE1 : Ljdk5/AllStructures$EnumClass;
AASTORE
DUP
ICONST_2
GETSTATIC jdk5/AllStructures$EnumClass.VALUE2 : Ljdk5/AllStructures$EnumClass;
AASTORE