SourceCodeAnalysis (Java SE 19 & JDK 19) (original) (raw)


public abstract class SourceCodeAnalysis extends Object

Provides analysis utilities for source code input. Optional functionality that provides for a richer interactive experience. Includes completion analysis: Is the input a complete snippet of code? Do I need to prompt for more input? Would adding a semicolon make it complete? Is there more than one snippet? etc. Also includes completion suggestions, as might be used in tab-completion.

Since:

9

Nested Classes
static enum
A span attribute which can be used to derive a coloring.
static enum
Describes the completeness of the given input.
static interface
The result of analyzeCompletion(String input).
static interface
A documentation for a candidate for continuation of the given user's input.
static final record
Assigns attributes usable for coloring to spans inside a snippet.
static final class
List of possible qualified names.
static interface
The wrapping of a snippet of Java source into valid top-level Java source.
static interface
A candidate for continuation of the given user's input.

Given an input string, find the first snippet of code (one statement, definition, import, or expression) and evaluate if it is complete.
Infer the type of the given expression.
[completionSuggestions](#completionSuggestions%28java.lang.String,int,int%5B%5D%29)([String](../../../java.base/java/lang/String.html "class in java.lang") input, int cursor, int[] anchor)
Compute possible follow-ups for the given input.
Returns a collection of Snippets which might need updating if the given Snippet is updated.
[documentation](#documentation%28java.lang.String,int,boolean%29)([String](../../../java.base/java/lang/String.html "class in java.lang") input, int cursor, boolean computeJavadoc)
Compute documentation for the given user's input.
Returns a collection of Highlights which can be used to color the given snippet.
List qualified names known for the simple name in the given code immediately to the left of the given cursor position.
Converts the source code of a snippet into a Snippet object (or list of Snippet objects in the case of some var declarations, e.g.: int x, y, z;).
Returns the wrapper information for the Snippet.
Returns the wrapper information for the snippet within the input source string.

Methods declared in class java.lang.Object

[clone](../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../java.base/java/lang/Object.html#wait%28long,int%29)