diff --git a/buildSrc/src/main/java/lock/GlobalLockTask.java b/buildSrc/src/main/java/lock/GlobalLockTask.java index e361e3e9..8cba42c1 100644 --- a/buildSrc/src/main/java/lock/GlobalLockTask.java +++ b/buildSrc/src/main/java/lock/GlobalLockTask.java @@ -19,7 +19,7 @@ public class GlobalLockTask extends DefaultTask { throw new IllegalStateException("You just specify --write-locks argument"); } writeLocksFor(taskProject); - taskProject.getSubprojects().forEach(new Consumer() { + taskProject.getSubprojects().forEach(new Consumer<>() { @Override public void accept(Project subproject) { writeLocksFor(subproject); @@ -28,7 +28,7 @@ public class GlobalLockTask extends DefaultTask { } private void writeLocksFor(Project project) { - project.getConfigurations().configureEach(new Action() { + project.getConfigurations().configureEach(new Action<>() { @Override public void execute(Configuration configuration) { if (configuration.isCanBeResolved()) { diff --git a/buildSrc/src/main/java/org/springframework/gradle/antora/CheckAntoraVersionPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/antora/CheckAntoraVersionPlugin.java index a0dcb966..ab16376a 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/antora/CheckAntoraVersionPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/antora/CheckAntoraVersionPlugin.java @@ -13,7 +13,7 @@ public class CheckAntoraVersionPlugin implements Plugin { @Override public void apply(Project project) { - TaskProvider antoraCheckVersion = project.getTasks().register(ANTORA_CHECK_VERSION_TASK_NAME, CheckAntoraVersionTask.class, new Action() { + TaskProvider antoraCheckVersion = project.getTasks().register(ANTORA_CHECK_VERSION_TASK_NAME, CheckAntoraVersionTask.class, new Action<>() { @Override public void execute(CheckAntoraVersionTask antoraCheckVersion) { antoraCheckVersion.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); @@ -23,10 +23,10 @@ public class CheckAntoraVersionPlugin implements Plugin { antoraCheckVersion.getAntoraYmlFile().fileProvider(project.provider(() -> project.file("antora.yml"))); } }); - project.getPlugins().withType(LifecycleBasePlugin.class, new Action() { + project.getPlugins().withType(LifecycleBasePlugin.class, new Action<>() { @Override public void execute(LifecycleBasePlugin lifecycleBasePlugin) { - project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(new Action() { + project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(new Action<>() { @Override public void execute(Task check) { check.dependsOn(antoraCheckVersion); diff --git a/buildSrc/src/main/java/org/springframework/gradle/github/changelog/GitHubChangelogPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/github/changelog/GitHubChangelogPlugin.java index 0eab3d80..7c09fa6c 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/github/changelog/GitHubChangelogPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/github/changelog/GitHubChangelogPlugin.java @@ -40,7 +40,7 @@ public class GitHubChangelogPlugin implements Plugin { public void apply(Project project) { createRepository(project); createChangelogGeneratorConfiguration(project); - project.getTasks().register("generateChangelog", JavaExec.class, new Action() { + project.getTasks().register("generateChangelog", JavaExec.class, new Action<>() { @Override public void execute(JavaExec generateChangelog) { File outputFile = project.file(Paths.get(project.getBuildDir().getPath(), RELEASE_NOTES_PATH)); @@ -49,7 +49,7 @@ public class GitHubChangelogPlugin implements Plugin { generateChangelog.setDescription("Generates the changelog"); generateChangelog.setWorkingDir(project.getRootDir()); generateChangelog.classpath(project.getConfigurations().getAt(CHANGELOG_GENERATOR_CONFIGURATION_NAME)); - generateChangelog.doFirst(new Action() { + generateChangelog.doFirst(new Action<>() { @Override public void execute(Task task) { generateChangelog.args("--spring.config.location=scripts/release/release-notes-sections.yml", project.property("nextVersion"), outputFile.toString()); @@ -60,10 +60,10 @@ public class GitHubChangelogPlugin implements Plugin { } private void createChangelogGeneratorConfiguration(Project project) { - project.getConfigurations().create(CHANGELOG_GENERATOR_CONFIGURATION_NAME, new Action() { + project.getConfigurations().create(CHANGELOG_GENERATOR_CONFIGURATION_NAME, new Action<>() { @Override public void execute(Configuration configuration) { - configuration.defaultDependencies(new Action() { + configuration.defaultDependencies(new Action<>() { @Override public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("spring-io:github-changelog-generator:0.0.6")); @@ -74,11 +74,11 @@ public class GitHubChangelogPlugin implements Plugin { } private void createRepository(Project project) { - IvyArtifactRepository repository = project.getRepositories().ivy(new Action() { + IvyArtifactRepository repository = project.getRepositories().ivy(new Action<>() { @Override public void execute(IvyArtifactRepository repository) { repository.setUrl("https://github.com/"); - repository.patternLayout(new Action() { + repository.patternLayout(new Action<>() { @Override public void execute(IvyPatternRepositoryLayout layout) { layout.artifact("[organization]/[artifact]/releases/download/v[revision]/[artifact].[ext]"); @@ -87,11 +87,11 @@ public class GitHubChangelogPlugin implements Plugin { repository.getMetadataSources().artifact(); } }); - project.getRepositories().exclusiveContent(new Action() { + project.getRepositories().exclusiveContent(new Action<>() { @Override public void execute(ExclusiveContentRepository exclusiveContentRepository) { exclusiveContentRepository.forRepositories(repository); - exclusiveContentRepository.filter(new Action() { + exclusiveContentRepository.filter(new Action<>() { @Override public void execute(InclusiveRepositoryContentDescriptor descriptor) { descriptor.includeGroup("spring-io"); diff --git a/buildSrc/src/main/java/org/springframework/gradle/github/milestones/GitHubMilestonePlugin.java b/buildSrc/src/main/java/org/springframework/gradle/github/milestones/GitHubMilestonePlugin.java index 81663f25..57f749d9 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/github/milestones/GitHubMilestonePlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/github/milestones/GitHubMilestonePlugin.java @@ -23,7 +23,7 @@ import org.gradle.api.Project; public class GitHubMilestonePlugin implements Plugin { @Override public void apply(Project project) { - project.getTasks().register("gitHubCheckMilestoneHasNoOpenIssues", GitHubMilestoneHasNoOpenIssuesTask.class, new Action() { + project.getTasks().register("gitHubCheckMilestoneHasNoOpenIssues", GitHubMilestoneHasNoOpenIssuesTask.class, new Action<>() { @Override public void execute(GitHubMilestoneHasNoOpenIssuesTask githubCheckMilestoneHasNoOpenIssues) { githubCheckMilestoneHasNoOpenIssues.setGroup("Release"); diff --git a/buildSrc/src/main/java/org/springframework/gradle/github/release/GitHubReleasePlugin.java b/buildSrc/src/main/java/org/springframework/gradle/github/release/GitHubReleasePlugin.java index ae2c44a7..1a33162e 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/github/release/GitHubReleasePlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/github/release/GitHubReleasePlugin.java @@ -27,7 +27,7 @@ import org.gradle.api.Project; public class GitHubReleasePlugin implements Plugin { @Override public void apply(Project project) { - project.getTasks().register("createGitHubRelease", CreateGitHubReleaseTask.class, new Action() { + project.getTasks().register("createGitHubRelease", CreateGitHubReleaseTask.class, new Action<>() { @Override public void execute(CreateGitHubReleaseTask createGitHubRelease) { createGitHubRelease.setGroup("Release"); diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/MavenPublishingConventionsPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/MavenPublishingConventionsPlugin.java index 473712ec..47a7e41a 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/MavenPublishingConventionsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/MavenPublishingConventionsPlugin.java @@ -18,7 +18,7 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; public class MavenPublishingConventionsPlugin implements Plugin { @Override public void apply(Project project) { - project.getPlugins().withType(MavenPublishPlugin.class).all(new Action() { + project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<>() { @Override public void execute(MavenPublishPlugin mavenPublish) { PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishAllJavaComponentsPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishAllJavaComponentsPlugin.java index d8983604..f0737fa8 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishAllJavaComponentsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishAllJavaComponentsPlugin.java @@ -15,7 +15,7 @@ public class PublishAllJavaComponentsPlugin implements Plugin { public void apply(Project project) { project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> { PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); - publishing.getPublications().create("mavenJava", MavenPublication.class, new Action() { + publishing.getPublications().create("mavenJava", MavenPublication.class, new Action<>() { @Override public void execute(MavenPublication maven) { project.getPlugins().withType(JavaPlugin.class, (plugin) -> { diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishArtifactsPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishArtifactsPlugin.java index ed3985e2..0bf363dd 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishArtifactsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishArtifactsPlugin.java @@ -9,7 +9,7 @@ import org.gradle.api.Task; public class PublishArtifactsPlugin implements Plugin { @Override public void apply(Project project) { - project.getTasks().register("publishArtifacts", new Action() { + project.getTasks().register("publishArtifacts", new Action<>() { @Override public void execute(Task publishArtifacts) { publishArtifacts.setGroup("Publishing"); diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishLocalPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishLocalPlugin.java index 0e09936f..17617a29 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/PublishLocalPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/PublishLocalPlugin.java @@ -12,11 +12,11 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; public class PublishLocalPlugin implements Plugin { @Override public void apply(Project project) { - project.getPlugins().withType(MavenPublishPlugin.class).all(new Action() { + project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<>() { @Override public void execute(MavenPublishPlugin mavenPublish) { PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); - publishing.getRepositories().maven(new Action() { + publishing.getRepositories().maven(new Action<>() { @Override public void execute(MavenArtifactRepository maven) { maven.setName("local"); diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/SpringNexusPublishPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/SpringNexusPublishPlugin.java index 5570fa2c..c94a8164 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/SpringNexusPublishPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/SpringNexusPublishPlugin.java @@ -15,7 +15,7 @@ public class SpringNexusPublishPlugin implements Plugin { public void apply(Project project) { project.getPlugins().apply(NexusPublishPlugin.class); NexusPublishExtension nexusPublishing = project.getExtensions().findByType(NexusPublishExtension.class); - nexusPublishing.getRepositories().create("ossrh", new Action() { + nexusPublishing.getRepositories().create("ossrh", new Action<>() { @Override public void execute(NexusRepository nexusRepository) { nexusRepository.getNexusUrl().set(URI.create("https://s01.oss.sonatype.org/service/local/")); diff --git a/buildSrc/src/main/java/org/springframework/gradle/maven/SpringSigningPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/maven/SpringSigningPlugin.java index d34225da..ed3f46e2 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/maven/SpringSigningPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/maven/SpringSigningPlugin.java @@ -30,7 +30,7 @@ public class SpringSigningPlugin implements Plugin { @Override public void apply(Project project) { project.getPluginManager().apply(SigningPlugin.class); - project.getPlugins().withType(SigningPlugin.class).all(new Action() { + project.getPlugins().withType(SigningPlugin.class).all(new Action<>() { @Override public void execute(SigningPlugin signingPlugin) { boolean hasSigningKey = project.hasProperty("signing.keyId") || project.hasProperty("signingKey"); @@ -50,7 +50,7 @@ public class SpringSigningPlugin implements Plugin { } }); sign(project, signing); - project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(new Action() { + project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(new Action<>() { @Override public void execute(PublishAllJavaComponentsPlugin publishingPlugin) { PublishingExtension publishing = project.getExtensions().findByType(PublishingExtension.class); diff --git a/buildSrc/src/main/java/org/springframework/gradle/sagan/SaganPlugin.java b/buildSrc/src/main/java/org/springframework/gradle/sagan/SaganPlugin.java index c5ff7d70..987a8a3b 100644 --- a/buildSrc/src/main/java/org/springframework/gradle/sagan/SaganPlugin.java +++ b/buildSrc/src/main/java/org/springframework/gradle/sagan/SaganPlugin.java @@ -24,7 +24,7 @@ import org.gradle.api.Project; public class SaganPlugin implements Plugin { @Override public void apply(Project project) { - project.getTasks().register("saganCreateRelease", SaganCreateReleaseTask.class, new Action() { + project.getTasks().register("saganCreateRelease", SaganCreateReleaseTask.class, new Action<>() { @Override public void execute(SaganCreateReleaseTask saganCreateVersion) { saganCreateVersion.setGroup("Release"); @@ -34,7 +34,7 @@ public class SaganPlugin implements Plugin { saganCreateVersion.setGitHubAccessToken((String) project.findProperty("gitHubAccessToken")); } }); - project.getTasks().register("saganDeleteRelease", SaganDeleteReleaseTask.class, new Action() { + project.getTasks().register("saganDeleteRelease", SaganDeleteReleaseTask.class, new Action<>() { @Override public void execute(SaganDeleteReleaseTask saganDeleteVersion) { saganDeleteVersion.setGroup("Release"); diff --git a/buildSrc/src/main/java/org/springframework/security/convention/versions/GitHubApi.java b/buildSrc/src/main/java/org/springframework/security/convention/versions/GitHubApi.java index e2aeb80e..24b8e6d2 100644 --- a/buildSrc/src/main/java/org/springframework/security/convention/versions/GitHubApi.java +++ b/buildSrc/src/main/java/org/springframework/security/convention/versions/GitHubApi.java @@ -38,7 +38,7 @@ public class GitHubApi { String label = "\"type: dependency-upgrade\""; FindCreateIssueInputQuery findCreateIssueInputQuery = new FindCreateIssueInputQuery(owner, name, Input.optional(label), Input.optional(milestone)); return Mono.create( sink -> this.apolloClient.query(findCreateIssueInputQuery) - .enqueue(new ApolloCall.Callback() { + .enqueue(new ApolloCall.Callback<>() { @Override public void onResponse(@NotNull Response response) { if (response.hasErrors()) { @@ -101,7 +101,7 @@ public class GitHubApi { public Mono findRateLimit() { return Mono.create( sink -> this.apolloClient.query(new RateLimitQuery()) - .enqueue(new ApolloCall.Callback() { + .enqueue(new ApolloCall.Callback<>() { @Override public void onResponse(@NotNull Response response) { if (response.hasErrors()) { @@ -126,7 +126,7 @@ public class GitHubApi { .assigneeId(assigneeId) .build(); return Mono.create( sink -> this.apolloClient.mutate(createIssue) - .enqueue(new ApolloCall.Callback() { + .enqueue(new ApolloCall.Callback<>() { @Override public void onResponse(@NotNull Response response) { if (response.hasErrors()) { diff --git a/buildSrc/src/main/java/org/springframework/security/convention/versions/UpdateDependenciesPlugin.java b/buildSrc/src/main/java/org/springframework/security/convention/versions/UpdateDependenciesPlugin.java index 5361d551..6387488a 100644 --- a/buildSrc/src/main/java/org/springframework/security/convention/versions/UpdateDependenciesPlugin.java +++ b/buildSrc/src/main/java/org/springframework/security/convention/versions/UpdateDependenciesPlugin.java @@ -71,7 +71,7 @@ public class UpdateDependenciesPlugin implements Plugin { String gitHubAccessToken = String.valueOf(project.findProperty("gitHubAccessToken")); updateDependenciesSettings.getGitHub().setAccessToken(gitHubAccessToken); } - project.getTasks().register("updateDependencies", DependencyUpdatesTask.class, new Action() { + project.getTasks().register("updateDependencies", DependencyUpdatesTask.class, new Action<>() { @Override public void execute(DependencyUpdatesTask updateDependencies) { updateDependencies.setDescription("Update the dependencies"); @@ -88,10 +88,10 @@ public class UpdateDependenciesPlugin implements Plugin { return null; } }); - updateDependencies.resolutionStrategy(new Action() { + updateDependencies.resolutionStrategy(new Action<>() { @Override public void execute(ResolutionStrategyWithCurrent resolution) { - resolution.componentSelection(new Action() { + resolution.componentSelection(new Action<>() { @Override public void execute(ComponentSelectionRulesWithCurrent components) { updateDependenciesSettings.getExcludes().getActions().forEach((action) -> { diff --git a/buildSrc/src/test/java/io/spring/gradle/convention/SpringMavenPluginITests.java b/buildSrc/src/test/java/io/spring/gradle/convention/SpringMavenPluginITests.java index 0c7685fa..2b89e534 100644 --- a/buildSrc/src/test/java/io/spring/gradle/convention/SpringMavenPluginITests.java +++ b/buildSrc/src/test/java/io/spring/gradle/convention/SpringMavenPluginITests.java @@ -40,7 +40,7 @@ public class SpringMavenPluginITests { @Disabled @Test public void signArchivesWhenInMemory() throws Exception { - LinkedHashMap map = new LinkedHashMap(2); + LinkedHashMap map = new LinkedHashMap<>(2); map.put("ORG_GRADLE_PROJECT_signingKey", getSigningKey()); map.put("ORG_GRADLE_PROJECT_signingPassword", "password"); BuildResult result = this.testKit.withProjectResource("samples/maven/signing") diff --git a/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java b/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java index 3510388b..55f29890 100644 --- a/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java +++ b/core/src/main/java/org/springframework/ldap/config/ContextSourceParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2015 the original author or authors. + * Copyright 2005-2025 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. @@ -327,7 +327,7 @@ public class ContextSourceParser implements BeanDefinitionParser { String nonTransientExceptions = ParserUtils.getString(element, ATT_NON_TRANSIENT_EXCEPTIONS, CommunicationException.class.getName()); String[] strings = StringUtils.commaDelimitedListToStringArray(nonTransientExceptions); - Set> nonTransientExceptionClasses = new HashSet>(); + Set> nonTransientExceptionClasses = new HashSet<>(); for (String className : strings) { try { nonTransientExceptionClasses.add(ClassUtils.getDefaultClassLoader().loadClass(className)); @@ -356,7 +356,7 @@ public class ContextSourceParser implements BeanDefinitionParser { String nonTransientExceptions = ParserUtils.getString(element, ATT_NON_TRANSIENT_EXCEPTIONS, CommunicationException.class.getName()); String[] strings = StringUtils.commaDelimitedListToStringArray(nonTransientExceptions); - Set> nonTransientExceptionClasses = new HashSet>(); + Set> nonTransientExceptionClasses = new HashSet<>(); for (String className : strings) { try { nonTransientExceptionClasses.add(ClassUtils.getDefaultClassLoader().loadClass(className)); diff --git a/core/src/main/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandler.java b/core/src/main/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandler.java index 707117a5..304a6e62 100644 --- a/core/src/main/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandler.java +++ b/core/src/main/java/org/springframework/ldap/core/CollectingNameClassPairCallbackHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -30,7 +30,7 @@ import javax.naming.NamingException; */ public abstract class CollectingNameClassPairCallbackHandler implements NameClassPairCallbackHandler { - private List list = new LinkedList(); + private List list = new LinkedList<>(); /** * Get the assembled list. diff --git a/core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java b/core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java index a5256a68..1749f6d9 100644 --- a/core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java +++ b/core/src/main/java/org/springframework/ldap/core/DirContextAdapter.java @@ -237,7 +237,7 @@ public class DirContextAdapter implements DirContextOperations { @Override public String[] getNamesOfModifiedAttributes() { - List tmpList = new ArrayList(); + List tmpList = new ArrayList<>(); if (isUpdateMode()) { for (NameAwareAttribute attribute : this.updatedAttrs) { @@ -273,7 +273,7 @@ public class DirContextAdapter implements DirContextOperations { return new ModificationItem[0]; } - List tmpList = new LinkedList(); + List tmpList = new LinkedList<>(); for (NameAwareAttribute attribute : this.updatedAttrs) { collectModifications(attribute, tmpList); } @@ -333,7 +333,7 @@ public class DirContextAdapter implements DirContextOperations { else if (changedAttr.size() > 0) { // Change of multivalue Attribute. Collect additions and removals // individually. - List myModifications = new LinkedList(); + List myModifications = new LinkedList<>(); collectModifications(currentAttribute, changedAttr, myModifications); if (myModifications.isEmpty()) { @@ -715,7 +715,7 @@ public class DirContextAdapter implements DirContextOperations { } private List collectAttributeValuesAsList(String name, Class clazz) { - List list = new LinkedList(); + List list = new LinkedList<>(); LdapUtils.collectAttributeValues(this.originalAttrs, name, list, clazz); return list; } @@ -726,7 +726,7 @@ public class DirContextAdapter implements DirContextOperations { @Override public SortedSet getAttributeSortedStringSet(String name) { try { - TreeSet attrSet = new TreeSet(); + TreeSet attrSet = new TreeSet<>(); LdapUtils.collectAttributeValues(this.originalAttrs, name, attrSet, String.class); return attrSet; } diff --git a/core/src/main/java/org/springframework/ldap/core/LdapAttribute.java b/core/src/main/java/org/springframework/ldap/core/LdapAttribute.java index 4dc9efa7..de8cf7b5 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapAttribute.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2005-2025 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. @@ -40,7 +40,7 @@ public class LdapAttribute extends BasicAttribute { /** * Holds the attributes options. */ - protected Set options = new HashSet(); + protected Set options = new HashSet<>(); /** * Creates an unordered attribute with the specified ID. diff --git a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java index d6dd3b28..8375e0d7 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapRdn.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapRdn.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -45,7 +45,7 @@ public class LdapRdn implements Serializable, Comparable { private static final int DEFAULT_BUFFER_SIZE = 100; - private Map components = new LinkedHashMap(); + private Map components = new LinkedHashMap<>(); /** * Default constructor. Create an empty, uninitialized LdapRdn. @@ -280,8 +280,7 @@ public class LdapRdn implements Serializable, Comparable { * @since 1.3 */ public LdapRdn immutableLdapRdn() { - Map mapWithImmutableRdns = new LinkedHashMap( - this.components.size()); + Map mapWithImmutableRdns = new LinkedHashMap<>(this.components.size()); for (Iterator iterator = this.components.values().iterator(); iterator.hasNext();) { LdapRdnComponent rdnComponent = (LdapRdnComponent) iterator.next(); mapWithImmutableRdns.put(rdnComponent.getKey(), rdnComponent.immutableLdapRdnComponent()); diff --git a/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java b/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java index f73558ec..3cacd5c8 100644 --- a/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java +++ b/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -583,7 +583,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { @Override public List search(String base, String filter, SearchControls controls, AttributesMapper mapper, DirContextProcessor processor) { - AttributesMapperCallbackHandler handler = new AttributesMapperCallbackHandler(mapper); + AttributesMapperCallbackHandler handler = new AttributesMapperCallbackHandler<>(mapper); search(base, filter, controls, handler, processor); return handler.getList(); @@ -595,7 +595,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { @Override public List search(Name base, String filter, SearchControls controls, AttributesMapper mapper, DirContextProcessor processor) { - AttributesMapperCallbackHandler handler = new AttributesMapperCallbackHandler(mapper); + AttributesMapperCallbackHandler handler = new AttributesMapperCallbackHandler<>(mapper); search(base, filter, controls, handler, processor); return handler.getList(); @@ -608,7 +608,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { public List search(String base, String filter, SearchControls controls, ContextMapper mapper, DirContextProcessor processor) { assureReturnObjFlagSet(controls); - ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler(mapper); + ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler<>(mapper); search(base, filter, controls, handler, processor); return handler.getList(); @@ -621,7 +621,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { public List search(Name base, String filter, SearchControls controls, ContextMapper mapper, DirContextProcessor processor) { assureReturnObjFlagSet(controls); - ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler(mapper); + ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler<>(mapper); search(base, filter, controls, handler, processor); return handler.getList(); @@ -660,8 +660,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List list(String base, NameClassPairMapper mapper) { - CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler( - mapper); + CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper); list(base, handler); return handler.getList(); } @@ -671,8 +670,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List list(Name base, NameClassPairMapper mapper) { - CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler( - mapper); + CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper); list(base, handler); return handler.getList(); } @@ -726,8 +724,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List listBindings(String base, NameClassPairMapper mapper) { - CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler( - mapper); + CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper); listBindings(base, handler); return handler.getList(); } @@ -737,8 +734,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List listBindings(Name base, NameClassPairMapper mapper) { - CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler( - mapper); + CollectingNameClassPairCallbackHandler handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper); listBindings(base, handler); return handler.getList(); } @@ -764,7 +760,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List listBindings(String base, ContextMapper mapper) { - ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler(mapper); + ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler<>(mapper); listBindings(base, handler); return handler.getList(); @@ -775,7 +771,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public List listBindings(Name base, ContextMapper mapper) { - ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler(mapper); + ContextMapperCallbackHandler handler = new ContextMapperCallbackHandler<>(mapper); listBindings(base, handler); return handler.getList(); @@ -1356,7 +1352,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { try { DirContext ctx = this.contextSource.getContext(entryIdentification.getAbsoluteName().toString(), password); - executeWithContext(new ContextExecutor() { + executeWithContext(new ContextExecutor<>() { public Object executeWithContext(DirContext ctx) throws javax.naming.NamingException { callback.executeWithContext(ctx, entryIdentification); return null; @@ -1377,8 +1373,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { @Override public T authenticate(LdapQuery query, String password, AuthenticatedLdapEntryContextMapper mapper) { SearchControls searchControls = searchControlsForQuery(query, RETURN_OBJ_FLAG); - ReturningAuthenticatedLdapEntryContext mapperCallback = new ReturningAuthenticatedLdapEntryContext( - mapper); + ReturningAuthenticatedLdapEntryContext mapperCallback = new ReturningAuthenticatedLdapEntryContext<>(mapper); CollectingAuthenticationErrorCallback errorCallback = new CollectingAuthenticationErrorCallback(); AuthenticationStatus authenticationStatus = authenticate(query.base(), query.filter().encode(), password, @@ -1507,7 +1502,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { */ @Override public DirContextOperations searchForContext(LdapQuery query) { - return searchForObject(query, new ContextMapper() { + return searchForObject(query, new ContextMapper<>() { @Override public DirContextOperations mapFromContext(Object ctx) throws javax.naming.NamingException { return (DirContextOperations) ctx; @@ -1591,7 +1586,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { // Make sure the class is OK before doing the lookup String[] attributes = this.odm.manageClass(clazz); - T result = lookup(dn, attributes, new ContextMapper() { + T result = lookup(dn, attributes, new ContextMapper<>() { @Override public T mapFromContext(Object ctx) throws javax.naming.NamingException { return LdapTemplate.this.odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz); @@ -1746,7 +1741,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean { searchControls)); } - List result = search(localBase, finalFilter.encode(), searchControls, new ContextMapper() { + List result = search(localBase, finalFilter.encode(), searchControls, new ContextMapper<>() { @Override public T mapFromContext(Object ctx) throws javax.naming.NamingException { return LdapTemplate.this.odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz); diff --git a/core/src/main/java/org/springframework/ldap/core/NameAwareAttribute.java b/core/src/main/java/org/springframework/ldap/core/NameAwareAttribute.java index 86e2afe3..c46ce89c 100644 --- a/core/src/main/java/org/springframework/ldap/core/NameAwareAttribute.java +++ b/core/src/main/java/org/springframework/ldap/core/NameAwareAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -47,9 +47,9 @@ public final class NameAwareAttribute implements Attribute, Iterable { private final boolean orderMatters; - private final Set values = new LinkedHashSet(); + private final Set values = new LinkedHashSet<>(); - private Map valuesAsNames = new HashMap(); + private Map valuesAsNames = new HashMap<>(); /** * Construct a new instance with the specified id and one value. @@ -104,7 +104,7 @@ public final class NameAwareAttribute implements Attribute, Iterable { @Override public NamingEnumeration getAll() { - return new IterableNamingEnumeration(this.values); + return new IterableNamingEnumeration<>(this.values); } @Override @@ -162,7 +162,7 @@ public final class NameAwareAttribute implements Attribute, Iterable { return; } - Map newValuesAsNames = new HashMap(); + Map newValuesAsNames = new HashMap<>(); for (Object value : this.values) { if (value instanceof String) { String s = (String) value; diff --git a/core/src/main/java/org/springframework/ldap/core/NameAwareAttributes.java b/core/src/main/java/org/springframework/ldap/core/NameAwareAttributes.java index dc44a375..bad22553 100644 --- a/core/src/main/java/org/springframework/ldap/core/NameAwareAttributes.java +++ b/core/src/main/java/org/springframework/ldap/core/NameAwareAttributes.java @@ -36,7 +36,7 @@ import org.springframework.util.Assert; */ public final class NameAwareAttributes implements Attributes, Iterable { - private Map attributes = new HashMap(); + private Map attributes = new HashMap<>(); /** * Create an empty instance @@ -75,12 +75,12 @@ public final class NameAwareAttributes implements Attributes, Iterable getAll() { - return new IterableNamingEnumeration(this.attributes.values()); + return new IterableNamingEnumeration<>(this.attributes.values()); } @Override public NamingEnumeration getIDs() { - return new IterableNamingEnumeration(this.attributes.keySet()); + return new IterableNamingEnumeration<>(this.attributes.keySet()); } /** diff --git a/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java b/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java index 434397c7..4524f516 100644 --- a/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java +++ b/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2024 the original author or authors. + * Copyright 2005-2025 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. @@ -103,7 +103,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource private boolean pooled = false; - private Hashtable baseEnv = new Hashtable(); + private Hashtable baseEnv = new Hashtable<>(); private Hashtable anonymousEnv; @@ -447,7 +447,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource LOG.debug("Not using LDAP pooling"); } - Hashtable env = new Hashtable(this.baseEnv); + Hashtable env = new Hashtable<>(this.baseEnv); env.put(Context.INITIAL_CONTEXT_FACTORY, this.contextFactory.getName()); env.put(Context.PROVIDER_URL, assembleProviderUrlString(this.urls)); @@ -563,7 +563,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource * be used when creating new Context instances. */ public void setBaseEnvironmentProperties(Map baseEnvironmentProperties) { - this.baseEnv = new Hashtable(baseEnvironmentProperties); + this.baseEnv = new Hashtable<>(baseEnvironmentProperties); } protected Hashtable getAnonymousEnv() { @@ -577,7 +577,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource protected Hashtable getAuthenticatedEnv(String principal, String credentials) { // The authenticated environment should always be rebuilt. - Hashtable env = new Hashtable(getAnonymousEnv()); + Hashtable env = new Hashtable<>(getAnonymousEnv()); setupAuthenticatedEnvironment(env, principal, credentials); return env; } diff --git a/core/src/main/java/org/springframework/ldap/core/support/AggregateDirContextProcessor.java b/core/src/main/java/org/springframework/ldap/core/support/AggregateDirContextProcessor.java index 9d865fb9..bbb2f184 100644 --- a/core/src/main/java/org/springframework/ldap/core/support/AggregateDirContextProcessor.java +++ b/core/src/main/java/org/springframework/ldap/core/support/AggregateDirContextProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -35,7 +35,7 @@ import org.springframework.ldap.core.DirContextProcessor; */ public class AggregateDirContextProcessor implements DirContextProcessor { - private List dirContextProcessors = new LinkedList(); + private List dirContextProcessors = new LinkedList<>(); /** * Add the supplied DirContextProcessor to the list of managed objects. @@ -59,7 +59,7 @@ public class AggregateDirContextProcessor implements DirContextProcessor { * set. */ public void setDirContextProcessors(List dirContextProcessors) { - this.dirContextProcessors = new ArrayList(dirContextProcessors); + this.dirContextProcessors = new ArrayList<>(dirContextProcessors); } /* diff --git a/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java b/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java index 422cdfa9..5588dd1f 100644 --- a/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java +++ b/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -81,9 +81,9 @@ public class DefaultIncrementalAttributesMapper private static final Logger LOG = LoggerFactory.getLogger(DefaultIncrementalAttributesMapper.class); - private Map stateMap = new LinkedHashMap(); + private Map stateMap = new LinkedHashMap<>(); - private Set rangedAttributesInNextIteration = new LinkedHashSet(); + private Set rangedAttributesInNextIteration = new LinkedHashSet<>(); /** * This guy will be used when an unmapped attribute is encountered. This really should @@ -171,7 +171,7 @@ public class DefaultIncrementalAttributesMapper } // Reset the affected attributes. - this.rangedAttributesInNextIteration = new HashSet(); + this.rangedAttributesInNextIteration = new HashSet<>(); NamingEnumeration attributeNameEnum = attributes.getIDs(); while (attributeNameEnum.hasMore()) { @@ -417,14 +417,14 @@ public class DefaultIncrementalAttributesMapper private void initValuesIfApplicable() { if (this.values == null) { - this.values = new LinkedList(); + this.values = new LinkedList<>(); } } @Override public List getValues() { if (this.values != null) { - return new ArrayList(this.values); + return new ArrayList<>(this.values); } else { return null; diff --git a/core/src/main/java/org/springframework/ldap/filter/BinaryLogicalFilter.java b/core/src/main/java/org/springframework/ldap/filter/BinaryLogicalFilter.java index 7ffcb7ab..63776cfd 100644 --- a/core/src/main/java/org/springframework/ldap/filter/BinaryLogicalFilter.java +++ b/core/src/main/java/org/springframework/ldap/filter/BinaryLogicalFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -28,7 +28,7 @@ import java.util.List; */ public abstract class BinaryLogicalFilter extends AbstractFilter { - private List queryList = new LinkedList(); + private List queryList = new LinkedList<>(); public StringBuffer encode(StringBuffer buff) { if (this.queryList.size() <= 0) { diff --git a/core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java b/core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java index 4365179e..29e5d340 100755 --- a/core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java +++ b/core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -101,7 +101,7 @@ import org.springframework.ldap.odm.annotations.Transient; // Grab the @Attribute annotation Attribute attribute = field.getAnnotation(Attribute.class); - List attrList = new ArrayList(); + List attrList = new ArrayList<>(); // Did we find the annotation? if (attribute != null) { // Pull attribute name, syntax and whether attribute is binary diff --git a/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java b/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java index f55b33b0..737698d0 100644 --- a/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java +++ b/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -96,7 +96,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { } // A map of managed classes to to meta data about those classes - private final ConcurrentMap, EntityData> metaDataMap = new ConcurrentHashMap, EntityData>(); + private final ConcurrentMap, EntityData> metaDataMap = new ConcurrentHashMap<>(); private EntityData getEntityData(Class managedClass) { EntityData result = this.metaDataMap.get(managedClass); @@ -110,7 +110,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { public String[] manageClass(Class clazz) { // This throws exception if data is invalid EntityData entityData = getEntityData(clazz); - Set managedAttributeNames = new HashSet(); + Set managedAttributeNames = new HashSet<>(); // extract all relevant attributes for (Field field : entityData.metaData) { AttributeMetaData attributeMetaData = entityData.metaData.getAttribute(field); @@ -253,7 +253,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { private void populateMultiValueAttribute(Object entry, LdapDataEntry context, Field field, AttributeMetaData attributeInfo, Class targetClass) throws IllegalAccessException { // We need to build up a list of of the values - List attributeValues = new ArrayList(); + List attributeValues = new ArrayList<>(); // Get the list of values Collection fieldValues = (Collection) field.get(entry); // Ignore null lists @@ -300,7 +300,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { result = clazz.newInstance(); // Build a map of JNDI attribute names to values - Map attributeValueMap = new HashMap(); + Map attributeValueMap = new HashMap<>(); // Get a NamingEnumeration to loop through the JNDI attributes in the entry Attributes attributes = context.getAttributes(); NamingEnumeration attributesEnumeration = attributes.getAll(); @@ -318,7 +318,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { Attribute ocAttribute = attributeValueMap.get(OBJECT_CLASS_ATTRIBUTE_CI); if (ocAttribute != null) { // Get all object class values from the JNDI attribute - Set objectClassesFromJndi = new HashSet(); + Set objectClassesFromJndi = new HashSet<>(); NamingEnumeration objectClassesFromJndiEnum = ocAttribute.getAll(); while (objectClassesFromJndiEnum.hasMoreElements()) { objectClassesFromJndi.add(new CaseIgnoreString((String) objectClassesFromJndiEnum.nextElement())); diff --git a/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java b/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java index f0092441..4c2e71cc 100755 --- a/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java +++ b/core/src/main/java/org/springframework/ldap/odm/core/impl/ObjectMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -47,9 +47,9 @@ import org.springframework.util.StringUtils; private AttributeMetaData idAttribute; - private Map fieldToAttribute = new HashMap(); + private Map fieldToAttribute = new HashMap<>(); - private Set dnAttributes = new TreeSet(new Comparator() { + private Set dnAttributes = new TreeSet<>(new Comparator<>() { @Override public int compare(AttributeMetaData a1, AttributeMetaData a2) { if (!a1.isDnAttribute() || !a2.isDnAttribute()) { @@ -63,7 +63,7 @@ import org.springframework.util.StringUtils; private boolean indexedDnAttributes = false; - private Set objectClasses = new LinkedHashSet(); + private Set objectClasses = new LinkedHashSet<>(); private Name base = LdapUtils.emptyLdapName(); diff --git a/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerFactoryBean.java b/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerFactoryBean.java index 650a3786..3ab2b9be 100755 --- a/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerFactoryBean.java +++ b/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -166,13 +166,13 @@ public final class ConverterManagerFactoryBean implements FactoryBean { public static final class ConverterConfig { // The set of classes the Converter will convert from. - private Set> fromClasses = new HashSet>(); + private Set> fromClasses = new HashSet<>(); // The (optional) LDAP syntax. private String syntax = null; // The set of classes the Converter will convert to. - private Set> toClasses = new HashSet>(); + private Set> toClasses = new HashSet<>(); // The Converter to use. private Converter converter = null; diff --git a/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerImpl.java b/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerImpl.java index 1ff83294..114f470c 100755 --- a/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerImpl.java +++ b/core/src/main/java/org/springframework/ldap/odm/typeconversion/impl/ConverterManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -51,7 +51,7 @@ public final class ConverterManagerImpl implements ConverterManager { /** * Map of keys created via makeConverterKey to Converter instances. */ - private final Map converters = new HashMap(); + private final Map converters = new HashMap<>(); /** * Make a key into the converters map - the keys is formed from the @@ -80,7 +80,7 @@ public final class ConverterManagerImpl implements ConverterManager { * Used to help in the process of dealing with primitive types by mapping them to * their equivalent boxed class. */ - private static Map, Class> primitiveTypeMap = new HashMap, Class>(); + private static Map, Class> primitiveTypeMap = new HashMap<>(); static { primitiveTypeMap.put(Byte.TYPE, Byte.class); primitiveTypeMap.put(Short.TYPE, Short.class); diff --git a/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java b/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java index 4746dc67..6c7d05a7 100644 --- a/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java +++ b/core/src/main/java/org/springframework/ldap/pool/factory/DirContextPoolableObjectFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -82,7 +82,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory { */ protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - private static final Set> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet>() { + private static final Set> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<>() { { add(CommunicationException.class); } @@ -95,7 +95,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory { private Set> nonTransientExceptions = DEFAULT_NONTRANSIENT_EXCEPTIONS; void setNonTransientExceptions(Collection> nonTransientExceptions) { - this.nonTransientExceptions = new HashSet>(nonTransientExceptions); + this.nonTransientExceptions = new HashSet<>(nonTransientExceptions); } /** diff --git a/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java b/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java index 092b3306..7b1631cd 100644 --- a/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java +++ b/core/src/main/java/org/springframework/ldap/pool2/factory/DirContextPooledObjectFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2015 the original author or authors. + * Copyright 2005-2025 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. @@ -87,7 +87,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet>(); + private static final Set> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<>(); static { DEFAULT_NONTRANSIENT_EXCEPTIONS.add(CommunicationException.class); @@ -100,7 +100,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory> nonTransientExceptions = DEFAULT_NONTRANSIENT_EXCEPTIONS; void setNonTransientExceptions(Collection> nonTransientExceptions) { - this.nonTransientExceptions = new HashSet>(nonTransientExceptions); + this.nonTransientExceptions = new HashSet<>(nonTransientExceptions); } /** @@ -239,7 +239,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory wrap(Object value) { - return new DefaultPooledObject(value); + return new DefaultPooledObject<>(value); } /** diff --git a/core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java b/core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java index 0fcc2ba1..4e0cb5f6 100644 --- a/core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java +++ b/core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2015 the original author or authors. + * Copyright 2005-2025 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. @@ -105,7 +105,7 @@ public class PooledContextSource extends DelegatingBaseLdapPathContextSourceSupp objectPoolConfig); } else { - this.keyedObjectPool = new GenericKeyedObjectPool(this.dirContextPooledObjectFactory); + this.keyedObjectPool = new GenericKeyedObjectPool<>(this.dirContextPooledObjectFactory); } } diff --git a/core/src/main/java/org/springframework/ldap/query/DefaultContainerCriteria.java b/core/src/main/java/org/springframework/ldap/query/DefaultContainerCriteria.java index fae3140a..55e47a07 100644 --- a/core/src/main/java/org/springframework/ldap/query/DefaultContainerCriteria.java +++ b/core/src/main/java/org/springframework/ldap/query/DefaultContainerCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -29,7 +29,7 @@ import org.springframework.ldap.filter.Filter; */ class DefaultContainerCriteria implements AppendableContainerCriteria { - private final Set filters = new LinkedHashSet(); + private final Set filters = new LinkedHashSet<>(); private final LdapQuery topQuery; diff --git a/core/src/main/java/org/springframework/ldap/support/LdapUtils.java b/core/src/main/java/org/springframework/ldap/support/LdapUtils.java index 9c38f1ee..a556ff36 100644 --- a/core/src/main/java/org/springframework/ldap/support/LdapUtils.java +++ b/core/src/main/java/org/springframework/ldap/support/LdapUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -280,7 +280,7 @@ public final class LdapUtils { throw new NoSuchAttributeException("No attribute with name '" + name + "'"); } - iterateAttributeValues(attribute, new CollectingAttributeValueCallbackHandler(collection, clazz)); + iterateAttributeValues(attribute, new CollectingAttributeValueCallbackHandler<>(collection, clazz)); } diff --git a/core/src/main/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorder.java b/core/src/main/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorder.java index ae04738a..46e8c64a 100644 --- a/core/src/main/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorder.java +++ b/core/src/main/java/org/springframework/ldap/transaction/compensating/ModifyAttributesOperationRecorder.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -63,7 +63,7 @@ public class ModifyAttributesOperationRecorder implements CompensatingTransactio ModificationItem[] incomingModifications = (ModificationItem[]) args[1]; - Set set = new HashSet(); + Set set = new HashSet<>(); for (ModificationItem incomingModification : incomingModifications) { set.add(incomingModification.getAttribute().getID()); } diff --git a/core/src/main/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManager.java b/core/src/main/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManager.java index 6fdacbb2..d34b076b 100644 --- a/core/src/main/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManager.java +++ b/core/src/main/java/org/springframework/transaction/compensating/support/DefaultCompensatingTransactionOperationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -39,7 +39,7 @@ public class DefaultCompensatingTransactionOperationManager implements Compensat private static Logger log = LoggerFactory.getLogger(DefaultCompensatingTransactionOperationManager.class); - private Stack operationExecutors = new Stack(); + private Stack operationExecutors = new Stack<>(); private CompensatingTransactionOperationFactory operationFactory; diff --git a/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java b/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java index 6ffc42b9..3009ae44 100644 --- a/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java +++ b/core/src/test/java/org/springframework/ldap/core/support/BaseLdapPathBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -126,7 +126,7 @@ public class BaseLdapPathBeanPostProcessorTests { .willReturn(new String[] { "contextSource" }); final LdapContextSource expectedContextSource = new LdapContextSource(); - HashMap expectedBeans = new HashMap() { + HashMap expectedBeans = new HashMap<>() { { put("dummy", expectedContextSource); } diff --git a/core/src/test/java/org/springframework/ldap/core/support/ContextMapperCallbackHandlerWithControlsTests.java b/core/src/test/java/org/springframework/ldap/core/support/ContextMapperCallbackHandlerWithControlsTests.java index 963fdae6..606755de 100644 --- a/core/src/test/java/org/springframework/ldap/core/support/ContextMapperCallbackHandlerWithControlsTests.java +++ b/core/src/test/java/org/springframework/ldap/core/support/ContextMapperCallbackHandlerWithControlsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -49,7 +49,7 @@ public class ContextMapperCallbackHandlerWithControlsTests { @Test(expected = IllegalArgumentException.class) public void testConstructorWithEmptyArgument() { - new ContextMapperCallbackHandlerWithControls(null); + new ContextMapperCallbackHandlerWithControls<>(null); } @Test diff --git a/core/src/test/java/org/springframework/ldap/core/support/SingleContextSourceTests.java b/core/src/test/java/org/springframework/ldap/core/support/SingleContextSourceTests.java index 156a8303..71c40824 100644 --- a/core/src/test/java/org/springframework/ldap/core/support/SingleContextSourceTests.java +++ b/core/src/test/java/org/springframework/ldap/core/support/SingleContextSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -55,10 +55,10 @@ public class SingleContextSourceTests { given(this.contextSourceMock.getReadWriteContext()).willReturn(this.dirContextMock); verifyNoMoreInteractions(this.contextSourceMock); - SingleContextSource.doWithSingleContext(this.contextSourceMock, new LdapOperationsCallback() { + SingleContextSource.doWithSingleContext(this.contextSourceMock, new LdapOperationsCallback<>() { @Override public Object doWithLdapOperations(LdapOperations operations) { - operations.executeReadOnly(new ContextExecutor() { + operations.executeReadOnly(new ContextExecutor<>() { @Override public Object executeWithContext(DirContext ctx) throws NamingException { Object targetContex = getInternalState(Proxy.getInvocationHandler(ctx), "target"); @@ -70,7 +70,7 @@ public class SingleContextSourceTests { // Second operation will have retrieved new DirContext from the // SingleContextSource. // It should be the same instance. - operations.executeReadOnly(new ContextExecutor() { + operations.executeReadOnly(new ContextExecutor<>() { @Override public Object executeWithContext(DirContext ctx) throws NamingException { Object targetContex = getInternalState(Proxy.getInvocationHandler(ctx), "target"); diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/ObjectSchema.java b/odm/src/main/java/org/springframework/ldap/odm/tools/ObjectSchema.java index 9e12a50a..1aacee65 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/tools/ObjectSchema.java +++ b/odm/src/main/java/org/springframework/ldap/odm/tools/ObjectSchema.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -29,11 +29,11 @@ import java.util.Set; */ public final class ObjectSchema { - private final Set must = new HashSet(); + private final Set must = new HashSet<>(); - private final Set may = new HashSet(); + private final Set may = new HashSet<>(); - private final Set objectClass = new HashSet(); + private final Set objectClass = new HashSet<>(); public void addMust(AttributeSchema must) { // if may attributes contain must attribute, remove from may and add to must diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java index 98ebb996..f8a9e600 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java +++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -141,7 +141,7 @@ import org.springframework.ldap.odm.tools.SyntaxToJavaClass.ClassInfo; throws NamingException, ClassNotFoundException { // Super classes - Set supList = new HashSet(); + Set supList = new HashSet<>(); // For each of the given object classes for (String objectClass : objectClasses) { diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java index 2a41a62c..e128a8d0 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java +++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -179,7 +179,7 @@ public final class SchemaToJava { // Read list of LDAP syntaxes that are returned as byte[] private static Set readBinarySet(File binarySetFile) throws IOException { - Set result = new HashSet(); + Set result = new HashSet<>(); BufferedReader reader = null; try { @@ -209,7 +209,7 @@ public final class SchemaToJava { // Read mappings of LDAP syntaxes to Java classes. private static Map readSyntaxMap(File syntaxMapFile) throws IOException { - Map result = new HashMap(); + Map result = new HashMap<>(); BufferedReader reader = null; try { @@ -247,7 +247,7 @@ public final class SchemaToJava { Set binarySet, Set objectClasses) throws NamingException, ClassNotFoundException { // Set up environment - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put(Context.PROVIDER_URL, url); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); if (user != null) { @@ -279,7 +279,7 @@ public final class SchemaToJava { freeMarkerConfiguration.setObjectWrapper(new DefaultObjectWrapper()); // Build the model for FreeMarker - Map model = new HashMap(); + Map model = new HashMap<>(); model.put("package", packageName); model.put("class", className); model.put("schema", schema); @@ -337,7 +337,7 @@ public final class SchemaToJava { } private static Set parseObjectClassesFlag(String objectClassesFlag) { - Set objectClasses = new HashSet(); + Set objectClasses = new HashSet<>(); for (String objectClassFlag : objectClassesFlag.split(",")) { if (objectClassFlag.length() > 0) { @@ -412,7 +412,7 @@ public final class SchemaToJava { // Look for the optional syntax to Java class mapping file String syntaxMapFileName = cmd.getOptionValue(Flag.SYNTAX_MAP.getShort(), null); - SyntaxToJavaClass syntaxToJavaClass = new SyntaxToJavaClass(new HashMap()); + SyntaxToJavaClass syntaxToJavaClass = new SyntaxToJavaClass(new HashMap<>()); if (syntaxMapFileName != null) { File syntaxMapFile = new File(syntaxMapFileName); if (syntaxMapFile.canRead()) { @@ -459,7 +459,7 @@ public final class SchemaToJava { } // Work out what imports we need - Set imports = new HashSet(); + Set imports = new HashSet<>(); for (AttributeSchema attributeSchema : schema.getMay()) { SyntaxToJavaClass.ClassInfo classInfo = syntaxToJavaClass.getClassInfo(attributeSchema.getSyntax()); if (classInfo != null) { diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java index 39f511c6..2a85379e 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java +++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaViewer.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -220,7 +220,7 @@ public final class SchemaViewer { String user = cmd.getOptionValue(Flag.USERNAME.getShort(), ""); String pass = cmd.getOptionValue(Flag.PASSWORD.getShort(), ""); - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put(Context.PROVIDER_URL, url); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); if (user != null) { diff --git a/odm/src/main/java/org/springframework/ldap/odm/tools/SyntaxToJavaClass.java b/odm/src/main/java/org/springframework/ldap/odm/tools/SyntaxToJavaClass.java index de05d1f8..baab9a15 100755 --- a/odm/src/main/java/org/springframework/ldap/odm/tools/SyntaxToJavaClass.java +++ b/odm/src/main/java/org/springframework/ldap/odm/tools/SyntaxToJavaClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -27,7 +27,7 @@ import java.util.Map.Entry; */ /* package */ final class SyntaxToJavaClass { - private final Map mapSyntaxToClassInfo = new HashMap(); + private final Map mapSyntaxToClassInfo = new HashMap<>(); SyntaxToJavaClass(Map mapSyntaxToClass) { for (Entry syntaxAndClass : mapSyntaxToClass.entrySet()) { diff --git a/odm/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java b/odm/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java index f322c879..cdaa9d5f 100644 --- a/odm/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java +++ b/odm/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java @@ -131,7 +131,7 @@ public class ArrayMarshaller implements Marshaller> { if ((data.length == 1) && (data[0] == 0)) { E[] array = (E[]) new Object[] {}; - ArrayTree tree = new ArrayTree(this.comparator, array); + ArrayTree tree = new ArrayTree<>(this.comparator, array); return tree; } @@ -160,7 +160,7 @@ public class ArrayMarshaller implements Marshaller> { } } - ArrayTree arrayTree = new ArrayTree(this.comparator, nodes); + ArrayTree arrayTree = new ArrayTree<>(this.comparator, nodes); return arrayTree; } diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java index 33c962fb..20315c30 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -52,19 +52,19 @@ public class ConverterFactoryTests { @Test public void testConverterFactory() throws Exception { ConverterManagerFactoryBean converterManagerFactory = new ConverterManagerFactoryBean(); - Set configList = new HashSet(); + Set configList = new HashSet<>(); for (ConverterConfigTestData config : converterConfigTestData) { ConverterManagerFactoryBean.ConverterConfig converterConfig = new ConverterManagerFactoryBean.ConverterConfig(); - converterConfig.setFromClasses(new HashSet>(Arrays.asList(config.fromClasses))); + converterConfig.setFromClasses(new HashSet<>(Arrays.asList(config.fromClasses))); converterConfig.setSyntax(config.syntax); - converterConfig.setToClasses(new HashSet>(Arrays.asList(config.toClasses))); + converterConfig.setToClasses(new HashSet<>(Arrays.asList(config.toClasses))); converterConfig.setConverter(nullConverter); configList.add(converterConfig); } converterManagerFactory.setConverterConfig(configList); final ConverterManager converterManager = (ConverterManager) converterManagerFactory.getObject(); - new ExecuteRunnable().runTests(new RunnableTests() { + new ExecuteRunnable().runTests(new RunnableTests<>() { public void runTest(ConverterTestData testData) { assertThat(testData.canConvert) .isEqualTo(converterManager.canConvert(testData.fromClass, testData.syntax, testData.toClass)); diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java index fcce66f3..be25c68a 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/ConverterManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -73,33 +73,33 @@ public final class ConverterManagerTests { @Test public void basicTypeConverion() throws Exception { final ConverterTestData[] primitiveTypeTests = new ConverterTestData[] { - new ConverterTestData("33", Byte.class, Byte.valueOf((byte) 33)), - new ConverterTestData("-88", Byte.class, Byte.valueOf((byte) -88)), - new ConverterTestData("666", Short.class, Short.valueOf((short) 666)), - new ConverterTestData("-123", Short.class, Short.valueOf((short) -123)), - new ConverterTestData("123", Integer.class, Integer.valueOf(123)), - new ConverterTestData("-500", Integer.class, Integer.valueOf(-500)), - new ConverterTestData("123456", Long.class, Long.valueOf(123456)), - new ConverterTestData("-654321", Long.class, Long.valueOf(-654321)), - new ConverterTestData("2", Double.class, Double.valueOf(2)), - new ConverterTestData("-0.4", Double.class, Double.valueOf(-0.4)), - new ConverterTestData("666", Float.class, Float.valueOf(666)), - new ConverterTestData("-0.75", Float.class, Float.valueOf(-0.75F)), - new ConverterTestData("false", Boolean.class, Boolean.FALSE), - new ConverterTestData("TRUE", Boolean.class, Boolean.TRUE), - new ConverterTestData("This is a string", String.class, "This is a string"), - new ConverterTestData("This is another String", String.class, "This is another String"), - new ConverterTestData((byte) 66, String.class, "66"), - new ConverterTestData((int) 1234, String.class, "1234"), - new ConverterTestData((int) -9876, String.class, "-9876"), - new ConverterTestData("https://google.com/", URI.class, new URI("https://google.com/")), - new ConverterTestData("https://apache.org/index.html", URI.class, + new ConverterTestData<>("33", Byte.class, Byte.valueOf((byte) 33)), + new ConverterTestData<>("-88", Byte.class, Byte.valueOf((byte) -88)), + new ConverterTestData<>("666", Short.class, Short.valueOf((short) 666)), + new ConverterTestData<>("-123", Short.class, Short.valueOf((short) -123)), + new ConverterTestData<>("123", Integer.class, Integer.valueOf(123)), + new ConverterTestData<>("-500", Integer.class, Integer.valueOf(-500)), + new ConverterTestData<>("123456", Long.class, Long.valueOf(123456)), + new ConverterTestData<>("-654321", Long.class, Long.valueOf(-654321)), + new ConverterTestData<>("2", Double.class, Double.valueOf(2)), + new ConverterTestData<>("-0.4", Double.class, Double.valueOf(-0.4)), + new ConverterTestData<>("666", Float.class, Float.valueOf(666)), + new ConverterTestData<>("-0.75", Float.class, Float.valueOf(-0.75F)), + new ConverterTestData<>("false", Boolean.class, Boolean.FALSE), + new ConverterTestData<>("TRUE", Boolean.class, Boolean.TRUE), + new ConverterTestData<>("This is a string", String.class, "This is a string"), + new ConverterTestData<>("This is another String", String.class, "This is another String"), + new ConverterTestData<>((byte) 66, String.class, "66"), + new ConverterTestData<>((int) 1234, String.class, "1234"), + new ConverterTestData<>((int) -9876, String.class, "-9876"), + new ConverterTestData<>("https://google.com/", URI.class, new URI("https://google.com/")), + new ConverterTestData<>("https://apache.org/index.html", URI.class, new URI("https://apache.org/index.html")), - new ConverterTestData(new URI("https://google.com/"), String.class, "https://google.com/"), - new ConverterTestData(new URI("https://apache.org/index.html"), String.class, + new ConverterTestData<>(new URI("https://google.com/"), String.class, "https://google.com/"), + new ConverterTestData<>(new URI("https://apache.org/index.html"), String.class, "https://apache.org/index.html") }; - new ExecuteRunnable>().runTests(new RunnableTests>() { + new ExecuteRunnable>().runTests(new RunnableTests<>() { public void runTest(ConverterTestData testData) { assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager .convert(testData.sourceData, "", testData.destClass)); @@ -118,20 +118,20 @@ public final class ConverterManagerTests { this.converterManager.addConverter(Integer.class, "3", Integer.class, cubedConverter); final ConverterTestData[] syntaxTests = new ConverterTestData[] { - new ConverterTestData("3", "", Integer.class, Integer.valueOf(3)), - new ConverterTestData("4", "", Integer.class, Integer.valueOf(4)), - new ConverterTestData(5, "", Integer.class, Integer.valueOf(5)), - new ConverterTestData(6, "", Integer.class, Integer.valueOf(6)), - new ConverterTestData("3", "1", Integer.class, Integer.valueOf(9)), - new ConverterTestData("4", "1", Integer.class, Integer.valueOf(16)), - new ConverterTestData(5, "1", Integer.class, Integer.valueOf(25)), - new ConverterTestData(6, "1", Integer.class, Integer.valueOf(36)), - new ConverterTestData("3", "2", Integer.class, Integer.valueOf(27)), - new ConverterTestData("4", "2", Integer.class, Integer.valueOf(64)), - new ConverterTestData(5, "3", Integer.class, Integer.valueOf(125)), - new ConverterTestData(6, "3", Integer.class, Integer.valueOf(216)), }; + new ConverterTestData<>("3", "", Integer.class, Integer.valueOf(3)), + new ConverterTestData<>("4", "", Integer.class, Integer.valueOf(4)), + new ConverterTestData<>(5, "", Integer.class, Integer.valueOf(5)), + new ConverterTestData<>(6, "", Integer.class, Integer.valueOf(6)), + new ConverterTestData<>("3", "1", Integer.class, Integer.valueOf(9)), + new ConverterTestData<>("4", "1", Integer.class, Integer.valueOf(16)), + new ConverterTestData<>(5, "1", Integer.class, Integer.valueOf(25)), + new ConverterTestData<>(6, "1", Integer.class, Integer.valueOf(36)), + new ConverterTestData<>("3", "2", Integer.class, Integer.valueOf(27)), + new ConverterTestData<>("4", "2", Integer.class, Integer.valueOf(64)), + new ConverterTestData<>(5, "3", Integer.class, Integer.valueOf(125)), + new ConverterTestData<>(6, "3", Integer.class, Integer.valueOf(216)), }; - new ExecuteRunnable>().runTests(new RunnableTests>() { + new ExecuteRunnable>().runTests(new RunnableTests<>() { public void runTest(ConverterTestData testData) { assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager .convert(testData.sourceData, testData.syntax, testData.destClass)); diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java index 4f045c07..1285219f 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/LdapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -185,7 +185,7 @@ public final class LdapTests { LdapTestUtils.cleanAndSetup(this.contextSource, baseName, new ClassPathResource("testdata.ldif")); // Create our OdmManager - Set> managedClasses = new HashSet>(); + Set> managedClasses = new HashSet<>(); managedClasses.add(Person.class); managedClasses.add(PlainPerson.class); managedClasses.add(OrganizationalUnit.class); @@ -243,7 +243,7 @@ public final class LdapTests { // Read various entries from the sample data set and check they are what we'd expect. @Test public void read() throws Exception { - new ExecuteRunnable().runTests(new RunnableTests() { + new ExecuteRunnable().runTests(new RunnableTests<>() { public void runTest(Person testData) { Name dn = testData.getDn(); LOG.debug(String.format("reading - %1$s", dn)); @@ -269,14 +269,14 @@ public final class LdapTests { // we'd expect. @Test public void search() throws Exception { - new ExecuteRunnable().runTests(new RunnableTests() { + new ExecuteRunnable().runTests(new RunnableTests<>() { public void runTest(SearchTestData testData) { String search = testData.search; LOG.debug(String.format("searching - %1$s", search)); List results = LdapTests.this.odmManager.search(Person.class, baseName, testData.search, testData.searchScope); LOG.debug(String.format("found - %1$s", results)); - assertThat(new HashSet(Arrays.asList(testData.people))).isEqualTo(new HashSet(results)); + assertThat(new HashSet<>(Arrays.asList(testData.people))).isEqualTo(new HashSet<>(results)); } }, this.searchTestData); } @@ -311,8 +311,7 @@ public final class LdapTests { List allOus = this.odmManager.findAll(OrganizationalUnit.class, baseName, this.searchControls); LOG.debug(String.format("Found - %1$s", allOus)); - assertThat(new HashSet(Arrays.asList(ouTestData))) - .isEqualTo(new HashSet(allOus)); + assertThat(new HashSet<>(Arrays.asList(ouTestData))).isEqualTo(new HashSet<>(allOus)); OrganizationalUnit testOu = ouTestData[OrganizationalName.ASSISTANTS.getIndex()]; LOG.debug(String.format("Reading - %1$s", testOu.getDn())); @@ -328,7 +327,7 @@ public final class LdapTests { LOG.debug("finding all people"); List allPeople = this.odmManager.findAll(Person.class, baseName, this.searchControls); LOG.debug(String.format("found %1$s", allPeople)); - assertThat(new HashSet(Arrays.asList(this.personTestData))).isEqualTo(new HashSet(allPeople)); + assertThat(new HashSet<>(Arrays.asList(this.personTestData))).isEqualTo(new HashSet<>(allPeople)); } @Test @@ -394,7 +393,7 @@ public final class LdapTests { this.odmManager.create(person); } LOG.debug("Created all, reading back"); - new ExecuteRunnable().runTests(new RunnableTests() { + new ExecuteRunnable().runTests(new RunnableTests<>() { public void runTest(Person testData) { Name dn = testData.getDn(); LOG.debug(String.format("reading - %1$s", dn)); @@ -434,7 +433,7 @@ public final class LdapTests { } List allPeople = this.odmManager.findAll(Person.class, baseName, this.searchControls); - assertThat(new HashSet(Arrays.asList(this.whatsLeft))).isEqualTo(new HashSet(allPeople)); + assertThat(new HashSet<>(Arrays.asList(this.whatsLeft))).isEqualTo(new HashSet<>(allPeople)); } // Trying to read a non-existant entry should be flagged as an error diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/OrganizationalUnit.java b/odm/src/test/java/org/springframework/ldap/odm/test/OrganizationalUnit.java index 183a5a6e..6101ede4 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/OrganizationalUnit.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/OrganizationalUnit.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -38,7 +38,7 @@ public final class OrganizationalUnit { private Name dn; @Attribute(name = "objectClass", syntax = "1.3.6.1.4.1.1466.115.121.1.38") - private List objectClass = new ArrayList(); + private List objectClass = new ArrayList<>(); @Attribute(name = "ou", syntax = "1.3.6.1.4.1.1466.115.121.1.15") private String ou; @@ -132,7 +132,7 @@ public final class OrganizationalUnit { } } else if (this.objectClass.size() != other.objectClass.size() - || !(new HashSet(this.objectClass)).equals(new HashSet(other.objectClass))) { + || !(new HashSet<>(this.objectClass)).equals(new HashSet<>(other.objectClass))) { return false; } if (this.ou == null) { @@ -160,7 +160,7 @@ public final class OrganizationalUnit { int result = 1; result = prime * result + ((this.description == null) ? 0 : this.description.hashCode()); result = prime * result + ((this.dn == null) ? 0 : this.dn.hashCode()); - result = prime * result + ((this.objectClass == null) ? 0 : new HashSet(this.objectClass).hashCode()); + result = prime * result + ((this.objectClass == null) ? 0 : new HashSet<>(this.objectClass).hashCode()); result = prime * result + ((this.ou == null) ? 0 : this.ou.hashCode()); result = prime * result + ((this.street == null) ? 0 : this.street.hashCode()); return result; diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/Person.java b/odm/src/test/java/org/springframework/ldap/odm/test/Person.java index 31306478..aec1981a 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/Person.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -42,7 +42,7 @@ public final class Person { this.desc = desc; this.telephoneNumber = telephoneNumber; this.jpegPhoto = jpegPhoto; - this.objectClasses = new ArrayList(); + this.objectClasses = new ArrayList<>(); this.objectClasses.add("inetOrgPerson"); this.objectClasses.add("organizationalPerson"); this.objectClasses.add("person"); @@ -60,7 +60,7 @@ public final class Person { private String someRandomField = null; @Transient - private List someRandomList = new ArrayList(); + private List someRandomList = new ArrayList<>(); @Attribute(name = "objectClass") private List objectClasses; @@ -163,7 +163,7 @@ public final class Person { } } else if (this.desc.size() != other.desc.size() - || !(new HashSet(this.desc)).equals(new HashSet(other.desc))) { + || !(new HashSet<>(this.desc)).equals(new HashSet<>(other.desc))) { return false; } if (this.dn == null) { @@ -183,7 +183,7 @@ public final class Person { } } else if (this.objectClasses.size() != other.objectClasses.size() - || !(new HashSet(this.objectClasses)).equals(new HashSet(other.objectClasses))) { + || !(new HashSet<>(this.objectClasses)).equals(new HashSet<>(other.objectClasses))) { return false; } if (this.someRandomField == null) { @@ -221,11 +221,10 @@ public final class Person { final int prime = 31; int result = 1; result = prime * result + ((this.cn == null) ? 0 : this.cn.hashCode()); - result = prime * result + ((this.desc == null) ? 0 : new HashSet(this.desc).hashCode()); + result = prime * result + ((this.desc == null) ? 0 : new HashSet<>(this.desc).hashCode()); result = prime * result + ((this.dn == null) ? 0 : this.dn.hashCode()); result = prime * result + Arrays.hashCode(this.jpegPhoto); - result = prime * result - + ((this.objectClasses == null) ? 0 : new HashSet(this.objectClasses).hashCode()); + result = prime * result + ((this.objectClasses == null) ? 0 : new HashSet<>(this.objectClasses).hashCode()); result = prime * result + ((this.someRandomField == null) ? 0 : this.someRandomField.hashCode()); result = prime * result + ((this.someRandomList == null) ? 0 : this.someRandomList.hashCode()); result = prime * result + ((this.surname == null) ? 0 : this.surname.hashCode()); diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/PlainPerson.java b/odm/src/test/java/org/springframework/ldap/odm/test/PlainPerson.java index 89249c69..fe6e51ec 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/PlainPerson.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/PlainPerson.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -35,7 +35,7 @@ public final class PlainPerson { public PlainPerson(Name dn, String commonName, String surname) { this.dn = dn; this.surname = surname; - this.objectClasses = new ArrayList(); + this.objectClasses = new ArrayList<>(); this.objectClasses.add("top"); this.objectClasses.add("person"); this.cn = commonName; diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaViewerTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaViewerTests.java index 6fd282ca..d1b4bb1d 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaViewerTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaViewerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -83,7 +83,7 @@ public final class SchemaViewerTests { try { System.setErr(new PrintStream(output)); - List commandFlags = new ArrayList(Arrays.asList(commonFlags)); + List commandFlags = new ArrayList<>(Arrays.asList(commonFlags)); commandFlags.addAll(Arrays.asList(flags)); SchemaViewer.main(commandFlags.toArray(new String[0])); @@ -114,7 +114,7 @@ public final class SchemaViewerTests { // ensure we get representative test coverage @Test public void testSchemaViewer() throws Exception { - new ExecuteRunnable().runTests(new RunnableTests() { + new ExecuteRunnable().runTests(new RunnableTests<>() { public void runTest(TestData testData) { String result = runSchemaViewer(testData.flag, testData.value); assertThat(testData.result).isEqualTo(result); diff --git a/test-support/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java b/test-support/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java index f322c879..cdaa9d5f 100644 --- a/test-support/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java +++ b/test-support/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java @@ -131,7 +131,7 @@ public class ArrayMarshaller implements Marshaller> { if ((data.length == 1) && (data[0] == 0)) { E[] array = (E[]) new Object[] {}; - ArrayTree tree = new ArrayTree(this.comparator, array); + ArrayTree tree = new ArrayTree<>(this.comparator, array); return tree; } @@ -160,7 +160,7 @@ public class ArrayMarshaller implements Marshaller> { } } - ArrayTree arrayTree = new ArrayTree(this.comparator, nodes); + ArrayTree arrayTree = new ArrayTree<>(this.comparator, nodes); return arrayTree; } diff --git a/test-support/src/test/java/org/springframework/ldap/test/EmbeddedLdapServerFactoryBeanTests.java b/test-support/src/test/java/org/springframework/ldap/test/EmbeddedLdapServerFactoryBeanTests.java index b83469c4..d4ecd24b 100644 --- a/test-support/src/test/java/org/springframework/ldap/test/EmbeddedLdapServerFactoryBeanTests.java +++ b/test-support/src/test/java/org/springframework/ldap/test/EmbeddedLdapServerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2025 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. @@ -39,7 +39,7 @@ public class EmbeddedLdapServerFactoryBeanTests { assertThat(ldapTemplate).isNotNull(); List list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"), - new AttributesMapper() { + new AttributesMapper<>() { public String mapFromAttributes(Attributes attrs) throws NamingException { return (String) attrs.get("cn").get(); } diff --git a/test-support/src/test/java/org/springframework/ldap/test/unboundid/EmbeddedLdapServerFactoryBeanTests.java b/test-support/src/test/java/org/springframework/ldap/test/unboundid/EmbeddedLdapServerFactoryBeanTests.java index d938fac5..a05c8213 100644 --- a/test-support/src/test/java/org/springframework/ldap/test/unboundid/EmbeddedLdapServerFactoryBeanTests.java +++ b/test-support/src/test/java/org/springframework/ldap/test/unboundid/EmbeddedLdapServerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -49,7 +49,7 @@ public class EmbeddedLdapServerFactoryBeanTests { assertThat(ldapTemplate).isNotNull(); List list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"), - new AttributesMapper() { + new AttributesMapper<>() { public String mapFromAttributes(Attributes attrs) throws NamingException { return (String) attrs.get("cn").get(); } diff --git a/test-support/src/test/java/org/springframework/ldap/test/unboundid/TestContextSourceFactoryBeanTests.java b/test-support/src/test/java/org/springframework/ldap/test/unboundid/TestContextSourceFactoryBeanTests.java index cc643360..50509457 100644 --- a/test-support/src/test/java/org/springframework/ldap/test/unboundid/TestContextSourceFactoryBeanTests.java +++ b/test-support/src/test/java/org/springframework/ldap/test/unboundid/TestContextSourceFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -49,7 +49,7 @@ public class TestContextSourceFactoryBeanTests { assertThat(ldapTemplate).isNotNull(); List list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"), - new AttributesMapper() { + new AttributesMapper<>() { public String mapFromAttributes(Attributes attrs) throws NamingException { return (String) attrs.get("cn").get(); } diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java index 3132e09b..a95f4dd1 100644 --- a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/IncrementalAttributeMapperITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -203,7 +203,7 @@ public class IncrementalAttributeMapperITests extends AbstractJUnit4SpringContex TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); try { - transactionTemplate.execute(new TransactionCallback() { + transactionTemplate.execute(new TransactionCallback<>() { @Override public Object doInTransaction(TransactionStatus status) { ModificationItem modificationItem = new ModificationItem(DirContext.ADD_ATTRIBUTE, diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java index 4b4e32d6..799d33ee 100644 --- a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -100,7 +100,7 @@ public final class SchemaToJavaAdITests { this.contextSource.setPassword(PASSWORD); this.contextSource.setPooled(false); this.contextSource.setBase("dc=261consulting,dc=local"); - HashMap baseEnvironment = new HashMap() { + HashMap baseEnvironment = new HashMap<>() { { put("java.naming.ldap.attributes.binary", "thumbnailLogo replPropertyMetaData partialAttributeSet registeredAddress userPassword telexNumber partialAttributeDeletionList mS-DS-ConsistencyGuid attributeCertificateAttribute thumbnailPhoto teletexTerminalIdentifier replUpToDateVector dSASignature objectGUID"); diff --git a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/itest/control/PagedSearchITests.java b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/itest/control/PagedSearchITests.java index da34bfaf..a43afded 100644 --- a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/itest/control/PagedSearchITests.java +++ b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/itest/control/PagedSearchITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -51,7 +51,7 @@ public class PagedSearchITests extends AbstractJUnit4SpringContextTests { @Autowired private ContextSource contextSource; - private static final AttributesMapper CN_ATTRIBUTES_MAPPER = new AttributesMapper() { + private static final AttributesMapper CN_ATTRIBUTES_MAPPER = new AttributesMapper<>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get().toString(); @@ -77,7 +77,7 @@ public class PagedSearchITests extends AbstractJUnit4SpringContextTests { // There should be three pages of three entries, and one final page with one entry final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(3); - SingleContextSource.doWithSingleContext(this.contextSource, new LdapOperationsCallback() { + SingleContextSource.doWithSingleContext(this.contextSource, new LdapOperationsCallback<>() { @Override public Object doWithLdapOperations(LdapOperations operations) { List result = operations.search("ou=People", "(&(objectclass=person))", searchControls, diff --git a/test/integration-tests/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java b/test/integration-tests/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java index f322c879..cdaa9d5f 100644 --- a/test/integration-tests/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java +++ b/test/integration-tests/src/test/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java @@ -131,7 +131,7 @@ public class ArrayMarshaller implements Marshaller> { if ((data.length == 1) && (data[0] == 0)) { E[] array = (E[]) new Object[] {}; - ArrayTree tree = new ArrayTree(this.comparator, array); + ArrayTree tree = new ArrayTree<>(this.comparator, array); return tree; } @@ -160,7 +160,7 @@ public class ArrayMarshaller implements Marshaller> { } } - ArrayTree arrayTree = new ArrayTree(this.comparator, nodes); + ArrayTree arrayTree = new ArrayTree<>(this.comparator, nodes); return arrayTree; } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java index 523246fb..1afb7617 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateListITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -102,7 +102,7 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests } private void verifyBindings(List list) { - LinkedList transformed = new LinkedList(); + LinkedList transformed = new LinkedList<>(); for (String s : list) { transformed.add(LdapUtils.newLdapName(s)); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java index 61cd253f..12505deb 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2022 the original author or authors. + * Copyright 2005-2025 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. @@ -554,13 +554,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat @Test public void verifyThatSearchWithCountLimitReturnsTheEntriesFoundSoFar() { - List result = this.tested.search( - LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"), new ContextMapper() { - @Override - public Object mapFromContext(Object ctx) throws NamingException { - return new Object(); - } - }); + List result = this.tested + .search(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"), new ContextMapper<>() { + @Override + public Object mapFromContext(Object ctx) throws NamingException { + return new Object(); + } + }); assertThat(result).hasSize(3); } @@ -569,7 +569,7 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat public void verifyThatSearchWithCountLimitWithFlagToFalseThrowsException() { this.tested.setIgnoreSizeLimitExceededException(false); this.tested.search(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"), - new ContextMapper() { + new ContextMapper<>() { @Override public Object mapFromContext(Object ctx) throws NamingException { return new Object(); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java index 080a946b..9edaaa3d 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/control/SupportedControlsITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -72,7 +72,7 @@ public class SupportedControlsITests extends AbstractLdapTemplateIntegrationTest String[] controls = (String[]) this.tested.lookup("", new String[] { SUPPORTED_CONTROL }, mapper); System.out.println(Arrays.toString(controls)); - HashSet controlsSet = new HashSet(Arrays.asList(controls)); + HashSet controlsSet = new HashSet<>(Arrays.asList(controls)); assertThat(controlsSet.contains("1.3.6.1.4.1.4203.1.10.1")).as("Entry Change Notification LDAPv3 control,") .isTrue(); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java index aa4a3c06..9d3f3ea4 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/core/simple/SimpleLdapTemplateITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 the original author or authors. + * Copyright 2005-2025 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. @@ -129,7 +129,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes this.ldapTemplate.modifyAttributes(ctx); // verify that the data was properly updated. - this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { + this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<>() { public Object mapFromContext(Object ctx) { DirContextAdapter adapter = (DirContextAdapter) ctx; assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description"); @@ -150,7 +150,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes this.ldapTemplate.modifyAttributes(ctx); // verify that the data was properly updated. - this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper() { + this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<>() { public Object mapFromContext(Object ctx) { DirContextAdapter adapter = (DirContextAdapter) ctx; assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description"); diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/RoleRepo.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/RoleRepo.java index 89cdb12a..c1e22a50 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/RoleRepo.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/ldap321/RoleRepo.java @@ -28,7 +28,7 @@ public class RoleRepo { @Transactional public Map queryRoleMap() { - return new HashMap(); + return new HashMap<>(); } } diff --git a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java index 90ae257c..4e671814 100644 --- a/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java +++ b/test/integration-tests/src/test/java/org/springframework/ldap/itest/odm/LdapTemplateOdmGroupManipulationITests.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 the original author or authors. + * Copyright 2005-2025 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. @@ -130,7 +130,7 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate public void testSetMembersSyntacticallyEqual() { Group group = this.tested.findOne(LdapQueryBuilder.query().where("cn").is("ROLE_USER"), Group.class); - group.setMembers(new HashSet() { + group.setMembers(new HashSet<>() { { add(LdapUtils.newLdapName("CN=Some Person,OU=company1, ou=Sweden, " + base)); add(LdapUtils.newLdapName("CN=Some Person2, OU=company1,ou=Sweden," + base));