Bug 325096 - Use generics more for IQueryContext
Summary: Use generics more for IQueryContext
Status: CLOSED MOVED
Alias: None
Product: MAT
Classification: Tools
Component: Core (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-13 06:27 EDT by Andrew Johnson CLA
Modified: 2024-05-08 14:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.