{"action":"created","comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/comments/41961245","id":41961245,"diff_hunk":"@@ -0,0 +1,136 @@\n+/*\n+ * Copyright 2015 the original author or authors.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.springframework.cloud.dataflow.completion;\n+\n+import java.util.ArrayList;\n+import java.util.LinkedHashSet;\n+import java.util.List;\n+import java.util.Set;\n+\n+import org.springframework.cloud.dataflow.core.StreamDefinition;\n+import org.springframework.util.Assert;\n+\n+/**\n+ * A recovery strategy that will trigger if the parser failure is similar to that of some sample unfinished stream\n+ * definition. The match is decided by analyzing the top frames of the stack trace emitted by the parser when it\n+ * encounters the ill formed input. Multiple fingerprints are supported, as the control flow in the parser code may be\n+ * different depending on the form of the expression. For example, for the rule {@code stream = module (| module)* },\n+ * the pseudo code for the parser may look like\n+ *\n+ * <pre>\n+ * <code>\n+ * stream() {\n+ *   module();  (1)\n+ *   while(moreInput()) {\n+ *     swallowPipe();\n+ *     module();  (2)\n+ *   }\n+ * }\n+ * </code>\n+ * </pre>\n+ *\n+ * In that setup, whether we're dealing with the first module, or a subsequent module, stack frames would be different\n+ * (see (1) and (2)).\n+ *\n+ * @author Eric Bottard\n+ */\n+public abstract class StacktraceFingerprintingRecoveryStrategy<E extends Exception> implements\n+\t\tRecoveryStrategy<E> {\n+\n+\tprivate final Set<List<StackTraceElement>> fingerprints = new LinkedHashSet<>();\n+\n+\tprivate final Class<E> exceptionClass;\n+\n+\t/**\n+\t * Construct a new StacktraceFingerprintingRecoveryStrategy given the parser, and the expected exception\n+\t * class to be thrown for sample fragments of a stream definition that is to be parsed.\n+\t *\n+\t * @param exceptionClass the expected exception that results from parsing the sample fragment stream definitions.\n+\t *        Stack frames from the thrown exception are used to store the fingerprint of this exception thrown by the\n+\t *        parser.\n+\t * @param samples the sample fragments of stream definitions.\n+\t */\n+\tpublic StacktraceFingerprintingRecoveryStrategy(Class<E> exceptionClass,\n+\t\t\tString... samples) {\n+\t\tAssert.notNull(exceptionClass, \"exceptionClass should not be null\");\n+\t\tAssert.notEmpty(samples, \"samples should not be null or empty\");\n+\t\tthis.exceptionClass = exceptionClass;\n+\t\tinitFingerprints(samples);\n+\t}\n+\n+\t@SuppressWarnings(\"unchecked\")\n+\tprivate void initFingerprints(String... samples) {\n+\t\tfor (String sample : samples) {\n+\t\t\ttry {\n+\t\t\t\tnew StreamDefinition(\"__dummy\", sample);\n+\t\t\t}\n+\t\t\tcatch (RuntimeException exception) {\n+\t\t\t\tif (this.exceptionClass.isAssignableFrom(exception.getClass())) {\n+\t\t\t\t\tcomputeFingerprint((E) exception);\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\tthrow exception;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/**\n+\t * Extract the top frames (until the call to the {@link StreamDefinition} constructor appears) of the given exception.\n+\t */\n+\tprivate void computeFingerprint(E exception) {","path":"spring-cloud-dataflow-completion/src/main/java/org/springframework/cloud/dataflow/completion/StacktraceFingerprintingRecoveryStrategy.java","position":95,"original_position":95,"commit_id":"ef6574a2e9aa06243bb89f7cbe432727528b1a64","original_commit_id":"ef6574a2e9aa06243bb89f7cbe432727528b1a64","user":{"login":"ericbottard","id":313494,"avatar_url":"https://avatars.githubusercontent.com/u/313494?v=3","gravatar_id":"","url":"https://api.github.com/users/ericbottard","html_url":"https://github.com/ericbottard","followers_url":"https://api.github.com/users/ericbottard/followers","following_url":"https://api.github.com/users/ericbottard/following{/other_user}","gists_url":"https://api.github.com/users/ericbottard/gists{/gist_id}","starred_url":"https://api.github.com/users/ericbottard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericbottard/subscriptions","organizations_url":"https://api.github.com/users/ericbottard/orgs","repos_url":"https://api.github.com/users/ericbottard/repos","events_url":"https://api.github.com/users/ericbottard/events{/privacy}","received_events_url":"https://api.github.com/users/ericbottard/received_events","type":"User","site_admin":false},"body":"I would expect a method named `addFoo()` to take a Foo as an argument. This is mostly about \"computing\" it, also storing it, you're right. Any verb that captures those two ideas I'll buy, but not convinced by `add`. Sorry `¯\\_(ツ)_/¯`","created_at":"2015-10-14T07:10:42Z","updated_at":"2015-10-14T07:10:42Z","html_url":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108#discussion_r41961245","pull_request_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/comments/41961245"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108#discussion_r41961245"},"pull_request":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108","id":47448918,"html_url":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108","diff_url":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108.diff","patch_url":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108.patch","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/108","number":108,"state":"open","locked":false,"title":"XD-335, XD-3582: Options metadata and DSL completion","user":{"login":"ericbottard","id":313494,"avatar_url":"https://avatars.githubusercontent.com/u/313494?v=3","gravatar_id":"","url":"https://api.github.com/users/ericbottard","html_url":"https://github.com/ericbottard","followers_url":"https://api.github.com/users/ericbottard/followers","following_url":"https://api.github.com/users/ericbottard/following{/other_user}","gists_url":"https://api.github.com/users/ericbottard/gists{/gist_id}","starred_url":"https://api.github.com/users/ericbottard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericbottard/subscriptions","organizations_url":"https://api.github.com/users/ericbottard/orgs","repos_url":"https://api.github.com/users/ericbottard/repos","events_url":"https://api.github.com/users/ericbottard/events{/privacy}","received_events_url":"https://api.github.com/users/ericbottard/received_events","type":"User","site_admin":false},"body":"Not yet fully useful because of the huge number of options returned, I will work on a POC for server-side progressive results surfacing as a separate PR.\r\nIf not effective, will need to limit discoverability of options somehow, in which case the code in this PR is still 100% valid.\r\n\r\nRequires https://github.com/spring-cloud/spring-cloud-stream/pull/150","created_at":"2015-10-12T18:15:27Z","updated_at":"2015-10-14T07:10:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5868f84fc455db834966882816f66aed717c1ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108/commits","review_comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108/comments","review_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/108/comments","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/statuses/ef6574a2e9aa06243bb89f7cbe432727528b1a64","head":{"label":"ericbottard:CodeCompletion","ref":"CodeCompletion","sha":"ef6574a2e9aa06243bb89f7cbe432727528b1a64","user":{"login":"ericbottard","id":313494,"avatar_url":"https://avatars.githubusercontent.com/u/313494?v=3","gravatar_id":"","url":"https://api.github.com/users/ericbottard","html_url":"https://github.com/ericbottard","followers_url":"https://api.github.com/users/ericbottard/followers","following_url":"https://api.github.com/users/ericbottard/following{/other_user}","gists_url":"https://api.github.com/users/ericbottard/gists{/gist_id}","starred_url":"https://api.github.com/users/ericbottard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericbottard/subscriptions","organizations_url":"https://api.github.com/users/ericbottard/orgs","repos_url":"https://api.github.com/users/ericbottard/repos","events_url":"https://api.github.com/users/ericbottard/events{/privacy}","received_events_url":"https://api.github.com/users/ericbottard/received_events","type":"User","site_admin":false},"repo":{"id":40243328,"name":"spring-cloud-dataflow","full_name":"ericbottard/spring-cloud-dataflow","owner":{"login":"ericbottard","id":313494,"avatar_url":"https://avatars.githubusercontent.com/u/313494?v=3","gravatar_id":"","url":"https://api.github.com/users/ericbottard","html_url":"https://github.com/ericbottard","followers_url":"https://api.github.com/users/ericbottard/followers","following_url":"https://api.github.com/users/ericbottard/following{/other_user}","gists_url":"https://api.github.com/users/ericbottard/gists{/gist_id}","starred_url":"https://api.github.com/users/ericbottard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericbottard/subscriptions","organizations_url":"https://api.github.com/users/ericbottard/orgs","repos_url":"https://api.github.com/users/ericbottard/repos","events_url":"https://api.github.com/users/ericbottard/events{/privacy}","received_events_url":"https://api.github.com/users/ericbottard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericbottard/spring-cloud-dataflow","description":"","fork":true,"url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow","forks_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/forks","keys_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/teams","hooks_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/hooks","issue_events_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/issues/events{/number}","events_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/events","assignees_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/assignees{/user}","branches_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/branches{/branch}","tags_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/tags","blobs_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/statuses/{sha}","languages_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/languages","stargazers_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/stargazers","contributors_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/contributors","subscribers_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/subscribers","subscription_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/subscription","commits_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/contents/{+path}","compare_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/merges","archive_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/downloads","issues_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/issues{/number}","pulls_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/pulls{/number}","milestones_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/milestones{/number}","notifications_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/labels{/name}","releases_url":"https://api.github.com/repos/ericbottard/spring-cloud-dataflow/releases{/id}","created_at":"2015-08-05T12:13:08Z","updated_at":"2015-09-07T07:14:40Z","pushed_at":"2015-10-12T18:14:38Z","git_url":"git://github.com/ericbottard/spring-cloud-dataflow.git","ssh_url":"git@github.com:ericbottard/spring-cloud-dataflow.git","clone_url":"https://github.com/ericbottard/spring-cloud-dataflow.git","svn_url":"https://github.com/ericbottard/spring-cloud-dataflow","homepage":null,"size":1049,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spring-cloud:master","ref":"master","sha":"392bc95f4791ce4234e1228f98ce98f043fbbd6d","user":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":39469487,"name":"spring-cloud-dataflow","full_name":"spring-cloud/spring-cloud-dataflow","owner":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-cloud/spring-cloud-dataflow","description":"","fork":false,"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow","forks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/forks","keys_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/teams","hooks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/hooks","issue_events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/events{/number}","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/events","assignees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/assignees{/user}","branches_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/branches{/branch}","tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/tags","blobs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/languages","stargazers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/stargazers","contributors_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/contributors","subscribers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/subscribers","subscription_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/subscription","commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/contents/{+path}","compare_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/merges","archive_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/downloads","issues_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues{/number}","pulls_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/labels{/name}","releases_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/releases{/id}","created_at":"2015-07-21T20:56:11Z","updated_at":"2015-10-06T00:00:08Z","pushed_at":"2015-10-12T18:15:27Z","git_url":"git://github.com/spring-cloud/spring-cloud-dataflow.git","ssh_url":"git@github.com:spring-cloud/spring-cloud-dataflow.git","clone_url":"https://github.com/spring-cloud/spring-cloud-dataflow.git","svn_url":"https://github.com/spring-cloud/spring-cloud-dataflow","homepage":null,"size":2336,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":21,"mirror_url":null,"open_issues_count":5,"forks":21,"open_issues":5,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-dataflow/pull/108"},"issue":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/108"},"comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow/statuses/ef6574a2e9aa06243bb89f7cbe432727528b1a64"}}}}