question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java support (no, seriously)

See original GitHub issue

Commands:

javac Foo.java
javap - c Foo

Example code:

import java.util.ArrayList;

class Foo {

  void iterateList() {
    ArrayList<Integer> list = new ArrayList<Integer>();
    list.add(1);
    list.add(2);
    list.add(3);

    for (int i : list) {
      System.out.println(i);
    }
  }

  void iterateArray() {
    int[] array = {1, 2, 3};

    for (int i : array) {
      System.out.println(i);
    }
  }

}

Example output:

Compiled from "Foo.java"
class Foo extends java.lang.Object{
Foo();
  Code:
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
   4:   return

void iterateList();
  Code:
   0:   new #2; //class java/util/ArrayList
   3:   dup
   4:   invokespecial   #3; //Method java/util/ArrayList."<init>":()V
   7:   astore_1
   8:   aload_1
   9:   iconst_1
   10:  invokestatic    #4; //Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
   13:  invokevirtual   #5; //Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
   16:  pop
   17:  aload_1
   18:  iconst_2
   19:  invokestatic    #4; //Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
   22:  invokevirtual   #5; //Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
   25:  pop
   26:  aload_1
   27:  iconst_3
   28:  invokestatic    #4; //Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
   31:  invokevirtual   #5; //Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
   34:  pop
   35:  aload_1
   36:  invokevirtual   #6; //Method java/util/ArrayList.iterator:()Ljava/util/Iterator;
   39:  astore_2
   40:  aload_2
   41:  invokeinterface #7,  1; //InterfaceMethod java/util/Iterator.hasNext:()Z
   46:  ifeq    72
   49:  aload_2
   50:  invokeinterface #8,  1; //InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
   55:  checkcast   #9; //class java/lang/Integer
   58:  invokevirtual   #10; //Method java/lang/Integer.intValue:()I
   61:  istore_3
   62:  getstatic   #11; //Field java/lang/System.out:Ljava/io/PrintStream;
   65:  iload_3
   66:  invokevirtual   #12; //Method java/io/PrintStream.println:(I)V
   69:  goto    40
   72:  return

void iterateArray();
  Code:
   0:   iconst_3
   1:   newarray int
   3:   dup
   4:   iconst_0
   5:   iconst_1
   6:   iastore
   7:   dup
   8:   iconst_1
   9:   iconst_2
   10:  iastore
   11:  dup
   12:  iconst_2
   13:  iconst_3
   14:  iastore
   15:  astore_1
   16:  aload_1
   17:  astore_2
   18:  aload_2
   19:  arraylength
   20:  istore_3
   21:  iconst_0
   22:  istore  4
   24:  iload   4
   26:  iload_3
   27:  if_icmpge   50
   30:  aload_2
   31:  iload   4
   33:  iaload
   34:  istore  5
   36:  getstatic   #11; //Field java/lang/System.out:Ljava/io/PrintStream;
   39:  iload   5
   41:  invokevirtual   #12; //Method java/io/PrintStream.println:(I)V
   44:  iinc    4, 1
   47:  goto    24
   50:  return

}

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jkeamcommented, Dec 27, 2016

I just wanted to tag on and say that I’m working on a bunch of projects to show the disassembled code for languages that I find interesting.

So far I’ve done: http://erlangbytes.io/ http://javabytes.io/ http://rubybytes.io/

With plans to do elixir and python next. Feedback is always welcome 😃

0reactions
mattgodboltcommented, May 26, 2019

@joewalnes we actually have a PR pending to implement this… after only seven and a bit years…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java support (no, seriously) · Issue #12 · compiler-explorer ...
I'm going to close this. Compiler Explorer is going to concentrate on compiled languages that output machine-level instructions. I'd consider a patch to...
Read more >
Why doesn't Java support unsigned ints? - Stack Overflow
Although char does not support unsigned arithmetic, it essentially can be treated as an unsigned integer. You would have to explicitly cast arithmetic ......
Read more >
Troubleshooting tips for running Java
If Java is not enabled in the Java Control Panel, you will be unable to run Java ... versions of Java on your...
Read more >
No, Seriously, Just Disable Java in Your Browser Right Now
Disable Java, but leave Javascript enabled. If you have more questions, the blog Krebs on Security has an excellent FAQ here. (No, you...
Read more >
Disabling (or Enabling) the Java Plugin in a Browser
Here are the steps to disable (or enable) a third-party Java plugin in Chrome, Firefox, Safari, and other browsers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found