< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifySystemPropertyUsage.java

Print this page
rev 56282 : [mq]: graal


  79         String packageName = holderQualified.equals(holderUnqualified) ? "" : holderQualified.substring(0, holderQualified.length() - holderUnqualified.length() - 1);
  80         if (packageName.startsWith("jdk.vm.ci")) {
  81             if (JVMCI_VERSION_MAJOR >= 0 && JVMCI_VERSION_MINOR > 56) {
  82                 // This JVMCI version should not use non-saved system properties
  83             } else {
  84                 // This JVMCI version still has some calls that need to be removed
  85                 return;
  86             }
  87         } else if (holderQualified.equals("org.graalvm.compiler.hotspot.JVMCIVersionCheck") && caller.getName().equals("main")) {
  88             // The main method in JVMCIVersionCheck is only called from the shell
  89             return;
  90         } else if (packageName.startsWith("com.oracle.truffle") || packageName.startsWith("org.graalvm.polyglot")) {
  91             // Truffle and Polyglot do not depend on JVMCI so cannot use
  92             // Services.getSavedProperties()
  93             return;
  94         } else if (packageName.startsWith("com.oracle.svm")) {
  95             // SVM must read system properties in:
  96             // * its JDK substitutions to mimic required JDK semantics
  97             // * native-image for config info
  98             return;




  99         }
 100         for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
 101             ResolvedJavaMethod callee = t.targetMethod();
 102             if (callee.getDeclaringClass().equals(systemType)) {
 103                 if (callee.getName().equals("getProperty") || callee.getName().equals("getProperties")) {
 104                     throw new VerificationError("Call to %s at callsite %s is prohibited. Call Services.getSavedProperties().get(String) instead.",
 105                                     callee.format("%H.%n(%p)"),
 106                                     caller.format("%H.%n(%p)"));
 107                 }
 108             } else {
 109                 for (int i = 0; i < boxTypes.length; i++) {
 110                     ResolvedJavaType boxType = boxTypes[i];
 111                     if (callee.getDeclaringClass().equals(boxType)) {
 112                         String simpleName = boxType.toJavaName(false);
 113                         if (callee.getName().equals("get" + simpleName)) {
 114                             throw new VerificationError("Call to %s at callsite %s is prohibited. Call %s.parse%s(Services.getSavedProperties().get(String)) instead.",
 115                                             callee.format("%H.%n(%p)"),
 116                                             caller.format("%H.%n(%p)"),
 117                                             simpleName, simpleName);
 118                         }


  79         String packageName = holderQualified.equals(holderUnqualified) ? "" : holderQualified.substring(0, holderQualified.length() - holderUnqualified.length() - 1);
  80         if (packageName.startsWith("jdk.vm.ci")) {
  81             if (JVMCI_VERSION_MAJOR >= 0 && JVMCI_VERSION_MINOR > 56) {
  82                 // This JVMCI version should not use non-saved system properties
  83             } else {
  84                 // This JVMCI version still has some calls that need to be removed
  85                 return;
  86             }
  87         } else if (holderQualified.equals("org.graalvm.compiler.hotspot.JVMCIVersionCheck") && caller.getName().equals("main")) {
  88             // The main method in JVMCIVersionCheck is only called from the shell
  89             return;
  90         } else if (packageName.startsWith("com.oracle.truffle") || packageName.startsWith("org.graalvm.polyglot")) {
  91             // Truffle and Polyglot do not depend on JVMCI so cannot use
  92             // Services.getSavedProperties()
  93             return;
  94         } else if (packageName.startsWith("com.oracle.svm")) {
  95             // SVM must read system properties in:
  96             // * its JDK substitutions to mimic required JDK semantics
  97             // * native-image for config info
  98             return;
  99         } else if (packageName.startsWith("jdk.tools.jaotc")) {
 100             // Workaround since jdk.internal.vm.ci/jdk.vm.ci.services is not exported to jdk.aot.
 101             // The jaotc launcher dynamically adds these exports.
 102             return;
 103         }
 104         for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
 105             ResolvedJavaMethod callee = t.targetMethod();
 106             if (callee.getDeclaringClass().equals(systemType)) {
 107                 if (callee.getName().equals("getProperty") || callee.getName().equals("getProperties")) {
 108                     throw new VerificationError("Call to %s at callsite %s is prohibited. Call Services.getSavedProperties().get(String) instead.",
 109                                     callee.format("%H.%n(%p)"),
 110                                     caller.format("%H.%n(%p)"));
 111                 }
 112             } else {
 113                 for (int i = 0; i < boxTypes.length; i++) {
 114                     ResolvedJavaType boxType = boxTypes[i];
 115                     if (callee.getDeclaringClass().equals(boxType)) {
 116                         String simpleName = boxType.toJavaName(false);
 117                         if (callee.getName().equals("get" + simpleName)) {
 118                             throw new VerificationError("Call to %s at callsite %s is prohibited. Call %s.parse%s(Services.getSavedProperties().get(String)) instead.",
 119                                             callee.format("%H.%n(%p)"),
 120                                             caller.format("%H.%n(%p)"),
 121                                             simpleName, simpleName);
 122                         }
< prev index next >