Headline

a fragment locator for Java

Description

JFragmentLocator is a part of the 101companies:Explorer; it is a Java-specific tool for fragment location. That is, the technology supports the syntax-aware location of a fragment in Java compilation unit. The input/output behavior of JFragmentLocator is the following:

  • Input:
    • a Java compilation unit
    • a fragment description
  • Output:
    • the line range of the located fragment
JFragmentLocator leverages JSON for the description of fragments and the derived line ranges. Consider, for example, the following Java compilation unit:

package org.softlang.trivia;

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }

}

The following fragment description locates the main method of the class:

{ 
 "method" : "main"
}

If we wanted to make explicit the hosting class (which may be necessary in case there are multiple classes in the same compilation unit), then the description may take the following form instead:

{
 "class" : "HelloWorld", 
 "method" : "main"
}

The class name is unqualified in this example. It may also be desirable to explicitly specify the package qualifier of the class. Hence, the fragment description may also take the following form:

{
 "package" : "org.softlang.trivia",
 "class" : "HelloWorld", 
 "method" : "main"
}

Further, the method of interest may be overloaded. In this case, some sort of overloading resolution is needed. A simple, position-oriented approach is assumed here. That is, the 0-based index of the intended overload can be defined. In the example, the main method is not overloaded, but we can still demonstrate the extra description element at hand:

{
 "package" : "org.softlang.trivia",
 "class" : "HelloWorld", 
 "method" : "main",
 "overload" : "0"
}

All fragment descriptions locate the same fragment: the line range 3-5. Thus:

{"to": 3, "from": 5}

It may also be necessary to deal with fields, nested classes, anonymous classes, enum types, interfaces, statement sequences, expressions, and yet other language elements. The description of such fragments is not described here, but we refer to the implementation.

Contributors

Metadata


There are no revisions for this page.

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    10 most similar pages:

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.