Title: InMemoryJavaCompiler.compile() returns reference to old class when compiling a new class with the same name · Issue #16 · trung/InMemoryJavaCompiler · GitHub
Open Graph Title: InMemoryJavaCompiler.compile() returns reference to old class when compiling a new class with the same name · Issue #16 · trung/InMemoryJavaCompiler
X Title: InMemoryJavaCompiler.compile() returns reference to old class when compiling a new class with the same name · Issue #16 · trung/InMemoryJavaCompiler
Description: If I ask InMemoryJavaCompiler to compile a new class with the same name as an existing class, the compile() method returns a reference to the existing class. Minimal example across two files, both in the default package, compiled and loa...
Open Graph Description: If I ask InMemoryJavaCompiler to compile a new class with the same name as an existing class, the compile() method returns a reference to the existing class. Minimal example across two files, both ...
X Description: If I ask InMemoryJavaCompiler to compile a new class with the same name as an existing class, the compile() method returns a reference to the existing class. Minimal example across two files, both ...
Opengraph URL: https://github.com/trung/InMemoryJavaCompiler/issues/16
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"InMemoryJavaCompiler.compile() returns reference to old class when compiling a new class with the same name","articleBody":"If I ask InMemoryJavaCompiler to compile a new class with the same name as an existing class, the compile() method returns a reference to the existing class.\r\n\r\nMinimal example across two files, both in the default package, compiled and loaded on the classpath:\r\n\r\nExample.java:\r\n\r\n\r\n```\r\npublic class Example {\r\n}\r\n```\r\n\r\n\r\nMinimalExample.java:\r\n```\r\nimport org.mdkt.compiler.InMemoryJavaCompiler;\r\n\r\npublic class MinimalExample {\r\n\r\n public static void main(String args[]) throws Exception {\r\n\r\n Class\u003c?\u003e oldClass = Example.class;\r\n\r\n InMemoryJavaCompiler compiler = InMemoryJavaCompiler.newInstance();\r\n Class\u003c?\u003e newClass = compiler.compile(\"Example\", \"public class Example {\\n }\\n\");\r\n\r\n if (oldClass.hashCode() == newClass.hashCode()) {\r\n System.out.println(\"I have two copies of the old class.\");\r\n }\r\n\r\n }\r\n\r\n}\r\n```\r\n\r\n\r\nExpected behaviour: the class returned by compile should be the result of compiling the string passed to it.\r\n\r\nI think this is a bug. \r\n\r\nThanks very much for providing this library! I am very keen to use it in [Gin](https://github.com/gintool/gin) :-)\r\n","author":{"url":"https://github.com/drdrwhite","@type":"Person","name":"drdrwhite"},"datePublished":"2017-11-28T15:03:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/16/InMemoryJavaCompiler/issues/16"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:26d0462d-8216-7e45-5dd9-18ce6da8ae4d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8920:18EDB3:A95D23D:DAD12A4:697F240B |
| html-safe-nonce | 52cf72c4a38e980216106825293b63240417bcc0d318d071291962ec9be6eedf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTIwOjE4RURCMzpBOTVEMjNEOkRBRDEyQTQ6Njk3RjI0MEIiLCJ2aXNpdG9yX2lkIjoiNDQ2OTQwNjk1MjExNTM0ODQ5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | af056f539dbfba2852186a5173db49af4723820bed7541bb1de92a8e5f65ba30 |
| hovercard-subject-tag | issue:277416997 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/trung/InMemoryJavaCompiler/16/issue_layout |
| twitter:image | https://opengraph.githubassets.com/47ad21248e90d01060832385ed0d9bc135bb27e250e269b09bc17e225b63539c/trung/InMemoryJavaCompiler/issues/16 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/47ad21248e90d01060832385ed0d9bc135bb27e250e269b09bc17e225b63539c/trung/InMemoryJavaCompiler/issues/16 |
| og:image:alt | If I ask InMemoryJavaCompiler to compile a new class with the same name as an existing class, the compile() method returns a reference to the existing class. Minimal example across two files, both ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | drdrwhite |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/trung/InMemoryJavaCompiler git https://github.com/trung/InMemoryJavaCompiler.git |
| octolytics-dimension-user_id | 24930 |
| octolytics-dimension-user_login | trung |
| octolytics-dimension-repository_id | 31716516 |
| octolytics-dimension-repository_nwo | trung/InMemoryJavaCompiler |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31716516 |
| octolytics-dimension-repository_network_root_nwo | trung/InMemoryJavaCompiler |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width