Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this annotation in Intellij source code mean?

When looking into the source code of IntelliJ IDEA Community Edition project in github, in one of the files I found the following notation:

void m() {
    <selection><caret>System.out.println("");</selection>
}

What does this <selection> annotation mean? By which tool is it being processed?

The complete source of afterEnumConstantWithArgs.java is as follows.

// "Use existing implementation of 'm'" "true"
enum I {
    A("a") {
        void m() {
            <selection><caret>System.out.println("");</selection>
        }
    },
    B("b") {
        public void m() {
            System.out.println("");
        }
    };
    abstract void m();
    I(String s){}
}
like image 738
pinker Avatar asked Mar 31 '16 22:03

pinker


People also ask

What is annotations in IntelliJ?

Annotations Last modified: 26 July 2022. Java annotations are pieces of metadata that provide information about the code they are used with, and can instruct the IDE how to process this code.

How can I view source code in IntelliJ?

From the main menu, select View | Show Siblings. IntelliJ IDEA opens a popup where you can browse through the implementations, navigate to source, edit code, and open the list in the Find tool window.

What are coding annotations?

Annotations in programming languages are, similar to those in linguistics, structural elements containing additional or meta-information in the source code of a program.


1 Answers

Firstly you should note you're reading test data, not a source file itself. Presumably this is emulating a file that would be loaded into IntelliJ.

<caret> would be referring to where the caret is in the file, i.e. the blinking cursor. <selection> would be the code that's currently selected, which is why it has a beginning and end tag.

Source: reading the code until I figured this out.

Seems to be parsed by this file.

like image 145
djechlin Avatar answered Oct 22 '22 23:10

djechlin