{"action":"created","comment":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/169217071","pull_request_review_id":97706687,"id":169217071,"diff_hunk":"@@ -1254,48 +1252,22 @@ private Attachable findAttachment(final Element element, final String type) thro\n     return returnVal;\n   }\n \n-  private static String capitalizeFirstLetter(final String input) {\n-    char first = input.charAt(0);\n-    first = Character.toUpperCase(first);\n-    return first + input.substring(1);\n-  }\n-\n   private ArrayList<Tuple<String, String>> setValues(final IAttachment attachment, final List<Element> values)\n       throws GameParseException {\n+    final Map<String, Function<IAttachment, AttachmentProperty<?>>> attachmentMap = attachment.getAttachmentMap();\n     final ArrayList<Tuple<String, String>> options = new ArrayList<>();\n     for (final Element current : values) {\n       // find the setter\n       final String name = current.getAttribute(\"name\");\n       if (name.length() == 0) {\n         throw newGameParseException(\"Option name with 0 length\");\n       }\n-      final Method setter;\n-      try {\n-        setter = attachment.getClass().getMethod(\"set\" + capitalizeFirstLetter(name), SETTER_ARGS);\n-      } catch (final NoSuchMethodException nsme) {\n-        throw newGameParseException(String.format(\n-            \"The following option name of %s of class %s are either misspelled\"\n-                + \" or exist only in a future version of TripleA. Setter: %s\",\n-            attachment.getName(), attachment.getClass().getSimpleName(), name));\n-      }\n       // find the value\n       final String value = current.getAttribute(\"value\");\n       final String count = current.getAttribute(\"count\");\n-      final String itemValues;\n-      if (count.length() > 0) {\n-        itemValues = count + \":\" + value;\n-      } else {\n-        itemValues = value;\n-      }\n-      // invoke\n-      try {\n-        setter.invoke(attachment, itemValues);\n-      } catch (final IllegalAccessException iae) {\n-        throw newGameParseException(\n-            \"Setter not public. Setter:\" + name + \" Class:\" + attachment.getClass().getName(), iae);\n-      } catch (final InvocationTargetException ite) {\n-        throw newGameParseException(\"Error setting property:\" + name, ite);\n-      }\n+      final String itemValues = (count.length() > 0 ? count + \":\" : \"\") + value;\n+      attachmentMap.get(name).apply(attachment).setValue(itemValues);","path":"game-core/src/main/java/games/strategy/engine/data/GameParser.java","position":72,"original_position":72,"commit_id":"4a1dc36b29851cb258ad16e1876a4c371f414d91","original_commit_id":"4a1dc36b29851cb258ad16e1876a4c371f414d91","user":{"login":"ssoloff","id":4826349,"avatar_url":"https://avatars2.githubusercontent.com/u/4826349?v=4","gravatar_id":"","url":"https://api.github.com/users/ssoloff","html_url":"https://github.com/ssoloff","followers_url":"https://api.github.com/users/ssoloff/followers","following_url":"https://api.github.com/users/ssoloff/following{/other_user}","gists_url":"https://api.github.com/users/ssoloff/gists{/gist_id}","starred_url":"https://api.github.com/users/ssoloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssoloff/subscriptions","organizations_url":"https://api.github.com/users/ssoloff/orgs","repos_url":"https://api.github.com/users/ssoloff/repos","events_url":"https://api.github.com/users/ssoloff/events{/privacy}","received_events_url":"https://api.github.com/users/ssoloff/received_events","type":"User","site_admin":false},"body":"At least some of your tests are failing because the map XMLs under _src/test/resources_ have the same problem you fixed in all the map repos: capitalized option names (e.g. `CarrierCost` vs. `carrierCost`).\r\n\r\nNote that you should probably guard against the map `get()` call returning `null` for an unknown property name.  Throwing a `GameParseException` would be appropriate in that case.","created_at":"2018-02-20T04:49:14Z","updated_at":"2018-02-20T04:49:14Z","html_url":"https://github.com/triplea-game/triplea/pull/3042#discussion_r169217071","pull_request_url":"https://api.github.com/repos/triplea-game/triplea/pulls/3042","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/169217071"},"html":{"href":"https://github.com/triplea-game/triplea/pull/3042#discussion_r169217071"},"pull_request":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/3042"}}},"pull_request":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/3042","id":170033601,"html_url":"https://github.com/triplea-game/triplea/pull/3042","diff_url":"https://github.com/triplea-game/triplea/pull/3042.diff","patch_url":"https://github.com/triplea-game/triplea/pull/3042.patch","issue_url":"https://api.github.com/repos/triplea-game/triplea/issues/3042","number":3042,"state":"open","locked":false,"title":"Remove reflective access","user":{"login":"RoiEXLab","id":8350879,"avatar_url":"https://avatars0.githubusercontent.com/u/8350879?v=4","gravatar_id":"","url":"https://api.github.com/users/RoiEXLab","html_url":"https://github.com/RoiEXLab","followers_url":"https://api.github.com/users/RoiEXLab/followers","following_url":"https://api.github.com/users/RoiEXLab/following{/other_user}","gists_url":"https://api.github.com/users/RoiEXLab/gists{/gist_id}","starred_url":"https://api.github.com/users/RoiEXLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoiEXLab/subscriptions","organizations_url":"https://api.github.com/users/RoiEXLab/orgs","repos_url":"https://api.github.com/users/RoiEXLab/repos","events_url":"https://api.github.com/users/RoiEXLab/events{/privacy}","received_events_url":"https://api.github.com/users/RoiEXLab/received_events","type":"User","site_admin":false},"body":"This PR changes the GameParser, so the attachments are no longer accessed reflectively, which allows for compile-time checks if the required methods are available.\r\nI did test my changes, and parsed **_every single map_** manually, which revealed a lot of uppercase typos to me, which means they need to get fixed/my changes need o get merged before this PR.\r\nI need some help getting the tests green again though...","created_at":"2018-02-19T19:02:42Z","updated_at":"2018-02-20T04:49:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edce5249bf6d9c20b82803843793ccd4c3e2f665","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/triplea-game/triplea/pulls/3042/commits","review_comments_url":"https://api.github.com/repos/triplea-game/triplea/pulls/3042/comments","review_comment_url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}","comments_url":"https://api.github.com/repos/triplea-game/triplea/issues/3042/comments","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/4a1dc36b29851cb258ad16e1876a4c371f414d91","head":{"label":"RoiEXLab:remove-reflective-access","ref":"remove-reflective-access","sha":"4a1dc36b29851cb258ad16e1876a4c371f414d91","user":{"login":"RoiEXLab","id":8350879,"avatar_url":"https://avatars0.githubusercontent.com/u/8350879?v=4","gravatar_id":"","url":"https://api.github.com/users/RoiEXLab","html_url":"https://github.com/RoiEXLab","followers_url":"https://api.github.com/users/RoiEXLab/followers","following_url":"https://api.github.com/users/RoiEXLab/following{/other_user}","gists_url":"https://api.github.com/users/RoiEXLab/gists{/gist_id}","starred_url":"https://api.github.com/users/RoiEXLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoiEXLab/subscriptions","organizations_url":"https://api.github.com/users/RoiEXLab/orgs","repos_url":"https://api.github.com/users/RoiEXLab/repos","events_url":"https://api.github.com/users/RoiEXLab/events{/privacy}","received_events_url":"https://api.github.com/users/RoiEXLab/received_events","type":"User","site_admin":false},"repo":{"id":57201503,"name":"triplea","full_name":"RoiEXLab/triplea","owner":{"login":"RoiEXLab","id":8350879,"avatar_url":"https://avatars0.githubusercontent.com/u/8350879?v=4","gravatar_id":"","url":"https://api.github.com/users/RoiEXLab","html_url":"https://github.com/RoiEXLab","followers_url":"https://api.github.com/users/RoiEXLab/followers","following_url":"https://api.github.com/users/RoiEXLab/following{/other_user}","gists_url":"https://api.github.com/users/RoiEXLab/gists{/gist_id}","starred_url":"https://api.github.com/users/RoiEXLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoiEXLab/subscriptions","organizations_url":"https://api.github.com/users/RoiEXLab/orgs","repos_url":"https://api.github.com/users/RoiEXLab/repos","events_url":"https://api.github.com/users/RoiEXLab/events{/privacy}","received_events_url":"https://api.github.com/users/RoiEXLab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RoiEXLab/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":true,"url":"https://api.github.com/repos/RoiEXLab/triplea","forks_url":"https://api.github.com/repos/RoiEXLab/triplea/forks","keys_url":"https://api.github.com/repos/RoiEXLab/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RoiEXLab/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RoiEXLab/triplea/teams","hooks_url":"https://api.github.com/repos/RoiEXLab/triplea/hooks","issue_events_url":"https://api.github.com/repos/RoiEXLab/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/RoiEXLab/triplea/events","assignees_url":"https://api.github.com/repos/RoiEXLab/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/RoiEXLab/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/RoiEXLab/triplea/tags","blobs_url":"https://api.github.com/repos/RoiEXLab/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RoiEXLab/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RoiEXLab/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/RoiEXLab/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RoiEXLab/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/RoiEXLab/triplea/languages","stargazers_url":"https://api.github.com/repos/RoiEXLab/triplea/stargazers","contributors_url":"https://api.github.com/repos/RoiEXLab/triplea/contributors","subscribers_url":"https://api.github.com/repos/RoiEXLab/triplea/subscribers","subscription_url":"https://api.github.com/repos/RoiEXLab/triplea/subscription","commits_url":"https://api.github.com/repos/RoiEXLab/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/RoiEXLab/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/RoiEXLab/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/RoiEXLab/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/RoiEXLab/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/RoiEXLab/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RoiEXLab/triplea/merges","archive_url":"https://api.github.com/repos/RoiEXLab/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RoiEXLab/triplea/downloads","issues_url":"https://api.github.com/repos/RoiEXLab/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/RoiEXLab/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/RoiEXLab/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/RoiEXLab/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RoiEXLab/triplea/labels{/name}","releases_url":"https://api.github.com/repos/RoiEXLab/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/RoiEXLab/triplea/deployments","created_at":"2016-04-27T09:32:28Z","updated_at":"2017-01-04T17:58:13Z","pushed_at":"2018-02-19T19:49:19Z","git_url":"git://github.com/RoiEXLab/triplea.git","ssh_url":"git@github.com:RoiEXLab/triplea.git","clone_url":"https://github.com/RoiEXLab/triplea.git","svn_url":"https://github.com/RoiEXLab/triplea","homepage":null,"size":735846,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"triplea-game:master","ref":"master","sha":"012eb4aa7d5930acf1307c2562ac8e599df5196b","user":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars0.githubusercontent.com/u/13318615?v=4","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"repo":{"id":39766308,"name":"triplea","full_name":"triplea-game/triplea","owner":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars0.githubusercontent.com/u/13318615?v=4","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/triplea-game/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":false,"url":"https://api.github.com/repos/triplea-game/triplea","forks_url":"https://api.github.com/repos/triplea-game/triplea/forks","keys_url":"https://api.github.com/repos/triplea-game/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/triplea-game/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/triplea-game/triplea/teams","hooks_url":"https://api.github.com/repos/triplea-game/triplea/hooks","issue_events_url":"https://api.github.com/repos/triplea-game/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/triplea-game/triplea/events","assignees_url":"https://api.github.com/repos/triplea-game/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/triplea-game/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/triplea-game/triplea/tags","blobs_url":"https://api.github.com/repos/triplea-game/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/triplea-game/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/triplea-game/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/triplea-game/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/triplea-game/triplea/languages","stargazers_url":"https://api.github.com/repos/triplea-game/triplea/stargazers","contributors_url":"https://api.github.com/repos/triplea-game/triplea/contributors","subscribers_url":"https://api.github.com/repos/triplea-game/triplea/subscribers","subscription_url":"https://api.github.com/repos/triplea-game/triplea/subscription","commits_url":"https://api.github.com/repos/triplea-game/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/triplea-game/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/triplea-game/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/triplea-game/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/triplea-game/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/triplea-game/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/triplea-game/triplea/merges","archive_url":"https://api.github.com/repos/triplea-game/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/triplea-game/triplea/downloads","issues_url":"https://api.github.com/repos/triplea-game/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/triplea-game/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/triplea-game/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/triplea-game/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/triplea-game/triplea/labels{/name}","releases_url":"https://api.github.com/repos/triplea-game/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/triplea-game/triplea/deployments","created_at":"2015-07-27T09:32:58Z","updated_at":"2018-02-18T15:21:58Z","pushed_at":"2018-02-20T04:43:35Z","git_url":"git://github.com/triplea-game/triplea.git","ssh_url":"git@github.com:triplea-game/triplea.git","clone_url":"https://github.com/triplea-game/triplea.git","svn_url":"https://github.com/triplea-game/triplea","homepage":null,"size":744148,"stargazers_count":88,"watchers_count":88,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":84,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":49,"open_issues":84,"watchers":88,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/3042"},"html":{"href":"https://github.com/triplea-game/triplea/pull/3042"},"issue":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/3042"},"comments":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/3042/comments"},"review_comments":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/3042/comments"},"review_comment":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/3042/commits"},"statuses":{"href":"https://api.github.com/repos/triplea-game/triplea/statuses/4a1dc36b29851cb258ad16e1876a4c371f414d91"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ssoloff"}}