{"id":16416354,"url":"https://github.com/igapyon/simple-eclipseastjava","last_synced_at":"2026-05-18T07:02:51.033Z","repository":{"id":153082170,"uuid":"71691976","full_name":"igapyon/simple-EclipseAstJava","owner":"igapyon","description":"Simple Eclipse AST Parser sample for Java.","archived":false,"fork":false,"pushed_at":"2018-04-18T13:02:58.000Z","size":8157,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T11:18:51.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igapyon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-23T08:58:23.000Z","updated_at":"2018-11-08T15:02:57.000Z","dependencies_parsed_at":"2023-07-13T13:15:43.787Z","dependency_job_id":null,"html_url":"https://github.com/igapyon/simple-EclipseAstJava","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/igapyon/simple-EclipseAstJava","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igapyon%2Fsimple-EclipseAstJava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igapyon%2Fsimple-EclipseAstJava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igapyon%2Fsimple-EclipseAstJava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igapyon%2Fsimple-EclipseAstJava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igapyon","download_url":"https://codeload.github.com/igapyon/simple-EclipseAstJava/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igapyon%2Fsimple-EclipseAstJava/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33168910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:09:04.313Z","updated_at":"2026-05-18T07:02:51.016Z","avatar_url":"https://github.com/igapyon.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[target](http://www.igapyon.jp/igapyon/diary/2018/ig180417.html) \n\n2018-04-17 diary: Eclipse AST を利用した シンプルな Java ソースコード解析\n=====================================================================================================\n[![いがぴょん画像(小)](http://www.igapyon.jp/igapyon/diary/images/iga200306s.jpg \"いがぴょん\")](http://www.igapyon.jp/igapyon/diary/memo/memoigapyon.html) [いがぴょん](http://www.igapyon.jp/igapyon/diary/memo/memoigapyon.html)の日記に関連のあるコンテンツ。\n\n## Eclipse AST を利用した シンプルな Java ソースコード解析\n\nEclipse AST を利用した Java ソースコード解析の最新な状況をメモしておきます。\n\nまず、ここで調べた結果は以下の github リポジトリに反映済みです。\n\n* [https://github.com/igapy...ipseAstJava](https://github.com/igapyon/simple-EclipseAstJava)\n\n### Eclipse AST に必要な jar ライブラリを利用\n\nEclipse AST を利用するためには、Eclipse AST に関連する jar ライブラリ一式を揃える必要があります。これは Maven リポジトリを利用すると大変簡単に実現することができます。\n\nMaven の依存関係に、以下のように `org.eclipse.jdt.core` を加えます。これだけで、芋づる式に必要な jar ライブラリを利用することが可能になります。\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.eclipse.jdt\u003c/groupId\u003e\n  \u003cartifactId\u003eorg.eclipse.jdt.core\u003c/artifactId\u003e\n  \u003cversion\u003e3.13.102\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### シンプルな Eclipse AST コード\n\nEclipse AST に必要なライブラリ一式が組み込めたら、Eclipse AST を利用したパースコードが記述および実行できます。重要な箇所を以下にピックアップします。\n\n```java\nimport org.apache.commons.io.FileUtils;\nimport org.eclipse.jdt.core.dom.AST;\nimport org.eclipse.jdt.core.dom.ASTParser;\nimport org.eclipse.jdt.core.dom.CompilationUnit;\n\n        final ASTParser parser = ASTParser.newParser(AST.JLS10);\n        parser.setKind(ASTParser.K_COMPILATION_UNIT);\n        parser.setSource(buf.toString().toCharArray());\n\n        final CompilationUnit node = (CompilationUnit) parser.createAST(null);\n        final SimpleVisitor visitor = new SimpleVisitor();\n        node.accept(visitor);\n```\n\n完全なソースコードは [https://github.com/igapy...ipseAstJava](https://github.com/igapyon/simple-EclipseAstJava) にて参照することができます。\n\n### 関連する情報\n\n* [2016-10-22 diary: Eclipse AST を利用した Java ソースコード解析](http://www.igapyon.jp/igapyon/diary/2016/ig161022.html) : 旧バージョン\n* [2016-10-23 diary: Eclipse AST を利用した PHP ソースコード解析](http://www.igapyon.jp/igapyon/diary/2016/ig161023.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figapyon%2Fsimple-eclipseastjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figapyon%2Fsimple-eclipseastjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figapyon%2Fsimple-eclipseastjava/lists"}