Skip to content

Incorrect method call order #3159

@topolik

Description

@topolik

Hi guys,

do you know why there is SelfMethodCalls#interestingSignature method?

?

This ruins the correct order of method calls as derived by ClassContext#getMethodsInCallOrder -> ClassInfo#getXMethodsInCallOrder() -> SelfMethodCalls#interestingSignature

Having this example class:

public class Test {

	static {
		staticMethod1();
	}

	public static void staticMethod1(){
		staticMethod2();
	}
	public static void staticMethod2(){
		staticMethod3();
	}
	public static void staticMethod3(){
		staticMethod4();
	}
	public static void staticMethod4(){
		new Test().method1();
	}

	public void method1() {
		method2();
	}
	public void method2() {
		method3();
	}
	public void method3() {
		method4();
	}
	public void method4() {
		System.out.println("HERE WE GO!");
	}
}

The call order is derived as:

=========
= ClassContext.getMethodsInCallOrder() 
=========
staticMethod2
<init>
staticMethod1
staticMethod4
staticMethod3
method4
method3
method2
<clinit>
method1

Commenting out the private static thing then the topologically sorted call tree looks correct:

=========
= FIXED: 
=========
<init>
method4
method3
method2
method1
staticMethod4
staticMethod3
staticMethod2
staticMethod1
<clinit>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions