Skip to content

Commit

Permalink
feat: 添加去除 final 修饰符的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
h3h3qaq committed Sep 30, 2024
1 parent e48abe8 commit b1627ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/resources/plugin_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
"mavenDependencies": [
]
},
{
"name": "Set Final Static",
"code": "public static void setFinalStatic(Field field) throws NoSuchFieldException, IllegalAccessException {\n field.setAccessible(true);\n Field modifiersField = Field.class.getDeclaredField(\"modifiers\");\n modifiersField.setAccessible(true);\n modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);\n}",
"imports": [
"java.lang.reflect.Field",
"java.lang.reflect.Modifier"
],
"mavenDependencies": [
]
},
{
"name": "Get First Constructor Method",
"code": " public static Constructor<?> getFirstCtor(String name) throws Exception {\n Constructor<?> ctor = Class.forName(name).getDeclaredConstructors()[0];\n ctor.setAccessible(true);\n return ctor;\n }",
Expand Down

0 comments on commit b1627ab

Please sign in to comment.