131 * @return a list of wrapper information |
131 * @return a list of wrapper information |
132 */ |
132 */ |
133 public abstract List<SnippetWrapper> wrappers(String input); |
133 public abstract List<SnippetWrapper> wrappers(String input); |
134 |
134 |
135 /** |
135 /** |
|
136 * Converts the source code of a snippet into a {@link Snippet} object (or |
|
137 * list of {@code Snippet} objects in the case of some var declarations, |
|
138 * e.g.: int x, y, z;). |
|
139 * Does not install the snippets: declarations are not |
|
140 * accessible by other snippets; imports are not added. |
|
141 * Does not execute the snippets. |
|
142 * <p> |
|
143 * Queries may be done on the {@code Snippet} object. The {@link Snippet#id()} |
|
144 * will be {@code "*UNASSOCIATED*"}. |
|
145 * The returned snippets are not associated with the |
|
146 * {@link JShell} instance, so attempts to pass them to {@code JShell} |
|
147 * methods will throw an {@code IllegalArgumentException}. |
|
148 * They will not appear in queries for snippets -- |
|
149 * for example, {@link JShell#snippets() }. |
|
150 * <p> |
|
151 * Restrictions on the input are as in {@link JShell#eval}. |
|
152 * <p> |
|
153 * Only preliminary compilation is performed, sufficient to build the |
|
154 * {@code Snippet}. Snippets known to be erroneous, are returned as |
|
155 * {@link ErroneousSnippet}, other snippets may or may not be in error. |
|
156 * <p> |
|
157 * @param input The input String to convert |
|
158 * @return usually a singleton list of Snippet, but may be empty or multiple |
|
159 * @throws IllegalStateException if the {@code JShell} instance is closed. |
|
160 */ |
|
161 public abstract List<Snippet> sourceToSnippets(String input); |
|
162 |
|
163 /** |
136 * Returns a collection of {@code Snippet}s which might need updating if the |
164 * Returns a collection of {@code Snippet}s which might need updating if the |
137 * given {@code Snippet} is updated. The returned collection is designed to |
165 * given {@code Snippet} is updated. The returned collection is designed to |
138 * be inclusive and may include many false positives. |
166 * be inclusive and may include many false positives. |
139 * |
167 * |
140 * @param snippet the {@code Snippet} whose dependents are requested |
168 * @param snippet the {@code Snippet} whose dependents are requested |