diff options
author | Andrew Johnson | 2018-05-28 20:46:45 +0000 |
---|---|---|
committer | Andrew Johnson | 2018-05-28 20:49:07 +0000 |
commit | 9e6b9126a16ce184c214f29cc31834b6005eebcb (patch) | |
tree | 717124b604dd963c793533313c0e0e2b79dc6d63 | |
parent | 6e71be15aac43bf01359bcf465b4c6a8bc1d55bb (diff) | |
download | org.eclipse.mat-9e6b9126a16ce184c214f29cc31834b6005eebcb.tar.gz org.eclipse.mat-9e6b9126a16ce184c214f29cc31834b6005eebcb.tar.xz org.eclipse.mat-9e6b9126a16ce184c214f29cc31834b6005eebcb.zip |
[535233] Name resolver for special classes
Fix int, void etc.
Change-Id: I76c1888f47b116ce19a36181ba866cba83bdef77
-rw-r--r-- | plugins/org.eclipse.mat.api/plugin.xml | 1 | ||||
-rw-r--r-- | plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/CommonNameResolver.java | 22 |
2 files changed, 22 insertions, 1 deletions
diff --git a/plugins/org.eclipse.mat.api/plugin.xml b/plugins/org.eclipse.mat.api/plugin.xml index 59a7155c..b3295922 100644 --- a/plugins/org.eclipse.mat.api/plugin.xml +++ b/plugins/org.eclipse.mat.api/plugin.xml @@ -109,6 +109,7 @@ <resolver impl="org.eclipse.mat.inspections.CommonNameResolver$FieldResolver" />
<resolver impl="org.eclipse.mat.inspections.CommonNameResolver$MethodResolver" />
<resolver impl="org.eclipse.mat.inspections.CommonNameResolver$ConstructorResolver" />
+ <resolver impl="org.eclipse.mat.inspections.CommonNameResolver$ClassTypeResolver" />
<!-- eclipse -->
<resolver impl="org.eclipse.mat.inspections.eclipse.EclipseNameResolver$EclipseClassLoaderResolver" />
diff --git a/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/CommonNameResolver.java b/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/CommonNameResolver.java index 6accdfea..63c32d30 100644 --- a/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/CommonNameResolver.java +++ b/plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/CommonNameResolver.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2008, 2017 SAP AG and IBM Corporation.
+ * Copyright (c) 2008, 2018 SAP AG and IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -106,6 +106,26 @@ public class CommonNameResolver }
}
+ /**
+ * For Oracle VMs for int.class, byte.class, void.class etc.
+ * These are just simple IObjects, not IClass objects.
+ * All other classes resolve via IClass.
+ */
+ @Subjects("java.lang.Class")
+ public static class ClassTypeResolver implements IClassSpecificNameResolver
+ {
+ public String resolve(IObject object) throws SnapshotException
+ {
+ // Let normal IClass resolution happen if possible
+ if (object instanceof IClass)
+ return null;
+ IObject nameString = (IObject) object.resolveValue("name"); //$NON-NLS-1$
+ if (nameString == null)
+ return null;
+ return nameString.getClassSpecificName();
+ }
+ }
+
@Subjects("java.util.concurrent.atomic.AtomicBoolean")
public static class AtomicBooleanResolver implements IClassSpecificNameResolver
{
|