java - How to check if function was called by value? -


Edit: How do I use the type of parameter on the compilation of time to use an eclipse parser?


I am trying to check whether the function was value by call so I activate the following function on the user's code: < pre> public boolean visits (method Invocation node) {}

My question is, how was actually investigated by the call price or terms I node Tried the member functions of:

  typeArguments () argument () getExpression ()   

and could not forward The Ana For example, I tried:

  list r_type = node.typeArguments (); If (r_type.toString () == "int") {....}   

but r_type always starts to empty.

I want to know how the logic type (int / bool / double / ... )

In case of primitive, you know the type, it is not known how it is because it is not dynamic. That is, there is no way, that you know about the compilation of times, can be different for this.

For objects, there are several ways to find out that because a normal one instanceof example

  object o = ... if (o installation integer) {} else if (o installation Boolean) {} else if (o two insatanceof) {} else {// error}   

this An easy way to show that Java has passed the context of value is to change the context.

  Public boolean visit (method invocation node) {node = null; } Method Invocation node = new method Invocation (); Go to (node); // it changes to null system.out.printline (node); // No not the node is unchanged   

but r_type always starts to empty.

This may be because your test will always fail. That is, it is always false. Or the list is always empty because you did not put anything in it.

I suggest that you take steps to better understand your program by using your debugger through your code.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -