<commit_before>/*
 * Copyright 2022-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.task.configuration;

import java.sql.Statement;

import org.springframework.aop.SpringProxy;
import org.springframework.aop.framework.Advised;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.task.repository.TaskExplorer;
import org.springframework.cloud.task.repository.TaskRepository;
import org.springframework.core.DecoratingProxy;
import org.springframework.core.annotation.SynthesizedAnnotation;
import org.springframework.util.ClassUtils;

/**
 * Native Hints for Spring Cloud Task.
 *
 * @author <NAME>
 * @since 3.0
 */
public class TaskRuntimeHints implements RuntimeHintsRegistrar {

	@Override
	public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
		hints.reflection().registerType(TypeReference.of("java.sql.DatabaseMetaData"), hint -> {
		});
		hints.resources().registerPattern("org/springframework/cloud/task/schema-h2.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-mysql.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-oracle.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-postgresql.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-hsqldb.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-sqlserver.sql");

		hints.reflection().registerType(
				TypeReference.of("org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer"),
				hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
						MemberCategory.INVOKE_DECLARED_METHODS));

		hints.proxies().registerJdkProxy(builder -> builder.proxiedInterfaces(TaskRepository.class)
				.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class));
		hints.proxies().registerJdkProxy(builder -> builder.proxiedInterfaces(TaskExplorer.class)
				.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class));

		// Remove Qualifier hints once SCSt can be natively compiled.
		hints.reflection().registerType(Qualifier.class, RuntimeHintsUtils.ANNOTATION_HINT);
		hints.proxies().registerJdkProxy(Qualifier.class, SynthesizedAnnotation.class);

		if (!ClassUtils.isPresent("com.zaxxer.hikari.HikariDataSource", classLoader)) {
			return;
		}
		hints.reflection().registerType(Statement[].class, hint -> {
		});
		hints.reflection().registerType(TypeReference.of("com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[]"),
				hint -> {
				});
	}

}<commit_msg>Updated to cleanup hints that are no longer necessary<commit_after>/*
 * Copyright 2022-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.task.configuration;

import java.sql.Statement;

import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.util.ClassUtils;

/**
 * Native Hints for Spring Cloud Task.
 *
 * @author <NAME>
 * @since 3.0
 */
public class TaskRuntimeHints implements RuntimeHintsRegistrar {

	@Override
	public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
		hints.reflection().registerType(TypeReference.of("java.sql.DatabaseMetaData"), hint -> {
		});
		hints.resources().registerPattern("org/springframework/cloud/task/schema-h2.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-mysql.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-oracle.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-postgresql.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-hsqldb.sql");
		hints.resources().registerPattern("org/springframework/cloud/task/schema-sqlserver.sql");

		hints.reflection().registerType(
				TypeReference.of("org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer"),
				hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
						MemberCategory.INVOKE_DECLARED_METHODS));

		if (!ClassUtils.isPresent("com.zaxxer.hikari.HikariDataSource", classLoader)) {
			return;
		}
		hints.reflection().registerType(Statement[].class, hint -> {
		});
		hints.reflection().registerType(TypeReference.of("com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[]"),
				hint -> {
				});
	}

}
{'fraction_non_alphanumeric': 0.11596893990546928, 'fraction_numerical': 0.005064145847400405, 'mean_word_length': 5.440217391304348, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6653263', 'n_tokens_mistral': 1795, 'n_tokens_neox': 1684, 'n_words': 333}