public abstract class SourceCodeAnalysis extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SourceCodeAnalysis.Completeness
Describes the completeness of the given input.
|
static class |
SourceCodeAnalysis.CompletionInfo
The result of
analyzeCompletion(String input) . |
static class |
SourceCodeAnalysis.QualifiedNames
List of possible qualified names.
|
static class |
SourceCodeAnalysis.Suggestion
A candidate for continuation of the given user's input.
|
Modifier and Type | Method and Description |
---|---|
abstract SourceCodeAnalysis.CompletionInfo |
analyzeCompletion(String input)
Given an input string, find the first snippet of code (one statement,
definition, import, or expression) and evaluate if it is complete.
|
abstract String |
analyzeType(String code,
int cursor)
Infer the type of the given expression.
|
abstract List<SourceCodeAnalysis.Suggestion> |
completionSuggestions(String input,
int cursor,
int[] anchor)
Compute possible follow-ups for the given input.
|
abstract String |
documentation(String input,
int cursor)
Compute a description/help string for the given user's input.
|
abstract SourceCodeAnalysis.QualifiedNames |
listQualifiedNames(String code,
int cursor)
List qualified names known for the simple name in the given code immediately
to the left of the given cursor position.
|
public abstract SourceCodeAnalysis.CompletionInfo analyzeCompletion(String input)
input
- the input source stringpublic abstract List<SourceCodeAnalysis.Suggestion> completionSuggestions(String input, int cursor, int[] anchor)
JShell
state, including
type information, to filter the suggestions.input
- the user input, so farcursor
- the current position of the cursors in the given input
textanchor
- outgoing parameter - when an option will be completed, the text between
the anchor and cursor will be deleted and replaced with the given optionpublic abstract String documentation(String input, int cursor)
input
- the snippet the user wrote so farcursor
- the current position of the cursors in the given input
textpublic abstract String analyzeType(String code, int cursor)
code
to the given cursor
position. Returns null if the type of the expression cannot
be inferred.code
- the expression for which the type should be inferredcursor
- current cursor position in the given codepublic abstract SourceCodeAnalysis.QualifiedNames listQualifiedNames(String code, int cursor)
JShell.addToClasspath(java.lang.String)
).code
- the expression for which the candidate qualified names should be computedcursor
- current cursor position in the given code
Copyright © 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-04-25-041322.buildd.src