{"id":18466579,"url":"https://github.com/sbasalaev/tybyco","last_synced_at":"2025-07-04T02:35:10.127Z","repository":{"id":224686618,"uuid":"752261267","full_name":"SBasalaev/tybyco","owner":"SBasalaev","description":"Typesafe Java bytecode generator","archived":false,"fork":false,"pushed_at":"2024-02-27T07:33:01.000Z","size":111,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T13:55:00.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/SBasalaev.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":"2024-02-03T14:11:46.000Z","updated_at":"2024-02-27T06:11:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"8cec4ed6-5530-4b97-ba4e-a89ac6f2ffc7","html_url":"https://github.com/SBasalaev/tybyco","commit_stats":null,"previous_names":["sbasalaev/tybyco"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SBasalaev/tybyco","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SBasalaev%2Ftybyco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SBasalaev%2Ftybyco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SBasalaev%2Ftybyco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SBasalaev%2Ftybyco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SBasalaev","download_url":"https://codeload.github.com/SBasalaev/tybyco/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SBasalaev%2Ftybyco/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263434528,"owners_count":23465973,"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":[],"created_at":"2024-11-06T09:16:52.426Z","updated_at":"2025-07-04T02:35:10.089Z","avatar_url":"https://github.com/SBasalaev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Typesafe Java bytecode generator\n\n**tybyco** is a library to programmaticaly generate Java class files.\nIt is not as fast and flexible as\n[Objectweb ASM](https://asm.ow2.io/) or\n[Apache BCEL](https://commons.apache.org/proper/commons-bcel/).\nInstead it aims to simplify code generation and to ease catching bugs related to\ncode generation. I created this library mainly for a toy programming language\nI'm developing.\n\nAs an example the following code builds a class file for the \"Hello, world!\"\nprogram.\n```java\nCompiledClass compiled = Tybyco.getDefault()\n.buildClass(CLASS(\"Hello\"), PUBLIC)\n    .method(\"main\", METHOD(VOID, TYPE(String[].class)), PUBLIC, STATIC)\n        .code(\"args\")\n            .getStaticField(CLASS(System.class), \"out\", TYPE(PrintStream.class))\n            .pushConst(\"Hello, world!\")\n            .invokeVirtual(CLASS(PrintStream.class), \"println\", METHOD(VOID, TYPE(String.class)))\n            .voidReturn()\n        .end()\n    .end()\n.end();\nPath filePath = Paths.get(compiled.className().binaryName() + \".class\");\nFiles.write(filePath, compiled.code());\n```\n\nClass sections that are automatically handled by this library\ninclude:\n* `Signature`. Type and method descriptors in Tybyco are handled not by strings\n  but by the dedicated descriptor classes. For instance, the descriptor for\n  `List\u003c? extends Number\u003e` type may be created using\n  ```java\n  TYPE(List.class, EXTENDS(TYPE(Number.class)))\n  ```\n  and the appropriate descriptors and signatures will be generated everywhere it\n  is used.\n* `*TypeAnnotations`. Annotations may be attached to the type descriptor and the\n  corresponding type annotation sections are filled everywhere the type is used.\n  ```\n  var nonnullString = JvmType.ofClass(String.class).annotated(JvmAnnotation.of(Nullable.class));\n  ```\n* `InnerClasses`. By specification for every used class that is not a member of\n  a package there must be an entry in the `InnerClasses` table. Tybyco fills\n  this table automatically for each encountered class reference both for runtime\n  class references (instances of `java.lang.Class`) and symbolic references\n  (instances of `JvmNestedClass`).\n* `StackMapTable`. By virtue of using Objectweb ASM under the hood which also\n   handles stack maps automatically.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbasalaev%2Ftybyco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbasalaev%2Ftybyco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbasalaev%2Ftybyco/lists"}