{"id":18564473,"url":"https://github.com/guardsquare/kotlin-metadata-printer","last_synced_at":"2025-07-14T20:37:15.968Z","repository":{"id":44097368,"uuid":"266790885","full_name":"Guardsquare/kotlin-metadata-printer","owner":"Guardsquare","description":"Prints the Kotlin metadata attached to Java class files","archived":false,"fork":false,"pushed_at":"2025-02-27T10:38:01.000Z","size":3512,"stargazers_count":59,"open_issues_count":2,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-09T02:43:35.755Z","etag":null,"topics":["java","kotlin","kotlin-metadata","pretty-printer","proguard","proguard-core"],"latest_commit_sha":null,"homepage":"https://tools.guardsquare.com/kotlin-metadata-printer/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Guardsquare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2020-05-25T13:48:26.000Z","updated_at":"2025-04-25T02:37:07.000Z","dependencies_parsed_at":"2024-04-30T09:33:47.839Z","dependency_job_id":"a0411b04-69b6-4a92-ada1-99a58659c3aa","html_url":"https://github.com/Guardsquare/kotlin-metadata-printer","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Guardsquare/kotlin-metadata-printer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guardsquare%2Fkotlin-metadata-printer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guardsquare%2Fkotlin-metadata-printer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guardsquare%2Fkotlin-metadata-printer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guardsquare%2Fkotlin-metadata-printer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Guardsquare","download_url":"https://codeload.github.com/Guardsquare/kotlin-metadata-printer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guardsquare%2Fkotlin-metadata-printer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265344884,"owners_count":23750570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["java","kotlin","kotlin-metadata","pretty-printer","proguard","proguard-core"],"created_at":"2024-11-06T22:15:19.548Z","updated_at":"2025-07-14T20:37:15.944Z","avatar_url":"https://github.com/Guardsquare.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eKotlin Metadata Printer\u003c/h1\u003e\n\n\u003c!-- Badges --\u003e\n\u003cp align=\"center\"\u003e\n  \u003c!-- CI --\u003e\n  \u003c!--a href=\"https://github.com/Guardsquare/kotlin-metadata-printer/actions?query=workflow%3A%22Continuous+Integration%22\"\u003e\n    \u003cimg src=\"https://github.com/Guardsquare/kotlin-metadata-printer/workflows/Continuous%20Integration/badge.svg?branch=github-workflow\"\u003e\n  \u003c/a--\u003e\n\n  \u003c!-- Github version --\u003e\n  \u003c!--a href=\"releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/guardsquare/kotlin-metadata-printer\"\u003e\n  \u003c/a--\u003e\n\n  \u003c!-- Maven --\u003e\n  \u003c!--a href=\"https://search.maven.org/search?q=g:com.guardsquare\"\u003e\n    \u003cimg src=\"https://img.shields.io/maven-central/v/com.guardsquare/kotlin-metadata-printer\"\u003e\n  \u003c/a--\u003e\n\n  \u003c!-- License --\u003e\n  \u003ca href=\"LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/guardsquare/kotlin-metadata-printer\"\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Twitter --\u003e\n  \u003ca href=\"https://twitter.com/Guardsquare\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/follow/guardsquare?style=social\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nThe Kotlin metadata printer is a free tool to print the Kotlin metadata in\na human-readable format. The printer is built on the\n[ProGuardCORE](https://github.com/Guardsquare/proguard-core) library and can\nprocess class files, zip files, jars or apks.\n\nThe Kotlin metadata printer is integrated in [ProGuard Playground](https://playground.proguard.com/) or you can run it [locally](#executing).\n\n\u003ca href=\"https://tools.guardsquare.com/kotlin-metadata-printer/\"\u003e\n  \u003cimg src=\"./screenshot.png\" alt=\"demo of printer GUI\"/\u003e\n\u003c/a\u003e\n\n## Building\n\nYou can build the Kotlin metadata printer jar by executing the following Gradle command:\n\n    ./gradlew build\n\nOnce built a jar will be created in lib/kotlin-metadata-printer.jar\n\n## Executing\n\nYou can execute the printer directly through gradle as follows:\n\n    ./gradlew :kmp-cli:run --args \"input.{apk,jar,zip,class}\"\n\nOr you can execute the built printer jar as follows:\n\n    java -jar lib/kotlin-metadata-printer.jar input.{apk,jar,zip,class}\n\n## Options\n\n    --filter '\u003cclassNameFilter\u003e' class name filter e.g. --filter '!android.**,com.mypackage.**'\n    --output '\u003coutputFile\u003e'      write output to this file instead of stdout e.g. --output 'myfile.txt'\n    --json                       output the metadata in a JSON structure\n    --divider                    a string that is printed between each Kotlin metadata\n\n## Example\n\nThe following example is a basic Android activity class written in Kotlin:\n\n```kotlin\n/**\n * Sample activity that displays \"Hello world!\".\n */\nclass HelloWorldActivity : AppCompatActivity() {\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_main)\n    }\n}\n```\n\nand this is its associated metadata as printed by the Kotlin metadata printer:\n\n```\n/**\n* Kotlin class.\n* From Java class: com.example.HelloWorldActivity\n*/\nclass HelloWorldActivity : android.support.v7.app.AppCompatActivity {\n\n    // Functions\n\n    protected open fun onCreate(savedInstanceState: android.os.Bundle?) { }\n}\n```\n\n## Using as a library\n\nThe project is split into CLI (`kmp-cli`) and library (`kmp-lib`) modules. To use the \nprinter programmatically from your project add a dependency on the library and then use \nthe `KotlinMetadataPrinter` class along with a ProGuardCORE `ClassPool`. The printed \nmetadata is placed into the processing info field of the `Clazz`.\n\n```java\nimport com.guardsquare.proguard.kotlin.printer.KotlinMetadataPrinter;\nimport proguard.classfile.kotlin.visitor.ReferencedKotlinMetadataVisitor;\nimport proguard.classfile.visitor.MultiClassVisitor;\nimport proguard.classfile.util.kotlin.KotlinMetadataInitializer;\nimport proguard.classfile.ClassPool;\n\nimport static proguard.io.util.IOUtil.read;\n\npublic class Main\n{\n    public static void main(String[] args)\n    {\n        ClassPool programClassPool = read(args[0], false);\n        programClassPool.classesAccept(\n            new MultiClassVisitor(    \n            new KotlinMetadataInitializer((clazz, errorMessage) -\u003e System.err.println(errorMessage)),        \n            new ReferencedKotlinMetadataVisitor(\n            new KotlinMetadataPrinter(programClassPool)))\n        );\n\n        programClassPool.classesAccept(clazz -\u003e System.out.println(clazz.getProcessingInfo()));\n    }\n}\n```\n\n## Contributing\n\nThe **Kotlin metadata printer** is built on the\n[ProGuardCORE](https://github.com/Guardsquare/proguard-core) library.\n\nContributions, issues and feature requests are welcome in both projects.\nFeel free to check the [issues](issues) page and the [contributing\nguide](CONTRIBUTING.md) if you would like to contribute.\n\n## License\n\nThe **Kotlin metadata printer** is distributed under the terms of\nthe [Apache License Version 2.0](LICENSE).\n\nEnjoy!\n\nCopyright (c) 2002-2023 Guardsquare NV\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardsquare%2Fkotlin-metadata-printer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguardsquare%2Fkotlin-metadata-printer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardsquare%2Fkotlin-metadata-printer/lists"}