Is there asm nop equivalent in java?

前端 未结 5 1849
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 17:48

When I program C/C++ with Visual Studio I often use __asm nop; command to insert a noop code in order to have something to break on. For instance:

5条回答
  •  旧时难觅i
    2020-12-18 18:05

    I did not find a perfect solution for this, but here is the solution I like most. Probably not efficient but it lets you place a breakpoint, Eclipse does not complain or warns and from the code reader's point of view, it is obvious what you want to do.

    // Silly method that allows me to make noop
    private static void noop() {
    
    }
    
    public otherMethod() { 
        // Here I need breakpoint
        noop();
    }
    

    If I want to precondition breakpoint I place the condition before:

    public otherMethod() { 
        // Here I need breakpoint
        if(someCondition())
            noop();
    }
    

提交回复
热议问题