Title: Import wildcards · Issue #44 · microsoftgraph/msgraph-sdk-java · GitHub
Open Graph Title: Import wildcards · Issue #44 · microsoftgraph/msgraph-sdk-java
X Title: Import wildcards · Issue #44 · microsoftgraph/msgraph-sdk-java
Description: I'd rank this as a nice to have. Import wildcards are used throughout the library. This has two primary effects: Namespace disambiguation must be controlled by class names rather than just package names Understanding the code outside a j...
Open Graph Description: I'd rank this as a nice to have. Import wildcards are used throughout the library. This has two primary effects: Namespace disambiguation must be controlled by class names rather than just package ...
X Description: I'd rank this as a nice to have. Import wildcards are used throughout the library. This has two primary effects: Namespace disambiguation must be controlled by class names rather than just pack...
Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-java/issues/44
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Import wildcards","articleBody":"I'd rank this as a nice to have. \r\n\r\nImport wildcards are used throughout the library. This has two primary effects:\r\n\r\n* Namespace disambiguation must be controlled by class names rather than just package names\r\n* Understanding the code outside a java enabled IDE is difficult (say in the browser)\r\n\r\nThe first one has been dealt with by ensuring no names are repeated between packages and I can cope with that though it is not ideal.\r\n\r\nThe second point is a more critical annoyance when trying to browse the code on github itself or as text locally because you can't see what package a referenced class is from.\r\n\r\nThe import wildcards in the generated code can be removed (and ambiguous names handled correctly with full qualification when necessary) using a technique like this (taken from https://github.com/davidmoten/state-machine/blob/master/state-machine-generator/src/main/java/com/github/davidmoten/fsm/model/Generator.java):\r\n\r\n```java\r\nImports imports = new Imports();\r\nByteArrayOutputStream bytes = new ByteArrayOutputStream();\r\nPrintStream out = new PrintStream(bytes);\r\nout.format(\"package %s;\\n\", pkg);\r\nout.println();\r\nout.println(\"\u003cIMPORTS>\");\r\nout.println();\r\nout.format(\"public interface %s\u003cId> extends %s\u003c%s, Id>{\\n\", behaviourClassSimpleName(),\r\n imports.add(EntityBehaviour.class), imports.add(clsName));\r\n...\r\nresult.print(new String(bytes.toByteArray(StandardCharsets.UTF_8))\r\n .replace(\"\u003cIMPORTS>\", imports.importsAsString()));\r\n```\r\nIn a nutshell, you write your imports last after registering all types in the `Imports` and the `Imports` object decides which classes need to be fully qualified (first in best dressed).\r\n\r\nAn easy option is after pasting generated code, use an IDE like Eclipse to organize imports across the project (right mouse on project - Source - Organize imports).\r\n\r\nGot an opinion on this one @cbales?","author":{"url":"https://github.com/davidmoten","@type":"Person","name":"davidmoten"},"datePublished":"2018-02-08T02:50:26Z","url":"https://github.com/microsoftgraph/msgraph-sdk-java/issues/44"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:cd3743b1-d698-1554-c8e3-f86c2d7193e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9244:33B36B:EC3545:1384178:6B050CFC |
| html-safe-nonce | 85d5c8cfd289ac616533a985c919f44dfd61333cca599ac0a3a71afe4d806f64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjQ0OjMzQjM2QjpFQzM1NDU6MTM4NDE3ODo2QjA1MENGQyIsInZpc2l0b3JfaWQiOiIxNjk5Mjc4ODYyOTkyODcwNjUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9a74b739c3aa81cbaf3f24f145e8c3fdc8d607f0f649be7ea7311f4666653c5f |
| hovercard-subject-tag | issue:295367380 |
| 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/microsoftgraph/msgraph-sdk-java/44/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b0aa124a18864845b630702c19c21b82e287715d3ac53f3f79b476a921fb21e8/microsoftgraph/msgraph-sdk-java/issues/44 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b0aa124a18864845b630702c19c21b82e287715d3ac53f3f79b476a921fb21e8/microsoftgraph/msgraph-sdk-java/issues/44 |
| og:image:alt | I'd rank this as a nice to have. Import wildcards are used throughout the library. This has two primary effects: Namespace disambiguation must be controlled by class names rather than just package ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidmoten |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoftgraph/msgraph-sdk-java git https://github.com/microsoftgraph/msgraph-sdk-java.git |
| octolytics-dimension-user_id | 17304259 |
| octolytics-dimension-user_login | microsoftgraph |
| octolytics-dimension-repository_id | 103300409 |
| octolytics-dimension-repository_nwo | microsoftgraph/msgraph-sdk-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 103300409 |
| octolytics-dimension-repository_network_root_nwo | microsoftgraph/msgraph-sdk-java |
| 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 | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width