{"id":37029808,"url":"https://github.com/dump247/javapoet-dsl","last_synced_at":"2026-01-14T03:35:59.010Z","repository":{"id":57726763,"uuid":"238854969","full_name":"dump247/javapoet-dsl","owner":"dump247","description":"Kotlin DSL wrapper for the JavaPoet Java code generation library","archived":false,"fork":false,"pushed_at":"2020-12-03T18:17:53.000Z","size":246,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T15:48:24.928Z","etag":null,"topics":["javapoet","kotlin"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dump247.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}},"created_at":"2020-02-07T06:03:30.000Z","updated_at":"2023-08-18T13:35:40.000Z","dependencies_parsed_at":"2022-09-26T21:51:00.356Z","dependency_job_id":null,"html_url":"https://github.com/dump247/javapoet-dsl","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/dump247/javapoet-dsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dump247%2Fjavapoet-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dump247%2Fjavapoet-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dump247%2Fjavapoet-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dump247%2Fjavapoet-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dump247","download_url":"https://codeload.github.com/dump247/javapoet-dsl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dump247%2Fjavapoet-dsl/sbom","scorecard":{"id":359586,"data":{"date":"2025-08-11","repo":{"name":"github.com/dump247/javapoet-dsl","commit":"7acd4d22b3b8192de892581305226f9fc3cfb35c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/publish-githubpackages.yml:1","Warn: no topLevel permission defined: .github/workflows/publish-mavencentral.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-githubpackages.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-githubpackages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-githubpackages.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-githubpackages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-githubpackages.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-githubpackages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-mavencentral.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-mavencentral.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-mavencentral.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-mavencentral.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-mavencentral.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/dump247/javapoet-dsl/publish-mavencentral.yml/master?enable=pin","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}}]},"last_synced_at":"2025-08-18T10:27:59.842Z","repository_id":57726763,"created_at":"2025-08-18T10:27:59.842Z","updated_at":"2025-08-18T10:27:59.842Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["javapoet","kotlin"],"created_at":"2026-01-14T03:35:58.314Z","updated_at":"2026-01-14T03:35:58.933Z","avatar_url":"https://github.com/dump247.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/dump247/javapoet-dsl/workflows/Build%20master%20branch/badge.svg)\n![](https://img.shields.io/maven-central/v/com.mostlycertain/javapoet-dsl)\n\n# What is JavaPoet?\n\n[JavaPoet](https://github.com/square/javapoet) is a Java API for generating `.java`\nsource files. JavaPoet is developed by [Square](https://squareup.com). The JavaPoet\nlibrary does a great job of outputting valid java code.\n\n# What is JavaPoet DSL?\n\nThis project is a DSL written in Kotlin on top of the JavaPoet API. The JavaPoet\nAPI is composed of a set of fluent builder interfaces. While this works quite nicely,\nthe result can be very difficult to read and understand.\n\n## Differences from JavaPoet\n\nUnlike JavaPoet, this DSL uses percent signs (`%`) instead of dollar signs (`$`) for formatting markers.\nThis makes it easier to write format strings since Kotlin uses the dollar sign for string\ninterpolation.\n\nThe DSL makes use of `this` context objects to define code blocks.\n\n# Documentation\n\n* [Latest Javadocs](https://dump247.github.io/javapoet-dsl/latest/index.html)\n\n# Examples\n\n## Code Snippet\n\n```kotlin\nval variableName = \"counter\"\n\nval block = codeBlock {\n    v(Int::class, variableName, literal(1))\n    \n    whileDecl(\"%L \u003c 10\", variableName) {\n        ifDecl(\"%L %% 2 == 0\", variableName) {\n            s(\"%T.out.printf(%S, %L)\", System::class, \"even: %d\", variableName)\n        }.elseDecl {\n            s(\"%T.out.printf(%S, %L)\", System::class, \"odd: %d\", variableName)\n        }\n\n        s(\"%L += 1\", variableName)\n    }\n}\n\nprintln(block)\n\n// -- Output --\n// int counter = 1;\n// while (counter \u003c 10) {\n//  if (counter % 2 == 0) {\n//    java.lang.System.out.printf(\"even: %d\\n\", counter);\n//  } else {\n//    java.lang.System.out.printf(\"odd: %d\\n\", counter);\n//  }\n//  counter += 1;\n// }\n```\n\n## Class\n\n```kotlin\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.net.MalformedURLException\nimport java.net.URL\nimport java.net.URLConnection\nimport javax.lang.model.element.Modifier.PUBLIC\nimport javax.lang.model.element.Modifier.FINAL\nimport javax.lang.model.element.Modifier.PRIVATE\n\nval myClass = classSpec(\"MyClass\", listOf(PUBLIC, FINAL)) {\n    fieldDecl(Int::class, \"foo\", listOf(PRIVATE))\n\n    constructorDecl(listOf(parameterSpec(Int::class, \"foo\")), listOf(PUBLIC)) {\n        s(\"this.foo = foo\")\n    }\n\n    methodDecl(\"add\", listOf(parameterSpec(Int::class, \"value\")), listOf(PUBLIC)) {\n        s(\"this.foo += value\")\n    }\n\n    methodDecl(\n            returns = String::class,\n            name = \"requestData\",\n            parameters = listOf(parameterSpec(String::class, \"urlStr\")),\n            modifiers = listOf(PUBLIC),\n            throws = typeList(IOException::class)\n    ) {\n        v(StringBuilder::class, \"content\", e(\"new StringBuilder()\"))\n        v(BufferedReader::class, \"bufferedReader\", literalNull())\n\n        tryDecl {\n            v(URL::class, \"url\", e(\"new %T(urlStr)\", URL::class))\n            v(URLConnection::class, \"urlConnection\", e(\"url.openConnection()\"))\n            s(\"bufferedReader = new %T(new %T(urlConnection.getInputStream())\", BufferedReader::class, InputStreamReader::class)\n            v(String::class, \"line\")\n\n            whileDecl(\"(line = bufferedReader.readLine()) != null\") {\n                s(\"content.append(line + %S)\", \"\\n\")\n            }\n        }.catchDecl(MalformedURLException::class, \"ex\") {\n            s(\"throw new %T(urlStr, ex)\", IllegalArgumentException::class)\n        }.catchDecl(Exception::class, \"ex\") {\n            s(\"throw new %T(%S, ex)\", IOException::class, \"I/O error requesting data\")\n        }.finallyDecl {\n            ifDecl(\"bufferedReader != null\") {\n                s(\"bufferedReader.close()\")\n            }\n        }\n\n        s(\"return content.toString()\")\n    }\n}\n\nprintln(myClass)\n\n// -- Output --\n// public final class MyClass {\n//   private int foo;\n// \n//   public MyClass(final int foo) {\n//     this.foo = foo;\n//   }\n// \n//   public void add(final int value) {\n//     this.foo += value;\n//   }\n// \n//   public java.lang.String requestData(final java.lang.String urlStr) throws java.io.IOException {\n//     java.lang.StringBuilder content = new StringBuilder();\n//     java.io.BufferedReader bufferedReader = null;\n//     try {\n//       java.net.URL url = new java.net.URL(urlStr);\n//       java.net.URLConnection urlConnection = url.openConnection();\n//       bufferedReader = new java.io.BufferedReader(new java.io.InputStreamReader(urlConnection.getInputStream());\n//       java.lang.String line;\n//       while ((line = bufferedReader.readLine()) != null) {\n//         content.append(line + \"\\n\");\n//       }\n//     } catch (final java.net.MalformedURLException ex) {\n//       throw new java.lang.IllegalArgumentException(urlStr, ex);\n//     } catch (final java.lang.Exception ex) {\n//       throw new java.io.IOException(\"I/O error requesting data\", ex);\n//     } finally {\n//       if (bufferedReader != null) {\n//         bufferedReader.close();\n//       }\n//     }\n//     return content.toString();\n//   }\n// }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdump247%2Fjavapoet-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdump247%2Fjavapoet-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdump247%2Fjavapoet-dsl/lists"}