Title: Inconsistent handling of self-references (`ResolvedRecursiveType`) in caching and equality · Issue #128 · FasterXML/java-classmate · GitHub
Open Graph Title: Inconsistent handling of self-references (`ResolvedRecursiveType`) in caching and equality · Issue #128 · FasterXML/java-classmate
X Title: Inconsistent handling of self-references (`ResolvedRecursiveType`) in caching and equality · Issue #128 · FasterXML/java-classmate
Description: Follow-up from review of the #125 fix: handling of self-references (ResolvedRecursiveType) is inconsistent in two ways. 1. Cached types may contain self-references from another resolution context A type without type parameters is cached ...
Open Graph Description: Follow-up from review of the #125 fix: handling of self-references (ResolvedRecursiveType) is inconsistent in two ways. 1. Cached types may contain self-references from another resolution context A...
X Description: Follow-up from review of the #125 fix: handling of self-references (ResolvedRecursiveType) is inconsistent in two ways. 1. Cached types may contain self-references from another resolution context A...
Opengraph URL: https://github.com/FasterXML/java-classmate/issues/128
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent handling of self-references (`ResolvedRecursiveType`) in caching and equality","articleBody":"Follow-up from review of the #125 fix: handling of self-references (`ResolvedRecursiveType`) is inconsistent in two ways.\n\n### 1. Cached types may contain self-references from another resolution context\n\nA type without type parameters is cached under a single key, but when it is first resolved as a supertype of a type that refers back to it, its members contain self-references to *that* type (with its parameterization). A later direct resolution returns the cached instance, so results depend on resolution order:\n\n```java\nstatic abstract class Bar implements Comparable\u003cFoo> { } // raw Foo\nstatic abstract class Foo\u003cT> extends Bar { }\n\nTypeResolver r = new TypeResolver();\n// with fresh resolver: Comparable\u003cFoo\u003cObject>> (ResolvedObjectType)\nr.resolve(Foo.class, String.class);\nr.resolve(Bar.class).typeParametersFor(Comparable.class).get(0);\n// -> ResolvedRecursiveType that refers to Foo\u003cString>\n```\n\nBefore #125 this was hidden for generic subtypes (supertypes were cached per enclosing parameterization), but the same already happens on 1.7 for non-generic subtypes. As of 1.8, types that have self-references in their *type parameters* are no longer cached, but self-references in supertypes are not checked.\n\n### 2. Self-reference vs resolved type equality is only relaxed for array elements\n\nAs of 1.8, `ResolvedArrayType.equals()` treats a self-referential element type as equal to the fully resolved type (by erased type and bindings), so that f.ex `Node[]` within `class Node extends Base\u003cNode[]>` equals `resolve(Node[].class)` (needed to detect method overrides). But the same is not done for type parameters: `Base\u003cNode>` reached via `Node`'s parent is still not equal to a directly resolved `Base\u003cNode>`, nor is `List\u003cNode>[]`. Also, two equal arrays may have element types that are not equal to each other.\n\n### Possible approach\n\nMake `ResolvedRecursiveType` equality (and hash code) consistent with the type it refers to, in general rather than only for array elements; this needs care to avoid infinite recursion (see #117). That would also allow simplifying the array special case.\n","author":{"url":"https://github.com/cowtowncoder","@type":"Person","name":"cowtowncoder"},"datePublished":"2026-10-08T03:18:43Z","url":"https://github.com/FasterXML/java-classmate/issues/128"}
| 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:e91a33c1-0230-9f16-829f-fe612953fae1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2E8:10FAD5:D11A0:123A10:6AFBC936 |
| html-safe-nonce | 4d1c5adc50cdcbe47db392d88b7de7fc2bb5ab2d5d79e275f6d15c58d9a260d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkU4OjEwRkFENTpEMTFBMDoxMjNBMTA6NkFGQkM5MzYiLCJ2aXNpdG9yX2lkIjoiNTg0MjU0MDYyOTgzMzAwOTQ2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4840588f649648d160721674a4e4977b841bd9d0cc31c4f32773d22cfda0558b |
| hovercard-subject-tag | issue:5755276338 |
| 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/FasterXML/java-classmate/128/issue_layout |
| twitter:image | https://opengraph.githubassets.com/494919a82bca17feff850449b74b9de93965b3bbf01d135923576ab918cac73d/FasterXML/java-classmate/issues/128 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/494919a82bca17feff850449b74b9de93965b3bbf01d135923576ab918cac73d/FasterXML/java-classmate/issues/128 |
| og:image:alt | Follow-up from review of the #125 fix: handling of self-references (ResolvedRecursiveType) is inconsistent in two ways. 1. Cached types may contain self-references from another resolution context A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cowtowncoder |
| hostname | github.com |
| expected-hostname | github.com |
| None | d440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b |
| turbo-cache-control | no-preview |
| go-import | github.com/FasterXML/java-classmate git https://github.com/FasterXML/java-classmate.git |
| octolytics-dimension-user_id | 382692 |
| octolytics-dimension-user_login | FasterXML |
| octolytics-dimension-repository_id | 935336 |
| octolytics-dimension-repository_nwo | FasterXML/java-classmate |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 935336 |
| octolytics-dimension-repository_network_root_nwo | FasterXML/java-classmate |
| 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 | 2c43021aed8695990c86c0eaaedc600bfeffec36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width