Explanation needed to return boolean methods

I was looking at some code from a decompiled APK file and was looking at this syntax to return a logical state that I had not seen before. Does anyone have an explanation of how this works?

public static boolean is2G(NetworkType paramNetworkType) { if ((EDGE.equals(paramNetworkType)) || (IDEN.equals(paramNetworkType)) || (CDMA.equals(paramNetworkType)) || (GPRS.equals(paramNetworkType))); for (int i = 1; ; i = 0) return i; } 
+4
source share
2 answers

These terms and conditions mean that if all or all of these 4 conditions are true, the entire condition is true.

But the condition body is empty, so then nothing happens. The cycle, however, is executed regardless of the condition.

But you should also be aware that decompilation sometimes does not work for sure, so this may be a decompilation error. This assumption is even more true if you look at the wrong return type. Therefore, even if this code is widely used throughout the application, I would suggest a decompilation problem.

+5
source

OK, this is strange.

The condition does nothing. Like it

 if (condition) { } 

Loop condition says “execute forever”

The body of the loop says "return immediately", but it returns the WRONG TYPE !!! How can this be compiled?

0
source

Source: https://habr.com/ru/post/1346300/


All Articles