From 065061bf792afc2b1dc7518f08e4558951a8d8bb Mon Sep 17 00:00:00 2001 From: jvukicev Date: Fri, 17 Jan 2025 13:13:06 +0100 Subject: [PATCH] Make access scopes more uniform --- .../svm/hosted/DynamicAccessDetectionFeature.java | 6 +++--- .../svm/hosted/phases/DynamicAccessDetectionPhase.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/DynamicAccessDetectionFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/DynamicAccessDetectionFeature.java index b1dd2c1c80a9..428ee23009e9 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/DynamicAccessDetectionFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/DynamicAccessDetectionFeature.java @@ -115,7 +115,7 @@ public void addCall(String entry, String methodType, String call, String callLoc callLocations.add(callLocation); } - private MethodsByType getMethodsByType(String entry) { + public MethodsByType getMethodsByType(String entry) { return this.callsByPathEntry.getOrDefault(entry, new MethodsByType()); } @@ -131,7 +131,7 @@ public static String getEntryName(String path) { return fileName; } - public void printReportForEntry(String entry) { + private void printReportForEntry(String entry) { System.out.println("Dynamic method usage detected in " + entry + ":"); MethodsByType methodsByType = getMethodsByType(entry); for (String methodType : methodsByType.getMethodTypes()) { @@ -146,7 +146,7 @@ public void printReportForEntry(String entry) { } } - public void dumpReportForEntry(String entry) { + private void dumpReportForEntry(String entry) { String fileName = getEntryName(entry) + "_method_calls.json"; Path targetPath = NativeImageGenerator.generatedFiles(HostedOptionValues.singleton()).resolve(fileName); try (var writer = new JsonPrettyWriter(targetPath)) { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/DynamicAccessDetectionPhase.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/DynamicAccessDetectionPhase.java index 36cba06889e2..c4968007f2bc 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/DynamicAccessDetectionPhase.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/DynamicAccessDetectionPhase.java @@ -71,10 +71,10 @@ */ public class DynamicAccessDetectionPhase extends BasePhase { - public static final String METHODTYPE_REFLECTION = "reflection"; - public static final String METHODTYPE_RESOURCE = "resource"; - public static final String METHODTYPE_SERIALIZATION = "serialization"; - public static final String METHODTYPE_PROXY = "proxy"; + private static final String METHODTYPE_REFLECTION = "reflection"; + private static final String METHODTYPE_RESOURCE = "resource"; + private static final String METHODTYPE_SERIALIZATION = "serialization"; + private static final String METHODTYPE_PROXY = "proxy"; private static final Map> reflectMethodNames = new HashMap<>(); private static final Map> resourceMethodNames = new HashMap<>(); @@ -204,7 +204,7 @@ protected void run(StructuredGraph graph, CoreProviders context) { * Returns the name and type of a method if it exists in the predetermined set, based on its * graph and MethodCallTargetNode; otherwise, returns null. */ - public Pair getMethod(MethodCallTargetNode callTarget) { + private static Pair getMethod(MethodCallTargetNode callTarget) { String methodName = callTarget.targetMethod().getName(); String declaringClass = callTarget.targetMethod().getDeclaringClass().toJavaName();