Skip to content

Commit 57d4c64

Browse files
MBoegerstimtebeek
andauthored
Security Manager API Removal (#713)
* Add Java 25 migration recipe and removal of SecurityManager * Apply suggestions from code review * Apply suggestions from code review * Update java-version-25.yml year * split security manager API removals into separate recipes to guard with precondition * Remove intermediate recipe * tighten preconditions --------- Co-authored-by: Tim te Beek <[email protected]>
1 parent ec6ba92 commit 57d4c64

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#
2+
# Copyright 2025 the original author or authors.
3+
# <p>
4+
# Licensed under the Moderne Source Available License (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# <p>
8+
# https://docs.moderne.io/licensing/moderne-source-available-license
9+
# <p>
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
---
18+
type: specs.openrewrite.org/v1beta/recipe
19+
name: org.openrewrite.java.migrate.UpgradeToJava25
20+
displayName: Migrate to Java 25
21+
description: >-
22+
This recipe will apply changes commonly needed when migrating to Java 25. This recipe will also replace deprecated API
23+
with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 25 as the
24+
target/source and plugins will be also be upgraded to versions that are compatible with Java 25.
25+
tags:
26+
- java25
27+
recipeList:
28+
- org.openrewrite.java.migrate.RemoveSecurityPolicy
29+
- org.openrewrite.java.migrate.RemoveSecurityAccessController
30+
- org.openrewrite.java.migrate.RemoveSecurityManager
31+
32+
---
33+
type: specs.openrewrite.org/v1beta/recipe
34+
name: org.openrewrite.java.migrate.AccessController
35+
displayName: Remove Security AccessController
36+
description: The Security Manager API is unsupported in Java 24. This recipe will remove the usage of `java.security.AccessController`.
37+
tags:
38+
- java25
39+
- security
40+
- deprecation
41+
preconditions:
42+
- org.openrewrite.java.migrate.search.FindJavaVersion:
43+
version: 24
44+
- org.openrewrite.java.search.FindMethods:
45+
methodPattern: java.security.AccessController#checkPermission(..)
46+
recipeList:
47+
- org.openrewrite.java.RemoveMethodInvocations:
48+
methodPattern: java.security.AccessController#checkPermission(..)
49+
- org.openrewrite.staticanalysis.UnnecessaryCatch
50+
- org.openrewrite.staticanalysis.UnnecessaryThrows
51+
52+
---
53+
type: specs.openrewrite.org/v1beta/recipe
54+
name: org.openrewrite.java.migrate.RemoveSecurityPolicy
55+
displayName: Remove Security Policy
56+
description: The Security Manager API is unsupported in Java 24. This recipe will remove the use of `java.security.Policy`.
57+
tags:
58+
- java25
59+
- security
60+
- deprecation
61+
preconditions:
62+
- org.openrewrite.java.migrate.search.FindJavaVersion:
63+
version: 24
64+
- org.openrewrite.java.search.FindMethods:
65+
methodPattern: java.security.Policy#setPolicy(..)
66+
recipeList:
67+
- org.openrewrite.java.RemoveMethodInvocations:
68+
methodPattern: java.security.Policy#setPolicy(..)
69+
- org.openrewrite.staticanalysis.UnnecessaryCatch
70+
- org.openrewrite.staticanalysis.UnnecessaryThrows
71+
72+
---
73+
type: specs.openrewrite.org/v1beta/recipe
74+
name: org.openrewrite.java.migrate.RemoveSecurityManager
75+
displayName: Remove Security SecurityManager
76+
description: The Security Manager API is unsupported in Java 24. This recipe will remove the usage of `java.security.SecurityManager`.
77+
tags:
78+
- java25
79+
- security
80+
- deprecation
81+
preconditions:
82+
- org.openrewrite.java.migrate.search.FindJavaVersion:
83+
version: 24
84+
- org.openrewrite.java.search.FindMethods:
85+
methodPattern: java.lang.SecurityManager#check*(..)
86+
recipeList:
87+
- org.openrewrite.java.RemoveMethodInvocations:
88+
methodPattern: java.lang.SecurityManager#check*(..)
89+
- org.openrewrite.staticanalysis.UnnecessaryCatch
90+
- org.openrewrite.staticanalysis.UnnecessaryThrows

0 commit comments

Comments
 (0)