D
D
DarkByte20152017-06-17 11:03:03
IntelliJ IDEA
DarkByte2015, 2017-06-17 11:03:03

How to make normal sources in IDEA?

I'm new to java and often want to look at the source of standard classes (I use IDEA). But when I look, it feels like they are auto-generated or decompiled... For example

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package java.io;

public abstract class OutputStream implements Closeable, Flushable {
    public OutputStream() {
    }

    public abstract void write(int var1) throws IOException;

    public void write(byte[] var1) throws IOException {
        this.write(var1, 0, var1.length);
    }

    public void write(byte[] var1, int var2, int var3) throws IOException {
        if(var1 == null) {
            throw new NullPointerException();
        } else if(var2 >= 0 && var2 <= var1.length && var3 >= 0 && var2 + var3 <= var1.length && var2 + var3 >= 0) {
            if(var3 != 0) {
                for(int var4 = 0; var4 < var3; ++var4) {
                    this.write(var1[var2 + var4]);
                }

            }
        } else {
            throw new IndexOutOfBoundsException();
        }
    }

    public void flush() throws IOException {
    }

    public void close() throws IOException {
    }
}


This is how my OutputStream sources look like there. What the hell is with local variables? Why aren't they properly named? Like index, count... And instead var1, var2... It certainly shouldn't be like that. It just makes it hard to learn the language. Can I somehow upload the original source code of the standard classes there? (so that when you click on the class, normal source codes open)

PS Yes, I just noticed the inscription "Source code recreated from a .class file by IntelliJ IDEA". They are decompiled. And I would like to see the original there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shockoway, 2017-06-17
@Shockoway

As far as I remember, the sources usually come with the downloaded JDK, check what you have:
5908b6eae14d4ceb807c603684ebc406.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question