{"record":{"id":"4e7b4d0942b5dd05","repo":"NationalSecurityAgency/ghidra","slug":"property-has-type-which-is-not-a-super-type","errorCode":null,"errorMessage":"Property {} has type {}, which is not a super-type of {}","messagePattern":"Property (.+?) has type (.+?), which is not a super-type of (.+?)","errorType":"validation","errorClass":"TypeMismatchException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/property/DBTraceAddressPropertyManager.java","lineNumber":251,"sourceCode":"\t\t}\n\t}\n\n\t@Override\n\t@SuppressWarnings(\"unchecked\")\n\tpublic <T> TracePropertyMap<? super T> getOrCreatePropertyMapSuper(String name,\n\t\t\tClass<T> valueClass) {\n\t\ttry (LockHold hold = LockHold.lock(lock.writeLock())) {\n\t\t\tAbstractDBTracePropertyMap<?, ?> map = propertyMapsByName.get(name);\n\t\t\tif (map == null) {\n\t\t\t\ttry {\n\t\t\t\t\treturn createPropertyMap(name, valueClass);\n\t\t\t\t}\n\t\t\t\tcatch (DuplicateNameException e) {\n\t\t\t\t\tthrow new AssertionError(e); // It cannot exist here\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!map.getValueClass().isAssignableFrom(valueClass)) {\n\t\t\t\tthrow new TypeMismatchException(\"Property \" + name + \" has type \" +\n\t\t\t\t\tmap.getValueClass() + \", which is not a super-type of \" + valueClass);\n\t\t\t}\n\t\t\treturn (TracePropertyMap<? super T>) map;\n\t\t}\n\t}\n\n\t@Override\n\tpublic TracePropertyMap<?> getPropertyMap(String name) {\n\t\ttry (LockHold hold = LockHold.lock(lock.readLock())) {\n\t\t\treturn propertyMapsByName.get(name);\n\t\t}\n\t}\n\n\t@Override\n\tpublic Map<String, TracePropertyMap<?>> getAllProperties() {\n\t\ttry (LockHold hold = LockHold.lock(lock.readLock())) {\n\t\t\treturn Map.copyOf(propertyMapsByName);\n\t\t}","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/property/DBTraceAddressPropertyManager.java#L233-L269","documentation":"Thrown as TypeMismatchException by getPropertyMapSuper when the stored map's value class is not a supertype of the requested valueClass (i.e. stored class does NOT have the requested class as a subtype). This getter is for writing values contravariantly: you want a map that can accept the requested type.","triggerScenarios":"Map stored as Dog.class, queried via getPropertyMapSuper(\"x\", Animal.class) — Dog is not a supertype of Animal, so it fails. The covariant reverse (querying with a subtype) succeeds.","commonSituations":"Choosing the wrong variance direction; refactoring that narrowed the stored type after the map was persisted.","solutions":["Query with a subtype of the stored class.","If you need the covariant direction (querying with a supertype), use getPropertyMapExtends.","Re-create the property map with a broader stored type if the contract changed."],"exampleFix":"// before\nTracePropertyMap<? super Animal> m =\n    mgr.getPropertyMapSuper(\"x\", Animal.class); // stored Dog\n// after\nTracePropertyMap<? super Dog> m =\n    mgr.getPropertyMapSuper(\"x\", Dog.class);","handlingStrategy":"validation","validationCode":"AbstractDBTracePropertyMap<?,?> existing = mgr.getPropertyMap(name);\nif (existing != null && !existing.getValueClass().isAssignableFrom(valueClass)) {\n    // stored type is NOT a supertype of requested\n}\nreturn mgr.getPropertyMapSuper(name, valueClass);","typeGuard":"static boolean storedIsSuper(Class<?> stored, Class<?> requested) {\n    return stored.isAssignableFrom(requested);\n}","tryCatchPattern":"try { return mgr.getPropertyMapSuper(name, cls); }\ncatch (TypeMismatchException e) { /* pick extends or exact getter */ }","preventionTips":["getPropertyMapSuper is contravariant: request a subtype.","Inspect getValueClass() to pick the correct variance getter."],"tags":["property-map","type-mismatch","generics"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}