use of com.oracle.svm.configure.config.ConfigurationMethod in project graal by oracle.
the class TypeMethodsWithFlagsTest method doTestMethods.
private static void doTestMethods(TypeConfiguration typeConfig) {
ConfigurationType methodTestType = getConfigTypeOrFail(typeConfig, "MethodAndFieldTest");
Assert.assertNull(ConfigurationType.TestBackdoor.getMethodInfoIfPresent(methodTestType, new ConfigurationMethod("<init>", "(I)V")));
Assert.assertNotNull(ConfigurationType.TestBackdoor.getMethodInfoIfPresent(methodTestType, new ConfigurationMethod("method", "()V")));
}
use of com.oracle.svm.configure.config.ConfigurationMethod in project graal by oracle.
the class TypeMethodsWithFlagsTest method populateConfig.
void populateConfig() {
ConfigurationType oldType = new ConfigurationType(ConfigurationCondition.alwaysTrue(), getTypeName());
setFlags(oldType);
previousConfig.add(oldType);
ConfigurationType newType = new ConfigurationType(ConfigurationCondition.alwaysTrue(), getTypeName());
for (Map.Entry<ConfigurationMethod, ConfigurationMemberDeclaration> methodEntry : methodsThatMustExist.entrySet()) {
newType.addMethod(methodEntry.getKey().getName(), methodEntry.getKey().getInternalSignature(), methodEntry.getValue());
}
for (Map.Entry<ConfigurationMethod, ConfigurationMemberDeclaration> methodEntry : methodsThatMustNotExist.entrySet()) {
newType.addMethod(methodEntry.getKey().getName(), methodEntry.getKey().getInternalSignature(), methodEntry.getValue());
}
currentConfig.add(newType);
}
use of com.oracle.svm.configure.config.ConfigurationMethod in project graal by oracle.
the class TypeMethodsWithFlagsTest method generateTestMethods.
void generateTestMethods() {
Map<ConfigurationMethod, ConfigurationMemberDeclaration> targetMap;
targetMap = getMethodsMap(ConfigurationMemberDeclaration.DECLARED);
targetMap.put(new ConfigurationMethod("<init>", INTERNAL_SIGNATURE_ONE), ConfigurationMemberDeclaration.DECLARED);
targetMap.put(new ConfigurationMethod("testMethodDeclaredSpecificSignature", INTERNAL_SIGNATURE_ONE), ConfigurationMemberDeclaration.DECLARED);
targetMap.put(new ConfigurationMethod("testMethodDeclaredMatchesAllSignature", null), ConfigurationMemberDeclaration.DECLARED);
targetMap = getMethodsMap(ConfigurationMemberDeclaration.PUBLIC);
targetMap.put(new ConfigurationMethod("<init>", INTERNAL_SIGNATURE_TWO), ConfigurationMemberDeclaration.PUBLIC);
targetMap.put(new ConfigurationMethod("testMethodPublicSpecificSignature", INTERNAL_SIGNATURE_ONE), ConfigurationMemberDeclaration.PUBLIC);
targetMap.put(new ConfigurationMethod("testMethodPublicMatchesAllSignature", null), ConfigurationMemberDeclaration.PUBLIC);
}
use of com.oracle.svm.configure.config.ConfigurationMethod in project graal by oracle.
the class TypeMethodsWithFlagsTest method doTest.
void doTest() {
TypeConfiguration currentConfigWithoutPrevious = TypeConfiguration.copyAndSubtract(currentConfig, previousConfig);
String name = getTypeName();
ConfigurationType configurationType = currentConfigWithoutPrevious.get(ConfigurationCondition.alwaysTrue(), name);
if (methodsThatMustExist.size() == 0) {
Assert.assertNull("Generated configuration type " + name + " exists. Expected it to be cleared as it is empty.", configurationType);
} else {
Assert.assertNotNull("Generated configuration type " + name + " does not exist. Has the test code changed?", configurationType);
for (Map.Entry<ConfigurationMethod, ConfigurationMemberDeclaration> methodEntry : methodsThatMustExist.entrySet()) {
ConfigurationMemberDeclaration kind = ConfigurationType.TestBackdoor.getMethodInfoIfPresent(configurationType, methodEntry.getKey()).getDeclaration();
Assert.assertNotNull("Method " + methodEntry.getKey() + " unexpectedly NOT found in the new configuration.", kind);
Assert.assertEquals("Method " + methodEntry.getKey() + " contains a different kind than expected in the new configuration.", kind, methodEntry.getValue());
}
for (Map.Entry<ConfigurationMethod, ConfigurationMemberDeclaration> methodEntry : methodsThatMustNotExist.entrySet()) {
ConfigurationMemberInfo kind = ConfigurationType.TestBackdoor.getMethodInfoIfPresent(configurationType, methodEntry.getKey());
Assert.assertNull("Method " + methodEntry.getKey() + " unexpectedly found in the new configuration.", kind);
}
}
}
Aggregations