File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 2525package com .oracle .svm .util ;
2626
2727import java .lang .reflect .Method ;
28+ import java .net .URL ;
2829import java .util .Arrays ;
2930import java .util .Collections ;
3031import java .util .List ;
@@ -282,4 +283,15 @@ public static String getTypeName(ResolvedJavaType type) {
282283 public static ResolvedJavaModule getModule (ResolvedJavaType declaringClass ) {
283284 return JVMCIReflectionUtilFallback .getModule (declaringClass );
284285 }
286+
287+ /**
288+ * Returns the <em>origin</em> associated with this {@link ResolvedJavaType}.
289+ *
290+ * This is not yet properly implemented as it falls back to the original class (GR-71068).
291+ *
292+ * @return the location (URL), or {@code null} if no URL was supplied during construction.
293+ */
294+ public static URL getOrigin (ResolvedJavaType type ) {
295+ return JVMCIReflectionUtilFallback .getOrigin (type );
296+ }
285297}
Original file line number Diff line number Diff line change 2424 */
2525package com .oracle .svm .util ;
2626
27+ import java .net .URL ;
28+ import java .security .CodeSource ;
29+ import java .security .ProtectionDomain ;
30+
2731import jdk .vm .ci .meta .ResolvedJavaType ;
2832
2933/**
@@ -43,4 +47,13 @@ static ResolvedJavaPackage getPackage(ResolvedJavaType type) {
4347 static ResolvedJavaModule getModule (ResolvedJavaType declaringClass ) {
4448 return new ResolvedJavaModuleImpl (getJavaClass (declaringClass ).getModule ());
4549 }
50+
51+ static URL getOrigin (ResolvedJavaType type ) {
52+ ProtectionDomain pd = getJavaClass (type ).getProtectionDomain ();
53+ CodeSource cs = pd .getCodeSource ();
54+ if (cs == null ) {
55+ return null ;
56+ }
57+ return cs .getLocation ();
58+ }
4659}
You can’t perform that action at this time.
0 commit comments