Bug 325096

Summary: Use generics more for IQueryContext
Product: [Tools] MAT Reporter: Andrew Johnson <andrew_johnson>
Component: CoreAssignee: Project Inbox <mat.core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: minor    
Priority: P3    
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Andrew Johnson CLA 2010-09-13 06:27:22 EDT
IQueryContext makes some use of generics, but we could improve type safety by using it a little more.

E.g. instead of 
Object get(Class<?> type, Argument.Advice advice);
have
<T> T get(Class<T> type, Argument.Advice advice);

It might be a bit harder to convert
String convertToString(Class<?> type, Argument.Advice advice, Object value)
to
<T> String convertToString(Class<T> type, Argument.Advice advice, T value)

as SnapshotQueryContext converts ISnapshot.class to SnapshotArgument and int.class to HeapObjectParamArgument

Are these compatible changes as the type erasure is the same, and IQueryContext is noimplement, and so the source uses should be compatible.
Comment 1 Krum Tsvetkov CLA 2010-09-17 06:09:59 EDT
Andrew, in some SAP coding we have classes implementing the IQueryContext, despite of the @noimplement remark. I'd like to check first how the changes you suggest affect these.
Comment 2 Eclipse Webmaster CLA 2024-05-08 14:35:55 EDT
This issue has been migrated to https://github.com/eclipse-mat/org.eclipse.mat/issues/9.