Yahya Uddin Yahya Uddin - 1 month ago 5
Java Question

Java Source code not showing (InteliJ?)

I'm using InteliJ and developing code using Java.

When I use "Go to Declaration" [Ctrl+B] to a Java inbuilt feature (e.g. ArrayList), it takes me to that class (e.g. ArrayList.class) and looks a bit like this:

// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available

package java.util;

public class ArrayList <E> extends java.util.AbstractList<E>
implements java.util.List<E>, java.util.RandomAccess,
java.lang.Cloneable, java.io.Serializable {

private static final long serialVersionUID = 8683452581122892189L;
private static final int DEFAULT_CAPACITY = 10;
private static final java.lang.Object[] EMPTY_ELEMENTDATA;
private transient java.lang.Object[] elementData;
private int size;
private static final int MAX_ARRAY_SIZE = 2147483639;

public ArrayList(int i) { /* compiled code */ }

public ArrayList() { /* compiled code */ }

public ArrayList(java.util.Collection<? extends E> es) { /* compiled code */ }


However I seen it on other computer and it actually shows the Java source, not just a comment saying "compiled code".

How do I get this on my computer. Have I set up Java incorrectly?

Answer

You should be able to configure it in your project structure (ctrl + alt + shift + S) settings here:

enter image description here

Is your JDK pointing to an invalid Sourcepath?