{"action":"opened","issue":{"url":"https://api.github.com/repos/Storyyeller/Krakatau/issues/95","repository_url":"https://api.github.com/repos/Storyyeller/Krakatau","labels_url":"https://api.github.com/repos/Storyyeller/Krakatau/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/Storyyeller/Krakatau/issues/95/comments","events_url":"https://api.github.com/repos/Storyyeller/Krakatau/issues/95/events","html_url":"https://github.com/Storyyeller/Krakatau/issues/95","id":162686475,"number":95,"title":"Issues with ints and booleans and comparision","user":{"login":"Janmm14","id":3533175,"avatar_url":"https://avatars.githubusercontent.com/u/3533175?v=3","gravatar_id":"","url":"https://api.github.com/users/Janmm14","html_url":"https://github.com/Janmm14","followers_url":"https://api.github.com/users/Janmm14/followers","following_url":"https://api.github.com/users/Janmm14/following{/other_user}","gists_url":"https://api.github.com/users/Janmm14/gists{/gist_id}","starred_url":"https://api.github.com/users/Janmm14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Janmm14/subscriptions","organizations_url":"https://api.github.com/users/Janmm14/orgs","repos_url":"https://api.github.com/users/Janmm14/repos","events_url":"https://api.github.com/users/Janmm14/events{/privacy}","received_events_url":"https://api.github.com/users/Janmm14/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-28T13:31:33Z","updated_at":"2016-06-28T13:31:33Z","closed_at":null,"body":"As booleans are basically ints in the stack, there are some issues noticed by me where krakatau puts out code like `if (bool >= 0)`.\r\nA possible solution would be to add an inline if: `if ((bool?:1:0) >= 0)` (if that decompiled code above is even correct at all)\r\nI additionally noticed this:\r\n```java\r\nSystem.currentTimeMillis() != ((Long)some.class.someMap.get((Object)a0.someUUIDreturningMethod())).longValue();\r\n```\r\nWhich looks to be wrong (also as other decompilers show a subtraction).\r\n\r\nHere is the bytecode where I found these two issues (sorry, anonymized)\r\n```jasmin\r\n.method public a : (Lsome/class2;)Z\r\n    .code stack 6 locals 4 \r\nL0:     getstatic Field some/class alwaysZero I \r\nL3:     istore_3 \r\nL4:     aload_0 \r\nL5:     getfield Field some/class someMap Ljava/util/Map; \r\nL8:     aload_1 \r\nL9:     invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL14:    invokeinterface InterfaceMethod java/util/Map containsKey (Ljava/lang/Object;)Z 2 \r\nL19:    iload_3 \r\nL20:    ifne L61 \r\nL23:    ifne L46 \r\nL26:    aload_0 \r\nL27:    getfield Field some/class someMap Ljava/util/Map; \r\nL30:    aload_1 \r\nL31:    invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL36:    lconst_0 \r\nL37:    invokestatic Method java/lang/Long valueOf (J)Ljava/lang/Long; \r\nL40:    invokeinterface InterfaceMethod java/util/Map put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3 \r\nL45:    pop \r\n\r\n        .stack append Top Integer \r\nL46:    aload_0 \r\nL47:    getfield Field some/class someSet Ljava/util/Set; \r\nL50:    aload_1 \r\nL51:    invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL56:    invokeinterface InterfaceMethod java/util/Set contains (Ljava/lang/Object;)Z 2 \r\n\r\n        .stack stack_1 Integer \r\nL61:    iload_3 \r\nL62:    ifne L226 \r\nL65:    ifeq L201 \r\nL68:    invokestatic Method java/lang/System currentTimeMillis ()J \r\nL71:    aload_0 \r\nL72:    getfield Field some/class someMap Ljava/util/Map; \r\nL75:    aload_1 \r\nL76:    invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL81:    invokeinterface InterfaceMethod java/util/Map get (Ljava/lang/Object;)Ljava/lang/Object; 2 \r\nL86:    checkcast java/lang/Long \r\nL89:    invokevirtual Method java/lang/Long longValue ()J \r\nL92:    lcmp \r\nL93:    iload_3 \r\nL94:    ifne L115 \r\nL97:    ifge L106 \r\nL100:   iconst_1 \r\nL101:   istore_2 \r\nL102:   iload_3 \r\nL103:   ifeq L330 \r\n\r\n        .stack same \r\nL106:   aload_1 \r\nL107:   ldc_w 'iAmAString' \r\nL110:   invokeinterface InterfaceMethod some/class2 someMethod (Ljava/lang/String;)Z 2 \r\n\r\n        .stack stack_1 Integer \r\nL115:   istore_2 \r\nL116:   iload_2 \r\nL117:   iload_3 \r\nL118:   ifne L159 \r\nL121:   ifeq L144 \r\nL124:   aload_0 \r\nL125:   getfield Field some/class someSet Ljava/util/Set; \r\nL128:   aload_1 \r\nL129:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL134:   invokeinterface InterfaceMethod java/util/Set add (Ljava/lang/Object;)Z 2 \r\nL139:   pop \r\nL140:   iload_3 \r\nL141:   ifeq L160 \r\n\r\n        .stack full \r\n            locals Object some/class Object some/class2 Integer Integer \r\n            stack \r\n        .end stack \r\nL144:   aload_0 \r\nL145:   getfield Field some/class someSet Ljava/util/Set; \r\nL148:   aload_1 \r\nL149:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL154:   invokeinterface InterfaceMethod java/util/Set remove (Ljava/lang/Object;)Z 2 \r\n\r\n        .stack stack_1 Integer \r\nL159:   pop \r\n\r\n        .stack same \r\nL160:   aload_0 \r\nL161:   getfield Field some/class someMap Ljava/util/Map; \r\nL164:   aload_1 \r\nL165:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL170:   invokestatic Method java/lang/System currentTimeMillis ()J \r\nL173:   getstatic Field some/class random Ljava/util/Random; \r\nL176:   sipush 6374 \r\nL179:   invokevirtual Method java/util/Random nextInt (I)I \r\nL182:   i2l \r\nL183:   ladd \r\nL184:   ldc2_w 5387L \r\nL187:   ladd \r\nL188:   invokestatic Method java/lang/Long valueOf (J)Ljava/lang/Long; \r\nL191:   invokeinterface InterfaceMethod java/util/Map put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3 \r\nL196:   pop \r\nL197:   iload_3 \r\nL198:   ifeq L330 \r\n\r\n        .stack full \r\n            locals Object some/class Object some/class2 Top Integer \r\n            stack \r\n        .end stack \r\nL201:   invokestatic Method java/lang/System currentTimeMillis ()J \r\nL204:   aload_0 \r\nL205:   getfield Field some/class someMap Ljava/util/Map; \r\nL208:   aload_1 \r\nL209:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL214:   invokeinterface InterfaceMethod java/util/Map get (Ljava/lang/Object;)Ljava/lang/Object; 2 \r\nL219:   checkcast java/lang/Long \r\nL222:   invokevirtual Method java/lang/Long longValue ()J \r\nL225:   lcmp \r\n\r\n        .stack stack_1 Integer \r\nL226:   iload_3 \r\nL227:   ifne L248 \r\nL230:   ifge L239 \r\nL233:   iconst_0 \r\nL234:   istore_2 \r\nL235:   iload_3 \r\nL236:   ifeq L330 \r\n\r\n        .stack same \r\nL239:   aload_1 \r\nL240:   ldc_w 'iAmAString' \r\nL243:   invokeinterface InterfaceMethod some/class2 someMethod (Ljava/lang/String;)Z 2 \r\n\r\n        .stack stack_1 Integer \r\nL248:   istore_2 \r\nL249:   iload_2 \r\nL250:   iload_3 \r\nL251:   ifne L292 \r\nL254:   ifeq L277 \r\nL257:   aload_0 \r\nL258:   getfield Field some/class someSet Ljava/util/Set; \r\nL261:   aload_1 \r\nL262:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL267:   invokeinterface InterfaceMethod java/util/Set add (Ljava/lang/Object;)Z 2 \r\nL272:   pop \r\nL273:   iload_3 \r\nL274:   ifeq L293 \r\n\r\n        .stack full \r\n            locals Object some/class Object some/class2 Integer Integer \r\n            stack \r\n        .end stack \r\nL277:   aload_0 \r\nL278:   getfield Field some/class someSet Ljava/util/Set; \r\nL281:   aload_1 \r\nL282:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL287:   invokeinterface InterfaceMethod java/util/Set remove (Ljava/lang/Object;)Z 2 \r\n\r\n        .stack stack_1 Integer \r\nL292:   pop \r\n\r\n        .stack same \r\nL293:   aload_0 \r\nL294:   getfield Field some/class someMap Ljava/util/Map; \r\nL297:   aload_1 \r\nL298:   invokeinterface InterfaceMethod some/class2 someUUIDreturningMethod ()Ljava/util/UUID; 1 \r\nL303:   invokestatic Method java/lang/System currentTimeMillis ()J \r\nL306:   getstatic Field some/class random Ljava/util/Random; \r\nL309:   sipush 6374 \r\nL312:   invokevirtual Method java/util/Random nextInt (I)I \r\nL315:   i2l \r\nL316:   ladd \r\nL317:   ldc2_w 5387L \r\nL320:   ladd \r\nL321:   invokestatic Method java/lang/Long valueOf (J)Ljava/lang/Long; \r\nL324:   invokeinterface InterfaceMethod java/util/Map put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3 \r\nL329:   pop \r\n\r\n        .stack same \r\nL330:   iload_2 \r\nL331:   ireturn \r\nL332:   \r\n    .end code \r\n.end method \r\n```"}}
{"actor":{"display_login":"Janmm14"}}