diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicResourceLoader.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicResourceLoader.java index dc443527e4ab887bc834687b5440f823bab95e5f..f37c9bba5a7901355ca5fd1c8788fc7df60656f8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicResourceLoader.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicResourceLoader.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.exception.ResourceNotFoundException; @@ -24,24 +12,36 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.stream.Collectors; -/** 资源加载器 */ +/** + * 资源加载器 + */ public class MagicResourceLoader { - /** 保存自动导入的包路径 */ + /** + * 保存自动导入的包路径 + */ private static final Set PACKAGES = new HashSet<>(); - /** 函数加载器 */ + /** + * 函数加载器 + */ private static final List> FUNCTION_LOADERS = new ArrayList<>(); - /** JSR223 脚本函数加载器 */ + /** + * JSR223 脚本函数加载器 + */ private static final List, String, Object>>> SCRIPT_LANGUAGE_LOADERS = new ArrayList<>(); - /** 保存已注册的模块 */ + /** + * 保存已注册的模块 + */ private static final Map MODULES = new ConcurrentHashMap<>(); - /** 默认的类加载器 */ + /** + * 默认的类加载器 + */ private static Function classLoader = (className) -> { try { @@ -57,7 +57,9 @@ public class MagicResourceLoader { addPackage("java.lang.*"); } - /** 获取已注册的模块信息,此方法主要用于代码提示 */ + /** + * 获取已注册的模块信息,此方法主要用于代码提示 + */ public static Map getModules() { return MODULES.entrySet().stream() .collect( @@ -80,13 +82,17 @@ public class MagicResourceLoader { })); } - /** 添加函数加载器 */ + /** + * 添加函数加载器 + */ public static void addFunctionLoader( BiFunction functionLoader) { FUNCTION_LOADERS.add(functionLoader); } - /** 设置类加载器 */ + /** + * 设置类加载器 + */ public static void setClassLoader(Function classLoader) { MagicResourceLoader.classLoader = classLoader; } @@ -95,7 +101,7 @@ public class MagicResourceLoader { * 添加模块 * * @param moduleName 模块名称 - * @param target 模块,可以是对象实例,也可以是Class类型的,此时只能使用类中的静态方法 + * @param target 模块,可以是对象实例,也可以是Class类型的,此时只能使用类中的静态方法 */ public static void addModule(String moduleName, Object target) { MODULES.put(moduleName, target); @@ -132,7 +138,9 @@ public class MagicResourceLoader { return classLoader.apply(className); } - /** 获取可用的模块列表 */ + /** + * 获取可用的模块列表 + */ public static Set getModuleNames() { return MODULES.keySet(); } @@ -161,7 +169,9 @@ public class MagicResourceLoader { return null; } - /** 添加JSR223 脚本函数加载器 */ + /** + * 添加JSR223 脚本函数加载器 + */ public static void addScriptLanguageLoader( Function, String, Object>> loader) { SCRIPT_LANGUAGE_LOADERS.add(loader); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScript.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScript.java index 996910d55dabfbe5a5039ba19cc859397e8e7d5e..6c792edcb8603a6fa704422673345b3f3b5910d8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScript.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScript.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.compile.CompileCache; @@ -45,18 +33,26 @@ public class MagicScript extends CompiledScript { public static final String DEBUG_MARK = "!# DEBUG\r\n"; - /** 所有语句 */ + /** + * 所有语句 + */ private final List nodes; private final ScriptEngine scriptEngine; - /** 存放所有变量定义 */ + /** + * 存放所有变量定义 + */ private final Set varIndices; - /** 编译后的类 */ + /** + * 编译后的类 + */ private MagicScriptVariableAccessRuntime accessRuntime; - /** 构造函数 */ + /** + * 构造函数 + */ private Constructor constructor; private final boolean debug; @@ -79,12 +75,16 @@ public class MagicScript extends CompiledScript { compileCache = new CompileCache(capacity); } - /** 创建MagicScript */ + /** + * 创建MagicScript + */ public static MagicScript create(String source, ScriptEngine scriptEngine) { return create(false, source, scriptEngine); } - /** 创建MagicScript */ + /** + * 创建MagicScript + */ public static MagicScript create(boolean expression, String source, ScriptEngine scriptEngine) { if (compileCache == null) { compileCache = new CompileCache(500); @@ -125,7 +125,9 @@ public class MagicScript extends CompiledScript { return null; } - /** 编译 */ + /** + * 编译 + */ public MagicScriptRuntime compile() throws MagicScriptCompileException { if (this.accessRuntime != null) { return this.accessRuntime; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptContext.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptContext.java index e809eca191daff34e9f00e5cce67851d76d243e0..cf78048b8e127bb74e91ffcf69ec9c62c678b6b3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptContext.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptContext.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.exception.MagicScriptException; @@ -22,13 +10,19 @@ import java.util.List; import java.util.Map; import java.util.Objects; -/** 脚本环境上下文 编译后的类每个方法的第一个参数都是本类。 此类主要用于辅助读写变量以及设置/读取/ */ +/** + * 脚本环境上下文 编译后的类每个方法的第一个参数都是本类。 此类主要用于辅助读写变量以及设置/读取/ + */ public class MagicScriptContext { - /** 保存手动设置的环境变量 */ + /** + * 保存手动设置的环境变量 + */ private final Map rootVariables = new LinkedHashMap<>(); - /** 代码执行时,存放 import "xx.xx.xx.*" 的包 */ + /** + * 代码执行时,存放 import "xx.xx.xx.*" 的包 + */ private final List importPackages = new ArrayList<>(); private MagicScriptRuntime runtime; @@ -37,7 +31,8 @@ public class MagicScriptContext { private String scriptName; - public MagicScriptContext() {} + public MagicScriptContext() { + } public MagicScriptContext(Map variables) { putMapIntoContext(variables); @@ -93,7 +88,7 @@ public class MagicScriptContext { /** * 设置环境变量 * - * @param name 变量名 + * @param name 变量名 * @param value 变量值 */ public MagicScriptContext set(String name, Object value) { @@ -105,7 +100,7 @@ public class MagicScriptContext { * 创建变量 * * @param runtime 脚本实例 - * @param size 数组大小(变量个数) + * @param size 数组大小(变量个数) */ public Variables createVariables(MagicScriptRuntime runtime, int size) { this.runtime = runtime; @@ -120,7 +115,7 @@ public class MagicScriptContext { * 从当前上下文中动态执行脚本 * * @param runtimeContext - * @param script 脚本内容 + * @param script 脚本内容 */ public Object eval(RuntimeContext runtimeContext, String script) { Map varMap = @@ -155,12 +150,16 @@ public class MagicScriptContext { return runtime.getVarNames(); } - /** 获取调用时传入的变量信息 */ + /** + * 获取调用时传入的变量信息 + */ public Map getRootVariables() { return rootVariables; } - /** 批量设置环境变量 */ + /** + * 批量设置环境变量 + */ public void putMapIntoContext(Map map) { if (map != null && !map.isEmpty()) { rootVariables.putAll(map); @@ -179,5 +178,6 @@ public class MagicScriptContext { } public void pause(int startRow, int startCol, int endRow, int endCol, Variables variables) - throws InterruptedException {} + throws InterruptedException { + } } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptDebugContext.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptDebugContext.java index a4255f9d0d39fb3793f821e424678e10b85b8e06..2cf0ee591e767bb2c549e02e26ee9ed7ee75eb03 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptDebugContext.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptDebugContext.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.runtime.Variables; @@ -61,7 +49,7 @@ public class MagicScriptDebugContext extends MagicScriptContext { int startRow, int startCol, int endRow, int endCol, Variables variables) throws InterruptedException { if (stepInto || breakpoints.contains(startRow)) { - this.line = new int[] {startRow, startCol, endRow, endCol}; + this.line = new int[]{startRow, startCol, endRow, endCol}; consumer.offer(this.id); Map varMap = new LinkedHashMap<>(getRootVariables()); varMap.putAll(variables.getVariables(this)); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngine.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngine.java index 762675f921cb6fb64617c46a2dc8fedc764e2086..5a20321aa6a67e19d189f5cf2417e3e8796da068 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngine.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngine.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.ScriptClass.ScriptAttribute; @@ -157,7 +145,7 @@ public class MagicScriptEngine extends AbstractScriptEngine implements ScriptEng String methodName = method.getName(); if (method.getParameters().isEmpty() && ((methodName.startsWith("get") && methodName.length() > 3) - || (methodName.startsWith("is") && methodName.length() > 2))) { + || (methodName.startsWith("is") && methodName.length() > 2))) { String attributeName = method.getName().substring(3); attributeName = attributeName.substring(0, 1).toLowerCase() + attributeName.substring(1); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngineFactory.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngineFactory.java index c77039ca07bb3e0124a4db1ce2e67e40bcbc3f98..7890a3782da4fc35666c3803bba10fa984b8e124 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngineFactory.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptEngineFactory.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import java.util.Arrays; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptError.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptError.java index b5db8006c4c6300b15e210f49a63d1c1da9c9085..2343ebdec515cbe7a3aada64b8ea88225ebaec6e 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptError.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/MagicScriptError.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.exception.MagicExitException; @@ -20,7 +8,9 @@ import cn.universal.core.engine.runtime.MagicScriptRuntime; import java.util.ArrayList; import java.util.List; -/** All errors reported by the library go through the static functions of this class. */ +/** + * All errors reported by the library go through the static functions of this class. + */ public class MagicScriptError { /** diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/ScriptClass.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/ScriptClass.java index d46e5a1034cd3c8e47a5c2ff9b924118c91cc3b2..cf47639275b17663a495bdc48d536fcbbcc91169 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/ScriptClass.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/ScriptClass.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Comment.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Comment.java index 37932b7e387b4bd4a9ab2db63752d6718a294add..61258c130aca03e6c646d5437004c62820421ec9 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Comment.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Comment.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.annotation; import java.lang.annotation.Documented; @@ -18,7 +6,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** 方法、字段、参数注释 */ +/** + * 方法、字段、参数注释 + */ @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented @@ -28,6 +18,8 @@ public @interface Comment { String name() default ""; - /** 是否返回原类型 */ + /** + * 是否返回原类型 + */ boolean origin() default false; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Function.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Function.java index ea30ec8a122e2eaabdd61b427daff2fb8da34936..2a1dd02235c50fd4d7bf11cd37b4365d8e37b593 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Function.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/annotation/Function.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.annotation; import java.lang.annotation.Documented; @@ -18,8 +6,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -/** 标识是个函数 */ +/** + * 标识是个函数 + */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented -public @interface Function {} +public @interface Function { + +} diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationVisitor.java index dc221a91b4c2985324bc0ba6653b7269373c96b7..a0075d2e272100c7a49c236774e13b0c7a7af2df 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationVisitor.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -20,22 +8,23 @@ package cn.universal.core.engine.asm; public abstract class AnnotationVisitor { /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ protected final int api; /** - * The annotation visitor to which this visitor must delegate method calls. May be {@literal - * null}. + * The annotation visitor to which this visitor must delegate method calls. May be + * {@literal null}. */ protected AnnotationVisitor av; /** * Constructs a new {@link AnnotationVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. */ public AnnotationVisitor(final int api) { this(api, null); @@ -44,10 +33,11 @@ public abstract class AnnotationVisitor { /** * Constructs a new {@link AnnotationVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. * @param annotationVisitor the annotation visitor to which this visitor must delegate method - * calls. May be {@literal null}. + * calls. May be {@literal null}. */ public AnnotationVisitor(final int api, final AnnotationVisitor annotationVisitor) { if (api != Opcodes.ASM9 @@ -69,13 +59,14 @@ public abstract class AnnotationVisitor { /** * Visits a primitive value of the annotation. * - * @param name the value name. - * @param value the actual value, whose type must be {@link Byte}, {@link Boolean}, {@link - * Character}, {@link Short}, {@link Integer} , {@link Long}, {@link Float}, {@link Double}, - * {@link String} or {@link Type} of {@link Type#OBJECT} or {@link Type#ARRAY} sort. This - * value can also be an array of byte, boolean, short, char, int, long, float or double values - * (this is equivalent to using {@link #visitArray} and visiting each array element in turn, - * but is more convenient). + * @param name the value name. + * @param value the actual value, whose type must be {@link Byte}, {@link Boolean}, + * {@link Character}, {@link Short}, {@link Integer} , {@link Long}, {@link Float}, + * {@link Double}, {@link String} or {@link Type} of {@link Type#OBJECT} or + * {@link Type#ARRAY} sort. This value can also be an array of byte, boolean, short, + * char, int, long, float or double values (this is equivalent to using + * {@link #visitArray} and visiting each array element in turn, but is more + * convenient). */ public void visit(final String name, final Object value) { if (av != null) { @@ -86,9 +77,9 @@ public abstract class AnnotationVisitor { /** * Visits an enumeration value of the annotation. * - * @param name the value name. + * @param name the value name. * @param descriptor the class descriptor of the enumeration class. - * @param value the actual enumeration value. + * @param value the actual enumeration value. */ public void visitEnum(final String name, final String descriptor, final String value) { if (av != null) { @@ -99,11 +90,11 @@ public abstract class AnnotationVisitor { /** * Visits a nested annotation value of the annotation. * - * @param name the value name. + * @param name the value name. * @param descriptor the class descriptor of the nested annotation class. * @return a visitor to visit the actual nested annotation value, or {@literal null} if this - * visitor is not interested in visiting this nested annotation. The nested annotation - * value must be fully visited before calling other methods on this annotation visitor. + * visitor is not interested in visiting this nested annotation. The nested annotation value + * must be fully visited before calling other methods on this annotation visitor. */ public AnnotationVisitor visitAnnotation(final String name, final String descriptor) { if (av != null) { @@ -114,14 +105,15 @@ public abstract class AnnotationVisitor { /** * Visits an array value of the annotation. Note that arrays of primitive values (such as byte, - * boolean, short, char, int, long, float or double) can be passed as value to {@link #visit - * visit}. This is what {@link ClassReader} does for non empty arrays of primitive values. + * boolean, short, char, int, long, float or double) can be passed as value to + * {@link #visit visit}. This is what {@link ClassReader} does for non empty arrays of primitive + * values. * * @param name the value name. * @return a visitor to visit the actual array value elements, or {@literal null} if this visitor - * is not interested in visiting these values. The 'name' parameters passed to the methods of - * this visitor are ignored. All the array values must be visited before calling other - * methods on this annotation visitor. + * is not interested in visiting these values. The 'name' parameters passed to the methods of this + * visitor are ignored. All the array values must be visited before calling other methods on + * this annotation visitor. */ public AnnotationVisitor visitArray(final String name) { if (av != null) { @@ -130,7 +122,9 @@ public abstract class AnnotationVisitor { return null; } - /** Visits the end of the annotation. */ + /** + * Visits the end of the annotation. + */ public void visitEnd() { if (av != null) { av.visitEnd(); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationWriter.java index 8d6c7f65f2fe38b46d89e9caed96421306c5f020..30303b6b85a9e74ef54071c35ddd67c3e42f8166 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/AnnotationWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -21,13 +9,15 @@ package cn.universal.core.engine.asm; * Bruneton @Author Eugene Kuleshov * * @see JVMS - * 4.7.16 + * 4.7.16 * @see JVMS - * 4.7.20 + * 4.7.20 */ final class AnnotationWriter extends AnnotationVisitor { - /** Where the constants used in this AnnotationWriter must be stored. */ + /** + * Where the constants used in this AnnotationWriter must be stored. + */ private final SymbolTable symbolTable; /** @@ -41,9 +31,9 @@ final class AnnotationWriter extends AnnotationVisitor { * The 'annotation' or 'type_annotation' JVMS structure corresponding to the annotation values * visited so far. All the fields of these structures, except the last one - the * element_value_pairs array, must be set before this ByteVector is passed to the constructor - * (num_element_value_pairs can be set to 0, it is reset to the correct value in {@link - * #visitEnd()}). The element_value_pairs array is filled incrementally in the various visit() - * methods. + * (num_element_value_pairs can be set to 0, it is reset to the correct value in + * {@link #visitEnd()}). The element_value_pairs array is filled incrementally in the various + * visit() methods. * *

Note: as an exception to the above rules, for AnnotationDefault attributes (which contain a * single element_value by definition), this ByteVector is initially empty when passed to the @@ -57,7 +47,9 @@ final class AnnotationWriter extends AnnotationVisitor { */ private final int numElementValuePairsOffset; - /** The number of element value pairs visited so far. */ + /** + * The number of element value pairs visited so far. + */ private int numElementValuePairs; /** @@ -81,15 +73,17 @@ final class AnnotationWriter extends AnnotationVisitor { /** * Constructs a new {@link AnnotationWriter}. * - * @param symbolTable where the constants used in this AnnotationWriter must be stored. - * @param useNamedValues whether values are named or not. AnnotationDefault and annotation arrays - * use unnamed values. - * @param annotation where the 'annotation' or 'type_annotation' JVMS structure corresponding to - * the visited content must be stored. This ByteVector must already contain all the fields of - * the structure except the last one (the element_value_pairs array). + * @param symbolTable where the constants used in this AnnotationWriter must be stored. + * @param useNamedValues whether values are named or not. AnnotationDefault and annotation + * arrays use unnamed values. + * @param annotation where the 'annotation' or 'type_annotation' JVMS structure + * corresponding to the visited content must be stored. This ByteVector + * must already contain all the fields of the structure except the last + * one (the element_value_pairs array). * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or - * {@literal null} in other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this + * annotation belongs, or {@literal null} in other cases (e.g. nested or + * array annotations). */ AnnotationWriter( final SymbolTable symbolTable, @@ -111,11 +105,12 @@ final class AnnotationWriter extends AnnotationVisitor { /** * Creates a new {@link AnnotationWriter} using named values. * - * @param symbolTable where the constants used in this AnnotationWriter must be stored. - * @param descriptor the class descriptor of the annotation class. + * @param symbolTable where the constants used in this AnnotationWriter must be stored. + * @param descriptor the class descriptor of the annotation class. * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or - * {@literal null} in other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this + * annotation belongs, or {@literal null} in other cases (e.g. nested or + * array annotations). * @return a new {@link AnnotationWriter} for the given annotation descriptor. */ static AnnotationWriter create( @@ -134,18 +129,19 @@ final class AnnotationWriter extends AnnotationVisitor { /** * Creates a new {@link AnnotationWriter} using named values. * - * @param symbolTable where the constants used in this AnnotationWriter must be stored. - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#CLASS_TYPE_PARAMETER}, {@link - * TypeReference#CLASS_TYPE_PARAMETER_BOUND} or {@link TypeReference#CLASS_EXTENDS}. See - * {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. - * @param descriptor the class descriptor of the annotation class. + * @param symbolTable where the constants used in this AnnotationWriter must be stored. + * @param typeRef a reference to the annotated type. The sort of this type reference + * must be {@link TypeReference#CLASS_TYPE_PARAMETER}, + * {@link TypeReference#CLASS_TYPE_PARAMETER_BOUND} or + * {@link TypeReference#CLASS_EXTENDS}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array + * element type, or static inner type within 'typeRef'. May be + * {@literal null} if the annotation targets 'typeRef' as a whole. + * @param descriptor the class descriptor of the annotation class. * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or - * {@literal null} in other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this + * annotation belongs, or {@literal null} in other cases (e.g. nested or + * array annotations). * @return a new {@link AnnotationWriter} for the given type annotation reference and descriptor. */ static AnnotationWriter create( @@ -310,8 +306,8 @@ final class AnnotationWriter extends AnnotationVisitor { * * @param attributeName one of "Runtime[In]Visible[Type]Annotations", or {@literal null}. * @return the size in bytes of a Runtime[In]Visible[Type]Annotations attribute containing this - * annotation and all its predecessors. This includes the size of the attribute_name_index and - * attribute_length fields. + * annotation and all its predecessors. This includes the size of the attribute_name_index and + * attribute_length fields. */ int computeAnnotationsSize(final String attributeName) { if (attributeName != null) { @@ -332,21 +328,25 @@ final class AnnotationWriter extends AnnotationVisitor { * annotations and all their predecessors (see {@link #previousAnnotation}. Also adds the * attribute names to the constant pool of the class (if not null). * - * @param lastRuntimeVisibleAnnotation The last runtime visible annotation of a field, method or - * class. The previous ones can be accessed with the {@link #previousAnnotation} field. May be - * {@literal null}. - * @param lastRuntimeInvisibleAnnotation The last runtime invisible annotation of this a field, - * method or class. The previous ones can be accessed with the {@link #previousAnnotation} - * field. May be {@literal null}. - * @param lastRuntimeVisibleTypeAnnotation The last runtime visible type annotation of this a - * field, method or class. The previous ones can be accessed with the {@link - * #previousAnnotation} field. May be {@literal null}. + * @param lastRuntimeVisibleAnnotation The last runtime visible annotation of a field, + * method or class. The previous ones can be accessed + * with the {@link #previousAnnotation} field. May be + * {@literal null}. + * @param lastRuntimeInvisibleAnnotation The last runtime invisible annotation of this a + * field, method or class. The previous ones can be + * accessed with the {@link #previousAnnotation} field. + * May be {@literal null}. + * @param lastRuntimeVisibleTypeAnnotation The last runtime visible type annotation of this a + * field, method or class. The previous ones can be + * accessed with the {@link #previousAnnotation} field. + * May be {@literal null}. * @param lastRuntimeInvisibleTypeAnnotation The last runtime invisible type annotation of a - * field, method or class field. The previous ones can be accessed with the {@link - * #previousAnnotation} field. May be {@literal null}. + * field, method or class field. The previous ones can + * be accessed with the {@link #previousAnnotation} + * field. May be {@literal null}. * @return the size in bytes of a Runtime[In]Visible[Type]Annotations attribute containing the - * given annotations and all their predecessors. This includes the size of the - * attribute_name_index and attribute_length fields. + * given annotations and all their predecessors. This includes the size of the + * attribute_name_index and attribute_length fields. */ static int computeAnnotationsSize( final AnnotationWriter lastRuntimeVisibleAnnotation, @@ -383,8 +383,8 @@ final class AnnotationWriter extends AnnotationVisitor { * put in the same order they have been visited. * * @param attributeNameIndex the constant pool index of the attribute name (one of - * "Runtime[In]Visible[Type]Annotations"). - * @param output where the attribute must be put. + * "Runtime[In]Visible[Type]Annotations"). + * @param output where the attribute must be put. */ void putAnnotations(final int attributeNameIndex, final ByteVector output) { int attributeLength = 2; // For num_annotations. @@ -414,20 +414,25 @@ final class AnnotationWriter extends AnnotationVisitor { * all their predecessors (see {@link #previousAnnotation} in the given ByteVector. * Annotations are put in the same order they have been visited. * - * @param symbolTable where the constants used in the AnnotationWriter instances are stored. - * @param lastRuntimeVisibleAnnotation The last runtime visible annotation of a field, method or - * class. The previous ones can be accessed with the {@link #previousAnnotation} field. May be - * {@literal null}. - * @param lastRuntimeInvisibleAnnotation The last runtime invisible annotation of this a field, - * method or class. The previous ones can be accessed with the {@link #previousAnnotation} - * field. May be {@literal null}. - * @param lastRuntimeVisibleTypeAnnotation The last runtime visible type annotation of this a - * field, method or class. The previous ones can be accessed with the {@link - * #previousAnnotation} field. May be {@literal null}. + * @param symbolTable where the constants used in the AnnotationWriter + * instances are stored. + * @param lastRuntimeVisibleAnnotation The last runtime visible annotation of a field, + * method or class. The previous ones can be accessed + * with the {@link #previousAnnotation} field. May be + * {@literal null}. + * @param lastRuntimeInvisibleAnnotation The last runtime invisible annotation of this a + * field, method or class. The previous ones can be + * accessed with the {@link #previousAnnotation} field. + * May be {@literal null}. + * @param lastRuntimeVisibleTypeAnnotation The last runtime visible type annotation of this a + * field, method or class. The previous ones can be + * accessed with the {@link #previousAnnotation} field. + * May be {@literal null}. * @param lastRuntimeInvisibleTypeAnnotation The last runtime invisible type annotation of a - * field, method or class field. The previous ones can be accessed with the {@link - * #previousAnnotation} field. May be {@literal null}. - * @param output where the attributes must be put. + * field, method or class field. The previous ones can + * be accessed with the {@link #previousAnnotation} + * field. May be {@literal null}. + * @param output where the attributes must be put. */ static void putAnnotations( final SymbolTable symbolTable, @@ -459,14 +464,14 @@ final class AnnotationWriter extends AnnotationVisitor { * annotation lists from the given AnnotationWriter sub-array. Also adds the attribute name to the * constant pool of the class. * - * @param attributeName one of "Runtime[In]VisibleParameterAnnotations". - * @param annotationWriters an array of AnnotationWriter lists (designated by their last - * element). + * @param attributeName one of "Runtime[In]VisibleParameterAnnotations". + * @param annotationWriters an array of AnnotationWriter lists (designated by their + * last element). * @param annotableParameterCount the number of elements in annotationWriters to take into account - * (elements [0..annotableParameterCount[ are taken into account). + * (elements [0..annotableParameterCount[ are taken into account). * @return the size in bytes of a Runtime[In]VisibleParameterAnnotations attribute corresponding - * to the given sub-array of AnnotationWriter lists. This includes the size of the - * attribute_name_index and attribute_length fields. + * to the given sub-array of AnnotationWriter lists. This includes the size of the + * attribute_name_index and attribute_length fields. */ static int computeParameterAnnotationsSize( final String attributeName, @@ -490,13 +495,13 @@ final class AnnotationWriter extends AnnotationVisitor { * Puts a Runtime[In]VisibleParameterAnnotations attribute containing all the annotation lists * from the given AnnotationWriter sub-array in the given ByteVector. * - * @param attributeNameIndex constant pool index of the attribute name (one of - * Runtime[In]VisibleParameterAnnotations). - * @param annotationWriters an array of AnnotationWriter lists (designated by their last - * element). + * @param attributeNameIndex constant pool index of the attribute name (one of + * Runtime[In]VisibleParameterAnnotations). + * @param annotationWriters an array of AnnotationWriter lists (designated by their + * last element). * @param annotableParameterCount the number of elements in annotationWriters to put (elements - * [0..annotableParameterCount[ are put). - * @param output where the attribute must be put. + * [0..annotableParameterCount[ are put). + * @param output where the attribute must be put. */ static void putParameterAnnotations( final int attributeNameIndex, diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Attribute.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Attribute.java index 4828c412a661375fa8c2f3062eddcfe7f28e134c..7a7cea4071474ff93ea7d480c1757e16f34b65ce 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Attribute.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Attribute.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -17,13 +5,15 @@ package cn.universal.core.engine.asm; * Specification (JVMS). @Author Eric Bruneton @Author Eugene Kuleshov * * @see JVMS - * 4.7 + * 4.7 * @see JVMS - * 4.7.3 + * 4.7.3 */ public class Attribute { - /** The type of this attribute, also called its name in the JVMS. */ + /** + * The type of this attribute, also called its name in the JVMS. + */ public final String type; /** @@ -54,7 +44,8 @@ public class Attribute { * attribute content is read as an opaque byte array, and written back as is. This can lead to * invalid attributes, if the content actually contains constant pool references, labels, or other * symbolic references that need to be updated when there are changes to the constant pool, the - * method bytecode, etc. The default implementation of this method always returns {@literal true}. + * method bytecode, etc. The default implementation of this method always returns + * {@literal true}. * * @return {@literal true} if this type of attribute is unknown. */ @@ -75,7 +66,7 @@ public class Attribute { * Returns the labels corresponding to this attribute. * * @return the labels corresponding to this attribute, or {@literal null} if this attribute is not - * a Code attribute that contains labels. + * a Code attribute that contains labels. */ protected Label[] getLabels() { return new Label[0]; @@ -86,19 +77,21 @@ public class Attribute { * of type {@link #type}, corresponding to the 'length' bytes starting at 'offset', in the given * ClassReader. * - * @param classReader the class that contains the attribute to be read. - * @param offset index of the first byte of the attribute's content in {@link ClassReader}. The 6 - * attribute header bytes (attribute_name_index and attribute_length) are not taken into - * account here. - * @param length the length of the attribute's content (excluding the 6 attribute header bytes). - * @param charBuffer the buffer to be used to call the ClassReader methods requiring a - * 'charBuffer' parameter. + * @param classReader the class that contains the attribute to be read. + * @param offset index of the first byte of the attribute's content in + * {@link ClassReader}. The 6 attribute header bytes + * (attribute_name_index and attribute_length) are not taken into + * account here. + * @param length the length of the attribute's content (excluding the 6 attribute + * header bytes). + * @param charBuffer the buffer to be used to call the ClassReader methods requiring a + * 'charBuffer' parameter. * @param codeAttributeOffset index of the first byte of content of the enclosing Code attribute - * in {@link ClassReader}, or -1 if the attribute to be read is not a Code attribute. The 6 - * attribute header bytes (attribute_name_index and attribute_length) are not taken into - * account here. - * @param labels the labels of the method's code, or {@literal null} if the attribute to be read - * is not a Code attribute. + * in {@link ClassReader}, or -1 if the attribute to be read is not a + * Code attribute. The 6 attribute header bytes (attribute_name_index + * and attribute_length) are not taken into account here. + * @param labels the labels of the method's code, or {@literal null} if the attribute + * to be read is not a Code attribute. * @return a new {@link Attribute} object corresponding to the specified bytes. */ protected Attribute read( @@ -120,17 +113,18 @@ public class Attribute { * ByteVector. * * @param classWriter the class to which this attribute must be added. This parameter can be used - * to add the items that corresponds to this attribute to the constant pool of this class. - * @param code the bytecode of the method corresponding to this Code attribute, or {@literal null} - * if this attribute is not a Code attribute. Corresponds to the 'code' field of the Code - * attribute. - * @param codeLength the length of the bytecode of the method corresponding to this code - * attribute, or 0 if this attribute is not a Code attribute. Corresponds to the 'code_length' - * field of the Code attribute. - * @param maxStack the maximum stack size of the method corresponding to this Code attribute, or - * -1 if this attribute is not a Code attribute. - * @param maxLocals the maximum number of local variables of the method corresponding to this code - * attribute, or -1 if this attribute is not a Code attribute. + * to add the items that corresponds to this attribute to the constant pool of + * this class. + * @param code the bytecode of the method corresponding to this Code attribute, or + * {@literal null} if this attribute is not a Code attribute. Corresponds to + * the 'code' field of the Code attribute. + * @param codeLength the length of the bytecode of the method corresponding to this code + * attribute, or 0 if this attribute is not a Code attribute. Corresponds to + * the 'code_length' field of the Code attribute. + * @param maxStack the maximum stack size of the method corresponding to this Code attribute, + * or -1 if this attribute is not a Code attribute. + * @param maxLocals the maximum number of local variables of the method corresponding to this + * code attribute, or -1 if this attribute is not a Code attribute. * @return the byte array form of this attribute. */ protected ByteVector write( @@ -164,7 +158,7 @@ public class Attribute { * * @param symbolTable where the constants used in the attributes must be stored. * @return the size of all the attributes in this attribute list. This size includes the size of - * the attribute headers. + * the attribute headers. */ final int computeAttributesSize(final SymbolTable symbolTable) { final byte[] code = null; @@ -180,18 +174,18 @@ public class Attribute { * attribute_length) per attribute. Also adds the attribute type names to the constant pool. * * @param symbolTable where the constants used in the attributes must be stored. - * @param code the bytecode of the method corresponding to these Code attributes, or {@literal - * null} if they are not Code attributes. Corresponds to the 'code' field of the Code - * attribute. - * @param codeLength the length of the bytecode of the method corresponding to these code - * attributes, or 0 if they are not Code attributes. Corresponds to the 'code_length' field of - * the Code attribute. - * @param maxStack the maximum stack size of the method corresponding to these Code attributes, or - * -1 if they are not Code attributes. - * @param maxLocals the maximum number of local variables of the method corresponding to these - * Code attributes, or -1 if they are not Code attribute. + * @param code the bytecode of the method corresponding to these Code attributes, or + * {@literal null} if they are not Code attributes. Corresponds to the 'code' + * field of the Code attribute. + * @param codeLength the length of the bytecode of the method corresponding to these code + * attributes, or 0 if they are not Code attributes. Corresponds to the + * 'code_length' field of the Code attribute. + * @param maxStack the maximum stack size of the method corresponding to these Code attributes, + * or -1 if they are not Code attributes. + * @param maxLocals the maximum number of local variables of the method corresponding to these + * Code attributes, or -1 if they are not Code attribute. * @return the size of all the attributes in this attribute list. This size includes the size of - * the attribute headers. + * the attribute headers. */ final int computeAttributesSize( final SymbolTable symbolTable, @@ -216,11 +210,11 @@ public class Attribute { * (attribute_name_index and attribute_length) per attribute. Also adds the attribute type names * to the constant pool. * - * @param symbolTable where the constants used in the attributes must be stored. - * @param accessFlags some field, method or class access flags. + * @param symbolTable where the constants used in the attributes must be stored. + * @param accessFlags some field, method or class access flags. * @param signatureIndex the constant pool index of a field, method of class signature. * @return the size of all the attributes in bytes. This size includes the size of the attribute - * headers. + * headers. */ static int computeAttributesSize( final SymbolTable symbolTable, final int accessFlags, final int signatureIndex) { @@ -252,7 +246,7 @@ public class Attribute { * attribute. * * @param symbolTable where the constants used in the attributes must be stored. - * @param output where the attributes must be written. + * @param output where the attributes must be written. */ final void putAttributes(final SymbolTable symbolTable, final ByteVector output) { final byte[] code = null; @@ -268,17 +262,17 @@ public class Attribute { * attribute. * * @param symbolTable where the constants used in the attributes must be stored. - * @param code the bytecode of the method corresponding to these Code attributes, or {@literal - * null} if they are not Code attributes. Corresponds to the 'code' field of the Code - * attribute. - * @param codeLength the length of the bytecode of the method corresponding to these code - * attributes, or 0 if they are not Code attributes. Corresponds to the 'code_length' field of - * the Code attribute. - * @param maxStack the maximum stack size of the method corresponding to these Code attributes, or - * -1 if they are not Code attributes. - * @param maxLocals the maximum number of local variables of the method corresponding to these - * Code attributes, or -1 if they are not Code attribute. - * @param output where the attributes must be written. + * @param code the bytecode of the method corresponding to these Code attributes, or + * {@literal null} if they are not Code attributes. Corresponds to the 'code' + * field of the Code attribute. + * @param codeLength the length of the bytecode of the method corresponding to these code + * attributes, or 0 if they are not Code attributes. Corresponds to the + * 'code_length' field of the Code attribute. + * @param maxStack the maximum stack size of the method corresponding to these Code attributes, + * or -1 if they are not Code attributes. + * @param maxLocals the maximum number of local variables of the method corresponding to these + * Code attributes, or -1 if they are not Code attribute. + * @param output where the attributes must be written. */ final void putAttributes( final SymbolTable symbolTable, @@ -304,10 +298,10 @@ public class Attribute { * signature, in the given byte vector. This includes the 6 header bytes (attribute_name_index and * attribute_length) per attribute. * - * @param symbolTable where the constants used in the attributes must be stored. - * @param accessFlags some field, method or class access flags. + * @param symbolTable where the constants used in the attributes must be stored. + * @param accessFlags some field, method or class access flags. * @param signatureIndex the constant pool index of a field, method of class signature. - * @param output where the attributes must be written. + * @param output where the attributes must be written. */ static void putAttributes( final SymbolTable symbolTable, @@ -330,7 +324,9 @@ public class Attribute { } } - /** A set of attribute prototypes (attributes with the same type are considered equal). */ + /** + * A set of attribute prototypes (attributes with the same type are considered equal). + */ static final class Set { private static final int SIZE_INCREMENT = 6; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ByteVector.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ByteVector.java index d61b4eeb5018b70b5a28ebfca8ba2911e1bd571b..72dc99f11664fa7710fdca2cffaef1f4fc7056a2 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ByteVector.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ByteVector.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -18,13 +6,19 @@ package cn.universal.core.engine.asm; */ public class ByteVector { - /** The content of this vector. Only the first {@link #length} bytes contain real data. */ + /** + * The content of this vector. Only the first {@link #length} bytes contain real data. + */ byte[] data; - /** The actual number of bytes in this vector. */ + /** + * The actual number of bytes in this vector. + */ int length; - /** Constructs a new {@link ByteVector} with a default initial capacity. */ + /** + * Constructs a new {@link ByteVector} with a default initial capacity. + */ public ByteVector() { data = new byte[64]; } @@ -105,7 +99,7 @@ public class ByteVector { * Puts a byte and a short into this byte vector. The byte vector is automatically enlarged if * necessary. * - * @param byteValue a byte. + * @param byteValue a byte. * @param shortValue a short. * @return this byte vector. */ @@ -169,7 +163,7 @@ public class ByteVector { * Puts one byte and two shorts into this byte vector. The byte vector is automatically enlarged * if necessary. * - * @param byteValue a byte. + * @param byteValue a byte. * @param shortValue1 a short. * @param shortValue2 another short. * @return this byte vector. @@ -257,11 +251,11 @@ public class ByteVector { * necessary. The string length is encoded in two bytes before the encoded characters, if there is * space for that (i.e. if this.length - offset - 2 >= 0). * - * @param stringValue the String to encode. - * @param offset the index of the first character to encode. The previous characters are supposed - * to have already been encoded, using only one byte per character. + * @param stringValue the String to encode. + * @param offset the index of the first character to encode. The previous characters are + * supposed to have already been encoded, using only one byte per character. * @param maxByteLength the maximum byte length of the encoded string, including the already - * encoded characters. + * encoded characters. * @return this byte vector. */ final ByteVector encodeUtf8(final String stringValue, final int offset, final int maxByteLength) { @@ -312,9 +306,9 @@ public class ByteVector { * necessary. * * @param byteArrayValue an array of bytes. May be {@literal null} to put {@code byteLength} null - * bytes into this byte vector. - * @param byteOffset index of the first byte of byteArrayValue that must be copied. - * @param byteLength number of bytes of byteArrayValue that must be copied. + * bytes into this byte vector. + * @param byteOffset index of the first byte of byteArrayValue that must be copied. + * @param byteLength number of bytes of byteArrayValue that must be copied. * @return this byte vector. */ public ByteVector putByteArray( diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassReader.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassReader.java index bb240c1b49da0aee977235345e205c590b34a1b8..fa39fa6eab2bfcf6cfd06a8dc45d1de39802bd2a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassReader.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassReader.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; import java.io.ByteArrayOutputStream; @@ -35,9 +23,9 @@ public class ClassReader { /** * A flag to skip the SourceFile, SourceDebugExtension, LocalVariableTable, * LocalVariableTypeTable, LineNumberTable and MethodParameters attributes. If this flag is set - * these attributes are neither parsed nor visited (i.e. {@link ClassVisitor#visitSource}, {@link - * MethodVisitor#visitLocalVariable}, {@link MethodVisitor#visitLineNumber} and {@link - * MethodVisitor#visitParameter} are not called). + * these attributes are neither parsed nor visited (i.e. {@link ClassVisitor#visitSource}, + * {@link MethodVisitor#visitLocalVariable}, {@link MethodVisitor#visitLineNumber} and + * {@link MethodVisitor#visitParameter} are not called). */ public static final int SKIP_DEBUG = 2; @@ -71,23 +59,29 @@ public class ClassReader { */ static final int EXPAND_ASM_INSNS = 256; - /** The maximum size of array to allocate. */ + /** + * The maximum size of array to allocate. + */ private static final int MAX_BUFFER_SIZE = 1024 * 1024; - /** The size of the temporary byte array used to read class input streams chunk by chunk. */ + /** + * The size of the temporary byte array used to read class input streams chunk by chunk. + */ private static final int INPUT_STREAM_DATA_CHUNK_SIZE = 4096; /** * A byte array containing the JVMS ClassFile structure to be parsed. * * @deprecated Use {@link #readByte(int)} and the other read methods instead. This field will - * eventually be deleted. + * eventually be deleted. */ @Deprecated // DontCheck(MemberName): can't be renamed (for backward binary compatibility). public final byte[] b; - /** The offset in bytes of the ClassFile's access_flags field. */ + /** + * The offset in bytes of the ClassFile's access_flags field. + */ public final int header; /** @@ -126,7 +120,7 @@ public class ClassReader { * (in the BootstrapMethods attribute). * * @see JVMS - * 4.7.23 + * 4.7.23 */ private final int[] bootstrapMethodOffsets; @@ -167,8 +161,9 @@ public class ClassReader { * Constructs a new {@link ClassReader} object. This internal constructor must not be exposed * as a public API. * - * @param classFileBuffer a byte array containing the JVMS ClassFile structure to be read. - * @param classFileOffset the offset in byteBuffer of the first byte of the ClassFile to be read. + * @param classFileBuffer a byte array containing the JVMS ClassFile structure to be read. + * @param classFileOffset the offset in byteBuffer of the first byte of the ClassFile to be + * read. * @param checkClassVersion whether to check the class version or not. */ ClassReader( @@ -262,8 +257,8 @@ public class ClassReader { * Constructs a new {@link ClassReader} object. * * @param inputStream an input stream of the JVMS ClassFile structure to be read. This input - * stream must contain nothing more than the ClassFile structure itself. It is read from its - * current position to its end. + * stream must contain nothing more than the ClassFile structure itself. It is + * read from its current position to its end. * @throws IOException if a problem occurs during reading. */ public ClassReader(final InputStream inputStream) throws IOException { @@ -274,7 +269,8 @@ public class ClassReader { * Constructs a new {@link ClassReader} object. * * @param className the fully qualified name of the class to be read. The ClassFile structure is - * retrieved with the current class loader's {@link ClassLoader#getSystemResourceAsStream}. + * retrieved with the current class loader's + * {@link ClassLoader#getSystemResourceAsStream}. * @throws IOException if an exception occurs during reading. */ public ClassReader(final String className) throws IOException { @@ -287,7 +283,7 @@ public class ClassReader { * Reads the given input stream and returns its content as a byte array. * * @param inputStream an input stream. - * @param close true to close the input stream after reading. + * @param close true to close the input stream after reading. * @return the content of the given input stream. * @throws IOException if a problem occurs during reading. */ @@ -373,7 +369,7 @@ public class ClassReader { * Returns the internal names of the implemented interfaces (see {@link Type#getInternalName()}). * * @return the internal names of the directly implemented interfaces. Inherited implemented - * interfaces are not returned. + * interfaces are not returned. * @see ClassVisitor#visit(int, int, String, String, String, String[]) */ public String[] getInterfaces() { @@ -399,9 +395,10 @@ public class ClassReader { * Makes the given visitor visit the JVMS ClassFile structure passed to the constructor of this * {@link ClassReader}. * - * @param classVisitor the visitor that must visit this class. - * @param parsingOptions the options to use to parse this class. One or more of {@link - * #SKIP_CODE}, {@link #SKIP_DEBUG}, {@link #SKIP_FRAMES} or {@link #EXPAND_FRAMES}. + * @param classVisitor the visitor that must visit this class. + * @param parsingOptions the options to use to parse this class. One or more of + * {@link #SKIP_CODE}, {@link #SKIP_DEBUG}, {@link #SKIP_FRAMES} or + * {@link #EXPAND_FRAMES}. */ public void accept(final ClassVisitor classVisitor, final int parsingOptions) { accept(classVisitor, new Attribute[0], parsingOptions); @@ -411,15 +408,17 @@ public class ClassReader { * Makes the given visitor visit the JVMS ClassFile structure passed to the constructor of this * {@link ClassReader}. * - * @param classVisitor the visitor that must visit this class. + * @param classVisitor the visitor that must visit this class. * @param attributePrototypes prototypes of the attributes that must be parsed during the visit of - * the class. Any attribute whose type is not equal to the type of one the prototypes will not - * be parsed: its byte array value will be passed unchanged to the ClassWriter. This may - * corrupt it if this value contains references to the constant pool, or has syntactic or - * semantic links with a class element that has been transformed by a class adapter between - * the reader and the writer. - * @param parsingOptions the options to use to parse this class. One or more of {@link - * #SKIP_CODE}, {@link #SKIP_DEBUG}, {@link #SKIP_FRAMES} or {@link #EXPAND_FRAMES}. + * the class. Any attribute whose type is not equal to the type of one + * the prototypes will not be parsed: its byte array value will be + * passed unchanged to the ClassWriter. This may corrupt it if this + * value contains references to the constant pool, or has syntactic or + * semantic links with a class element that has been transformed by a + * class adapter between the reader and the writer. + * @param parsingOptions the options to use to parse this class. One or more of + * {@link #SKIP_CODE}, {@link #SKIP_DEBUG}, {@link #SKIP_FRAMES} or + * {@link #EXPAND_FRAMES}. */ public void accept( final ClassVisitor classVisitor, @@ -738,14 +737,15 @@ public class ClassReader { /** * Reads the Module, ModulePackages and ModuleMainClass attributes and visit them. * - * @param classVisitor the current class visitor - * @param context information about the class being parsed. - * @param moduleOffset the offset of the Module attribute (excluding the attribute_info's - * attribute_name_index and attribute_length fields). + * @param classVisitor the current class visitor + * @param context information about the class being parsed. + * @param moduleOffset the offset of the Module attribute (excluding the attribute_info's + * attribute_name_index and attribute_length fields). * @param modulePackagesOffset the offset of the ModulePackages attribute (excluding the - * attribute_info's attribute_name_index and attribute_length fields), or 0. - * @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or {@literal - * null}. + * attribute_info's attribute_name_index and attribute_length fields), + * or 0. + * @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or + * {@literal null}. */ private void readModuleAttributes( final ClassVisitor classVisitor, @@ -865,8 +865,8 @@ public class ClassReader { /** * Reads a record component and visit it. * - * @param classVisitor the current class visitor - * @param context information about the class being parsed. + * @param classVisitor the current class visitor + * @param context information about the class being parsed. * @param recordComponentOffset the offset of the current record component. * @return the offset of the first byte following the record component. */ @@ -1039,8 +1039,8 @@ public class ClassReader { /** * Reads a JVMS field_info structure and makes the given visitor visit it. * - * @param classVisitor the visitor that must visit the field. - * @param context information about the class being parsed. + * @param classVisitor the visitor that must visit the field. + * @param context information about the class being parsed. * @param fieldInfoOffset the start offset of the field_info structure. * @return the offset of the first byte following the field_info structure. */ @@ -1223,8 +1223,8 @@ public class ClassReader { /** * Reads a JVMS method_info structure and makes the given visitor visit it. * - * @param classVisitor the visitor that must visit the method. - * @param context information about the class being parsed. + * @param classVisitor the visitor that must visit the method. + * @param context information about the class being parsed. * @param methodInfoOffset the start offset of the method_info structure. * @return the offset of the first byte following the method_info structure. */ @@ -1507,9 +1507,9 @@ public class ClassReader { * Reads a JVMS 'Code' attribute and makes the given visitor visit it. * * @param methodVisitor the visitor that must visit the Code attribute. - * @param context information about the class being parsed. - * @param codeOffset the start offset in {@link #classFileBuffer} of the Code attribute, excluding - * its attribute_name_index and attribute_length fields. + * @param context information about the class being parsed. + * @param codeOffset the start offset in {@link #classFileBuffer} of the Code attribute, + * excluding its attribute_name_index and attribute_length fields. */ private void readCode( final MethodVisitor methodVisitor, final Context context, final int codeOffset) { @@ -1986,7 +1986,7 @@ public class ClassReader { if (potentialBytecodeOffset >= 0 && potentialBytecodeOffset < codeLength && (classBuffer[bytecodeStartOffset + potentialBytecodeOffset] & 0xFF) - == Opcodes.NEW) { + == Opcodes.NEW) { createLabel(potentialBytecodeOffset, labels); } } @@ -2040,7 +2040,7 @@ public class ClassReader { // Visit the stack map frame for this bytecode offset, if any. while (stackMapFrameOffset != 0 && (context.currentFrameOffset == currentBytecodeOffset - || context.currentFrameOffset == -1)) { + || context.currentFrameOffset == -1)) { // If there is a stack map frame for this offset, make methodVisitor visit it, and read the // next stack map frame if there is one. if (context.currentFrameOffset != -1) { @@ -2287,37 +2287,36 @@ public class ClassReader { case Constants.ASM_GOTO: case Constants.ASM_JSR: case Constants.ASM_IFNULL: - case Constants.ASM_IFNONNULL: - { - // A forward jump with an offset > 32767. In this case we automatically replace ASM_GOTO - // with GOTO_W, ASM_JSR with JSR_W and ASM_IFxxx with IFNOTxxx GOTO_W L:..., - // where IFNOTxxx is the "opposite" opcode of ASMS_IFxxx (e.g. IFNE for ASM_IFEQ) and - // where designates the instruction just after the GOTO_W. - // First, change the ASM specific opcodes ASM_IFEQ ... ASM_JSR, ASM_IFNULL and - // ASM_IFNONNULL to IFEQ ... JSR, IFNULL and IFNONNULL. - opcode = - opcode < Constants.ASM_IFNULL - ? opcode - Constants.ASM_OPCODE_DELTA - : opcode - Constants.ASM_IFNULL_OPCODE_DELTA; - Label target = labels[currentBytecodeOffset + readUnsignedShort(currentOffset + 1)]; - if (opcode == Opcodes.GOTO || opcode == Opcodes.JSR) { - // Replace GOTO with GOTO_W and JSR with JSR_W. - methodVisitor.visitJumpInsn(opcode + Constants.WIDE_JUMP_OPCODE_DELTA, target); - } else { - // Compute the "opposite" of opcode. This can be done by flipping the least - // significant bit for IFNULL and IFNONNULL, and similarly for IFEQ ... IF_ACMPEQ - // (with a pre and post offset by 1). - opcode = opcode < Opcodes.GOTO ? ((opcode + 1) ^ 1) - 1 : opcode ^ 1; - Label endif = createLabel(currentBytecodeOffset + 3, labels); - methodVisitor.visitJumpInsn(opcode, endif); - methodVisitor.visitJumpInsn(Constants.GOTO_W, target); - // endif designates the instruction just after GOTO_W, and is visited as part of the - // next instruction. Since it is a jump target, we need to insert a frame here. - insertFrame = true; - } - currentOffset += 3; - break; + case Constants.ASM_IFNONNULL: { + // A forward jump with an offset > 32767. In this case we automatically replace ASM_GOTO + // with GOTO_W, ASM_JSR with JSR_W and ASM_IFxxx with IFNOTxxx GOTO_W L:..., + // where IFNOTxxx is the "opposite" opcode of ASMS_IFxxx (e.g. IFNE for ASM_IFEQ) and + // where designates the instruction just after the GOTO_W. + // First, change the ASM specific opcodes ASM_IFEQ ... ASM_JSR, ASM_IFNULL and + // ASM_IFNONNULL to IFEQ ... JSR, IFNULL and IFNONNULL. + opcode = + opcode < Constants.ASM_IFNULL + ? opcode - Constants.ASM_OPCODE_DELTA + : opcode - Constants.ASM_IFNULL_OPCODE_DELTA; + Label target = labels[currentBytecodeOffset + readUnsignedShort(currentOffset + 1)]; + if (opcode == Opcodes.GOTO || opcode == Opcodes.JSR) { + // Replace GOTO with GOTO_W and JSR with JSR_W. + methodVisitor.visitJumpInsn(opcode + Constants.WIDE_JUMP_OPCODE_DELTA, target); + } else { + // Compute the "opposite" of opcode. This can be done by flipping the least + // significant bit for IFNULL and IFNONNULL, and similarly for IFEQ ... IF_ACMPEQ + // (with a pre and post offset by 1). + opcode = opcode < Opcodes.GOTO ? ((opcode + 1) ^ 1) - 1 : opcode ^ 1; + Label endif = createLabel(currentBytecodeOffset + 3, labels); + methodVisitor.visitJumpInsn(opcode, endif); + methodVisitor.visitJumpInsn(Constants.GOTO_W, target); + // endif designates the instruction just after GOTO_W, and is visited as part of the + // next instruction. Since it is a jump target, we need to insert a frame here. + insertFrame = true; } + currentOffset += 3; + break; + } case Constants.ASM_GOTO_W: // Replace ASM_GOTO_W with GOTO_W. methodVisitor.visitJumpInsn( @@ -2339,41 +2338,39 @@ public class ClassReader { currentOffset += 4; } break; - case Opcodes.TABLESWITCH: - { - // Skip 0 to 3 padding bytes. - currentOffset += 4 - (currentBytecodeOffset & 3); - // Read the instruction. - Label defaultLabel = labels[currentBytecodeOffset + readInt(currentOffset)]; - int low = readInt(currentOffset + 4); - int high = readInt(currentOffset + 8); - currentOffset += 12; - Label[] table = new Label[high - low + 1]; - for (int i = 0; i < table.length; ++i) { - table[i] = labels[currentBytecodeOffset + readInt(currentOffset)]; - currentOffset += 4; - } - methodVisitor.visitTableSwitchInsn(low, high, defaultLabel, table); - break; + case Opcodes.TABLESWITCH: { + // Skip 0 to 3 padding bytes. + currentOffset += 4 - (currentBytecodeOffset & 3); + // Read the instruction. + Label defaultLabel = labels[currentBytecodeOffset + readInt(currentOffset)]; + int low = readInt(currentOffset + 4); + int high = readInt(currentOffset + 8); + currentOffset += 12; + Label[] table = new Label[high - low + 1]; + for (int i = 0; i < table.length; ++i) { + table[i] = labels[currentBytecodeOffset + readInt(currentOffset)]; + currentOffset += 4; } - case Opcodes.LOOKUPSWITCH: - { - // Skip 0 to 3 padding bytes. - currentOffset += 4 - (currentBytecodeOffset & 3); - // Read the instruction. - Label defaultLabel = labels[currentBytecodeOffset + readInt(currentOffset)]; - int numPairs = readInt(currentOffset + 4); + methodVisitor.visitTableSwitchInsn(low, high, defaultLabel, table); + break; + } + case Opcodes.LOOKUPSWITCH: { + // Skip 0 to 3 padding bytes. + currentOffset += 4 - (currentBytecodeOffset & 3); + // Read the instruction. + Label defaultLabel = labels[currentBytecodeOffset + readInt(currentOffset)]; + int numPairs = readInt(currentOffset + 4); + currentOffset += 8; + int[] keys = new int[numPairs]; + Label[] values = new Label[numPairs]; + for (int i = 0; i < numPairs; ++i) { + keys[i] = readInt(currentOffset); + values[i] = labels[currentBytecodeOffset + readInt(currentOffset + 4)]; currentOffset += 8; - int[] keys = new int[numPairs]; - Label[] values = new Label[numPairs]; - for (int i = 0; i < numPairs; ++i) { - keys[i] = readInt(currentOffset); - values[i] = labels[currentBytecodeOffset + readInt(currentOffset + 4)]; - currentOffset += 8; - } - methodVisitor.visitLookupSwitchInsn(defaultLabel, keys, values); - break; } + methodVisitor.visitLookupSwitchInsn(defaultLabel, keys, values); + break; + } case Opcodes.ILOAD: case Opcodes.LLOAD: case Opcodes.FLOAD: @@ -2413,49 +2410,47 @@ public class ClassReader { case Opcodes.INVOKEVIRTUAL: case Opcodes.INVOKESPECIAL: case Opcodes.INVOKESTATIC: - case Opcodes.INVOKEINTERFACE: - { - int cpInfoOffset = cpInfoOffsets[readUnsignedShort(currentOffset + 1)]; - int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 2)]; - String owner = readClass(cpInfoOffset, charBuffer); - String name = readUTF8(nameAndTypeCpInfoOffset, charBuffer); - String descriptor = readUTF8(nameAndTypeCpInfoOffset + 2, charBuffer); - if (opcode < Opcodes.INVOKEVIRTUAL) { - methodVisitor.visitFieldInsn(opcode, owner, name, descriptor); - } else { - boolean isInterface = - classBuffer[cpInfoOffset - 1] == Symbol.CONSTANT_INTERFACE_METHODREF_TAG; - methodVisitor.visitMethodInsn(opcode, owner, name, descriptor, isInterface); - } - if (opcode == Opcodes.INVOKEINTERFACE) { - currentOffset += 5; - } else { - currentOffset += 3; - } - break; + case Opcodes.INVOKEINTERFACE: { + int cpInfoOffset = cpInfoOffsets[readUnsignedShort(currentOffset + 1)]; + int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 2)]; + String owner = readClass(cpInfoOffset, charBuffer); + String name = readUTF8(nameAndTypeCpInfoOffset, charBuffer); + String descriptor = readUTF8(nameAndTypeCpInfoOffset + 2, charBuffer); + if (opcode < Opcodes.INVOKEVIRTUAL) { + methodVisitor.visitFieldInsn(opcode, owner, name, descriptor); + } else { + boolean isInterface = + classBuffer[cpInfoOffset - 1] == Symbol.CONSTANT_INTERFACE_METHODREF_TAG; + methodVisitor.visitMethodInsn(opcode, owner, name, descriptor, isInterface); } - case Opcodes.INVOKEDYNAMIC: - { - int cpInfoOffset = cpInfoOffsets[readUnsignedShort(currentOffset + 1)]; - int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 2)]; - String name = readUTF8(nameAndTypeCpInfoOffset, charBuffer); - String descriptor = readUTF8(nameAndTypeCpInfoOffset + 2, charBuffer); - int bootstrapMethodOffset = bootstrapMethodOffsets[readUnsignedShort(cpInfoOffset)]; - Handle handle = - (Handle) readConst(readUnsignedShort(bootstrapMethodOffset), charBuffer); - Object[] bootstrapMethodArguments = - new Object[readUnsignedShort(bootstrapMethodOffset + 2)]; - bootstrapMethodOffset += 4; - for (int i = 0; i < bootstrapMethodArguments.length; i++) { - bootstrapMethodArguments[i] = - readConst(readUnsignedShort(bootstrapMethodOffset), charBuffer); - bootstrapMethodOffset += 2; - } - methodVisitor.visitInvokeDynamicInsn( - name, descriptor, handle, bootstrapMethodArguments); + if (opcode == Opcodes.INVOKEINTERFACE) { currentOffset += 5; - break; + } else { + currentOffset += 3; } + break; + } + case Opcodes.INVOKEDYNAMIC: { + int cpInfoOffset = cpInfoOffsets[readUnsignedShort(currentOffset + 1)]; + int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 2)]; + String name = readUTF8(nameAndTypeCpInfoOffset, charBuffer); + String descriptor = readUTF8(nameAndTypeCpInfoOffset + 2, charBuffer); + int bootstrapMethodOffset = bootstrapMethodOffsets[readUnsignedShort(cpInfoOffset)]; + Handle handle = + (Handle) readConst(readUnsignedShort(bootstrapMethodOffset), charBuffer); + Object[] bootstrapMethodArguments = + new Object[readUnsignedShort(bootstrapMethodOffset + 2)]; + bootstrapMethodOffset += 4; + for (int i = 0; i < bootstrapMethodArguments.length; i++) { + bootstrapMethodArguments[i] = + readConst(readUnsignedShort(bootstrapMethodOffset), charBuffer); + bootstrapMethodOffset += 2; + } + methodVisitor.visitInvokeDynamicInsn( + name, descriptor, handle, bootstrapMethodArguments); + currentOffset += 5; + break; + } case Opcodes.NEW: case Opcodes.ANEWARRAY: case Opcodes.CHECKCAST: @@ -2650,9 +2645,9 @@ public class ClassReader { * this method creates a label for the given offset if it has not been already created. * * @param bytecodeOffset a bytecode offset in a method. - * @param labels the already created labels, indexed by their offset. If a label already exists - * for bytecodeOffset this method must not create a new one. Otherwise it must store the new - * label in this array. + * @param labels the already created labels, indexed by their offset. If a label already + * exists for bytecodeOffset this method must not create a new one. + * Otherwise it must store the new label in this array. * @return a non null Label, which must be equal to labels[bytecodeOffset]. */ protected Label readLabel(final int bytecodeOffset, final Label[] labels) { @@ -2664,11 +2659,11 @@ public class ClassReader { /** * Creates a label without the {@link Label#FLAG_DEBUG_ONLY} flag set, for the given bytecode - * offset. The label is created with a call to {@link #readLabel} and its {@link - * Label#FLAG_DEBUG_ONLY} flag is cleared. + * offset. The label is created with a call to {@link #readLabel} and its + * {@link Label#FLAG_DEBUG_ONLY} flag is cleared. * * @param bytecodeOffset a bytecode offset in a method. - * @param labels the already created labels, indexed by their offset. + * @param labels the already created labels, indexed by their offset. * @return a Label without the {@link Label#FLAG_DEBUG_ONLY} flag set. */ private Label createLabel(final int bytecodeOffset, final Label[] labels) { @@ -2683,7 +2678,7 @@ public class ClassReader { * with a call to {@link #readLabel}. * * @param bytecodeOffset a bytecode offset in a method. - * @param labels the already created labels, indexed by their offset. + * @param labels the already created labels, indexed by their offset. */ private void createDebugLabel(final int bytecodeOffset, final Label[] labels) { if (labels[bytecodeOffset] == null) { @@ -2700,14 +2695,17 @@ public class ClassReader { * entry it contains, to find the corresponding labels, and to visit the try catch block * annotations. * - * @param methodVisitor the method visitor to be used to visit the try catch block annotations. - * @param context information about the class being parsed. + * @param methodVisitor the method visitor to be used to visit the try catch block + * annotations. + * @param context information about the class being parsed. * @param runtimeTypeAnnotationsOffset the start offset of a Runtime[In]VisibleTypeAnnotations - * attribute, excluding the attribute_info's attribute_name_index and attribute_length fields. - * @param visible true if the attribute to parse is a RuntimeVisibleTypeAnnotations attribute, - * false it is a RuntimeInvisibleTypeAnnotations attribute. + * attribute, excluding the attribute_info's + * attribute_name_index and attribute_length fields. + * @param visible true if the attribute to parse is a + * RuntimeVisibleTypeAnnotations attribute, false it is a + * RuntimeInvisibleTypeAnnotations attribute. * @return the start offset of each entry of the Runtime[In]VisibleTypeAnnotations_attribute's - * 'annotations' array field. + * 'annotations' array field. */ private int[] readTypeAnnotations( final MethodVisitor methodVisitor, @@ -2807,10 +2805,10 @@ public class ClassReader { * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a - * Runtime[In]VisibleTypeAnnotations attribute, or {@literal null}. - * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. + * Runtime[In]VisibleTypeAnnotations attribute, or {@literal null}. + * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 - * if there is no such type_annotation of if it does not have a bytecode offset. + * if there is no such type_annotation of if it does not have a bytecode offset. */ private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { @@ -2827,8 +2825,8 @@ public class ClassReader { * and target_path (the result is stored in the given context), and returns the start offset of * the rest of the type_annotation structure. * - * @param context information about the class being parsed. This is where the extracted - * target_type and target_path must be stored. + * @param context information about the class being parsed. This is where the + * extracted target_type and target_path must be stored. * @param typeAnnotationOffset the start offset of a type_annotation structure. * @return the start offset of the rest of the type_annotation structure. */ @@ -2907,13 +2905,16 @@ public class ClassReader { /** * Reads a Runtime[In]VisibleParameterAnnotations attribute and makes the given visitor visit it. * - * @param methodVisitor the visitor that must visit the parameter annotations. - * @param context information about the class being parsed. + * @param methodVisitor the visitor that must visit the parameter + * annotations. + * @param context information about the class being parsed. * @param runtimeParameterAnnotationsOffset the start offset of a - * Runtime[In]VisibleParameterAnnotations attribute, excluding the attribute_info's - * attribute_name_index and attribute_length fields. - * @param visible true if the attribute to parse is a RuntimeVisibleParameterAnnotations - * attribute, false it is a RuntimeInvisibleParameterAnnotations attribute. + * Runtime[In]VisibleParameterAnnotations attribute, + * excluding the attribute_info's attribute_name_index + * and attribute_length fields. + * @param visible true if the attribute to parse is a + * RuntimeVisibleParameterAnnotations attribute, false it + * is a RuntimeInvisibleParameterAnnotations attribute. */ private void readParameterAnnotations( final MethodVisitor methodVisitor, @@ -2948,12 +2949,12 @@ public class ClassReader { * annotation's 'element_value'. * * @param annotationVisitor the visitor that must visit the values. - * @param annotationOffset the start offset of an 'annotation' structure (excluding its type_index - * field) or of an 'array_value' structure. - * @param named if the annotation values are named or not. This should be true to parse the values - * of a JVMS 'annotation' structure, and false to parse the JVMS 'array_value' of an - * annotation's element_value. - * @param charBuffer the buffer used to read strings in the constant pool. + * @param annotationOffset the start offset of an 'annotation' structure (excluding its + * type_index field) or of an 'array_value' structure. + * @param named if the annotation values are named or not. This should be true to + * parse the values of a JVMS 'annotation' structure, and false to parse + * the JVMS 'array_value' of an annotation's element_value. + * @param charBuffer the buffer used to read strings in the constant pool. * @return the end offset of the JVMS 'annotation' or 'array_value' structure. */ private int readElementValues( @@ -2988,11 +2989,12 @@ public class ClassReader { /** * Reads a JVMS 'element_value' structure and makes the given visitor visit it. * - * @param annotationVisitor the visitor that must visit the element_value structure. + * @param annotationVisitor the visitor that must visit the element_value structure. * @param elementValueOffset the start offset in {@link #classFileBuffer} of the element_value - * structure to be read. - * @param elementName the name of the element_value structure to be read, or {@literal null}. - * @param charBuffer the buffer used to read strings in the constant pool. + * structure to be read. + * @param elementName the name of the element_value structure to be read, or + * {@literal null}. + * @param charBuffer the buffer used to read strings in the constant pool. * @return the end offset of the JVMS 'element_value' structure. */ private int readElementValue( @@ -3242,12 +3244,13 @@ public class ClassReader { * field (this is used to parse the legacy StackMap attributes). * * @param stackMapFrameOffset the start offset in {@link #classFileBuffer} of the - * stack_map_frame_value structure to be read, or the start offset of a full_frame structure - * (excluding its frame_type field). - * @param compressed true to read a 'stack_map_frame' structure, false to read a 'full_frame' - * structure without its frame_type field. - * @param expand if the stack map frame must be expanded. See {@link #EXPAND_FRAMES}. - * @param context where the parsed stack map frame must be stored. + * stack_map_frame_value structure to be read, or the start offset of a + * full_frame structure (excluding its frame_type field). + * @param compressed true to read a 'stack_map_frame' structure, false to read a + * 'full_frame' structure without its frame_type field. + * @param expand if the stack map frame must be expanded. See + * {@link #EXPAND_FRAMES}. + * @param context where the parsed stack map frame must be stored. * @return the end offset of the JVMS 'stack_map_frame' or 'full_frame' structure. */ private int readStackMapFrame( @@ -3340,13 +3343,14 @@ public class ClassReader { * array. * * @param verificationTypeInfoOffset the start offset of the 'verification_type_info' structure to - * read. - * @param frame the array where the parsed type must be stored. - * @param index the index in 'frame' where the parsed type must be stored. - * @param charBuffer the buffer used to read strings in the constant pool. - * @param labels the labels of the method currently being parsed, indexed by their offset. If the - * parsed type is an ITEM_Uninitialized, a new label for the corresponding NEW instruction is - * stored in this array if it does not already exist. + * read. + * @param frame the array where the parsed type must be stored. + * @param index the index in 'frame' where the parsed type must be stored. + * @param charBuffer the buffer used to read strings in the constant pool. + * @param labels the labels of the method currently being parsed, indexed by + * their offset. If the parsed type is an ITEM_Uninitialized, a + * new label for the corresponding NEW instruction is stored in + * this array if it does not already exist. * @return the end offset of the JVMS 'verification_type_info' structure. */ private int readVerificationTypeInfo( @@ -3402,7 +3406,7 @@ public class ClassReader { * field entry. * * @return the offset in {@link #classFileBuffer} of the first ClassFile's 'attributes' array - * field entry. + * field entry. */ final int getFirstAttributeOffset() { // Skip the access_flags, this_class, super_class, and interfaces_count fields (using 2 bytes @@ -3448,7 +3452,7 @@ public class ClassReader { * Reads the BootstrapMethods attribute to compute the offset of each bootstrap method. * * @param maxStringLength a conservative estimate of the maximum length of the strings contained - * in the constant pool of the class. + * in the constant pool of the class. * @return the offsets of the bootstrap methods. */ private int[] readBootstrapMethodsAttribute(final int maxStringLength) { @@ -3482,20 +3486,23 @@ public class ClassReader { * Reads a non standard JVMS 'attribute' structure in {@link #classFileBuffer}. * * @param attributePrototypes prototypes of the attributes that must be parsed during the visit of - * the class. Any attribute whose type is not equal to the type of one the prototypes will not - * be parsed: its byte array value will be passed unchanged to the ClassWriter. - * @param type the type of the attribute. - * @param offset the start offset of the JVMS 'attribute' structure in {@link #classFileBuffer}. - * The 6 attribute header bytes (attribute_name_index and attribute_length) are not taken into - * account here. - * @param length the length of the attribute's content (excluding the 6 attribute header bytes). - * @param charBuffer the buffer to be used to read strings in the constant pool. - * @param codeAttributeOffset the start offset of the enclosing Code attribute in {@link - * #classFileBuffer}, or -1 if the attribute to be read is not a code attribute. The 6 - * attribute header bytes (attribute_name_index and attribute_length) are not taken into - * account here. - * @param labels the labels of the method's code, or {@literal null} if the attribute to be read - * is not a code attribute. + * the class. Any attribute whose type is not equal to the type of one + * the prototypes will not be parsed: its byte array value will be + * passed unchanged to the ClassWriter. + * @param type the type of the attribute. + * @param offset the start offset of the JVMS 'attribute' structure in + * {@link #classFileBuffer}. The 6 attribute header bytes + * (attribute_name_index and attribute_length) are not taken into + * account here. + * @param length the length of the attribute's content (excluding the 6 attribute + * header bytes). + * @param charBuffer the buffer to be used to read strings in the constant pool. + * @param codeAttributeOffset the start offset of the enclosing Code attribute in + * {@link #classFileBuffer}, or -1 if the attribute to be read is not a + * code attribute. The 6 attribute header bytes (attribute_name_index + * and attribute_length) are not taken into account here. + * @param labels the labels of the method's code, or {@literal null} if the attribute + * to be read is not a code attribute. * @return the attribute that has been read. */ private Attribute readAttribute( @@ -3534,9 +3541,9 @@ public class ClassReader { * and is normally not needed by class generators or adapters. * * @param constantPoolEntryIndex the index a constant pool entry in the class's constant pool - * table. + * table. * @return the start offset in this {@link ClassReader} of the corresponding JVMS 'cp_info' - * structure, plus one. + * structure, plus one. */ public int getItem(final int constantPoolEntryIndex) { return cpInfoOffsets[constantPoolEntryIndex]; @@ -3547,15 +3554,15 @@ public class ClassReader { * constant pool table. * * @return a conservative estimate of the maximum length of the strings contained in the class's - * constant pool table. + * constant pool table. */ public int getMaxStringLength() { return maxStringLength; } /** - * Reads a byte value in this {@link ClassReader}. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * Reads a byte value in this {@link ClassReader}. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * * @param offset the start offset of the value to be read in this {@link ClassReader}. * @return the read value. @@ -3577,8 +3584,8 @@ public class ClassReader { } /** - * Reads a signed short value in this {@link ClassReader}. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * Reads a signed short value in this {@link ClassReader}. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * * @param offset the start offset of the value to be read in this {@link ClassReader}. * @return the read value. @@ -3589,8 +3596,8 @@ public class ClassReader { } /** - * Reads a signed int value in this {@link ClassReader}. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * Reads a signed int value in this {@link ClassReader}. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * * @param offset the start offset of the value to be read in this {@link ClassReader}. * @return the read value. @@ -3604,8 +3611,8 @@ public class ClassReader { } /** - * Reads a signed long value in this {@link ClassReader}. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * Reads a signed long value in this {@link ClassReader}. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * * @param offset the start offset of the value to be read in this {@link ClassReader}. * @return the read value. @@ -3621,10 +3628,11 @@ public class ClassReader { * intended for {@link Attribute} sub classes, and is normally not needed by class generators or * adapters. * - * @param offset the start offset of an unsigned short value in this {@link ClassReader}, whose - * value is the index of a CONSTANT_Utf8 entry in the class's constant pool table. + * @param offset the start offset of an unsigned short value in this {@link ClassReader}, + * whose value is the index of a CONSTANT_Utf8 entry in the class's constant + * pool table. * @param charBuffer the buffer to be used to read the string. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified CONSTANT_Utf8 entry. */ // DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility). @@ -3640,9 +3648,9 @@ public class ClassReader { * Reads a CONSTANT_Utf8 constant pool entry in {@link #classFileBuffer}. * * @param constantPoolEntryIndex the index of a CONSTANT_Utf8 entry in the class's constant pool - * table. - * @param charBuffer the buffer to be used to read the string. This buffer must be sufficiently - * large. It is not automatically resized. + * table. + * @param charBuffer the buffer to be used to read the string. This buffer must be + * sufficiently large. It is not automatically resized. * @return the String corresponding to the specified CONSTANT_Utf8 entry. */ final String readUtf(final int constantPoolEntryIndex, final char[] charBuffer) { @@ -3658,10 +3666,10 @@ public class ClassReader { /** * Reads an UTF8 string in {@link #classFileBuffer}. * - * @param utfOffset the start offset of the UTF8 string to be read. - * @param utfLength the length of the UTF8 string to be read. + * @param utfOffset the start offset of the UTF8 string to be read. + * @param utfLength the length of the UTF8 string to be read. * @param charBuffer the buffer to be used to read the string. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified UTF8 string. */ private String readUtf(final int utfOffset, final int utfLength, final char[] charBuffer) { @@ -3693,11 +3701,12 @@ public class ClassReader { * for {@link Attribute} sub classes, and is normally not needed by class generators or * adapters. * - * @param offset the start offset of an unsigned short value in {@link #classFileBuffer}, whose - * value is the index of a CONSTANT_Class, CONSTANT_String, CONSTANT_MethodType, - * CONSTANT_Module or CONSTANT_Package entry in class's constant pool table. + * @param offset the start offset of an unsigned short value in {@link #classFileBuffer}, + * whose value is the index of a CONSTANT_Class, CONSTANT_String, + * CONSTANT_MethodType, CONSTANT_Module or CONSTANT_Package entry in class's + * constant pool table. * @param charBuffer the buffer to be used to read the item. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified constant pool entry. */ private String readStringish(final int offset, final char[] charBuffer) { @@ -3711,10 +3720,11 @@ public class ClassReader { * intended for {@link Attribute} sub classes, and is normally not needed by class generators or * adapters. * - * @param offset the start offset of an unsigned short value in this {@link ClassReader}, whose - * value is the index of a CONSTANT_Class entry in class's constant pool table. + * @param offset the start offset of an unsigned short value in this {@link ClassReader}, + * whose value is the index of a CONSTANT_Class entry in class's constant pool + * table. * @param charBuffer the buffer to be used to read the item. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified CONSTANT_Class entry. */ public String readClass(final int offset, final char[] charBuffer) { @@ -3726,10 +3736,11 @@ public class ClassReader { * intended for {@link Attribute} sub classes, and is normally not needed by class generators or * adapters. * - * @param offset the start offset of an unsigned short value in this {@link ClassReader}, whose - * value is the index of a CONSTANT_Module entry in class's constant pool table. + * @param offset the start offset of an unsigned short value in this {@link ClassReader}, + * whose value is the index of a CONSTANT_Module entry in class's constant pool + * table. * @param charBuffer the buffer to be used to read the item. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified CONSTANT_Module entry. */ public String readModule(final int offset, final char[] charBuffer) { @@ -3741,10 +3752,11 @@ public class ClassReader { * intended for {@link Attribute} sub classes, and is normally not needed by class generators or * adapters. * - * @param offset the start offset of an unsigned short value in this {@link ClassReader}, whose - * value is the index of a CONSTANT_Package entry in class's constant pool table. + * @param offset the start offset of an unsigned short value in this {@link ClassReader}, + * whose value is the index of a CONSTANT_Package entry in class's constant pool + * table. * @param charBuffer the buffer to be used to read the item. This buffer must be sufficiently - * large. It is not automatically resized. + * large. It is not automatically resized. * @return the String corresponding to the specified CONSTANT_Package entry. */ public String readPackage(final int offset, final char[] charBuffer) { @@ -3755,9 +3767,9 @@ public class ClassReader { * Reads a CONSTANT_Dynamic constant pool entry in {@link #classFileBuffer}. * * @param constantPoolEntryIndex the index of a CONSTANT_Dynamic entry in the class's constant - * pool table. - * @param charBuffer the buffer to be used to read the string. This buffer must be sufficiently - * large. It is not automatically resized. + * pool table. + * @param charBuffer the buffer to be used to read the string. This buffer must be + * sufficiently large. It is not automatically resized. * @return the ConstantDynamic corresponding to the specified CONSTANT_Dynamic entry. */ private ConstantDynamic readConstantDynamic( @@ -3788,13 +3800,14 @@ public class ClassReader { * adapters. * * @param constantPoolEntryIndex the index of a CONSTANT_Integer, CONSTANT_Float, CONSTANT_Long, - * CONSTANT_Double, CONSTANT_Class, CONSTANT_String, CONSTANT_MethodType, - * CONSTANT_MethodHandle or CONSTANT_Dynamic entry in the class's constant pool. - * @param charBuffer the buffer to be used to read strings. This buffer must be sufficiently - * large. It is not automatically resized. + * CONSTANT_Double, CONSTANT_Class, CONSTANT_String, + * CONSTANT_MethodType, CONSTANT_MethodHandle or CONSTANT_Dynamic + * entry in the class's constant pool. + * @param charBuffer the buffer to be used to read strings. This buffer must be + * sufficiently large. It is not automatically resized. * @return the {@link Integer}, {@link Float}, {@link Long}, {@link Double}, {@link String}, - * {@link Type}, {@link Handle} or {@link ConstantDynamic} corresponding to the specified - * constant pool entry. + * {@link Type}, {@link Handle} or {@link ConstantDynamic} corresponding to the specified constant + * pool entry. */ public Object readConst(final int constantPoolEntryIndex, final char[] charBuffer) { int cpInfoOffset = cpInfoOffsets[constantPoolEntryIndex]; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassTooLargeException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassTooLargeException.java index 68a077d4dfbb6b34b5086e0fa08d9e352d71658b..9838032347838910d334ff08d4035f48acf5a5b8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassTooLargeException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassTooLargeException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -26,7 +14,7 @@ public final class ClassTooLargeException extends IndexOutOfBoundsException { /** * Constructs a new {@link ClassTooLargeException}. * - * @param className the internal name of the class. + * @param className the internal name of the class. * @param constantPoolCount the number of constant pool items of the class. */ public ClassTooLargeException(final String className, final int constantPoolCount) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassVisitor.java index 239e612db3c06383c2faaecdfe35c9fb44130d9b..236b137fb87e5e758e738b6191b4b08e567b75ac 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassVisitor.java @@ -1,41 +1,32 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** * A visitor to visit a Java class. The methods of this class must be called in the following order: - * {@code visit} [ {@code visitSource} ] [ {@code visitModule} ][ {@code visitNestHost} ][ {@code - * visitOuterClass} ] ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code - * visitAttribute} )* ( {@code visitNestMember} | [ {@code * visitPermittedSubclass} ] | {@code - * visitInnerClass} | {@code visitRecordComponent} | {@code visitField} | {@code visitMethod} )* - * {@code visitEnd}. @Author Eric Bruneton + * {@code visit} [ {@code visitSource} ] [ {@code visitModule} ][ {@code visitNestHost} ][ + * {@code visitOuterClass} ] ( {@code visitAnnotation} | {@code visitTypeAnnotation} | + * {@code visitAttribute} )* ( {@code visitNestMember} | [ {@code * visitPermittedSubclass} ] | + * {@code visitInnerClass} | {@code visitRecordComponent} | {@code visitField} | {@code visitMethod} + * )* {@code visitEnd}. @Author Eric Bruneton */ public abstract class ClassVisitor { /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ protected final int api; - /** The class visitor to which this visitor must delegate method calls. May be {@literal null}. */ + /** + * The class visitor to which this visitor must delegate method calls. May be {@literal null}. + */ protected ClassVisitor cv; /** * Constructs a new {@link ClassVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. */ public ClassVisitor(final int api) { this(api, null); @@ -44,11 +35,11 @@ public abstract class ClassVisitor { /** * Constructs a new {@link ClassVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link - * Opcodes#ASM8} or {@link Opcodes#ASM9}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, + * {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}. * @param classVisitor the class visitor to which this visitor must delegate method calls. May be - * null. + * null. */ public ClassVisitor(final int api, final ClassVisitor classVisitor) { if (api != Opcodes.ASM9 @@ -70,19 +61,19 @@ public abstract class ClassVisitor { /** * Visits the header of the class. * - * @param version the class version. The minor version is stored in the 16 most significant bits, - * and the major version in the 16 least significant bits. - * @param access the class's access flags (see {@link Opcodes}). This parameter also indicates if - * the class is deprecated {@link Opcodes#ACC_DEPRECATED} or a record {@link - * Opcodes#ACC_RECORD}. - * @param name the internal name of the class (see {@link Type#getInternalName()}). - * @param signature the signature of this class. May be {@literal null} if the class is not a - * generic one, and does not extend or implement generic classes or interfaces. - * @param superName the internal of name of the super class (see {@link Type#getInternalName()}). - * For interfaces, the super class is {@link Object}. May be {@literal null}, but only for the - * {@link Object} class. - * @param interfaces the internal names of the class's interfaces (see {@link - * Type#getInternalName()}). May be {@literal null}. + * @param version the class version. The minor version is stored in the 16 most significant + * bits, and the major version in the 16 least significant bits. + * @param access the class's access flags (see {@link Opcodes}). This parameter also indicates + * if the class is deprecated {@link Opcodes#ACC_DEPRECATED} or a record + * {@link Opcodes#ACC_RECORD}. + * @param name the internal name of the class (see {@link Type#getInternalName()}). + * @param signature the signature of this class. May be {@literal null} if the class is not a + * generic one, and does not extend or implement generic classes or interfaces. + * @param superName the internal of name of the super class (see {@link Type#getInternalName()}). + * For interfaces, the super class is {@link Object}. May be {@literal null}, + * but only for the {@link Object} class. + * @param interfaces the internal names of the class's interfaces (see + * {@link Type#getInternalName()}). May be {@literal null}. */ public void visit( final int version, @@ -102,10 +93,10 @@ public abstract class ClassVisitor { /** * Visits the source of the class. * - * @param source the name of the source file from which the class was compiled. May be {@literal - * null}. - * @param debug additional debug information to compute the correspondence between source and - * compiled elements of the class. May be {@literal null}. + * @param source the name of the source file from which the class was compiled. May be + * {@literal null}. + * @param debug additional debug information to compute the correspondence between source and + * compiled elements of the class. May be {@literal null}. */ public void visitSource(final String source, final String debug) { if (cv != null) { @@ -116,12 +107,12 @@ public abstract class ClassVisitor { /** * Visit the module corresponding to the class. * - * @param name the fully qualified name (using dots) of the module. - * @param access the module access flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and {@code - * ACC_MANDATED}. + * @param name the fully qualified name (using dots) of the module. + * @param access the module access flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and + * {@code ACC_MANDATED}. * @param version the module version, or {@literal null}. * @return a visitor to visit the module values, or {@literal null} if this visitor is not - * interested in visiting this module. + * interested in visiting this module. */ public ModuleVisitor visitModule(final String name, final int access, final String version) { if (api < Opcodes.ASM6) { @@ -156,11 +147,11 @@ public abstract class ClassVisitor { * Visits the enclosing class of the class. This method must be called only if the class has an * enclosing class. * - * @param owner internal name of the enclosing class of the class. - * @param name the name of the method that contains the class, or {@literal null} if the class is - * not enclosed in a method of its enclosing class. + * @param owner internal name of the enclosing class of the class. + * @param name the name of the method that contains the class, or {@literal null} if the + * class is not enclosed in a method of its enclosing class. * @param descriptor the descriptor of the method that contains the class, or {@literal null} if - * the class is not enclosed in a method of its enclosing class. + * the class is not enclosed in a method of its enclosing class. */ public void visitOuterClass(final String owner, final String name, final String descriptor) { if (cv != null) { @@ -172,9 +163,9 @@ public abstract class ClassVisitor { * Visits an annotation of the class. * * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (cv != null) { @@ -186,17 +177,17 @@ public abstract class ClassVisitor { /** * Visits an annotation on a type in the class signature. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#CLASS_TYPE_PARAMETER}, {@link - * TypeReference#CLASS_TYPE_PARAMETER_BOUND} or {@link TypeReference#CLASS_EXTENDS}. See - * {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#CLASS_TYPE_PARAMETER}, + * {@link TypeReference#CLASS_TYPE_PARAMETER_BOUND} or + * {@link TypeReference#CLASS_EXTENDS}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { @@ -257,13 +248,14 @@ public abstract class ClassVisitor { * Visits information about an inner class. This inner class is not necessarily a member of the * class being visited. * - * @param name the internal name of an inner class (see {@link Type#getInternalName()}). - * @param outerName the internal name of the class to which the inner class belongs (see {@link - * Type#getInternalName()}). May be {@literal null} for not member classes. + * @param name the internal name of an inner class (see {@link Type#getInternalName()}). + * @param outerName the internal name of the class to which the inner class belongs (see + * {@link Type#getInternalName()}). May be {@literal null} for not member + * classes. * @param innerName the (simple) name of the inner class inside its enclosing class. May be - * {@literal null} for anonymous inner classes. - * @param access the access flags of the inner class as originally declared in the enclosing - * class. + * {@literal null} for anonymous inner classes. + * @param access the access flags of the inner class as originally declared in the enclosing + * class. */ public void visitInnerClass( final String name, final String outerName, final String innerName, final int access) { @@ -275,12 +267,12 @@ public abstract class ClassVisitor { /** * Visits a record component of the class. * - * @param name the record component name. + * @param name the record component name. * @param descriptor the record component descriptor (see {@link Type}). - * @param signature the record component signature. May be {@literal null} if the record component - * type does not use generic types. + * @param signature the record component signature. May be {@literal null} if the record + * component type does not use generic types. * @return a visitor to visit this record component annotations and attributes, or {@literal null} - * if this class visitor is not interested in visiting these annotations and attributes. + * if this class visitor is not interested in visiting these annotations and attributes. */ public RecordComponentVisitor visitRecordComponent( final String name, final String descriptor, final String signature) { @@ -296,20 +288,21 @@ public abstract class ClassVisitor { /** * Visits a field of the class. * - * @param access the field's access flags (see {@link Opcodes}). This parameter also indicates if - * the field is synthetic and/or deprecated. - * @param name the field's name. + * @param access the field's access flags (see {@link Opcodes}). This parameter also indicates + * if the field is synthetic and/or deprecated. + * @param name the field's name. * @param descriptor the field's descriptor (see {@link Type}). - * @param signature the field's signature. May be {@literal null} if the field's type does not use - * generic types. - * @param value the field's initial value. This parameter, which may be {@literal null} if the - * field does not have an initial value, must be an {@link Integer}, a {@link Float}, a {@link - * Long}, a {@link Double} or a {@link String} (for {@code int}, {@code float}, {@code long} - * or {@code String} fields respectively). This parameter is only used for static - * fields. Its value is ignored for non static fields, which must be initialized through - * bytecode instructions in constructors or methods. + * @param signature the field's signature. May be {@literal null} if the field's type does not + * use generic types. + * @param value the field's initial value. This parameter, which may be {@literal null} if + * the field does not have an initial value, must be an {@link Integer}, a + * {@link Float}, a {@link Long}, a {@link Double} or a {@link String} (for + * {@code int}, {@code float}, {@code long} or {@code String} fields + * respectively). This parameter is only used for static fields. Its + * value is ignored for non static fields, which must be initialized through + * bytecode instructions in constructors or methods. * @return a visitor to visit field annotations and attributes, or {@literal null} if this class - * visitor is not interested in visiting these annotations and attributes. + * visitor is not interested in visiting these annotations and attributes. */ public FieldVisitor visitField( final int access, @@ -328,16 +321,16 @@ public abstract class ClassVisitor { * instance (or {@literal null}) each time it is called, i.e., it should not return a previously * returned visitor. * - * @param access the method's access flags (see {@link Opcodes}). This parameter also indicates if - * the method is synthetic and/or deprecated. - * @param name the method's name. + * @param access the method's access flags (see {@link Opcodes}). This parameter also + * indicates if the method is synthetic and/or deprecated. + * @param name the method's name. * @param descriptor the method's descriptor (see {@link Type}). - * @param signature the method's signature. May be {@literal null} if the method parameters, - * return type and exceptions do not use generic types. - * @param exceptions the internal names of the method's exception classes (see {@link - * Type#getInternalName()}). May be {@literal null}. + * @param signature the method's signature. May be {@literal null} if the method parameters, + * return type and exceptions do not use generic types. + * @param exceptions the internal names of the method's exception classes (see + * {@link Type#getInternalName()}). May be {@literal null}. * @return an object to visit the byte code of the method, or {@literal null} if this class - * visitor is not interested in visiting the code of this method. + * visitor is not interested in visiting the code of this method. */ public MethodVisitor visitMethod( final int access, diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassWriter.java index 056c01a7273e5b64224a77970b0bdb6db268042b..e0017b83798b5ffdca2622949e4ad214b0b39247 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ClassWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -24,12 +12,13 @@ public class ClassWriter extends ClassVisitor { /** * A flag to automatically compute the maximum stack size and the maximum number of local - * variables of methods. If this flag is set, then the arguments of the {@link - * MethodVisitor#visitMaxs} method of the {@link MethodVisitor} returned by the {@link - * #visitMethod} method will be ignored, and computed automatically from the signature and the - * bytecode of each method. + * variables of methods. If this flag is set, then the arguments of the + * {@link MethodVisitor#visitMaxs} method of the {@link MethodVisitor} returned by the + * {@link #visitMethod} method will be ignored, and computed automatically from the signature and + * the bytecode of each method. * - *

Note: for classes whose version is {@link Opcodes#V1_7} of more, this option requires + *

Note: for classes whose version is {@link Opcodes#V1_7} of more, this option + * requires * valid stack map frames. The maximum stack size is then computed from these frames, and from the * bytecode instructions in between. If stack map frames are not present or must be recomputed, * used {@link #COMPUTE_FRAMES} instead. @@ -41,9 +30,9 @@ public class ClassWriter extends ClassVisitor { /** * A flag to automatically compute the stack map frames of methods from scratch. If this flag is * set, then the calls to the {@link MethodVisitor#visitFrame} method are ignored, and the stack - * map frames are recomputed from the methods bytecode. The arguments of the {@link - * MethodVisitor#visitMaxs} method are also ignored and recomputed from the bytecode. In other - * words, {@link #COMPUTE_FRAMES} implies {@link #COMPUTE_MAXS}. + * map frames are recomputed from the methods bytecode. The arguments of the + * {@link MethodVisitor#visitMaxs} method are also ignored and recomputed from the bytecode. In + * other words, {@link #COMPUTE_FRAMES} implies {@link #COMPUTE_MAXS}. * * @see #ClassWriter(int) */ @@ -58,7 +47,9 @@ public class ClassWriter extends ClassVisitor { */ private int version; - /** The symbol table for this class (contains the constant_pool and the BootstrapMethods). */ + /** + * The symbol table for this class (contains the constant_pool and the BootstrapMethods). + */ private final SymbolTable symbolTable; /** @@ -68,16 +59,24 @@ public class ClassWriter extends ClassVisitor { */ private int accessFlags; - /** The this_class field of the JVMS ClassFile structure. */ + /** + * The this_class field of the JVMS ClassFile structure. + */ private int thisClass; - /** The super_class field of the JVMS ClassFile structure. */ + /** + * The super_class field of the JVMS ClassFile structure. + */ private int superClass; - /** The interface_count field of the JVMS ClassFile structure. */ + /** + * The interface_count field of the JVMS ClassFile structure. + */ private int interfaceCount; - /** The 'interfaces' array of the JVMS ClassFile structure. */ + /** + * The 'interfaces' array of the JVMS ClassFile structure. + */ private int[] interfaces; /** @@ -104,25 +103,39 @@ public class ClassWriter extends ClassVisitor { */ private MethodWriter lastMethod; - /** The number_of_classes field of the InnerClasses attribute, or 0. */ + /** + * The number_of_classes field of the InnerClasses attribute, or 0. + */ private int numberOfInnerClasses; - /** The 'classes' array of the InnerClasses attribute, or {@literal null}. */ + /** + * The 'classes' array of the InnerClasses attribute, or {@literal null}. + */ private ByteVector innerClasses; - /** The class_index field of the EnclosingMethod attribute, or 0. */ + /** + * The class_index field of the EnclosingMethod attribute, or 0. + */ private int enclosingClassIndex; - /** The method_index field of the EnclosingMethod attribute. */ + /** + * The method_index field of the EnclosingMethod attribute. + */ private int enclosingMethodIndex; - /** The signature_index field of the Signature attribute, or 0. */ + /** + * The signature_index field of the Signature attribute, or 0. + */ private int signatureIndex; - /** The source_file_index field of the SourceFile attribute, or 0. */ + /** + * The source_file_index field of the SourceFile attribute, or 0. + */ private int sourceFileIndex; - /** The debug_extension field of the SourceDebugExtension attribute, or {@literal null}. */ + /** + * The debug_extension field of the SourceDebugExtension attribute, or {@literal null}. + */ private ByteVector debugExtension; /** @@ -149,22 +162,34 @@ public class ClassWriter extends ClassVisitor { */ private AnnotationWriter lastRuntimeInvisibleTypeAnnotation; - /** The Module attribute of this class, or {@literal null}. */ + /** + * The Module attribute of this class, or {@literal null}. + */ private ModuleWriter moduleWriter; - /** The host_class_index field of the NestHost attribute, or 0. */ + /** + * The host_class_index field of the NestHost attribute, or 0. + */ private int nestHostClassIndex; - /** The number_of_classes field of the NestMembers attribute, or 0. */ + /** + * The number_of_classes field of the NestMembers attribute, or 0. + */ private int numberOfNestMemberClasses; - /** The 'classes' array of the NestMembers attribute, or {@literal null}. */ + /** + * The 'classes' array of the NestMembers attribute, or {@literal null}. + */ private ByteVector nestMemberClasses; - /** The number_of_classes field of the PermittedSubclasses attribute, or 0. */ + /** + * The number_of_classes field of the PermittedSubclasses attribute, or 0. + */ private int numberOfPermittedSubclasses; - /** The 'classes' array of the PermittedSubclasses attribute, or {@literal null}. */ + /** + * The 'classes' array of the PermittedSubclasses attribute, or {@literal null}. + */ private ByteVector permittedSubclasses; /** @@ -182,20 +207,20 @@ public class ClassWriter extends ClassVisitor { private RecordComponentWriter lastRecordComponent; /** - * The first non standard attribute of this class. The next ones can be accessed with the {@link - * Attribute#nextAttribute} field. May be {@literal null}. + * The first non standard attribute of this class. The next ones can be accessed with the + * {@link Attribute#nextAttribute} field. May be {@literal null}. * *

WARNING: this list stores the attributes in the reverse order of their visit. - * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The {@link - * #toByteArray} method writes the attributes in the order defined by this list, i.e. in the - * reverse order specified by the user. + * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The + * {@link #toByteArray} method writes the attributes in the order defined by this list, i.e. in + * the reverse order specified by the user. */ private Attribute firstAttribute; /** - * Indicates what must be automatically computed in {@link MethodWriter}. Must be one of {@link - * MethodWriter#COMPUTE_NOTHING}, {@link MethodWriter#COMPUTE_MAX_STACK_AND_LOCAL}, {@link - * MethodWriter#COMPUTE_INSERTED_FRAMES}, or {@link MethodWriter#COMPUTE_ALL_FRAMES}. + * Indicates what must be automatically computed in {@link MethodWriter}. Must be one of + * {@link MethodWriter#COMPUTE_NOTHING}, {@link MethodWriter#COMPUTE_MAX_STACK_AND_LOCAL}, + * {@link MethodWriter#COMPUTE_INSERTED_FRAMES}, or {@link MethodWriter#COMPUTE_ALL_FRAMES}. */ private int compute; @@ -207,7 +232,7 @@ public class ClassWriter extends ClassVisitor { * Constructs a new {@link ClassWriter} object. * * @param flags option flags that can be used to modify the default behavior of this class. Must - * be zero or more of {@link #COMPUTE_MAXS} and {@link #COMPUTE_FRAMES}. + * be zero or more of {@link #COMPUTE_MAXS} and {@link #COMPUTE_FRAMES}. */ public ClassWriter(final int flags) { this(null, flags); @@ -230,12 +255,13 @@ public class ClassWriter extends ClassVisitor { * * * @param classReader the {@link ClassReader} used to read the original class. It will be used to - * copy the entire constant pool and bootstrap methods from the original class and also to - * copy other fragments of original bytecode where applicable. - * @param flags option flags that can be used to modify the default behavior of this class.Must be - * zero or more of {@link #COMPUTE_MAXS} and {@link #COMPUTE_FRAMES}. These option flags do - * not affect methods that are copied as is in the new class. This means that neither the - * maximum stack size nor the stack frames will be computed for these methods. + * copy the entire constant pool and bootstrap methods from the original class + * and also to copy other fragments of original bytecode where applicable. + * @param flags option flags that can be used to modify the default behavior of this + * class.Must be zero or more of {@link #COMPUTE_MAXS} and + * {@link #COMPUTE_FRAMES}. These option flags do not affect methods that + * are copied as is in the new class. This means that neither the maximum stack + * size nor the stack frames will be computed for these methods. */ public ClassWriter(final ClassReader classReader, final int flags) { super(/* latest api = */ Opcodes.ASM9); @@ -450,7 +476,7 @@ public class ClassWriter extends ClassVisitor { * Returns the content of the class file that was built by this ClassWriter. * * @return the binary content of the JVMS ClassFile structure that was built by this ClassWriter. - * @throws ClassTooLargeException if the constant pool of the class is too large. + * @throws ClassTooLargeException if the constant pool of the class is too large. * @throws MethodTooLargeException if the Code attribute of a method is too large. */ public byte[] toByteArray() { @@ -710,10 +736,10 @@ public class ClassWriter extends ClassVisitor { * with standard ones. This is done with a ClassReader -> ClassWriter round trip. * * @param classFile a class file containing ASM specific instructions, generated by this - * ClassWriter. + * ClassWriter. * @param hasFrames whether there is at least one stack map frames in 'classFile'. * @return an equivalent of 'classFile', with the ASM specific instructions replaced with standard - * ones. + * ones. */ private byte[] replaceAsmInstructions(final byte[] classFile, final boolean hasFrames) { final Attribute[] attributes = getAttributePrototypes(); @@ -775,11 +801,12 @@ public class ClassWriter extends ClassVisitor { /** * Adds a number or string constant to the constant pool of the class being build. Does nothing if - * the constant pool already contains a similar item. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * the constant pool already contains a similar item. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * * @param value the value of the constant to be added to the constant pool. This parameter must be - * an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a {@link String}. + * an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a + * {@link String}. * @return the index of a new or already existing constant item with the given value. */ public int newConst(final Object value) { @@ -852,16 +879,17 @@ public class ClassWriter extends ClassVisitor { * already contains a similar item. This method is intended for {@link Attribute} sub classes, * and is normally not needed by class generators or adapters. * - * @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, {@link - * Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link - * Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, - * {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of the field or method owner class. - * @param name the name of the field or method. + * @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, + * {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, + * {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, + * {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, + * {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of the field or method owner class. + * @param name the name of the field or method. * @param descriptor the descriptor of the field or method. * @return the index of a new or already existing method type reference item. - * @deprecated this method is superseded by {@link #newHandle(int, String, String, String, - * boolean)}. + * @deprecated this method is superseded by + * {@link #newHandle(int, String, String, String, boolean)}. */ @Deprecated public int newHandle( @@ -874,13 +902,14 @@ public class ClassWriter extends ClassVisitor { * already contains a similar item. This method is intended for {@link Attribute} sub classes, * and is normally not needed by class generators or adapters. * - * @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, {@link - * Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link - * Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, - * {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of the field or method owner class. - * @param name the name of the field or method. - * @param descriptor the descriptor of the field or method. + * @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, + * {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, + * {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, + * {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, + * {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of the field or method owner class. + * @param name the name of the field or method. + * @param descriptor the descriptor of the field or method. * @param isInterface true if the owner is an processer. * @return the index of a new or already existing method type reference item. */ @@ -895,12 +924,12 @@ public class ClassWriter extends ClassVisitor { /** * Adds a dynamic constant reference to the constant pool of the class being build. Does nothing - * if the constant pool already contains a similar item. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * if the constant pool already contains a similar item. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * - * @param name name of the invoked method. - * @param descriptor field descriptor of the constant type. - * @param bootstrapMethodHandle the bootstrap method. + * @param name name of the invoked method. + * @param descriptor field descriptor of the constant type. + * @param bootstrapMethodHandle the bootstrap method. * @param bootstrapMethodArguments the bootstrap method constant arguments. * @return the index of a new or already existing dynamic constant reference item. */ @@ -910,18 +939,18 @@ public class ClassWriter extends ClassVisitor { final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { return symbolTable.addConstantDynamic( - name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments) + name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments) .index; } /** * Adds an invokedynamic reference to the constant pool of the class being build. Does nothing if - * the constant pool already contains a similar item. This method is intended for {@link - * Attribute} sub classes, and is normally not needed by class generators or adapters. + * the constant pool already contains a similar item. This method is intended for + * {@link Attribute} sub classes, and is normally not needed by class generators or adapters. * - * @param name name of the invoked method. - * @param descriptor descriptor of the invoke method. - * @param bootstrapMethodHandle the bootstrap method. + * @param name name of the invoked method. + * @param descriptor descriptor of the invoke method. + * @param bootstrapMethodHandle the bootstrap method. * @param bootstrapMethodArguments the bootstrap method constant arguments. * @return the index of a new or already existing invokedynamic reference item. */ @@ -931,7 +960,7 @@ public class ClassWriter extends ClassVisitor { final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { return symbolTable.addConstantInvokeDynamic( - name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments) + name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments) .index; } @@ -940,8 +969,8 @@ public class ClassWriter extends ClassVisitor { * constant pool already contains a similar item. This method is intended for {@link Attribute} * sub classes, and is normally not needed by class generators or adapters. * - * @param owner the internal name of the field's owner class. - * @param name the field's name. + * @param owner the internal name of the field's owner class. + * @param name the field's name. * @param descriptor the field's descriptor. * @return the index of a new or already existing field reference item. */ @@ -954,9 +983,9 @@ public class ClassWriter extends ClassVisitor { * constant pool already contains a similar item. This method is intended for {@link Attribute} * sub classes, and is normally not needed by class generators or adapters. * - * @param owner the internal name of the method's owner class. - * @param name the method's name. - * @param descriptor the method's descriptor. + * @param owner the internal name of the method's owner class. + * @param name the method's name. + * @param descriptor the method's descriptor. * @param isInterface {@literal true} if {@code owner} is an processer. * @return the index of a new or already existing method reference item. */ @@ -970,7 +999,7 @@ public class ClassWriter extends ClassVisitor { * constant pool already contains a similar item. This method is intended for {@link Attribute} * sub classes, and is normally not needed by class generators or adapters. * - * @param name a name. + * @param name a name. * @param descriptor a type descriptor. * @return the index of a new or already existing name and type item. */ @@ -983,7 +1012,8 @@ public class ClassWriter extends ClassVisitor { // ----------------------------------------------------------------------------------------------- /** - * Returns the common super type of the two given types. The default implementation of this method + * Returns the common super type of the two given types. The default implementation of this + * method * loads the two given classes and uses the java.lang.Class methods to find the common * super class. It can be overridden to compute this common super type in other ways, in * particular without actually loading any class, or to take into account the class that is @@ -1025,9 +1055,9 @@ public class ClassWriter extends ClassVisitor { } /** - * Returns the {@link ClassLoader} to be used by the default implementation of {@link - * #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by - * default. + * Returns the {@link ClassLoader} to be used by the default implementation of + * {@link #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type + * by default. * * @return ClassLoader */ diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ConstantDynamic.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ConstantDynamic.java index 9fc08f8e9623cf0f6b0a81034b0fac05d2062cea..2fdac99dcee9c4c5321dedd07bafcba4058d1375 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ConstantDynamic.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ConstantDynamic.java @@ -1,29 +1,25 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; import java.util.Arrays; -/** A constant whose value is computed at runtime, with a bootstrap method. @Author Remi Forax */ +/** + * A constant whose value is computed at runtime, with a bootstrap method. @Author Remi Forax + */ public final class ConstantDynamic { - /** The constant name (can be arbitrary). */ + /** + * The constant name (can be arbitrary). + */ private final String name; - /** The constant type (must be a field descriptor). */ + /** + * The constant type (must be a field descriptor). + */ private final String descriptor; - /** The bootstrap method to use to compute the constant value at runtime. */ + /** + * The bootstrap method to use to compute the constant value at runtime. + */ private final Handle bootstrapMethod; /** @@ -35,11 +31,12 @@ public final class ConstantDynamic { /** * Constructs a new {@link ConstantDynamic}. * - * @param name the constant name (can be arbitrary). - * @param descriptor the constant type (must be a field descriptor). - * @param bootstrapMethod the bootstrap method to use to compute the constant value at runtime. + * @param name the constant name (can be arbitrary). + * @param descriptor the constant type (must be a field descriptor). + * @param bootstrapMethod the bootstrap method to use to compute the constant value at + * runtime. * @param bootstrapMethodArguments the arguments to pass to the bootstrap method, in order to - * compute the constant value at runtime. + * compute the constant value at runtime. */ public ConstantDynamic( final String name, @@ -84,7 +81,7 @@ public final class ConstantDynamic { * of this constant. * * @return the number of arguments passed to the bootstrap method, in order to compute the value - * of this constant. + * of this constant. */ public int getBootstrapMethodArgumentCount() { return bootstrapMethodArguments.length; @@ -95,7 +92,7 @@ public final class ConstantDynamic { * constant. * * @param index an argument index, between 0 and {@link #getBootstrapMethodArgumentCount()} - * (exclusive). + * (exclusive). * @return the argument passed to the bootstrap method, with the given index. */ public Object getBootstrapMethodArgument(final int index) { @@ -107,7 +104,7 @@ public final class ConstantDynamic { * constant. WARNING: this array must not be modified, and must not be returned to the user. * * @return the arguments to pass to the bootstrap method, in order to compute the value of this - * constant. + * constant. */ Object[] getBootstrapMethodArgumentsUnsafe() { return bootstrapMethodArguments; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Constants.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Constants.java index f2e421072a6d60dfcfc546341293be0860d8e137..49fb8e529e35f4cc8bd06e000c9627669744aa39 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Constants.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Constants.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; import java.io.DataInputStream; @@ -164,7 +152,8 @@ final class Constants { static final int ASM_IFNONNULL = Opcodes.IFNONNULL + ASM_IFNULL_OPCODE_DELTA; static final int ASM_GOTO_W = 220; - private Constants() {} + private Constants() { + } static void checkAsmExperimental(final Object caller) { Class callerClass = caller.getClass(); @@ -181,9 +170,9 @@ final class Constants { String member = "(Annotation|Class|Field|Method|Module|RecordComponent|Signature)"; return internalName.contains("Test$") || Pattern.matches( - "org/objectweb/asm/util/Trace" + member + "Visitor(\\$.*)?", internalName) + "org/objectweb/asm/util/Trace" + member + "Visitor(\\$.*)?", internalName) || Pattern.matches( - "org/objectweb/asm/util/Check" + member + "Adapter(\\$.*)?", internalName); + "org/objectweb/asm/util/Check" + member + "Adapter(\\$.*)?", internalName); } static void checkIsPreview(final InputStream classInputStream) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Context.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Context.java index 8e313a05988cba1c8a7fb74d7f7656e698038259..479b2687da5ab063e3961f862ba4a7aeb25a11bb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Context.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Context.java @@ -1,43 +1,43 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; -/** Information about a class being parsed in a {@link ClassReader}. @Author Eric Bruneton */ +/** + * Information about a class being parsed in a {@link ClassReader}. @Author Eric Bruneton + */ final class Context { - /** The prototypes of the attributes that must be parsed in this class. */ + /** + * The prototypes of the attributes that must be parsed in this class. + */ Attribute[] attributePrototypes; /** - * The options used to parse this class. One or more of {@link ClassReader#SKIP_CODE}, {@link - * ClassReader#SKIP_DEBUG}, {@link ClassReader#SKIP_FRAMES}, {@link ClassReader#EXPAND_FRAMES} or - * {@link ClassReader#EXPAND_ASM_INSNS}. + * The options used to parse this class. One or more of {@link ClassReader#SKIP_CODE}, + * {@link ClassReader#SKIP_DEBUG}, {@link ClassReader#SKIP_FRAMES}, + * {@link ClassReader#EXPAND_FRAMES} or {@link ClassReader#EXPAND_ASM_INSNS}. */ int parsingOptions; - /** The buffer used to read strings in the constant pool. */ + /** + * The buffer used to read strings in the constant pool. + */ char[] charBuffer; // Information about the current method, i.e. the one read in the current (or latest) call // to {@link ClassReader#readMethod()}. - /** The access flags of the current method. */ + /** + * The access flags of the current method. + */ int currentMethodAccessFlags; - /** The name of the current method. */ + /** + * The name of the current method. + */ String currentMethodName; - /** The descriptor of the current method. */ + /** + * The descriptor of the current method. + */ String currentMethodDescriptor; /** @@ -55,29 +55,39 @@ final class Context { */ int currentTypeAnnotationTarget; - /** The target_path of the current type annotation target. */ + /** + * The target_path of the current type annotation target. + */ TypePath currentTypeAnnotationTargetPath; - /** The start of each local variable range in the current local variable annotation. */ + /** + * The start of each local variable range in the current local variable annotation. + */ Label[] currentLocalVariableAnnotationRangeStarts; - /** The end of each local variable range in the current local variable annotation. */ + /** + * The end of each local variable range in the current local variable annotation. + */ Label[] currentLocalVariableAnnotationRangeEnds; /** - * The local variable index of each local variable range in the current local variable annotation. + * The local variable index of each local variable range in the current local variable + * annotation. */ int[] currentLocalVariableAnnotationRangeIndices; // Information about the current stack map frame, i.e. the one read in the current (or latest) // call to {@link ClassReader#readFrame()}. - /** The bytecode offset of the current stack map frame. */ + /** + * The bytecode offset of the current stack map frame. + */ int currentFrameOffset; /** - * The type of the current stack map frame. One of {@link Opcodes#F_FULL}, {@link - * Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or {@link Opcodes#F_SAME1}. + * The type of the current stack map frame. One of {@link Opcodes#F_FULL}, + * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or + * {@link Opcodes#F_SAME1}. */ int currentFrameType; @@ -96,9 +106,10 @@ final class Context { /** * The types of the local variables in the current stack map frame. Each type is represented with - * a single array element (even long and double), using the format described in {@link - * MethodVisitor#visitFrame}. Depending on {@link #currentFrameType}, this contains the types of - * all the local variables, or only those of the additional ones (compared to the previous frame). + * a single array element (even long and double), using the format described in + * {@link MethodVisitor#visitFrame}. Depending on {@link #currentFrameType}, this contains the + * types of all the local variables, or only those of the additional ones (compared to the + * previous frame). */ Object[] currentFrameLocalTypes; @@ -110,8 +121,8 @@ final class Context { /** * The types of the stack elements in the current stack map frame. Each type is represented with a - * single array element (even long and double), using the format described in {@link - * MethodVisitor#visitFrame}. + * single array element (even long and double), using the format described in + * {@link MethodVisitor#visitFrame}. */ Object[] currentFrameStackTypes; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/CurrentFrame.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/CurrentFrame.java index 23eabc71fd1169d7367775b03633a2861f0e4182..be1b669c93c2ebdd3391a34a5cff3f31997eba5b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/CurrentFrame.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/CurrentFrame.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Edge.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Edge.java index 35bb7a9e5b140887598386ce0798324fee679ae7..d1f3cda62f589d04e31c19b7c6a0857da5ebe4cb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Edge.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Edge.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -24,14 +12,14 @@ package cn.universal.core.engine.asm; final class Edge { /** - * A control flow graph edge corresponding to a jump or ret instruction. Only used with {@link - * ClassWriter#COMPUTE_FRAMES}. + * A control flow graph edge corresponding to a jump or ret instruction. Only used with + * {@link ClassWriter#COMPUTE_FRAMES}. */ static final int JUMP = 0; /** - * A control flow graph edge corresponding to an exception handler. Only used with {@link - * ClassWriter#COMPUTE_MAXS}. + * A control flow graph edge corresponding to an exception handler. Only used with + * {@link ClassWriter#COMPUTE_MAXS}. */ static final int EXCEPTION = 0x7FFFFFFF; @@ -52,7 +40,9 @@ final class Edge { */ final int info; - /** The successor block of this control flow graph edge. */ + /** + * The successor block of this control flow graph edge. + */ final Label successor; /** @@ -63,9 +53,9 @@ final class Edge { /** * Constructs a new Edge. * - * @param info see {@link #info}. + * @param info see {@link #info}. * @param successor see {@link #successor}. - * @param nextEdge see {@link #nextEdge}. + * @param nextEdge see {@link #nextEdge}. */ Edge(final int info, final Label successor, final Edge nextEdge) { this.info = info; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldVisitor.java index 8b2723b2d414d6584af202bb13d31de57206fa80..949b725049d4d52ce4ef40e1c2fed2577e8322c1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldVisitor.java @@ -1,40 +1,30 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** * A visitor to visit a Java field. The methods of this class must be called in the following order: - * ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code visitAttribute} )* {@code - * visitEnd}. @Author Eric Bruneton + * ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code visitAttribute} )* + * {@code visitEnd}. @Author Eric Bruneton */ public abstract class FieldVisitor { /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link - * Opcodes#ASM8} or {@link Opcodes#ASM9}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, + * {@link Opcodes#ASM8} or {@link Opcodes#ASM9}. */ protected final int api; - /** The field visitor to which this visitor must delegate method calls. May be {@literal null}. */ + /** + * The field visitor to which this visitor must delegate method calls. May be {@literal null}. + */ protected FieldVisitor fv; /** * Constructs a new {@link FieldVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7}, {@link - * Opcodes#ASM8} or {@link Opcodes#ASM9}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, + * {@link Opcodes#ASM7}, {@link Opcodes#ASM8} or {@link Opcodes#ASM9}. */ public FieldVisitor(final int api) { this(api, null); @@ -43,11 +33,11 @@ public abstract class FieldVisitor { /** * Constructs a new {@link FieldVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, {@link Opcodes#ASM7} or {@link - * Opcodes#ASM8}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6}, + * {@link Opcodes#ASM7} or {@link Opcodes#ASM8}. * @param fieldVisitor the field visitor to which this visitor must delegate method calls. May be - * null. + * null. */ public FieldVisitor(final int api, final FieldVisitor fieldVisitor) { if (api != Opcodes.ASM9 @@ -70,9 +60,9 @@ public abstract class FieldVisitor { * Visits an annotation of the field. * * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (fv != null) { @@ -84,15 +74,15 @@ public abstract class FieldVisitor { /** * Visits an annotation on the type of the field. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#FIELD}. See {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#FIELD}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldWriter.java index 9826f5ed81eda808970bb39194e9c33bdffcef3e..324ae5b5f4f300969c3f4aa0ee636199aed1d09d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/FieldWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -17,11 +5,13 @@ package cn.universal.core.engine.asm; * Java Virtual Machine Specification (JVMS). @Author Eric Bruneton * * @see JVMS - * 4.5 + * 4.5 */ final class FieldWriter extends FieldVisitor { - /** Where the constants used in this FieldWriter must be stored. */ + /** + * Where the constants used in this FieldWriter must be stored. + */ private final SymbolTable symbolTable; // Note: fields are ordered as in the field_info structure, and those related to attributes are @@ -34,10 +24,14 @@ final class FieldWriter extends FieldVisitor { */ private final int accessFlags; - /** The name_index field of the field_info JVMS structure. */ + /** + * The name_index field of the field_info JVMS structure. + */ private final int nameIndex; - /** The descriptor_index field of the field_info JVMS structure. */ + /** + * The descriptor_index field of the field_info JVMS structure. + */ private final int descriptorIndex; /** @@ -77,13 +71,13 @@ final class FieldWriter extends FieldVisitor { private AnnotationWriter lastRuntimeInvisibleTypeAnnotation; /** - * The first non standard attribute of this field. The next ones can be accessed with the {@link - * Attribute#nextAttribute} field. May be {@literal null}. + * The first non standard attribute of this field. The next ones can be accessed with the + * {@link Attribute#nextAttribute} field. May be {@literal null}. * *

WARNING: this list stores the attributes in the reverse order of their visit. - * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The {@link - * #putFieldInfo} method writes the attributes in the order defined by this list, i.e. in the - * reverse order specified by the user. + * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The + * {@link #putFieldInfo} method writes the attributes in the order defined by this list, i.e. in + * the reverse order specified by the user. */ private Attribute firstAttribute; @@ -94,11 +88,11 @@ final class FieldWriter extends FieldVisitor { /** * Constructs a new {@link FieldWriter}. * - * @param symbolTable where the constants used in this FieldWriter must be stored. - * @param access the field's access flags (see {@link Opcodes}). - * @param name the field's name. - * @param descriptor the field's descriptor (see {@link Type}). - * @param signature the field's signature. May be {@literal null}. + * @param symbolTable where the constants used in this FieldWriter must be stored. + * @param access the field's access flags (see {@link Opcodes}). + * @param name the field's name. + * @param descriptor the field's descriptor (see {@link Type}). + * @param signature the field's signature. May be {@literal null}. * @param constantValue the field's constant value. May be {@literal null}. */ FieldWriter( diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Frame.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Frame.java index e693b917464061547096021d4fdc76cffa80e810..e97c0567527da3a0df791b556d60c2f92854de44 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Frame.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Frame.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -131,10 +119,14 @@ class Frame { // Constants to manipulate the DIM field of an abstract type. - /** The constant to be added to an abstract type to get one with one more array dimension. */ + /** + * The constant to be added to an abstract type to get one with one more array dimension. + */ private static final int ARRAY_OF = +1 << DIM_SHIFT; - /** The constant to be added to an abstract type to get one with one less array dimension. */ + /** + * The constant to be added to an abstract type to get one with one less array dimension. + */ private static final int ELEMENT_OF = -1 << DIM_SHIFT; // Possible values for the KIND field of an abstract type. @@ -172,19 +164,29 @@ class Frame { // Instance fields // ----------------------------------------------------------------------------------------------- - /** The basic block to which these input and output stack map frames correspond. */ + /** + * The basic block to which these input and output stack map frames correspond. + */ Label owner; - /** The input stack map frame locals. This is an array of abstract types. */ + /** + * The input stack map frame locals. This is an array of abstract types. + */ private int[] inputLocals; - /** The input stack map frame stack. This is an array of abstract types. */ + /** + * The input stack map frame stack. This is an array of abstract types. + */ private int[] inputStack; - /** The output stack map frame locals. This is an array of abstract types. */ + /** + * The output stack map frame locals. This is an array of abstract types. + */ private int[] outputLocals; - /** The output stack map frame stack. This is an array of abstract types. */ + /** + * The output stack map frame stack. This is an array of abstract types. + */ private int[] outputStack; /** @@ -195,10 +197,14 @@ class Frame { */ private short outputStackStart; - /** The index of the top stack element in {@link #outputStack}. */ + /** + * The index of the top stack element in {@link #outputStack}. + */ private short outputStackTop; - /** The number of types that are initialized in the basic block. See {@link #initializations}. */ + /** + * The number of types that are initialized in the basic block. See {@link #initializations}. + */ private int initializationCount; /** @@ -253,11 +259,12 @@ class Frame { * Returns the abstract type corresponding to the given public API frame element type. * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param type a frame element type described using the same format as in {@link - * MethodVisitor#visitFrame}, i.e. either {@link Opcodes#TOP}, {@link Opcodes#INTEGER}, {@link - * Opcodes#FLOAT}, {@link Opcodes#LONG}, {@link Opcodes#DOUBLE}, {@link Opcodes#NULL}, or - * {@link Opcodes#UNINITIALIZED_THIS}, or the internal name of a class, or a Label designating - * a NEW instruction (for uninitialized types). + * @param type a frame element type described using the same format as in + * {@link MethodVisitor#visitFrame}, i.e. either {@link Opcodes#TOP}, + * {@link Opcodes#INTEGER}, {@link Opcodes#FLOAT}, {@link Opcodes#LONG}, + * {@link Opcodes#DOUBLE}, {@link Opcodes#NULL}, or + * {@link Opcodes#UNINITIALIZED_THIS}, or the internal name of a class, or a + * Label designating a NEW instruction (for uninitialized types). * @return the abstract type corresponding to the given frame element type. */ static int getAbstractTypeFromApiFormat(final SymbolTable symbolTable, final Object type) { @@ -275,9 +282,9 @@ class Frame { /** * Returns the abstract type corresponding to the internal name of a class. * - * @param symbolTable the type table to use to lookup and store type {@link Symbol}. + * @param symbolTable the type table to use to lookup and store type {@link Symbol}. * @param internalName the internal name of a class. This must not be an array type - * descriptor. + * descriptor. * @return the abstract type value corresponding to the given internal name. */ static int getAbstractTypeFromInternalName( @@ -289,8 +296,8 @@ class Frame { * Returns the abstract type corresponding to the given type descriptor. * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param buffer a string ending with a type descriptor. - * @param offset the start offset of the type descriptor in buffer. + * @param buffer a string ending with a type descriptor. + * @param offset the start offset of the type descriptor in buffer. * @return the abstract type corresponding to the given type descriptor. */ private static int getAbstractTypeFromDescriptor( @@ -368,9 +375,9 @@ class Frame { * attribute). * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param access the method's access flags. - * @param descriptor the method descriptor. - * @param maxLocals the maximum number of local variables of the method. + * @param access the method's access flags. + * @param descriptor the method descriptor. + * @param maxLocals the maximum number of local variables of the method. */ final void setInputFrameFromDescriptor( final SymbolTable symbolTable, @@ -405,12 +412,12 @@ class Frame { * Sets the input frame from the given public API frame description. * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param numLocal the number of local variables. - * @param local the local variable types, described using the same format as in {@link - * MethodVisitor#visitFrame}. - * @param numStack the number of operand stack elements. - * @param stack the operand stack types, described using the same format as in {@link - * MethodVisitor#visitFrame}. + * @param numLocal the number of local variables. + * @param local the local variable types, described using the same format as in + * {@link MethodVisitor#visitFrame}. + * @param numStack the number of operand stack elements. + * @param stack the operand stack types, described using the same format as in + * {@link MethodVisitor#visitFrame}. */ final void setInputFrameFromApiFormat( final SymbolTable symbolTable, @@ -479,7 +486,7 @@ class Frame { /** * Replaces the abstract type stored at the given local variable index in the output frame. * - * @param localIndex the index of the output frame local variable that must be set. + * @param localIndex the index of the output frame local variable that must be set. * @param abstractType the value that must be set. */ private void setLocal(final int localIndex, final int abstractType) { @@ -527,7 +534,7 @@ class Frame { * Pushes the abstract type corresponding to the given descriptor on the output frame stack. * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param descriptor a type or method descriptor (in which case its return type is pushed). + * @param descriptor a type or method descriptor (in which case its return type is pushed). */ private void push(final SymbolTable symbolTable, final String descriptor) { int typeDescriptorOffset = @@ -616,11 +623,11 @@ class Frame { /** * Returns the "initialized" abstract type corresponding to the given abstract type. * - * @param symbolTable the type table to use to lookup and store type {@link Symbol}. + * @param symbolTable the type table to use to lookup and store type {@link Symbol}. * @param abstractType an abstract type. * @return the REFERENCE_KIND abstract type corresponding to abstractType if it is - * UNINITIALIZED_THIS or an UNINITIALIZED_KIND abstract type for one of the types on which a - * constructor is invoked in the basic block. Otherwise returns abstractType. + * UNINITIALIZED_THIS or an UNINITIALIZED_KIND abstract type for one of the types on which a + * constructor is invoked in the basic block. Otherwise returns abstractType. */ private int getInitializedType(final SymbolTable symbolTable, final int abstractType) { if (abstractType == UNINITIALIZED_THIS @@ -655,9 +662,9 @@ class Frame { /** * Simulates the action of the given instruction on the output stack frame. * - * @param opcode the opcode of the instruction. - * @param arg the numeric operand of the instruction, if any. - * @param argSymbol the Symbol operand of the instruction, if any. + * @param opcode the opcode of the instruction. + * @param arg the numeric operand of the instruction, if any. + * @param argSymbol the Symbol operand of the instruction, if any. * @param symbolTable the type table to use to lookup and store type {@link Symbol}. */ void execute( @@ -1098,8 +1105,8 @@ class Frame { * Computes the concrete output type corresponding to a given abstract output type. * * @param abstractOutputType an abstract output type. - * @param numStack the size of the input stack, used to resolve abstract output types of - * STACK_KIND kind. + * @param numStack the size of the input stack, used to resolve abstract output types of + * STACK_KIND kind. * @return the concrete output type corresponding to 'abstractOutputType'. */ private int getConcreteOutputType(final int abstractOutputType, final int numStack) { @@ -1135,11 +1142,12 @@ class Frame { * {@link Frame}. Returns {@literal true} if the given frame has been changed by this operation * (the input and output frames of this {@link Frame} are never changed). * - * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param dstFrame the {@link Frame} whose input frame must be updated. This should be the frame - * of a successor, in the control flow graph, of the basic block corresponding to this frame. + * @param symbolTable the type table to use to lookup and store type {@link Symbol}. + * @param dstFrame the {@link Frame} whose input frame must be updated. This should be the + * frame of a successor, in the control flow graph, of the basic block + * corresponding to this frame. * @param catchTypeIndex if 'frame' corresponds to an exception handler basic block, the type - * table index of the caught exception type, otherwise 0. + * table index of the caught exception type, otherwise 0. * @return {@literal true} if the input frame of 'frame' has been changed by this operation. */ final boolean merge( @@ -1234,13 +1242,14 @@ class Frame { * Returns {@literal true} if the type array has been modified by this operation. * * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param sourceType the abstract type with which the abstract type array element must be merged. - * This type should be of {@link #CONSTANT_KIND}, {@link #REFERENCE_KIND} or {@link - * #UNINITIALIZED_KIND} kind, with positive or {@literal null} array dimensions. - * @param dstTypes an array of abstract types. These types should be of {@link #CONSTANT_KIND}, - * {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive or {@literal - * null} array dimensions. - * @param dstIndex the index of the type that must be merged in dstTypes. + * @param sourceType the abstract type with which the abstract type array element must be merged. + * This type should be of {@link #CONSTANT_KIND}, {@link #REFERENCE_KIND} or + * {@link #UNINITIALIZED_KIND} kind, with positive or {@literal null} array + * dimensions. + * @param dstTypes an array of abstract types. These types should be of {@link #CONSTANT_KIND}, + * {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive + * or {@literal null} array dimensions. + * @param dstIndex the index of the type that must be merged in dstTypes. * @return {@literal true} if the type array has been modified by this operation. */ private static boolean merge( @@ -1330,8 +1339,8 @@ class Frame { * done with the {@link MethodWriter#visitFrameStart}, {@link MethodWriter#visitAbstractType} and * {@link MethodWriter#visitFrameEnd} methods. * - * @param methodWriter the {@link MethodWriter} that should visit the input frame of this {@link - * Frame}. + * @param methodWriter the {@link MethodWriter} that should visit the input frame of this + * {@link Frame}. */ final void accept(final MethodWriter methodWriter) { // Compute the number of locals, ignoring TOP types that are just after a LONG or a DOUBLE, and @@ -1380,12 +1389,12 @@ class Frame { * Put the given abstract type in the given ByteVector, using the JVMS verification_type_info * format used in StackMapTable attributes. * - * @param symbolTable the type table to use to lookup and store type {@link Symbol}. - * @param abstractType an abstract type, restricted to {@link Frame#CONSTANT_KIND}, {@link - * Frame#REFERENCE_KIND} or {@link Frame#UNINITIALIZED_KIND} types. - * @param output where the abstract type must be put. + * @param symbolTable the type table to use to lookup and store type {@link Symbol}. + * @param abstractType an abstract type, restricted to {@link Frame#CONSTANT_KIND}, + * {@link Frame#REFERENCE_KIND} or {@link Frame#UNINITIALIZED_KIND} types. + * @param output where the abstract type must be put. * @see JVMS - * 4.7.4 + * 4.7.4 */ static void putAbstractType( final SymbolTable symbolTable, final int abstractType, final ByteVector output) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handle.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handle.java index 75c926126a23f82dd6ebde436e7032de034b335d..ee3980a6875cf54f34d10e9e6cc0bb0317ba6d40 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handle.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handle.java @@ -1,54 +1,54 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; -/** A reference to a field or a method. @Author Remi Forax @Author Eric Bruneton */ +/** + * A reference to a field or a method. @Author Remi Forax @Author Eric Bruneton + */ public final class Handle { /** * The kind of field or method designated by this Handle. Should be {@link Opcodes#H_GETFIELD}, - * {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link - * Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, - * {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. + * {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, + * {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. */ private final int tag; - /** The internal name of the class that owns the field or method designated by this handle. */ + /** + * The internal name of the class that owns the field or method designated by this handle. + */ private final String owner; - /** The name of the field or method designated by this handle. */ + /** + * The name of the field or method designated by this handle. + */ private final String name; - /** The descriptor of the field or method designated by this handle. */ + /** + * The descriptor of the field or method designated by this handle. + */ private final String descriptor; - /** Whether the owner is an processer or not. */ + /** + * Whether the owner is an processer or not. + */ private final boolean isInterface; /** * Constructs a new field or method handle. * - * @param tag the kind of field or method designated by this Handle. Must be {@link - * Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link - * Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, - * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or {@link - * Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of the class that owns the field or method designated by this - * handle. - * @param name the name of the field or method designated by this handle. + * @param tag the kind of field or method designated by this Handle. Must be + * {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, + * {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, + * {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of the class that owns the field or method designated by + * this handle. + * @param name the name of the field or method designated by this handle. * @param descriptor the descriptor of the field or method designated by this handle. - * @deprecated this constructor has been superseded by {@link #Handle(int, String, String, String, - * boolean)}. + * @deprecated this constructor has been superseded by + * {@link #Handle(int, String, String, String, boolean)}. */ @Deprecated public Handle(final int tag, final String owner, final String name, final String descriptor) { @@ -58,15 +58,16 @@ public final class Handle { /** * Constructs a new field or method handle. * - * @param tag the kind of field or method designated by this Handle. Must be {@link - * Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link - * Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, - * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or {@link - * Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of the class that owns the field or method designated by this - * handle. - * @param name the name of the field or method designated by this handle. - * @param descriptor the descriptor of the field or method designated by this handle. + * @param tag the kind of field or method designated by this Handle. Must be + * {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, + * {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, + * {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of the class that owns the field or method designated by + * this handle. + * @param name the name of the field or method designated by this handle. + * @param descriptor the descriptor of the field or method designated by this handle. * @param isInterface whether the owner is an processer or not. */ public Handle( @@ -86,16 +87,17 @@ public final class Handle { * Returns the kind of field or method designated by this handle. * * @return {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, - * {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link - * Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, {@link - * Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. + * {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. */ public int getTag() { return tag; } /** - * Returns the internal name of the class that owns the field or method designated by this handle. + * Returns the internal name of the class that owns the field or method designated by this + * handle. * * @return the internal name of the class that owns the field or method designated by this handle. */ diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handler.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handler.java index a9c04e71e7b8a94d7006d9c1cd8d11b1fb9cffbe..ab7c98111750000531e9fc1f03eb98c2706e64d1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handler.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Handler.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -19,7 +7,7 @@ package cn.universal.core.engine.asm; * exception_table array. @Author Eric Bruneton * * @see JVMS - * 4.7.3 + * 4.7.3 */ final class Handler { @@ -53,18 +41,20 @@ final class Handler { */ final String catchTypeDescriptor; - /** The next exception handler. */ + /** + * The next exception handler. + */ Handler nextHandler; /** * Constructs a new Handler. * - * @param startPc the start_pc field of this JVMS exception_table entry. - * @param endPc the end_pc field of this JVMS exception_table entry. - * @param handlerPc the handler_pc field of this JVMS exception_table entry. - * @param catchType The catch_type field of this JVMS exception_table entry. + * @param startPc the start_pc field of this JVMS exception_table entry. + * @param endPc the end_pc field of this JVMS exception_table entry. + * @param handlerPc the handler_pc field of this JVMS exception_table entry. + * @param catchType The catch_type field of this JVMS exception_table entry. * @param catchTypeDescriptor The internal name of the type of exceptions handled by this handler, - * or {@literal null} to catch any exceptions. + * or {@literal null} to catch any exceptions. */ Handler( final Label startPc, @@ -84,7 +74,7 @@ final class Handler { * * @param handler an existing Handler. * @param startPc the start_pc field of this JVMS exception_table entry. - * @param endPc the end_pc field of this JVMS exception_table entry. + * @param endPc the end_pc field of this JVMS exception_table entry. */ Handler(final Handler handler, final Label startPc, final Label endPc) { this(startPc, endPc, handler.handlerPc, handler.catchType, handler.catchTypeDescriptor); @@ -96,8 +86,8 @@ final class Handler { * element. * * @param firstHandler the beginning of a Handler list. May be {@literal null}. - * @param start the start of the range to be removed. - * @param end the end of the range to be removed. Maybe {@literal null}. + * @param start the start of the range to be removed. + * @param end the end of the range to be removed. Maybe {@literal null}. * @return the exception handler list with the start-end range removed. */ static Handler removeRange(final Handler firstHandler, final Label start, final Label end) { @@ -165,7 +155,8 @@ final class Handler { * element. This includes the exception_table_length field. * * @param firstHandler the beginning of a Handler list. May be {@literal null}. - * @param output where the exception_table_length and exception_table structures must be put. + * @param output where the exception_table_length and exception_table structures must be + * put. */ static void putExceptionTable(final Handler firstHandler, final ByteVector output) { output.putShort(getExceptionTableLength(firstHandler)); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Label.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Label.java index 5837d403260c392b8ed6eb2c0814a9ee3737db80..229b6a4bab619b1a53a32d23f1301b9e84b99d4f 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Label.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Label.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -33,10 +21,14 @@ public class Label { */ static final int FLAG_JUMP_TARGET = 2; - /** A flag indicating that the bytecode offset of a label is known. */ + /** + * A flag indicating that the bytecode offset of a label is known. + */ static final int FLAG_RESOLVED = 4; - /** A flag indicating that a label corresponds to a reachable basic block. */ + /** + * A flag indicating that a label corresponds to a reachable basic block. + */ static final int FLAG_REACHABLE = 8; /** @@ -61,7 +53,9 @@ public class Label { */ static final int FLAG_SUBROUTINE_START = 32; - /** A flag indicating that the basic block corresponding to a label is the end of a subroutine. */ + /** + * A flag indicating that the basic block corresponding to a label is the end of a subroutine. + */ static final int FLAG_SUBROUTINE_END = 64; /** @@ -121,9 +115,9 @@ public class Label { /** * The type and status of this label or its corresponding basic block. Must be zero or more of - * {@link #FLAG_DEBUG_ONLY}, {@link #FLAG_JUMP_TARGET}, {@link #FLAG_RESOLVED}, {@link - * #FLAG_REACHABLE}, {@link #FLAG_SUBROUTINE_CALLER}, {@link #FLAG_SUBROUTINE_START}, {@link - * #FLAG_SUBROUTINE_END}. + * {@link #FLAG_DEBUG_ONLY}, {@link #FLAG_JUMP_TARGET}, {@link #FLAG_RESOLVED}, + * {@link #FLAG_REACHABLE}, {@link #FLAG_SUBROUTINE_CALLER}, {@link #FLAG_SUBROUTINE_START}, + * {@link #FLAG_SUBROUTINE_END}. */ short flags; @@ -210,8 +204,8 @@ public class Label { /** * The maximum height reached by the output stack, relatively to the top of the input stack, in - * the basic block corresponding to this label. This maximum is always positive or {@literal - * null}. + * the basic block corresponding to this label. This maximum is always positive or + * {@literal null}. */ short outputStackMax; @@ -226,17 +220,17 @@ public class Label { /** * The input and output stack map frames of the basic block corresponding to this label. This - * field is only used when the {@link MethodWriter#COMPUTE_ALL_FRAMES} or {@link - * MethodWriter#COMPUTE_INSERTED_FRAMES} option is used. + * field is only used when the {@link MethodWriter#COMPUTE_ALL_FRAMES} or + * {@link MethodWriter#COMPUTE_INSERTED_FRAMES} option is used. */ Frame frame; /** * The successor of this label, in the order they are visited in {@link MethodVisitor#visitLabel}. - * This linked list does not include labels used for debug info only. If the {@link - * MethodWriter#COMPUTE_ALL_FRAMES} or {@link MethodWriter#COMPUTE_INSERTED_FRAMES} option is used - * then it does not contain either successive labels that denote the same bytecode offset (in this - * case only the first label appears in this list). + * This linked list does not include labels used for debug info only. If the + * {@link MethodWriter#COMPUTE_ALL_FRAMES} or {@link MethodWriter#COMPUTE_INSERTED_FRAMES} option + * is used then it does not contain either successive labels that denote the same bytecode offset + * (in this case only the first label appears in this list). */ Label nextBasicBlock; @@ -268,7 +262,9 @@ public class Label { // Constructor and accessors // ----------------------------------------------------------------------------------------------- - /** Constructs a new label. */ + /** + * Constructs a new label. + */ public Label() { // Nothing to do. } @@ -298,8 +294,8 @@ public class Label { * is used. * * @return the label itself if {@link #frame} is null, otherwise the Label's frame owner. This - * corresponds to the "canonical" label instance described above thanks to the way the label - * frame is set in {@link MethodWriter#visitLabel}. + * corresponds to the "canonical" label instance described above thanks to the way the label frame + * is set in {@link MethodWriter#visitLabel}. */ final Label getCanonicalInstance() { return frame == null ? this : frame.owner; @@ -334,7 +330,7 @@ public class Label { /** * Makes the given visitor visit this label and its source line numbers, if applicable. * - * @param methodVisitor a method visitor. + * @param methodVisitor a method visitor. * @param visitLineNumbers whether to visit of the label's source line numbers, if any. */ final void accept(final MethodVisitor methodVisitor, final boolean visitLineNumbers) { @@ -359,10 +355,12 @@ public class Label { * computed and written directly. Otherwise, a null relative offset is written and a new forward * reference is declared for this label. * - * @param code the bytecode of the method. This is where the reference is appended. + * @param code the bytecode of the method. This is where the reference is + * appended. * @param sourceInsnBytecodeOffset the bytecode offset of the instruction that contains the - * reference to be appended. - * @param wideReference whether the reference must be stored in 4 bytes (instead of 2 bytes). + * reference to be appended. + * @param wideReference whether the reference must be stored in 4 bytes (instead of 2 + * bytes). */ final void put( final ByteVector code, final int sourceInsnBytecodeOffset, final boolean wideReference) { @@ -389,11 +387,11 @@ public class Label { * bytecode offset of the reference can be, and must be, computed and stored directly. * * @param sourceInsnBytecodeOffset the bytecode offset of the instruction that contains the - * reference stored at referenceHandle. - * @param referenceType either {@link #FORWARD_REFERENCE_TYPE_SHORT} or {@link - * #FORWARD_REFERENCE_TYPE_WIDE}. - * @param referenceHandle the offset in the bytecode where the forward reference value must be - * stored. + * reference stored at referenceHandle. + * @param referenceType either {@link #FORWARD_REFERENCE_TYPE_SHORT} or + * {@link #FORWARD_REFERENCE_TYPE_WIDE}. + * @param referenceHandle the offset in the bytecode where the forward reference value + * must be stored. */ private void addForwardReference( final int sourceInsnBytecodeOffset, final int referenceType, final int referenceHandle) { @@ -417,13 +415,13 @@ public class Label { * the method, i.e. when its bytecode offset becomes known. This method fills in the blanks that * where left in the bytecode by each forward reference previously added to this label. * - * @param code the bytecode of the method. + * @param code the bytecode of the method. * @param bytecodeOffset the bytecode offset of this label. * @return {@literal true} if a blank that was left for this label was too small to store the - * offset. In such a case the corresponding jump instruction is replaced with an equivalent - * ASM specific instruction using an unsigned two bytes offset. These ASM specific - * instructions are later replaced with standard bytecode instructions with wider offsets (4 - * bytes instead of 2), in ClassReader. + * offset. In such a case the corresponding jump instruction is replaced with an equivalent ASM + * specific instruction using an unsigned two bytes offset. These ASM specific instructions are + * later replaced with standard bytecode instructions with wider offsets (4 bytes instead of 2), + * in ClassReader. */ final boolean resolve(final byte[] code, final int bytecodeOffset) { this.flags |= FLAG_RESOLVED; @@ -479,7 +477,7 @@ public class Label { * {@link #nextListElement}. * * @param subroutineId the id of the subroutine starting with the basic block corresponding to - * this label. + * this label. */ final void markSubroutine(final short subroutineId) { // Data flow algorithm: put this basic block in a list of blocks to process (which are blocks @@ -514,7 +512,8 @@ public class Label { * {@link #nextListElement}. * * @param subroutineCaller a basic block that ends with a jsr to the basic block corresponding to - * this label. This label is supposed to correspond to the start of a subroutine. + * this label. This label is supposed to correspond to the start of a + * subroutine. */ final void addSubroutineRetSuccessors(final Label subroutineCaller) { // Data flow algorithm: put this basic block in a list blocks to process (which are blocks @@ -567,7 +566,7 @@ public class Label { * blocks to process, and returns the new list. * * @param listOfLabelsToProcess a list of basic blocks to process, linked together with their - * {@link #nextListElement} field. + * {@link #nextListElement} field. * @return the new list of blocks to process. */ private Label pushSuccessors(final Label listOfLabelsToProcess) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodTooLargeException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodTooLargeException.java index 00b56ab62a83da54c6c9796ee8edb64120bc47f4..1f327ea2c7c9e7939fe3762f0f14c9be25d306d8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodTooLargeException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodTooLargeException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -28,10 +16,10 @@ public final class MethodTooLargeException extends IndexOutOfBoundsException { /** * Constructs a new {@link MethodTooLargeException}. * - * @param className the internal name of the owner class. + * @param className the internal name of the owner class. * @param methodName the name of the method. * @param descriptor the descriptor of the method. - * @param codeSize the size of the method's Code attribute, in bytes. + * @param codeSize the size of the method's Code attribute, in bytes. */ public MethodTooLargeException( final String className, diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodVisitor.java index 34df99a6370495139155ea9bc600c387383fdd07..70c22da07feabda995f30d1141329b2e20177c83 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodVisitor.java @@ -1,41 +1,30 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** * A visitor to visit a Java method. The methods of this class must be called in the following * order: ( {@code visitParameter} )* [ {@code visitAnnotationDefault} ] ( {@code visitAnnotation} | - * {@code visitAnnotableParameterCount} | {@code visitParameterAnnotation} {@code - * visitTypeAnnotation} | {@code visitAttribute} )* [ {@code visitCode} ( {@code visitFrame} | - * {@code visitXInsn} | {@code visitLabel} | {@code visitInsnAnnotation} | {@code - * visitTryCatchBlock} | {@code visitTryCatchAnnotation} | {@code visitLocalVariable} | {@code - * visitLocalVariableAnnotation} | {@code visitLineNumber} )* {@code visitMaxs} ] {@code visitEnd}. - * In addition, the {@code visitXInsn} and {@code visitLabel} methods must be called in the - * sequential order of the bytecode instructions of the visited code, {@code visitInsnAnnotation} - * must be called after the annotated instruction, {@code visitTryCatchBlock} must be called + * {@code visitAnnotableParameterCount} | {@code visitParameterAnnotation} + * {@code visitTypeAnnotation} | {@code visitAttribute} )* [ {@code visitCode} ( {@code visitFrame} + * | {@code visitXInsn} | {@code visitLabel} | {@code visitInsnAnnotation} | + * {@code visitTryCatchBlock} | {@code visitTryCatchAnnotation} | {@code visitLocalVariable} | + * {@code visitLocalVariableAnnotation} | {@code visitLineNumber} )* {@code visitMaxs} ] + * {@code visitEnd}. In addition, the {@code visitXInsn} and {@code visitLabel} methods must + * be called in the sequential order of the bytecode instructions of the visited code, + * {@code visitInsnAnnotation} must be called after the annotated instruction, + * {@code visitTryCatchBlock} must be called * before the labels passed as arguments have been visited, {@code * visitTryCatchBlockAnnotation} must be called after the corresponding try catch block has - * been visited, and the {@code visitLocalVariable}, {@code visitLocalVariableAnnotation} and {@code - * visitLineNumber} methods must be called after the labels passed as arguments have been - * visited. @Author Eric Bruneton + * been visited, and the {@code visitLocalVariable}, {@code visitLocalVariableAnnotation} and + * {@code visitLineNumber} methods must be called after the labels passed as arguments have + * been visited. @Author Eric Bruneton */ public abstract class MethodVisitor { private static final String REQUIRES_ASM5 = "This feature requires ASM5"; /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ protected final int api; @@ -47,8 +36,9 @@ public abstract class MethodVisitor { /** * Constructs a new {@link MethodVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. */ public MethodVisitor(final int api) { this(api, null); @@ -57,10 +47,11 @@ public abstract class MethodVisitor { /** * Constructs a new {@link MethodVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. * @param methodVisitor the method visitor to which this visitor must delegate method calls. May - * be null. + * be null. */ public MethodVisitor(final int api, final MethodVisitor methodVisitor) { if (api != Opcodes.ASM9 @@ -86,9 +77,9 @@ public abstract class MethodVisitor { /** * Visits a parameter of this method. * - * @param name parameter name or {@literal null} if none is provided. + * @param name parameter name or {@literal null} if none is provided. * @param access the parameter's access flags, only {@code ACC_FINAL}, {@code ACC_SYNTHETIC} - * or/and {@code ACC_MANDATED} are allowed (see {@link Opcodes}). + * or/and {@code ACC_MANDATED} are allowed (see {@link Opcodes}). */ public void visitParameter(final String name, final int access) { if (api < Opcodes.ASM5) { @@ -103,9 +94,9 @@ public abstract class MethodVisitor { * Visits the default value of this annotation processer method. * * @return a visitor to the visit the actual default value of this annotation processer method, or - * {@literal null} if this visitor is not interested in visiting this default value. The - * 'name' parameters passed to the methods of this annotation visitor are ignored. Moreover, - * exacly one visit method must be called on this annotation visitor, followed by visitEnd. + * {@literal null} if this visitor is not interested in visiting this default value. The 'name' + * parameters passed to the methods of this annotation visitor are ignored. Moreover, exacly one + * visit method must be called on this annotation visitor, followed by visitEnd. */ public AnnotationVisitor visitAnnotationDefault() { if (mv != null) { @@ -118,9 +109,9 @@ public abstract class MethodVisitor { * Visits an annotation of this method. * * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (mv != null) { @@ -132,18 +123,19 @@ public abstract class MethodVisitor { /** * Visits an annotation on a type in the method signature. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#METHOD_TYPE_PARAMETER}, {@link - * TypeReference#METHOD_TYPE_PARAMETER_BOUND}, {@link TypeReference#METHOD_RETURN}, {@link - * TypeReference#METHOD_RECEIVER}, {@link TypeReference#METHOD_FORMAL_PARAMETER} or {@link - * TypeReference#THROWS}. See {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#METHOD_TYPE_PARAMETER}, + * {@link TypeReference#METHOD_TYPE_PARAMETER_BOUND}, + * {@link TypeReference#METHOD_RETURN}, {@link TypeReference#METHOD_RECEIVER}, + * {@link TypeReference#METHOD_FORMAL_PARAMETER} or + * {@link TypeReference#THROWS}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { @@ -162,13 +154,14 @@ public abstract class MethodVisitor { * annotations. * * @param parameterCount the number of method parameters than can have annotations. This number - * must be less or equal than the number of parameter types in the method descriptor. It can - * be strictly less when a method has synthetic parameters and when these parameters are - * ignored when computing parameter indices for the purpose of parameter annotations (see - * https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18). - * @param visible {@literal true} to define the number of method parameters that can have - * annotations visible at runtime, {@literal false} to define the number of method parameters - * that can have annotations invisible at runtime. + * must be less or equal than the number of parameter types in the method + * descriptor. It can be strictly less when a method has synthetic + * parameters and when these parameters are ignored when computing parameter + * indices for the purpose of parameter annotations (see + * https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18). + * @param visible {@literal true} to define the number of method parameters that can have + * annotations visible at runtime, {@literal false} to define the number of + * method parameters that can have annotations invisible at runtime. */ public void visitAnnotableParameterCount(final int parameterCount, final boolean visible) { if (mv != null) { @@ -179,16 +172,17 @@ public abstract class MethodVisitor { /** * Visits an annotation of a parameter this method. * - * @param parameter the parameter index. This index must be strictly smaller than the number of - * parameters in the method descriptor, and strictly smaller than the parameter count - * specified in {@link #visitAnnotableParameterCount}. Important note: a parameter index i - * is not required to correspond to the i'th parameter descriptor in the method - * descriptor, in particular in case of synthetic parameters (see - * https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18). + * @param parameter the parameter index. This index must be strictly smaller than the number of + * parameters in the method descriptor, and strictly smaller than the parameter + * count specified in {@link #visitAnnotableParameterCount}. Important note: + * a parameter index i is not required to correspond to the i'th parameter + * descriptor in the method descriptor, in particular in case of synthetic + * parameters (see + * https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18). * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitParameterAnnotation( final int parameter, final String descriptor, final boolean visible) { @@ -209,7 +203,9 @@ public abstract class MethodVisitor { } } - /** Starts the visit of the method's code, if any (i.e. non abstract method). */ + /** + * Starts the visit of the method's code, if any (i.e. non abstract method). + */ public void visitCode() { if (mv != null) { mv.visitCode(); @@ -223,8 +219,8 @@ public abstract class MethodVisitor { * exception handler block. The visited types must describe the values of the local variables and * of the operand stack elements just before i is executed.
*
- * (*) this is mandatory only for classes whose version is greater than or equal to {@link - * Opcodes#V1_6}.
+ * (*) this is mandatory only for classes whose version is greater than or equal to + * {@link Opcodes#V1_6}.
*
* The frames of a method must be given either in expanded form, or in compressed form (all frames * must use the same format, i.e. you must not mix expanded and compressed frames within a single @@ -255,23 +251,25 @@ public abstract class MethodVisitor { * implicit and must not be visited. Also, it is illegal to visit two or more frames for the same * code location (i.e., at least one instruction must be visited between two calls to visitFrame). * - * @param type the type of this stack map frame. Must be {@link Opcodes#F_NEW} for expanded - * frames, or {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link - * Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames. + * @param type the type of this stack map frame. Must be {@link Opcodes#F_NEW} for expanded + * frames, or {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, + * {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, + * {@link Opcodes#F_SAME1} for compressed frames. * @param numLocal the number of local variables in the visited frame. - * @param local the local variable types in this frame. This array must not be modified. Primitive - * types are represented by {@link Opcodes#TOP}, {@link Opcodes#INTEGER}, {@link - * Opcodes#FLOAT}, {@link Opcodes#LONG}, {@link Opcodes#DOUBLE}, {@link Opcodes#NULL} or - * {@link Opcodes#UNINITIALIZED_THIS} (long and double are represented by a single element). - * Reference types are represented by String objects (representing internal names), and - * uninitialized types by Label objects (this label designates the NEW instruction that - * created this uninitialized value). + * @param local the local variable types in this frame. This array must not be modified. + * Primitive types are represented by {@link Opcodes#TOP}, + * {@link Opcodes#INTEGER}, {@link Opcodes#FLOAT}, {@link Opcodes#LONG}, + * {@link Opcodes#DOUBLE}, {@link Opcodes#NULL} or + * {@link Opcodes#UNINITIALIZED_THIS} (long and double are represented by a single + * element). Reference types are represented by String objects (representing + * internal names), and uninitialized types by Label objects (this label + * designates the NEW instruction that created this uninitialized value). * @param numStack the number of operand stack elements in the visited frame. - * @param stack the operand stack types in this frame. This array must not be modified. Its - * content has the same format as the "local" array. + * @param stack the operand stack types in this frame. This array must not be modified. Its + * content has the same format as the "local" array. * @throws IllegalStateException if a frame is visited just after another one, without any - * instruction between the two (unless this frame is a Opcodes#F_SAME frame, in which case it - * is silently ignored). + * instruction between the two (unless this frame is a + * Opcodes#F_SAME frame, in which case it is silently ignored). */ public void visitFrame( final int type, @@ -292,15 +290,16 @@ public abstract class MethodVisitor { * Visits a zero operand instruction. * * @param opcode the opcode of the instruction to be visited. This opcode is either NOP, - * ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, - * LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, - * FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE, DASTORE, - * AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, - * SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, - * FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, - * LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, - * D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN, - * DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT. + * ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, + * ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, + * IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, + * FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, + * DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, + * DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, + * INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, + * LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, + * I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN, DRETURN, + * ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT. */ public void visitInsn(final int opcode) { if (mv != null) { @@ -311,16 +310,18 @@ public abstract class MethodVisitor { /** * Visits an instruction with a single int operand. * - * @param opcode the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH - * or NEWARRAY. - * @param operand the operand of the instruction to be visited.
- * When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE. - *
- * When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE. - *
- * When opcode is NEWARRAY, operand value should be one of {@link Opcodes#T_BOOLEAN}, {@link - * Opcodes#T_CHAR}, {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE}, {@link Opcodes#T_BYTE}, - * {@link Opcodes#T_SHORT}, {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}. + * @param opcode the opcode of the instruction to be visited. This opcode is either BIPUSH, + * SIPUSH or NEWARRAY. + * @param operand the operand of the instruction to be visited.
When opcode is BIPUSH, operand + * value should be between Byte.MIN_VALUE and Byte.MAX_VALUE. + *
+ * When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and + * Short.MAX_VALUE. + *
+ * When opcode is NEWARRAY, operand value should be one of + * {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR}, {@link Opcodes#T_FLOAT}, + * {@link Opcodes#T_DOUBLE}, {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT}, + * {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}. */ public void visitIntInsn(final int opcode, final int operand) { if (mv != null) { @@ -333,9 +334,10 @@ public abstract class MethodVisitor { * or stores the value of a local variable. * * @param opcode the opcode of the local variable instruction to be visited. This opcode is either - * ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET. - * @param var the operand of the instruction to be visited. This operand is the index of a local - * variable. + * ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or + * RET. + * @param var the operand of the instruction to be visited. This operand is the index of a + * local variable. */ public void visitVarInsn(final int opcode, final int var) { if (mv != null) { @@ -348,9 +350,9 @@ public abstract class MethodVisitor { * a class as parameter. * * @param opcode the opcode of the type instruction to be visited. This opcode is either NEW, - * ANEWARRAY, CHECKCAST or INSTANCEOF. - * @param type the operand of the instruction to be visited. This operand must be the internal - * name of an object or array class (see {@link Type#getInternalName()}). + * ANEWARRAY, CHECKCAST or INSTANCEOF. + * @param type the operand of the instruction to be visited. This operand must be the internal + * name of an object or array class (see {@link Type#getInternalName()}). */ public void visitTypeInsn(final int opcode, final String type) { if (mv != null) { @@ -362,10 +364,11 @@ public abstract class MethodVisitor { * Visits a field instruction. A field instruction is an instruction that loads or stores the * value of a field of an object. * - * @param opcode the opcode of the type instruction to be visited. This opcode is either - * GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. - * @param owner the internal name of the field's owner class (see {@link Type#getInternalName()}). - * @param name the field's name. + * @param opcode the opcode of the type instruction to be visited. This opcode is either + * GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. + * @param owner the internal name of the field's owner class (see + * {@link Type#getInternalName()}). + * @param name the field's name. * @param descriptor the field's descriptor (see {@link Type}). */ public void visitFieldInsn( @@ -378,11 +381,11 @@ public abstract class MethodVisitor { /** * Visits a method instruction. A method instruction is an instruction that invokes a method. * - * @param opcode the opcode of the type instruction to be visited. This opcode is either - * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. - * @param owner the internal name of the method's owner class (see {@link - * Type#getInternalName()}). - * @param name the method's name. + * @param opcode the opcode of the type instruction to be visited. This opcode is either + * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. + * @param owner the internal name of the method's owner class (see + * {@link Type#getInternalName()}). + * @param name the method's name. * @param descriptor the method's descriptor (see {@link Type}). * @deprecated use {@link #visitMethodInsn(int, String, String, String, boolean)} instead. */ @@ -396,12 +399,12 @@ public abstract class MethodVisitor { /** * Visits a method instruction. A method instruction is an instruction that invokes a method. * - * @param opcode the opcode of the type instruction to be visited. This opcode is either - * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. - * @param owner the internal name of the method's owner class (see {@link - * Type#getInternalName()}). - * @param name the method's name. - * @param descriptor the method's descriptor (see {@link Type}). + * @param opcode the opcode of the type instruction to be visited. This opcode is either + * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. + * @param owner the internal name of the method's owner class (see + * {@link Type#getInternalName()}). + * @param name the method's name. + * @param descriptor the method's descriptor (see {@link Type}). * @param isInterface if the method's owner class is an processer. */ public void visitMethodInsn( @@ -425,13 +428,15 @@ public abstract class MethodVisitor { /** * Visits an invokedynamic instruction. * - * @param name the method's name. - * @param descriptor the method's descriptor (see {@link Type}). - * @param bootstrapMethodHandle the bootstrap method. + * @param name the method's name. + * @param descriptor the method's descriptor (see {@link Type}). + * @param bootstrapMethodHandle the bootstrap method. * @param bootstrapMethodArguments the bootstrap method constant arguments. Each argument must be - * an {@link Integer}, {@link Float}, {@link Long}, {@link Double}, {@link String}, {@link - * Type}, {@link Handle} or {@link ConstantDynamic} value. This method is allowed to modify - * the content of the array so a caller should expect that this array may change. + * an {@link Integer}, {@link Float}, {@link Long}, + * {@link Double}, {@link String}, {@link Type}, {@link Handle} or + * {@link ConstantDynamic} value. This method is allowed to modify + * the content of the array so a caller should expect that this + * array may change. */ public void visitInvokeDynamicInsn( final String name, @@ -451,10 +456,10 @@ public abstract class MethodVisitor { * instruction. * * @param opcode the opcode of the type instruction to be visited. This opcode is either IFEQ, - * IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, - * IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. - * @param label the operand of the instruction to be visited. This operand is a label that - * designates the instruction to which the jump instruction may jump. + * IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, + * IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. + * @param label the operand of the instruction to be visited. This operand is a label that + * designates the instruction to which the jump instruction may jump. */ public void visitJumpInsn(final int opcode, final Label label) { if (mv != null) { @@ -513,17 +518,18 @@ public abstract class MethodVisitor { * } * * - * @param value the constant to be loaded on the stack. This parameter must be a non null {@link - * Integer}, a {@link Float}, a {@link Long}, a {@link Double}, a {@link String}, a {@link - * Type} of OBJECT or ARRAY sort for {@code .class} constants, for classes whose version is - * 49, a {@link Type} of METHOD sort for MethodType, a {@link Handle} for MethodHandle - * constants, for classes whose version is 51 or a {@link ConstantDynamic} for a constant - * dynamic for classes whose version is 55. + * @param value the constant to be loaded on the stack. This parameter must be a non null + * {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double}, a + * {@link String}, a {@link Type} of OBJECT or ARRAY sort for {@code .class} + * constants, for classes whose version is 49, a {@link Type} of METHOD sort for + * MethodType, a {@link Handle} for MethodHandle constants, for classes whose version + * is 51 or a {@link ConstantDynamic} for a constant dynamic for classes whose + * version is 55. */ public void visitLdcInsn(final Object value) { if (api < Opcodes.ASM5 && (value instanceof Handle - || (value instanceof Type && ((Type) value).getSort() == Type.METHOD))) { + || (value instanceof Type && ((Type) value).getSort() == Type.METHOD))) { throw new UnsupportedOperationException(REQUIRES_ASM5); } if (api < Opcodes.ASM7 && value instanceof ConstantDynamic) { @@ -537,7 +543,7 @@ public abstract class MethodVisitor { /** * Visits an IINC instruction. * - * @param var index of the local variable to be incremented. + * @param var index of the local variable to be incremented. * @param increment amount to increment the local variable by. */ public void visitIincInsn(final int var, final int increment) { @@ -549,11 +555,11 @@ public abstract class MethodVisitor { /** * Visits a TABLESWITCH instruction. * - * @param min the minimum key value. - * @param max the maximum key value. - * @param dflt beginning of the default handler block. + * @param min the minimum key value. + * @param max the maximum key value. + * @param dflt beginning of the default handler block. * @param labels beginnings of the handler blocks. {@code labels[i]} is the beginning of the - * handler block for the {@code min + i} key. + * handler block for the {@code min + i} key. */ public void visitTableSwitchInsn( final int min, final int max, final Label dflt, final Label... labels) { @@ -565,10 +571,10 @@ public abstract class MethodVisitor { /** * Visits a LOOKUPSWITCH instruction. * - * @param dflt beginning of the default handler block. - * @param keys the values of the keys. + * @param dflt beginning of the default handler block. + * @param keys the values of the keys. * @param labels beginnings of the handler blocks. {@code labels[i]} is the beginning of the - * handler block for the {@code keys[i]} key. + * handler block for the {@code keys[i]} key. */ public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) { if (mv != null) { @@ -579,7 +585,7 @@ public abstract class MethodVisitor { /** * Visits a MULTIANEWARRAY instruction. * - * @param descriptor an array type descriptor (see {@link Type}). + * @param descriptor an array type descriptor (see {@link Type}). * @param numDimensions the number of dimensions of the array to allocate. */ public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) { @@ -592,20 +598,22 @@ public abstract class MethodVisitor { * Visits an annotation on an instruction. This method must be called just after the * annotated instruction. It can be called several times for the same instruction. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#INSTANCEOF}, {@link TypeReference#NEW}, {@link - * TypeReference#CONSTRUCTOR_REFERENCE}, {@link TypeReference#METHOD_REFERENCE}, {@link - * TypeReference#CAST}, {@link TypeReference#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link - * TypeReference#METHOD_INVOCATION_TYPE_ARGUMENT}, {@link - * TypeReference#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link - * TypeReference#METHOD_REFERENCE_TYPE_ARGUMENT}. See {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#INSTANCEOF}, {@link TypeReference#NEW}, + * {@link TypeReference#CONSTRUCTOR_REFERENCE}, + * {@link TypeReference#METHOD_REFERENCE}, {@link TypeReference#CAST}, + * {@link TypeReference#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, + * {@link TypeReference#METHOD_INVOCATION_TYPE_ARGUMENT}, + * {@link TypeReference#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or + * {@link TypeReference#METHOD_REFERENCE_TYPE_ARGUMENT}. See + * {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { @@ -625,13 +633,13 @@ public abstract class MethodVisitor { /** * Visits a try catch block. * - * @param start the beginning of the exception handler's scope (inclusive). - * @param end the end of the exception handler's scope (exclusive). + * @param start the beginning of the exception handler's scope (inclusive). + * @param end the end of the exception handler's scope (exclusive). * @param handler the beginning of the exception handler's code. - * @param type the internal name of the type of exceptions handled by the handler, or {@literal - * null} to catch any exceptions (for "finally" blocks). + * @param type the internal name of the type of exceptions handled by the handler, or + * {@literal null} to catch any exceptions (for "finally" blocks). * @throws IllegalArgumentException if one of the labels has already been visited by this visitor - * (by the {@link #visitLabel} method). + * (by the {@link #visitLabel} method). */ public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { @@ -645,15 +653,15 @@ public abstract class MethodVisitor { * {@link #visitTryCatchBlock} for the annotated exception handler. It can be called several times * for the same exception handler. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#EXCEPTION_PARAMETER}. See {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#EXCEPTION_PARAMETER}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitTryCatchAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { @@ -669,16 +677,17 @@ public abstract class MethodVisitor { /** * Visits a local variable declaration. * - * @param name the name of a local variable. + * @param name the name of a local variable. * @param descriptor the type descriptor of this local variable. - * @param signature the type signature of this local variable. May be {@literal null} if the local - * variable type does not use generic types. - * @param start the first instruction corresponding to the scope of this local variable - * (inclusive). - * @param end the last instruction corresponding to the scope of this local variable (exclusive). - * @param index the local variable's index. + * @param signature the type signature of this local variable. May be {@literal null} if the + * local variable type does not use generic types. + * @param start the first instruction corresponding to the scope of this local variable + * (inclusive). + * @param end the last instruction corresponding to the scope of this local variable + * (exclusive). + * @param index the local variable's index. * @throws IllegalArgumentException if one of the labels has not already been visited by this - * visitor (by the {@link #visitLabel} method). + * visitor (by the {@link #visitLabel} method). */ public void visitLocalVariable( final String name, @@ -695,22 +704,23 @@ public abstract class MethodVisitor { /** * Visits an annotation on a local variable type. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#LOCAL_VARIABLE} or {@link TypeReference#RESOURCE_VARIABLE}. See {@link - * TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. - * @param start the fist instructions corresponding to the continuous ranges that make the scope - * of this local variable (inclusive). - * @param end the last instructions corresponding to the continuous ranges that make the scope of - * this local variable (exclusive). This array must have the same size as the 'start' array. - * @param index the local variable's index in each range. This array must have the same size as - * the 'start' array. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#LOCAL_VARIABLE} or + * {@link TypeReference#RESOURCE_VARIABLE}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. + * @param start the fist instructions corresponding to the continuous ranges that make the + * scope of this local variable (inclusive). + * @param end the last instructions corresponding to the continuous ranges that make the + * scope of this local variable (exclusive). This array must have the same size + * as the 'start' array. + * @param index the local variable's index in each range. This array must have the same size + * as the 'start' array. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitLocalVariableAnnotation( final int typeRef, @@ -733,11 +743,11 @@ public abstract class MethodVisitor { /** * Visits a line number declaration. * - * @param line a line number. This number refers to the source file from which the class was - * compiled. + * @param line a line number. This number refers to the source file from which the class was + * compiled. * @param start the first instruction corresponding to this line number. * @throws IllegalArgumentException if {@code start} has not already been visited by this visitor - * (by the {@link #visitLabel} method). + * (by the {@link #visitLabel} method). */ public void visitLineNumber(final int line, final Label start) { if (mv != null) { @@ -748,7 +758,7 @@ public abstract class MethodVisitor { /** * Visits the maximum stack size and the maximum number of local variables of the method. * - * @param maxStack maximum stack size of the method. + * @param maxStack maximum stack size of the method. * @param maxLocals maximum number of local variables for the method. */ public void visitMaxs(final int maxStack, final int maxLocals) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodWriter.java index c932795766695b89588a23ebc93875525fdd241e..82882955418bb1f4323428fc21890ac97ab3d4a2 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/MethodWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -17,11 +5,13 @@ package cn.universal.core.engine.asm; * Java Virtual Machine Specification (JVMS). @Author Eric Bruneton @Author Eugene Kuleshov * * @see JVMS - * 4.6 + * 4.6 */ final class MethodWriter extends MethodVisitor { - /** Indicates that nothing must be computed. */ + /** + * Indicates that nothing must be computed. + */ static final int COMPUTE_NOTHING = 0; /** @@ -52,7 +42,9 @@ final class MethodWriter extends MethodVisitor { */ static final int COMPUTE_ALL_FRAMES = 4; - /** Indicates that {@link #STACK_SIZE_DELTA} is not applicable (not constant or never used). */ + /** + * Indicates that {@link #STACK_SIZE_DELTA} is not applicable (not constant or never used). + */ private static final int NA = 0; /** @@ -62,211 +54,213 @@ final class MethodWriter extends MethodVisitor { * @see JVMS 6 */ private static final int[] STACK_SIZE_DELTA = { - 0, // nop = 0 (0x0) - 1, // aconst_null = 1 (0x1) - 1, // iconst_m1 = 2 (0x2) - 1, // iconst_0 = 3 (0x3) - 1, // iconst_1 = 4 (0x4) - 1, // iconst_2 = 5 (0x5) - 1, // iconst_3 = 6 (0x6) - 1, // iconst_4 = 7 (0x7) - 1, // iconst_5 = 8 (0x8) - 2, // lconst_0 = 9 (0x9) - 2, // lconst_1 = 10 (0xa) - 1, // fconst_0 = 11 (0xb) - 1, // fconst_1 = 12 (0xc) - 1, // fconst_2 = 13 (0xd) - 2, // dconst_0 = 14 (0xe) - 2, // dconst_1 = 15 (0xf) - 1, // bipush = 16 (0x10) - 1, // sipush = 17 (0x11) - 1, // ldc = 18 (0x12) - NA, // ldc_w = 19 (0x13) - NA, // ldc2_w = 20 (0x14) - 1, // iload = 21 (0x15) - 2, // lload = 22 (0x16) - 1, // fload = 23 (0x17) - 2, // dload = 24 (0x18) - 1, // aload = 25 (0x19) - NA, // iload_0 = 26 (0x1a) - NA, // iload_1 = 27 (0x1b) - NA, // iload_2 = 28 (0x1c) - NA, // iload_3 = 29 (0x1d) - NA, // lload_0 = 30 (0x1e) - NA, // lload_1 = 31 (0x1f) - NA, // lload_2 = 32 (0x20) - NA, // lload_3 = 33 (0x21) - NA, // fload_0 = 34 (0x22) - NA, // fload_1 = 35 (0x23) - NA, // fload_2 = 36 (0x24) - NA, // fload_3 = 37 (0x25) - NA, // dload_0 = 38 (0x26) - NA, // dload_1 = 39 (0x27) - NA, // dload_2 = 40 (0x28) - NA, // dload_3 = 41 (0x29) - NA, // aload_0 = 42 (0x2a) - NA, // aload_1 = 43 (0x2b) - NA, // aload_2 = 44 (0x2c) - NA, // aload_3 = 45 (0x2d) - -1, // iaload = 46 (0x2e) - 0, // laload = 47 (0x2f) - -1, // faload = 48 (0x30) - 0, // daload = 49 (0x31) - -1, // aaload = 50 (0x32) - -1, // baload = 51 (0x33) - -1, // caload = 52 (0x34) - -1, // saload = 53 (0x35) - -1, // istore = 54 (0x36) - -2, // lstore = 55 (0x37) - -1, // fstore = 56 (0x38) - -2, // dstore = 57 (0x39) - -1, // astore = 58 (0x3a) - NA, // istore_0 = 59 (0x3b) - NA, // istore_1 = 60 (0x3c) - NA, // istore_2 = 61 (0x3d) - NA, // istore_3 = 62 (0x3e) - NA, // lstore_0 = 63 (0x3f) - NA, // lstore_1 = 64 (0x40) - NA, // lstore_2 = 65 (0x41) - NA, // lstore_3 = 66 (0x42) - NA, // fstore_0 = 67 (0x43) - NA, // fstore_1 = 68 (0x44) - NA, // fstore_2 = 69 (0x45) - NA, // fstore_3 = 70 (0x46) - NA, // dstore_0 = 71 (0x47) - NA, // dstore_1 = 72 (0x48) - NA, // dstore_2 = 73 (0x49) - NA, // dstore_3 = 74 (0x4a) - NA, // astore_0 = 75 (0x4b) - NA, // astore_1 = 76 (0x4c) - NA, // astore_2 = 77 (0x4d) - NA, // astore_3 = 78 (0x4e) - -3, // iastore = 79 (0x4f) - -4, // lastore = 80 (0x50) - -3, // fastore = 81 (0x51) - -4, // dastore = 82 (0x52) - -3, // aastore = 83 (0x53) - -3, // bastore = 84 (0x54) - -3, // castore = 85 (0x55) - -3, // sastore = 86 (0x56) - -1, // pop = 87 (0x57) - -2, // pop2 = 88 (0x58) - 1, // dup = 89 (0x59) - 1, // dup_x1 = 90 (0x5a) - 1, // dup_x2 = 91 (0x5b) - 2, // dup2 = 92 (0x5c) - 2, // dup2_x1 = 93 (0x5d) - 2, // dup2_x2 = 94 (0x5e) - 0, // swap = 95 (0x5f) - -1, // iadd = 96 (0x60) - -2, // ladd = 97 (0x61) - -1, // fadd = 98 (0x62) - -2, // dadd = 99 (0x63) - -1, // isub = 100 (0x64) - -2, // lsub = 101 (0x65) - -1, // fsub = 102 (0x66) - -2, // dsub = 103 (0x67) - -1, // imul = 104 (0x68) - -2, // lmul = 105 (0x69) - -1, // fmul = 106 (0x6a) - -2, // dmul = 107 (0x6b) - -1, // idiv = 108 (0x6c) - -2, // ldiv = 109 (0x6d) - -1, // fdiv = 110 (0x6e) - -2, // ddiv = 111 (0x6f) - -1, // irem = 112 (0x70) - -2, // lrem = 113 (0x71) - -1, // frem = 114 (0x72) - -2, // drem = 115 (0x73) - 0, // ineg = 116 (0x74) - 0, // lneg = 117 (0x75) - 0, // fneg = 118 (0x76) - 0, // dneg = 119 (0x77) - -1, // ishl = 120 (0x78) - -1, // lshl = 121 (0x79) - -1, // ishr = 122 (0x7a) - -1, // lshr = 123 (0x7b) - -1, // iushr = 124 (0x7c) - -1, // lushr = 125 (0x7d) - -1, // iand = 126 (0x7e) - -2, // land = 127 (0x7f) - -1, // ior = 128 (0x80) - -2, // lor = 129 (0x81) - -1, // ixor = 130 (0x82) - -2, // lxor = 131 (0x83) - 0, // iinc = 132 (0x84) - 1, // i2l = 133 (0x85) - 0, // i2f = 134 (0x86) - 1, // i2d = 135 (0x87) - -1, // l2i = 136 (0x88) - -1, // l2f = 137 (0x89) - 0, // l2d = 138 (0x8a) - 0, // f2i = 139 (0x8b) - 1, // f2l = 140 (0x8c) - 1, // f2d = 141 (0x8d) - -1, // d2i = 142 (0x8e) - 0, // d2l = 143 (0x8f) - -1, // d2f = 144 (0x90) - 0, // i2b = 145 (0x91) - 0, // i2c = 146 (0x92) - 0, // i2s = 147 (0x93) - -3, // lcmp = 148 (0x94) - -1, // fcmpl = 149 (0x95) - -1, // fcmpg = 150 (0x96) - -3, // dcmpl = 151 (0x97) - -3, // dcmpg = 152 (0x98) - -1, // ifeq = 153 (0x99) - -1, // ifne = 154 (0x9a) - -1, // iflt = 155 (0x9b) - -1, // ifge = 156 (0x9c) - -1, // ifgt = 157 (0x9d) - -1, // ifle = 158 (0x9e) - -2, // if_icmpeq = 159 (0x9f) - -2, // if_icmpne = 160 (0xa0) - -2, // if_icmplt = 161 (0xa1) - -2, // if_icmpge = 162 (0xa2) - -2, // if_icmpgt = 163 (0xa3) - -2, // if_icmple = 164 (0xa4) - -2, // if_acmpeq = 165 (0xa5) - -2, // if_acmpne = 166 (0xa6) - 0, // goto = 167 (0xa7) - 1, // jsr = 168 (0xa8) - 0, // ret = 169 (0xa9) - -1, // tableswitch = 170 (0xaa) - -1, // lookupswitch = 171 (0xab) - -1, // ireturn = 172 (0xac) - -2, // lreturn = 173 (0xad) - -1, // freturn = 174 (0xae) - -2, // dreturn = 175 (0xaf) - -1, // areturn = 176 (0xb0) - 0, // return = 177 (0xb1) - NA, // getstatic = 178 (0xb2) - NA, // putstatic = 179 (0xb3) - NA, // getfield = 180 (0xb4) - NA, // putfield = 181 (0xb5) - NA, // invokevirtual = 182 (0xb6) - NA, // invokespecial = 183 (0xb7) - NA, // invokestatic = 184 (0xb8) - NA, // invokeinterface = 185 (0xb9) - NA, // invokedynamic = 186 (0xba) - 1, // new = 187 (0xbb) - 0, // newarray = 188 (0xbc) - 0, // anewarray = 189 (0xbd) - 0, // arraylength = 190 (0xbe) - NA, // athrow = 191 (0xbf) - 0, // checkcast = 192 (0xc0) - 0, // instanceof = 193 (0xc1) - -1, // monitorenter = 194 (0xc2) - -1, // monitorexit = 195 (0xc3) - NA, // wide = 196 (0xc4) - NA, // multianewarray = 197 (0xc5) - -1, // ifnull = 198 (0xc6) - -1, // ifnonnull = 199 (0xc7) - NA, // goto_w = 200 (0xc8) - NA // jsr_w = 201 (0xc9) + 0, // nop = 0 (0x0) + 1, // aconst_null = 1 (0x1) + 1, // iconst_m1 = 2 (0x2) + 1, // iconst_0 = 3 (0x3) + 1, // iconst_1 = 4 (0x4) + 1, // iconst_2 = 5 (0x5) + 1, // iconst_3 = 6 (0x6) + 1, // iconst_4 = 7 (0x7) + 1, // iconst_5 = 8 (0x8) + 2, // lconst_0 = 9 (0x9) + 2, // lconst_1 = 10 (0xa) + 1, // fconst_0 = 11 (0xb) + 1, // fconst_1 = 12 (0xc) + 1, // fconst_2 = 13 (0xd) + 2, // dconst_0 = 14 (0xe) + 2, // dconst_1 = 15 (0xf) + 1, // bipush = 16 (0x10) + 1, // sipush = 17 (0x11) + 1, // ldc = 18 (0x12) + NA, // ldc_w = 19 (0x13) + NA, // ldc2_w = 20 (0x14) + 1, // iload = 21 (0x15) + 2, // lload = 22 (0x16) + 1, // fload = 23 (0x17) + 2, // dload = 24 (0x18) + 1, // aload = 25 (0x19) + NA, // iload_0 = 26 (0x1a) + NA, // iload_1 = 27 (0x1b) + NA, // iload_2 = 28 (0x1c) + NA, // iload_3 = 29 (0x1d) + NA, // lload_0 = 30 (0x1e) + NA, // lload_1 = 31 (0x1f) + NA, // lload_2 = 32 (0x20) + NA, // lload_3 = 33 (0x21) + NA, // fload_0 = 34 (0x22) + NA, // fload_1 = 35 (0x23) + NA, // fload_2 = 36 (0x24) + NA, // fload_3 = 37 (0x25) + NA, // dload_0 = 38 (0x26) + NA, // dload_1 = 39 (0x27) + NA, // dload_2 = 40 (0x28) + NA, // dload_3 = 41 (0x29) + NA, // aload_0 = 42 (0x2a) + NA, // aload_1 = 43 (0x2b) + NA, // aload_2 = 44 (0x2c) + NA, // aload_3 = 45 (0x2d) + -1, // iaload = 46 (0x2e) + 0, // laload = 47 (0x2f) + -1, // faload = 48 (0x30) + 0, // daload = 49 (0x31) + -1, // aaload = 50 (0x32) + -1, // baload = 51 (0x33) + -1, // caload = 52 (0x34) + -1, // saload = 53 (0x35) + -1, // istore = 54 (0x36) + -2, // lstore = 55 (0x37) + -1, // fstore = 56 (0x38) + -2, // dstore = 57 (0x39) + -1, // astore = 58 (0x3a) + NA, // istore_0 = 59 (0x3b) + NA, // istore_1 = 60 (0x3c) + NA, // istore_2 = 61 (0x3d) + NA, // istore_3 = 62 (0x3e) + NA, // lstore_0 = 63 (0x3f) + NA, // lstore_1 = 64 (0x40) + NA, // lstore_2 = 65 (0x41) + NA, // lstore_3 = 66 (0x42) + NA, // fstore_0 = 67 (0x43) + NA, // fstore_1 = 68 (0x44) + NA, // fstore_2 = 69 (0x45) + NA, // fstore_3 = 70 (0x46) + NA, // dstore_0 = 71 (0x47) + NA, // dstore_1 = 72 (0x48) + NA, // dstore_2 = 73 (0x49) + NA, // dstore_3 = 74 (0x4a) + NA, // astore_0 = 75 (0x4b) + NA, // astore_1 = 76 (0x4c) + NA, // astore_2 = 77 (0x4d) + NA, // astore_3 = 78 (0x4e) + -3, // iastore = 79 (0x4f) + -4, // lastore = 80 (0x50) + -3, // fastore = 81 (0x51) + -4, // dastore = 82 (0x52) + -3, // aastore = 83 (0x53) + -3, // bastore = 84 (0x54) + -3, // castore = 85 (0x55) + -3, // sastore = 86 (0x56) + -1, // pop = 87 (0x57) + -2, // pop2 = 88 (0x58) + 1, // dup = 89 (0x59) + 1, // dup_x1 = 90 (0x5a) + 1, // dup_x2 = 91 (0x5b) + 2, // dup2 = 92 (0x5c) + 2, // dup2_x1 = 93 (0x5d) + 2, // dup2_x2 = 94 (0x5e) + 0, // swap = 95 (0x5f) + -1, // iadd = 96 (0x60) + -2, // ladd = 97 (0x61) + -1, // fadd = 98 (0x62) + -2, // dadd = 99 (0x63) + -1, // isub = 100 (0x64) + -2, // lsub = 101 (0x65) + -1, // fsub = 102 (0x66) + -2, // dsub = 103 (0x67) + -1, // imul = 104 (0x68) + -2, // lmul = 105 (0x69) + -1, // fmul = 106 (0x6a) + -2, // dmul = 107 (0x6b) + -1, // idiv = 108 (0x6c) + -2, // ldiv = 109 (0x6d) + -1, // fdiv = 110 (0x6e) + -2, // ddiv = 111 (0x6f) + -1, // irem = 112 (0x70) + -2, // lrem = 113 (0x71) + -1, // frem = 114 (0x72) + -2, // drem = 115 (0x73) + 0, // ineg = 116 (0x74) + 0, // lneg = 117 (0x75) + 0, // fneg = 118 (0x76) + 0, // dneg = 119 (0x77) + -1, // ishl = 120 (0x78) + -1, // lshl = 121 (0x79) + -1, // ishr = 122 (0x7a) + -1, // lshr = 123 (0x7b) + -1, // iushr = 124 (0x7c) + -1, // lushr = 125 (0x7d) + -1, // iand = 126 (0x7e) + -2, // land = 127 (0x7f) + -1, // ior = 128 (0x80) + -2, // lor = 129 (0x81) + -1, // ixor = 130 (0x82) + -2, // lxor = 131 (0x83) + 0, // iinc = 132 (0x84) + 1, // i2l = 133 (0x85) + 0, // i2f = 134 (0x86) + 1, // i2d = 135 (0x87) + -1, // l2i = 136 (0x88) + -1, // l2f = 137 (0x89) + 0, // l2d = 138 (0x8a) + 0, // f2i = 139 (0x8b) + 1, // f2l = 140 (0x8c) + 1, // f2d = 141 (0x8d) + -1, // d2i = 142 (0x8e) + 0, // d2l = 143 (0x8f) + -1, // d2f = 144 (0x90) + 0, // i2b = 145 (0x91) + 0, // i2c = 146 (0x92) + 0, // i2s = 147 (0x93) + -3, // lcmp = 148 (0x94) + -1, // fcmpl = 149 (0x95) + -1, // fcmpg = 150 (0x96) + -3, // dcmpl = 151 (0x97) + -3, // dcmpg = 152 (0x98) + -1, // ifeq = 153 (0x99) + -1, // ifne = 154 (0x9a) + -1, // iflt = 155 (0x9b) + -1, // ifge = 156 (0x9c) + -1, // ifgt = 157 (0x9d) + -1, // ifle = 158 (0x9e) + -2, // if_icmpeq = 159 (0x9f) + -2, // if_icmpne = 160 (0xa0) + -2, // if_icmplt = 161 (0xa1) + -2, // if_icmpge = 162 (0xa2) + -2, // if_icmpgt = 163 (0xa3) + -2, // if_icmple = 164 (0xa4) + -2, // if_acmpeq = 165 (0xa5) + -2, // if_acmpne = 166 (0xa6) + 0, // goto = 167 (0xa7) + 1, // jsr = 168 (0xa8) + 0, // ret = 169 (0xa9) + -1, // tableswitch = 170 (0xaa) + -1, // lookupswitch = 171 (0xab) + -1, // ireturn = 172 (0xac) + -2, // lreturn = 173 (0xad) + -1, // freturn = 174 (0xae) + -2, // dreturn = 175 (0xaf) + -1, // areturn = 176 (0xb0) + 0, // return = 177 (0xb1) + NA, // getstatic = 178 (0xb2) + NA, // putstatic = 179 (0xb3) + NA, // getfield = 180 (0xb4) + NA, // putfield = 181 (0xb5) + NA, // invokevirtual = 182 (0xb6) + NA, // invokespecial = 183 (0xb7) + NA, // invokestatic = 184 (0xb8) + NA, // invokeinterface = 185 (0xb9) + NA, // invokedynamic = 186 (0xba) + 1, // new = 187 (0xbb) + 0, // newarray = 188 (0xbc) + 0, // anewarray = 189 (0xbd) + 0, // arraylength = 190 (0xbe) + NA, // athrow = 191 (0xbf) + 0, // checkcast = 192 (0xc0) + 0, // instanceof = 193 (0xc1) + -1, // monitorenter = 194 (0xc2) + -1, // monitorexit = 195 (0xc3) + NA, // wide = 196 (0xc4) + NA, // multianewarray = 197 (0xc5) + -1, // ifnull = 198 (0xc6) + -1, // ifnonnull = 199 (0xc7) + NA, // goto_w = 200 (0xc8) + NA // jsr_w = 201 (0xc9) }; - /** Where the constants used in this MethodWriter must be stored. */ + /** + * Where the constants used in this MethodWriter must be stored. + */ private final SymbolTable symbolTable; // Note: fields are ordered as in the method_info structure, and those related to attributes are @@ -279,27 +273,41 @@ final class MethodWriter extends MethodVisitor { */ private final int accessFlags; - /** The name_index field of the method_info JVMS structure. */ + /** + * The name_index field of the method_info JVMS structure. + */ private final int nameIndex; - /** The name of this method. */ + /** + * The name of this method. + */ private final String name; - /** The descriptor_index field of the method_info JVMS structure. */ + /** + * The descriptor_index field of the method_info JVMS structure. + */ private final int descriptorIndex; - /** The descriptor of this method. */ + /** + * The descriptor of this method. + */ private final String descriptor; // Code attribute fields and sub attributes: - /** The max_stack field of the Code attribute. */ + /** + * The max_stack field of the Code attribute. + */ private int maxStack; - /** The max_locals field of the Code attribute. */ + /** + * The max_locals field of the Code attribute. + */ private int maxLocals; - /** The 'code' field of the Code attribute. */ + /** + * The 'code' field of the Code attribute. + */ private final ByteVector code = new ByteVector(); /** @@ -316,13 +324,19 @@ final class MethodWriter extends MethodVisitor { */ private Handler lastHandler; - /** The line_number_table_length field of the LineNumberTable code attribute. */ + /** + * The line_number_table_length field of the LineNumberTable code attribute. + */ private int lineNumberTableLength; - /** The line_number_table array of the LineNumberTable code attribute, or {@literal null}. */ + /** + * The line_number_table array of the LineNumberTable code attribute, or {@literal null}. + */ private ByteVector lineNumberTable; - /** The local_variable_table_length field of the LocalVariableTable code attribute. */ + /** + * The local_variable_table_length field of the LocalVariableTable code attribute. + */ private int localVariableTableLength; /** @@ -330,19 +344,25 @@ final class MethodWriter extends MethodVisitor { */ private ByteVector localVariableTable; - /** The local_variable_type_table_length field of the LocalVariableTypeTable code attribute. */ + /** + * The local_variable_type_table_length field of the LocalVariableTypeTable code attribute. + */ private int localVariableTypeTableLength; /** - * The local_variable_type_table array of the LocalVariableTypeTable code attribute, or {@literal - * null}. + * The local_variable_type_table array of the LocalVariableTypeTable code attribute, or + * {@literal null}. */ private ByteVector localVariableTypeTable; - /** The number_of_entries field of the StackMapTable code attribute. */ + /** + * The number_of_entries field of the StackMapTable code attribute. + */ private int stackMapTableNumberOfEntries; - /** The 'entries' array of the StackMapTable code attribute. */ + /** + * The 'entries' array of the StackMapTable code attribute. + */ private ByteVector stackMapTableEntries; /** @@ -362,21 +382,27 @@ final class MethodWriter extends MethodVisitor { * {@link Attribute#nextAttribute} field. May be {@literal null}. * *

WARNING: this list stores the attributes in the reverse order of their visit. - * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The {@link - * #putMethodInfo} method writes the attributes in the order defined by this list, i.e. in the - * reverse order specified by the user. + * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The + * {@link #putMethodInfo} method writes the attributes in the order defined by this list, i.e. in + * the reverse order specified by the user. */ private Attribute firstCodeAttribute; // Other method_info attributes: - /** The number_of_exceptions field of the Exceptions attribute. */ + /** + * The number_of_exceptions field of the Exceptions attribute. + */ private final int numberOfExceptions; - /** The exception_index_table array of the Exceptions attribute, or {@literal null}. */ + /** + * The exception_index_table array of the Exceptions attribute, or {@literal null}. + */ private final int[] exceptionIndexTable; - /** The signature_index field of the Signature attribute. */ + /** + * The signature_index field of the Signature attribute. + */ private final int signatureIndex; /** @@ -391,7 +417,9 @@ final class MethodWriter extends MethodVisitor { */ private AnnotationWriter lastRuntimeInvisibleAnnotation; - /** The number of method parameters that can have runtime visible annotations, or 0. */ + /** + * The number of method parameters that can have runtime visible annotations, or 0. + */ private int visibleAnnotableParameterCount; /** @@ -401,7 +429,9 @@ final class MethodWriter extends MethodVisitor { */ private AnnotationWriter[] lastRuntimeVisibleParameterAnnotations; - /** The number of method parameters that can have runtime visible annotations, or 0. */ + /** + * The number of method parameters that can have runtime visible annotations, or 0. + */ private int invisibleAnnotableParameterCount; /** @@ -423,23 +453,29 @@ final class MethodWriter extends MethodVisitor { */ private AnnotationWriter lastRuntimeInvisibleTypeAnnotation; - /** The default_value field of the AnnotationDefault attribute, or {@literal null}. */ + /** + * The default_value field of the AnnotationDefault attribute, or {@literal null}. + */ private ByteVector defaultValue; - /** The parameters_count field of the MethodParameters attribute. */ + /** + * The parameters_count field of the MethodParameters attribute. + */ private int parametersCount; - /** The 'parameters' array of the MethodParameters attribute, or {@literal null}. */ + /** + * The 'parameters' array of the MethodParameters attribute, or {@literal null}. + */ private ByteVector parameters; /** - * The first non standard attribute of this method. The next ones can be accessed with the {@link - * Attribute#nextAttribute} field. May be {@literal null}. + * The first non standard attribute of this method. The next ones can be accessed with the + * {@link Attribute#nextAttribute} field. May be {@literal null}. * *

WARNING: this list stores the attributes in the reverse order of their visit. - * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The {@link - * #putMethodInfo} method writes the attributes in the order defined by this list, i.e. in the - * reverse order specified by the user. + * firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The + * {@link #putMethodInfo} method writes the attributes in the order defined by this list, i.e. in + * the reverse order specified by the user. */ private Attribute firstAttribute; @@ -448,8 +484,9 @@ final class MethodWriter extends MethodVisitor { // ----------------------------------------------------------------------------------------------- /** - * Indicates what must be computed. Must be one of {@link #COMPUTE_ALL_FRAMES}, {@link - * #COMPUTE_INSERTED_FRAMES}, {@link #COMPUTE_MAX_STACK_AND_LOCAL} or {@link #COMPUTE_NOTHING}. + * Indicates what must be computed. Must be one of {@link #COMPUTE_ALL_FRAMES}, + * {@link #COMPUTE_INSERTED_FRAMES}, {@link #COMPUTE_MAX_STACK_AND_LOCAL} or + * {@link #COMPUTE_NOTHING}. */ private final int compute; @@ -466,24 +503,25 @@ final class MethodWriter extends MethodVisitor { private Label lastBasicBlock; /** - * The current basic block, i.e. the basic block of the last visited instruction. When {@link - * #compute} is equal to {@link #COMPUTE_MAX_STACK_AND_LOCAL} or {@link #COMPUTE_ALL_FRAMES}, this - * field is {@literal null} for unreachable code. When {@link #compute} is equal to {@link - * #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES} or {@link #COMPUTE_INSERTED_FRAMES}, this field stays - * unchanged throughout the whole method (i.e. the whole code is seen as a single basic block; - * indeed, the existing frames are sufficient by hypothesis to compute any intermediate frame - - * and the maximum stack size as well - without using any control flow graph). + * The current basic block, i.e. the basic block of the last visited instruction. When + * {@link #compute} is equal to {@link #COMPUTE_MAX_STACK_AND_LOCAL} or + * {@link #COMPUTE_ALL_FRAMES}, this field is {@literal null} for unreachable code. When + * {@link #compute} is equal to {@link #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES} or + * {@link #COMPUTE_INSERTED_FRAMES}, this field stays unchanged throughout the whole method (i.e. + * the whole code is seen as a single basic block; indeed, the existing frames are sufficient by + * hypothesis to compute any intermediate frame - and the maximum stack size as well - without + * using any control flow graph). */ private Label currentBasicBlock; /** * The relative stack size after the last visited instruction. This size is relative to the * beginning of {@link #currentBasicBlock}, i.e. the true stack size after the last visited - * instruction is equal to the {@link Label#inputStackSize} of the current basic block plus {@link - * #relativeStackSize}. When {@link #compute} is equal to {@link - * #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES}, {@link #currentBasicBlock} is always the start of - * the method, so this relative size is also equal to the absolute stack size after the last - * visited instruction. + * instruction is equal to the {@link Label#inputStackSize} of the current basic block plus + * {@link #relativeStackSize}. When {@link #compute} is equal to + * {@link #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES}, {@link #currentBasicBlock} is always the + * start of the method, so this relative size is also equal to the absolute stack size after the + * last visited instruction. */ private int relativeStackSize; @@ -491,17 +529,21 @@ final class MethodWriter extends MethodVisitor { * The maximum relative stack size after the last visited instruction. This size is relative to * the beginning of {@link #currentBasicBlock}, i.e. the true maximum stack size after the last * visited instruction is equal to the {@link Label#inputStackSize} of the current basic block - * plus {@link #maxRelativeStackSize}.When {@link #compute} is equal to {@link - * #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES}, {@link #currentBasicBlock} is always the start of - * the method, so this relative size is also equal to the absolute maximum stack size after the - * last visited instruction. + * plus {@link #maxRelativeStackSize}.When {@link #compute} is equal to + * {@link #COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES}, {@link #currentBasicBlock} is always the + * start of the method, so this relative size is also equal to the absolute maximum stack size + * after the last visited instruction. */ private int maxRelativeStackSize; - /** The number of local variables in the last visited stack map frame. */ + /** + * The number of local variables in the last visited stack map frame. + */ private int currentLocals; - /** The bytecode offset of the last frame that was written in {@link #stackMapTableEntries}. */ + /** + * The bytecode offset of the last frame that was written in {@link #stackMapTableEntries}. + */ private int previousFrameOffset; /** @@ -516,19 +558,24 @@ final class MethodWriter extends MethodVisitor { * the number of stack elements. The local variables start at index 3 and are followed by the * operand stack elements. In summary frame[0] = offset, frame[1] = numLocal, frame[2] = numStack. * Local variables and operand stack entries contain abstract types, as defined in {@link Frame}, - * but restricted to {@link Frame#CONSTANT_KIND}, {@link Frame#REFERENCE_KIND} or {@link - * Frame#UNINITIALIZED_KIND} abstract types. Long and double types use only one array entry. + * but restricted to {@link Frame#CONSTANT_KIND}, {@link Frame#REFERENCE_KIND} or + * {@link Frame#UNINITIALIZED_KIND} abstract types. Long and double types use only one array + * entry. */ private int[] currentFrame; - /** Whether this method contains subroutines. */ + /** + * Whether this method contains subroutines. + */ private boolean hasSubroutines; // ----------------------------------------------------------------------------------------------- // Other miscellaneous status fields // ----------------------------------------------------------------------------------------------- - /** Whether the bytecode of this method contains ASM specific instructions. */ + /** + * Whether the bytecode of this method contains ASM specific instructions. + */ private boolean hasAsmInstructions; /** @@ -560,12 +607,12 @@ final class MethodWriter extends MethodVisitor { * Constructs a new {@link MethodWriter}. * * @param symbolTable where the constants used in this AnnotationWriter must be stored. - * @param access the method's access flags (see {@link Opcodes}). - * @param name the method's name. - * @param descriptor the method's descriptor (see {@link Type}). - * @param signature the method's signature. May be {@literal null}. - * @param exceptions the internal names of the method's exceptions. May be {@literal null}. - * @param compute indicates what must be computed (see #compute). + * @param access the method's access flags (see {@link Opcodes}). + * @param name the method's name. + * @param descriptor the method's descriptor (see {@link Type}). + * @param signature the method's signature. May be {@literal null}. + * @param exceptions the internal names of the method's exceptions. May be {@literal null}. + * @param compute indicates what must be computed (see #compute). */ MethodWriter( final SymbolTable symbolTable, @@ -1267,8 +1314,8 @@ final class MethodWriter extends MethodVisitor { constantSymbol.tag == Symbol.CONSTANT_LONG_TAG || constantSymbol.tag == Symbol.CONSTANT_DOUBLE_TAG || (constantSymbol.tag == Symbol.CONSTANT_DYNAMIC_TAG - && ((firstDescriptorChar = constantSymbol.value.charAt(0)) == 'J' - || firstDescriptorChar == 'D')); + && ((firstDescriptorChar = constantSymbol.value.charAt(0)) == 'J' + || firstDescriptorChar == 'D')); if (isLongOrDouble) { code.put12(Constants.LDC2_W, constantIndex); } else if (constantIndex >= 256) { @@ -1538,7 +1585,9 @@ final class MethodWriter extends MethodVisitor { } } - /** Computes all the stack map frames of the method, from scratch. */ + /** + * Computes all the stack map frames of the method, from scratch. + */ private void computeAllFrames() { // Complete the control flow graph with exception handler blocks. Handler handler = firstHandler; @@ -1640,7 +1689,9 @@ final class MethodWriter extends MethodVisitor { this.maxStack = maxStackSize; } - /** Computes the maximum stack size of the method. */ + /** + * Computes the maximum stack size of the method. + */ private void computeMaxStackAndLocal() { // Complete the control flow graph with exception handler blocks. Handler handler = firstHandler; @@ -1759,7 +1810,7 @@ final class MethodWriter extends MethodVisitor { /** * Adds a successor to {@link #currentBasicBlock} in the control flow graph. * - * @param info information about the control flow edge to be added. + * @param info information about the control flow edge to be added. * @param successor the successor block to be added to the current basic block. */ private void addSuccessorToCurrentBasicBlock(final int info, final Label successor) { @@ -1795,7 +1846,7 @@ final class MethodWriter extends MethodVisitor { /** * Starts the visit of a new stack map frame, stored in {@link #currentFrame}. * - * @param offset the bytecode offset of the instruction to which the frame corresponds. + * @param offset the bytecode offset of the instruction to which the frame corresponds. * @param numLocal the number of local variables in the frame. * @param numStack the number of stack elements in the frame. * @return the index of the next element to be written in this frame. @@ -1814,7 +1865,7 @@ final class MethodWriter extends MethodVisitor { /** * Sets an abstract type in {@link #currentFrame}. * - * @param frameIndex the index of the element to be set in {@link #currentFrame}. + * @param frameIndex the index of the element to be set in {@link #currentFrame}. * @param abstractType an abstract type. */ void visitAbstractType(final int frameIndex, final int abstractType) { @@ -1838,7 +1889,9 @@ final class MethodWriter extends MethodVisitor { currentFrame = null; } - /** Compresses and writes {@link #currentFrame} in a new StackMapTable entry. */ + /** + * Compresses and writes {@link #currentFrame} in a new StackMapTable entry. + */ private void putFrame() { final int numLocal = currentFrame[1]; final int numStack = currentFrame[2]; @@ -1936,7 +1989,7 @@ final class MethodWriter extends MethodVisitor { * JVMS verification_type_info format used in StackMapTable attributes. * * @param start index of the first type in {@link #currentFrame} to write. - * @param end index of last type in {@link #currentFrame} to write (exclusive). + * @param end index of last type in {@link #currentFrame} to write (exclusive). */ private void putAbstractTypes(final int start, final int end) { for (int i = start; i < end; ++i) { @@ -1948,11 +2001,12 @@ final class MethodWriter extends MethodVisitor { * Puts the given public API frame element type in {@link #stackMapTableEntries} , using the JVMS * verification_type_info format used in StackMapTable attributes. * - * @param type a frame element type described using the same format as in {@link - * MethodVisitor#visitFrame}, i.e. either {@link Opcodes#TOP}, {@link Opcodes#INTEGER}, {@link - * Opcodes#FLOAT}, {@link Opcodes#LONG}, {@link Opcodes#DOUBLE}, {@link Opcodes#NULL}, or - * {@link Opcodes#UNINITIALIZED_THIS}, or the internal name of a class, or a Label designating - * a NEW instruction (for uninitialized types). + * @param type a frame element type described using the same format as in + * {@link MethodVisitor#visitFrame}, i.e. either {@link Opcodes#TOP}, + * {@link Opcodes#INTEGER}, {@link Opcodes#FLOAT}, {@link Opcodes#LONG}, + * {@link Opcodes#DOUBLE}, {@link Opcodes#NULL}, or + * {@link Opcodes#UNINITIALIZED_THIS}, or the internal name of a class, or a Label + * designating a NEW instruction (for uninitialized types). */ private void putFrameType(final Object type) { if (type instanceof Integer) { @@ -1980,20 +2034,23 @@ final class MethodWriter extends MethodVisitor { * constructor arguments (at most a Signature, an Exception, a Deprecated and a Synthetic * attribute) are the same as the corresponding attributes in the given method. * - * @param source the source ClassReader from which the attributes of this method might be copied. - * @param hasSyntheticAttribute whether the method_info JVMS structure from which the attributes - * of this method might be copied contains a Synthetic attribute. + * @param source the source ClassReader from which the attributes of this method + * might be copied. + * @param hasSyntheticAttribute whether the method_info JVMS structure from which the attributes + * of this method might be copied contains a Synthetic attribute. * @param hasDeprecatedAttribute whether the method_info JVMS structure from which the attributes - * of this method might be copied contains a Deprecated attribute. - * @param descriptorIndex the descriptor_index field of the method_info JVMS structure from which - * the attributes of this method might be copied. - * @param signatureIndex the constant pool index contained in the Signature attribute of the - * method_info JVMS structure from which the attributes of this method might be copied, or 0. - * @param exceptionsOffset the offset in 'source.b' of the Exceptions attribute of the method_info - * JVMS structure from which the attributes of this method might be copied, or 0. + * of this method might be copied contains a Deprecated attribute. + * @param descriptorIndex the descriptor_index field of the method_info JVMS structure from + * which the attributes of this method might be copied. + * @param signatureIndex the constant pool index contained in the Signature attribute of + * the method_info JVMS structure from which the attributes of this + * method might be copied, or 0. + * @param exceptionsOffset the offset in 'source.b' of the Exceptions attribute of the + * method_info JVMS structure from which the attributes of this + * method might be copied, or 0. * @return whether the attributes of this method can be copied from the attributes of the - * method_info JVMS structure in 'source.b', between 'methodInfoOffset' and 'methodInfoOffset' - * + 'methodInfoLength'. + * method_info JVMS structure in 'source.b', between 'methodInfoOffset' and 'methodInfoOffset' + + * 'methodInfoLength'. */ boolean canCopyMethodAttributes( final ClassReader source, @@ -2036,9 +2093,9 @@ final class MethodWriter extends MethodVisitor { * Sets the source from which the attributes of this method will be copied. * * @param methodInfoOffset the offset in 'symbolTable.getSource()' of the method_info JVMS - * structure from which the attributes of this method will be copied. + * structure from which the attributes of this method will be copied. * @param methodInfoLength the length in 'symbolTable.getSource()' of the method_info JVMS - * structure from which the attributes of this method will be copied. + * structure from which the attributes of this method will be copied. */ void setMethodAttributesSource(final int methodInfoOffset, final int methodInfoLength) { // Don't copy the attributes yet, instead store their location in the source class reader so diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleVisitor.java index ad3186160a4eb21a76326f6f04767293ee0d924f..684c76849890652feb3fa7057f317b6ada00ff20 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleVisitor.java @@ -1,28 +1,16 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** * A visitor to visit a Java module. The methods of this class must be called in the following - * order: ( {@code visitMainClass} | ( {@code visitPackage} | {@code visitRequire} | {@code - * visitExport} | {@code visitOpen} | {@code visitUse} | {@code visitProvide} )* ) {@code - * visitEnd}. @Author Remi Forax @Author Eric Bruneton + * order: ( {@code visitMainClass} | ( {@code visitPackage} | {@code visitRequire} | + * {@code visitExport} | {@code visitOpen} | {@code visitUse} | {@code visitProvide} )* ) + * {@code visitEnd}. @Author Remi Forax @Author Eric Bruneton */ public abstract class ModuleVisitor { /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM6} or {@link Opcodes#ASM7}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ protected final int api; @@ -35,7 +23,7 @@ public abstract class ModuleVisitor { * Constructs a new {@link ModuleVisitor}. * * @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM6} - * or {@link Opcodes#ASM7}. + * or {@link Opcodes#ASM7}. */ public ModuleVisitor(final int api) { this(api, null); @@ -44,10 +32,10 @@ public abstract class ModuleVisitor { /** * Constructs a new {@link ModuleVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM6} - * or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. * @param moduleVisitor the module visitor to which this visitor must delegate method calls. May - * be null. + * be null. */ public ModuleVisitor(final int api, final ModuleVisitor moduleVisitor) { if (api != Opcodes.ASM9 @@ -91,9 +79,9 @@ public abstract class ModuleVisitor { /** * Visits a dependence of the current module. * - * @param module the fully qualified name (using dots) of the dependence. - * @param access the access flag of the dependence among {@code ACC_TRANSITIVE}, {@code - * ACC_STATIC_PHASE}, {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. + * @param module the fully qualified name (using dots) of the dependence. + * @param access the access flag of the dependence among {@code ACC_TRANSITIVE}, + * {@code ACC_STATIC_PHASE}, {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. * @param version the module version at compile time, or {@literal null}. */ public void visitRequire(final String module, final int access, final String version) { @@ -106,10 +94,10 @@ public abstract class ModuleVisitor { * Visit an exported package of the current module. * * @param packaze the internal name of the exported package. - * @param access the access flag of the exported package, valid values are among {@code - * ACC_SYNTHETIC} and {@code ACC_MANDATED}. + * @param access the access flag of the exported package, valid values are among + * {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. * @param modules the fully qualified names (using dots) of the modules that can access the public - * classes of the exported package, or {@literal null}. + * classes of the exported package, or {@literal null}. */ public void visitExport(final String packaze, final int access, final String... modules) { if (mv != null) { @@ -121,10 +109,10 @@ public abstract class ModuleVisitor { * Visit an open package of the current module. * * @param packaze the internal name of the opened package. - * @param access the access flag of the opened package, valid values are among {@code - * ACC_SYNTHETIC} and {@code ACC_MANDATED}. + * @param access the access flag of the opened package, valid values are among + * {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. * @param modules the fully qualified names (using dots) of the modules that can use deep - * reflection to the classes of the open package, or {@literal null}. + * reflection to the classes of the open package, or {@literal null}. */ public void visitOpen(final String packaze, final int access, final String... modules) { if (mv != null) { @@ -147,9 +135,9 @@ public abstract class ModuleVisitor { /** * Visit an implementation of a third. * - * @param service the internal name of the third. + * @param service the internal name of the third. * @param providers the internal names of the implementations of the third (there is at least one - * provider). + * provider). */ public void visitProvide(final String service, final String... providers) { if (mv != null) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleWriter.java index c3bf29530236ee681162bc8bf3224a028d94569a..f0a6734349f5a3e8c15884dfe329838b08224478 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/ModuleWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -18,63 +6,97 @@ package cn.universal.core.engine.asm; * Remi Forax @Author Eric Bruneton * * @see JVMS - * 4.7.25 + * 4.7.25 * @see JVMS - * 4.7.26 + * 4.7.26 * @see JVMS - * 4.7.27 + * 4.7.27 */ final class ModuleWriter extends ModuleVisitor { - /** Where the constants used in this AnnotationWriter must be stored. */ + /** + * Where the constants used in this AnnotationWriter must be stored. + */ private final SymbolTable symbolTable; - /** The module_name_index field of the JVMS Module attribute. */ + /** + * The module_name_index field of the JVMS Module attribute. + */ private final int moduleNameIndex; - /** The module_flags field of the JVMS Module attribute. */ + /** + * The module_flags field of the JVMS Module attribute. + */ private final int moduleFlags; - /** The module_version_index field of the JVMS Module attribute. */ + /** + * The module_version_index field of the JVMS Module attribute. + */ private final int moduleVersionIndex; - /** The requires_count field of the JVMS Module attribute. */ + /** + * The requires_count field of the JVMS Module attribute. + */ private int requiresCount; - /** The binary content of the 'requires' array of the JVMS Module attribute. */ + /** + * The binary content of the 'requires' array of the JVMS Module attribute. + */ private final ByteVector requires; - /** The exports_count field of the JVMS Module attribute. */ + /** + * The exports_count field of the JVMS Module attribute. + */ private int exportsCount; - /** The binary content of the 'exports' array of the JVMS Module attribute. */ + /** + * The binary content of the 'exports' array of the JVMS Module attribute. + */ private final ByteVector exports; - /** The opens_count field of the JVMS Module attribute. */ + /** + * The opens_count field of the JVMS Module attribute. + */ private int opensCount; - /** The binary content of the 'opens' array of the JVMS Module attribute. */ + /** + * The binary content of the 'opens' array of the JVMS Module attribute. + */ private final ByteVector opens; - /** The uses_count field of the JVMS Module attribute. */ + /** + * The uses_count field of the JVMS Module attribute. + */ private int usesCount; - /** The binary content of the 'uses_index' array of the JVMS Module attribute. */ + /** + * The binary content of the 'uses_index' array of the JVMS Module attribute. + */ private final ByteVector usesIndex; - /** The provides_count field of the JVMS Module attribute. */ + /** + * The provides_count field of the JVMS Module attribute. + */ private int providesCount; - /** The binary content of the 'provides' array of the JVMS Module attribute. */ + /** + * The binary content of the 'provides' array of the JVMS Module attribute. + */ private final ByteVector provides; - /** The provides_count field of the JVMS ModulePackages attribute. */ + /** + * The provides_count field of the JVMS ModulePackages attribute. + */ private int packageCount; - /** The binary content of the 'package_index' array of the JVMS ModulePackages attribute. */ + /** + * The binary content of the 'package_index' array of the JVMS ModulePackages attribute. + */ private final ByteVector packageIndex; - /** The main_class_index field of the JVMS ModuleMainClass attribute, or 0. */ + /** + * The main_class_index field of the JVMS ModuleMainClass attribute, or 0. + */ private int mainClassIndex; ModuleWriter(final SymbolTable symbolTable, final int name, final int access, final int version) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Opcodes.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Opcodes.java index 31f0c413fb01d9294aae9f314d0fd3fdde19346d..35e8abc8e121f9bef2da6793b3ba88c8998eae27 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Opcodes.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Opcodes.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -40,7 +28,8 @@ public interface Opcodes { * * @deprecated This API is experimental. */ - @Deprecated int ASM10_EXPERIMENTAL = 1 << 24 | 10 << 16 | 0 << 8; + @Deprecated + int ASM10_EXPERIMENTAL = 1 << 24 | 10 << 16 | 0 << 8; /* * Internal flags used to redirect calls to deprecated methods. For instance, if a visitOldStuff @@ -342,10 +331,14 @@ public interface Opcodes { // ASM specific stack map frame types, used in {@link ClassVisitor#visitFrame}. - /** An expanded frame. See {@link ClassReader#EXPAND_FRAMES}. */ + /** + * An expanded frame. See {@link ClassReader#EXPAND_FRAMES}. + */ int F_NEW = -1; - /** A compressed frame with complete frame data. */ + /** + * A compressed frame with complete frame data. + */ int F_FULL = 0; /** diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentVisitor.java index 8d6ea7947edafabbd7897227ebeac5a37f48943f..3e3afbbe64ee59ee8aa18b752e1d865e32741591 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentVisitor.java @@ -1,27 +1,15 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** * A visitor to visit a record component. The methods of this class must be called in the following - * order: ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code visitAttribute} )* {@code - * visitEnd}. @Author Remi Forax @Author Eric Bruneton + * order: ( {@code visitAnnotation} | {@code visitTypeAnnotation} | {@code visitAttribute} )* + * {@code visitEnd}. @Author Remi Forax @Author Eric Bruneton */ public abstract class RecordComponentVisitor { /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM8} or {@link Opcodes#ASM9}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM8} or {@link Opcodes#ASM9}. */ protected final int api; @@ -34,7 +22,7 @@ public abstract class RecordComponentVisitor { * Constructs a new {@link RecordComponentVisitor}. * * @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM8} - * or {@link Opcodes#ASM9}. + * or {@link Opcodes#ASM9}. */ public RecordComponentVisitor(final int api) { this(api, null); @@ -43,9 +31,10 @@ public abstract class RecordComponentVisitor { /** * Constructs a new {@link RecordComponentVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM8}. + * @param api the ASM API version implemented by this visitor. Must be + * {@link Opcodes#ASM8}. * @param recordComponentVisitor the record component visitor to which this visitor must delegate - * method calls. May be null. + * method calls. May be null. */ public RecordComponentVisitor( final int api, final RecordComponentVisitor recordComponentVisitor) { @@ -78,9 +67,9 @@ public abstract class RecordComponentVisitor { * Visits an annotation of the record component. * * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (delegate != null) { @@ -92,17 +81,17 @@ public abstract class RecordComponentVisitor { /** * Visits an annotation on a type in the record component signature. * - * @param typeRef a reference to the annotated type. The sort of this type reference must be - * {@link TypeReference#CLASS_TYPE_PARAMETER}, {@link - * TypeReference#CLASS_TYPE_PARAMETER_BOUND} or {@link TypeReference#CLASS_EXTENDS}. See - * {@link TypeReference}. - * @param typePath the path to the annotated type argument, wildcard bound, array element type, or - * static inner type within 'typeRef'. May be {@literal null} if the annotation targets - * 'typeRef' as a whole. + * @param typeRef a reference to the annotated type. The sort of this type reference must be + * {@link TypeReference#CLASS_TYPE_PARAMETER}, + * {@link TypeReference#CLASS_TYPE_PARAMETER_BOUND} or + * {@link TypeReference#CLASS_EXTENDS}. See {@link TypeReference}. + * @param typePath the path to the annotated type argument, wildcard bound, array element type, + * or static inner type within 'typeRef'. May be {@literal null} if the + * annotation targets 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. - * @param visible {@literal true} if the annotation is visible at runtime. + * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not - * interested in visiting this annotation. + * interested in visiting this annotation. */ public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentWriter.java index 71acc4f5b3a683a07ef7eda8a8793e783df4967d..8ed2832eeb2e38cb22555f82c674a1816969a8b0 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/RecordComponentWriter.java @@ -1,29 +1,23 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; final class RecordComponentWriter extends RecordComponentVisitor { - /** Where the constants used in this RecordComponentWriter must be stored. */ + /** + * Where the constants used in this RecordComponentWriter must be stored. + */ private final SymbolTable symbolTable; // Note: fields are ordered as in the record_component_info structure, and those related to // attributes are ordered as in Section 4.7 of the JVMS. - /** The name_index field of the Record attribute. */ + /** + * The name_index field of the Record attribute. + */ private final int nameIndex; - /** The descriptor_index field of the the Record attribute. */ + /** + * The descriptor_index field of the the Record attribute. + */ private final int descriptorIndex; /** @@ -71,9 +65,9 @@ final class RecordComponentWriter extends RecordComponentVisitor { * Constructs a new {@link RecordComponentWriter}. * * @param symbolTable where the constants used in this RecordComponentWriter must be stored. - * @param name the record component name. - * @param descriptor the record component descriptor (see {@link Type}). - * @param signature the record component signature. May be {@literal null}. + * @param name the record component name. + * @param descriptor the record component descriptor (see {@link Type}). + * @param signature the record component signature. May be {@literal null}. */ RecordComponentWriter( final SymbolTable symbolTable, diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Symbol.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Symbol.java index 06768d18dedbfe78ce631b61baa972e57353a598..0e71dda42eea696111565cb8539cf615cdce3919 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Symbol.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Symbol.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -17,73 +5,111 @@ package cn.universal.core.engine.asm; * table of a class. @Author Eric Bruneton * * @see JVMS - * 4.4 + * 4.4 * @see JVMS - * 4.7.23 + * 4.7.23 */ abstract class Symbol { // Tag values for the constant pool entries (using the same order as in the JVMS). - /** The tag value of CONSTANT_Class_info JVMS structures. */ + /** + * The tag value of CONSTANT_Class_info JVMS structures. + */ static final int CONSTANT_CLASS_TAG = 7; - /** The tag value of CONSTANT_Fieldref_info JVMS structures. */ + /** + * The tag value of CONSTANT_Fieldref_info JVMS structures. + */ static final int CONSTANT_FIELDREF_TAG = 9; - /** The tag value of CONSTANT_Methodref_info JVMS structures. */ + /** + * The tag value of CONSTANT_Methodref_info JVMS structures. + */ static final int CONSTANT_METHODREF_TAG = 10; - /** The tag value of CONSTANT_InterfaceMethodref_info JVMS structures. */ + /** + * The tag value of CONSTANT_InterfaceMethodref_info JVMS structures. + */ static final int CONSTANT_INTERFACE_METHODREF_TAG = 11; - /** The tag value of CONSTANT_String_info JVMS structures. */ + /** + * The tag value of CONSTANT_String_info JVMS structures. + */ static final int CONSTANT_STRING_TAG = 8; - /** The tag value of CONSTANT_Integer_info JVMS structures. */ + /** + * The tag value of CONSTANT_Integer_info JVMS structures. + */ static final int CONSTANT_INTEGER_TAG = 3; - /** The tag value of CONSTANT_Float_info JVMS structures. */ + /** + * The tag value of CONSTANT_Float_info JVMS structures. + */ static final int CONSTANT_FLOAT_TAG = 4; - /** The tag value of CONSTANT_Long_info JVMS structures. */ + /** + * The tag value of CONSTANT_Long_info JVMS structures. + */ static final int CONSTANT_LONG_TAG = 5; - /** The tag value of CONSTANT_Double_info JVMS structures. */ + /** + * The tag value of CONSTANT_Double_info JVMS structures. + */ static final int CONSTANT_DOUBLE_TAG = 6; - /** The tag value of CONSTANT_NameAndType_info JVMS structures. */ + /** + * The tag value of CONSTANT_NameAndType_info JVMS structures. + */ static final int CONSTANT_NAME_AND_TYPE_TAG = 12; - /** The tag value of CONSTANT_Utf8_info JVMS structures. */ + /** + * The tag value of CONSTANT_Utf8_info JVMS structures. + */ static final int CONSTANT_UTF8_TAG = 1; - /** The tag value of CONSTANT_MethodHandle_info JVMS structures. */ + /** + * The tag value of CONSTANT_MethodHandle_info JVMS structures. + */ static final int CONSTANT_METHOD_HANDLE_TAG = 15; - /** The tag value of CONSTANT_MethodType_info JVMS structures. */ + /** + * The tag value of CONSTANT_MethodType_info JVMS structures. + */ static final int CONSTANT_METHOD_TYPE_TAG = 16; - /** The tag value of CONSTANT_Dynamic_info JVMS structures. */ + /** + * The tag value of CONSTANT_Dynamic_info JVMS structures. + */ static final int CONSTANT_DYNAMIC_TAG = 17; - /** The tag value of CONSTANT_InvokeDynamic_info JVMS structures. */ + /** + * The tag value of CONSTANT_InvokeDynamic_info JVMS structures. + */ static final int CONSTANT_INVOKE_DYNAMIC_TAG = 18; - /** The tag value of CONSTANT_Module_info JVMS structures. */ + /** + * The tag value of CONSTANT_Module_info JVMS structures. + */ static final int CONSTANT_MODULE_TAG = 19; - /** The tag value of CONSTANT_Package_info JVMS structures. */ + /** + * The tag value of CONSTANT_Package_info JVMS structures. + */ static final int CONSTANT_PACKAGE_TAG = 20; // Tag values for the BootstrapMethods attribute entries (ASM specific tag). - /** The tag value of the BootstrapMethods attribute entries. */ + /** + * The tag value of the BootstrapMethods attribute entries. + */ static final int BOOTSTRAP_METHOD_TAG = 64; // Tag values for the type table entries (ASM specific tags). - /** The tag value of a normal type entry in the (ASM specific) type table of a class. */ + /** + * The tag value of a normal type entry in the (ASM specific) type table of a class. + */ static final int TYPE_TAG = 128; /** @@ -91,7 +117,9 @@ abstract class Symbol { */ static final int UNINITIALIZED_TYPE_TAG = 129; - /** The tag value of a merged type entry in the (ASM specific) type table of a class. */ + /** + * The tag value of a merged type entry in the (ASM specific) type table of a class. + */ static final int MERGED_TYPE_TAG = 130; // Instance fields. @@ -109,18 +137,18 @@ abstract class Symbol { final int tag; /** - * The internal name of the owner class of this symbol. Only used for {@link - * #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, {@link - * #CONSTANT_INTERFACE_METHODREF_TAG}, and {@link #CONSTANT_METHOD_HANDLE_TAG} symbols. + * The internal name of the owner class of this symbol. Only used for + * {@link #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, + * {@link #CONSTANT_INTERFACE_METHODREF_TAG}, and {@link #CONSTANT_METHOD_HANDLE_TAG} symbols. */ final String owner; /** - * The name of the class field or method corresponding to this symbol. Only used for {@link - * #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, {@link - * #CONSTANT_INTERFACE_METHODREF_TAG}, {@link #CONSTANT_NAME_AND_TYPE_TAG}, {@link - * #CONSTANT_METHOD_HANDLE_TAG}, {@link #CONSTANT_DYNAMIC_TAG} and {@link - * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols. + * The name of the class field or method corresponding to this symbol. Only used for + * {@link #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, + * {@link #CONSTANT_INTERFACE_METHODREF_TAG}, {@link #CONSTANT_NAME_AND_TYPE_TAG}, + * {@link #CONSTANT_METHOD_HANDLE_TAG}, {@link #CONSTANT_DYNAMIC_TAG} and + * {@link #CONSTANT_INVOKE_DYNAMIC_TAG} symbols. */ final String name; @@ -187,13 +215,13 @@ abstract class Symbol { * abstract. Instead, use the factory methods of the {@link SymbolTable} class. * * @param index the symbol index in the constant pool, in the BootstrapMethods attribute, or in - * the (ASM specific) type table of a class (depending on 'tag'). - * @param tag the symbol type. Must be one of the static tag values defined in this class. + * the (ASM specific) type table of a class (depending on 'tag'). + * @param tag the symbol type. Must be one of the static tag values defined in this class. * @param owner The internal name of the symbol's owner class. Maybe {@literal null}. - * @param name The name of the symbol's corresponding class field or method. Maybe {@literal - * null}. + * @param name The name of the symbol's corresponding class field or method. Maybe + * {@literal null}. * @param value The string value of this symbol. Maybe {@literal null}. - * @param data The numeric value of this symbol. + * @param data The numeric value of this symbol. */ Symbol( final int index, @@ -214,9 +242,8 @@ abstract class Symbol { * Returns the result {@link Type#getArgumentsAndReturnSizes} on {@link #value}. * * @return the result {@link Type#getArgumentsAndReturnSizes} on {@link #value} (memoized in - * {@link #info} for efficiency). This should only be used for {@link - * #CONSTANT_METHODREF_TAG}, {@link #CONSTANT_INTERFACE_METHODREF_TAG} and {@link - * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols. + * {@link #info} for efficiency). This should only be used for {@link #CONSTANT_METHODREF_TAG}, + * {@link #CONSTANT_INTERFACE_METHODREF_TAG} and {@link #CONSTANT_INVOKE_DYNAMIC_TAG} symbols. */ int getArgumentsAndReturnSizes() { if (info == 0) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/SymbolTable.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/SymbolTable.java index 7106610674f275ea92d820eafab9d61944637f67..a7a051b27fe9929756b572a2188c22d7d1c57162 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/SymbolTable.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/SymbolTable.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -17,16 +5,16 @@ package cn.universal.core.engine.asm; * table entries of a class. @Author Eric Bruneton * * @see JVMS - * 4.4 + * 4.4 * @see JVMS - * 4.7.23 + * 4.7.23 */ final class SymbolTable { /** - * The ClassWriter to which this SymbolTable belongs. This is only used to get access to {@link - * ClassWriter#getCommonSuperClass} and to serialize custom attributes with {@link - * Attribute#write}. + * The ClassWriter to which this SymbolTable belongs. This is only used to get access to + * {@link ClassWriter#getCommonSuperClass} and to serialize custom attributes with + * {@link Attribute#write}. */ final ClassWriter classWriter; @@ -36,10 +24,14 @@ final class SymbolTable { */ private final ClassReader sourceClassReader; - /** The major version number of the class to which this symbol table belongs. */ + /** + * The major version number of the class to which this symbol table belongs. + */ private int majorVersion; - /** The internal name of the class to which this symbol table belongs. */ + /** + * The internal name of the class to which this symbol table belongs. + */ private String className; /** @@ -91,9 +83,9 @@ final class SymbolTable { /** * An ASM specific type table used to temporarily store internal names that will not necessarily * be stored in the constant pool. This type table is used by the control flow and data flow - * analysis algorithm used to compute stack map frames from scratch. This array stores {@link - * Symbol#TYPE_TAG} and {@link Symbol#UNINITIALIZED_TYPE_TAG}) Symbol. The type symbol at index - * {@code i} has its {@link Symbol#index} equal to {@code i} (and vice versa). + * analysis algorithm used to compute stack map frames from scratch. This array stores + * {@link Symbol#TYPE_TAG} and {@link Symbol#UNINITIALIZED_TYPE_TAG}) Symbol. The type symbol at + * index {@code i} has its {@link Symbol#index} equal to {@code i} (and vice versa). */ private Entry[] typeTable; @@ -116,7 +108,7 @@ final class SymbolTable { * * @param classWriter a ClassWriter. * @param classReader the ClassReader whose constant pool and bootstrap methods must be copied to - * initialize the SymbolTable. + * initialize the SymbolTable. */ SymbolTable(final ClassWriter classWriter, final ClassReader classReader) { this.classWriter = classWriter; @@ -221,8 +213,8 @@ final class SymbolTable { * the SymbolTable. * * @param classReader the ClassReader whose bootstrap methods must be copied to initialize the - * SymbolTable. - * @param charBuffer a buffer used to read strings in the constant pool. + * SymbolTable. + * @param charBuffer a buffer used to read strings in the constant pool. */ private void copyBootstrapMethods(final ClassReader classReader, final char[] charBuffer) { // Find attributOffset of the 'bootstrap_methods' array. @@ -266,7 +258,7 @@ final class SymbolTable { * Returns the ClassReader from which this SymbolTable was constructed. * * @return the ClassReader from which this SymbolTable was constructed, or {@literal null} if it - * was constructed from scratch. + * was constructed from scratch. */ ClassReader getSource() { return sourceClassReader; @@ -295,7 +287,7 @@ final class SymbolTable { * the class name to the constant pool. * * @param majorVersion a major ClassFile version number. - * @param className an internal class name. + * @param className an internal class name. * @return the constant pool index of a new or already existing Symbol with the given class name. */ int setMajorVersionAndClassName(final int majorVersion, final String className) { @@ -372,7 +364,7 @@ final class SymbolTable { * * @param hashCode a {@link Entry#hashCode} value. * @return the list of entries which can potentially have the given hash code. The list is stored - * via the {@link Entry#next} field. + * via the {@link Entry#next} field. */ private Entry get(final int hashCode) { return entries[hashCode % entries.length]; @@ -381,8 +373,8 @@ final class SymbolTable { /** * Puts the given entry in the {@link #entries} hash set. This method does not check * whether {@link #entries} already contains a similar entry or not. {@link #entries} is resized - * if necessary to avoid hash collisions (multiple entries needing to be stored at the same {@link - * #entries} array index) as much as possible, with reasonable memory usage. + * if necessary to avoid hash collisions (multiple entries needing to be stored at the same + * {@link #entries} array index) as much as possible, with reasonable memory usage. * * @param entry an Entry (which must not already be contained in {@link #entries}). * @return the given entry @@ -433,8 +425,9 @@ final class SymbolTable { * constant pool already contains a similar item. * * @param value the value of the constant to be added to the constant pool. This parameter must be - * an {@link Integer}, {@link Byte}, {@link Character}, {@link Short}, {@link Boolean}, {@link - * Float}, {@link Long}, {@link Double}, {@link String}, {@link Type} or {@link Handle}. + * an {@link Integer}, {@link Byte}, {@link Character}, {@link Short}, + * {@link Boolean}, {@link Float}, {@link Long}, {@link Double}, {@link String}, + * {@link Type} or {@link Handle}. * @return a new or already existing Symbol with the given value. */ Symbol addConstant(final Object value) { @@ -501,8 +494,8 @@ final class SymbolTable { * Adds a CONSTANT_Fieldref_info to the constant pool of this symbol table. Does nothing if the * constant pool already contains a similar item. * - * @param owner the internal name of a class. - * @param name a field name. + * @param owner the internal name of a class. + * @param name a field name. * @param descriptor a field descriptor. * @return a new or already existing Symbol with the given value. */ @@ -514,9 +507,9 @@ final class SymbolTable { * Adds a CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this * symbol table. Does nothing if the constant pool already contains a similar item. * - * @param owner the internal name of a class. - * @param name a method name. - * @param descriptor a method descriptor. + * @param owner the internal name of a class. + * @param name a method name. + * @param descriptor a method descriptor. * @param isInterface whether owner is an processer or not. * @return a new or already existing Symbol with the given value. */ @@ -531,10 +524,11 @@ final class SymbolTable { * the constant pool of this symbol table. Does nothing if the constant pool already contains a * similar item. * - * @param tag one of {@link Symbol#CONSTANT_FIELDREF_TAG}, {@link Symbol#CONSTANT_METHODREF_TAG} - * or {@link Symbol#CONSTANT_INTERFACE_METHODREF_TAG}. - * @param owner the internal name of a class. - * @param name a field or method name. + * @param tag one of {@link Symbol#CONSTANT_FIELDREF_TAG}, + * {@link Symbol#CONSTANT_METHODREF_TAG} or + * {@link Symbol#CONSTANT_INTERFACE_METHODREF_TAG}. + * @param owner the internal name of a class. + * @param name a field or method name. * @param descriptor a field or method descriptor. * @return a new or already existing Symbol with the given value. */ @@ -561,11 +555,12 @@ final class SymbolTable { * Adds a new CONSTANT_Fieldref_info, CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info * to the constant pool of this symbol table. * - * @param index the constant pool index of the new Symbol. - * @param tag one of {@link Symbol#CONSTANT_FIELDREF_TAG}, {@link Symbol#CONSTANT_METHODREF_TAG} - * or {@link Symbol#CONSTANT_INTERFACE_METHODREF_TAG}. - * @param owner the internal name of a class. - * @param name a field or method name. + * @param index the constant pool index of the new Symbol. + * @param tag one of {@link Symbol#CONSTANT_FIELDREF_TAG}, + * {@link Symbol#CONSTANT_METHODREF_TAG} or + * {@link Symbol#CONSTANT_INTERFACE_METHODREF_TAG}. + * @param owner the internal name of a class. + * @param name a field or method name. * @param descriptor a field or method descriptor. */ private void addConstantMemberReference( @@ -614,7 +609,7 @@ final class SymbolTable { * Adds a CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol table. * Does nothing if the constant pool already contains a similar item. * - * @param tag one of {@link Symbol#CONSTANT_INTEGER_TAG} or {@link Symbol#CONSTANT_FLOAT_TAG}. + * @param tag one of {@link Symbol#CONSTANT_INTEGER_TAG} or {@link Symbol#CONSTANT_FLOAT_TAG}. * @param value an int or float. * @return a constant pool constant with the given tag and primitive values. */ @@ -636,7 +631,7 @@ final class SymbolTable { * table. * * @param index the constant pool index of the new Symbol. - * @param tag one of {@link Symbol#CONSTANT_INTEGER_TAG} or {@link Symbol#CONSTANT_FLOAT_TAG}. + * @param tag one of {@link Symbol#CONSTANT_INTEGER_TAG} or {@link Symbol#CONSTANT_FLOAT_TAG}. * @param value an int or float. */ private void addConstantIntegerOrFloat(final int index, final int tag, final int value) { @@ -669,7 +664,7 @@ final class SymbolTable { * Adds a CONSTANT_Long_info or CONSTANT_Double_info to the constant pool of this symbol table. * Does nothing if the constant pool already contains a similar item. * - * @param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}. + * @param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}. * @param value a long or double. * @return a constant pool constant with the given tag and primitive values. */ @@ -693,7 +688,7 @@ final class SymbolTable { * table. * * @param index the constant pool index of the new Symbol. - * @param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}. + * @param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}. * @param value a long or double. */ private void addConstantLongOrDouble(final int index, final int tag, final long value) { @@ -704,7 +699,7 @@ final class SymbolTable { * Adds a CONSTANT_NameAndType_info to the constant pool of this symbol table. Does nothing if the * constant pool already contains a similar item. * - * @param name a field or method name. + * @param name a field or method name. * @param descriptor a field or method descriptor. * @return a new or already existing Symbol with the given value. */ @@ -728,8 +723,8 @@ final class SymbolTable { /** * Adds a new CONSTANT_NameAndType_info to the constant pool of this symbol table. * - * @param index the constant pool index of the new Symbol. - * @param name a field or method name. + * @param index the constant pool index of the new Symbol. + * @param name a field or method name. * @param descriptor a field or method descriptor. */ private void addConstantNameAndType(final int index, final String name, final String descriptor) { @@ -773,14 +768,15 @@ final class SymbolTable { * Adds a CONSTANT_MethodHandle_info to the constant pool of this symbol table. Does nothing if * the constant pool already contains a similar item. * - * @param referenceKind one of {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link - * Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link - * Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, {@link - * Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of a class of processer. - * @param name a field or method name. - * @param descriptor a field or method descriptor. - * @param isInterface whether owner is an processer or not. + * @param referenceKind one of {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, + * {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, + * {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of a class of processer. + * @param name a field or method name. + * @param descriptor a field or method descriptor. + * @param isInterface whether owner is an processer or not. * @return a new or already existing Symbol with the given value. */ Symbol addConstantMethodHandle( @@ -818,14 +814,15 @@ final class SymbolTable { /** * Adds a new CONSTANT_MethodHandle_info to the constant pool of this symbol table. * - * @param index the constant pool index of the new Symbol. - * @param referenceKind one of {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, {@link - * Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link Opcodes#H_INVOKEVIRTUAL}, {@link - * Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL}, {@link - * Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}. - * @param owner the internal name of a class of processer. - * @param name a field or method name. - * @param descriptor a field or method descriptor. + * @param index the constant pool index of the new Symbol. + * @param referenceKind one of {@link Opcodes#H_GETFIELD}, {@link Opcodes#H_GETSTATIC}, + * {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, + * {@link Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, + * {@link Opcodes#H_INVOKESPECIAL}, {@link Opcodes#H_NEWINVOKESPECIAL} or + * {@link Opcodes#H_INVOKEINTERFACE}. + * @param owner the internal name of a class of processer. + * @param name a field or method name. + * @param descriptor a field or method descriptor. */ private void addConstantMethodHandle( final int index, @@ -854,9 +851,9 @@ final class SymbolTable { * bootstrap method to the BootstrapMethods of this symbol table. Does nothing if the constant * pool already contains a similar item. * - * @param name a method name. - * @param descriptor a field descriptor. - * @param bootstrapMethodHandle a bootstrap method handle. + * @param name a method name. + * @param descriptor a field descriptor. + * @param bootstrapMethodHandle a bootstrap method handle. * @param bootstrapMethodArguments the bootstrap method arguments. * @return a new or already existing Symbol with the given value. */ @@ -875,9 +872,9 @@ final class SymbolTable { * related bootstrap method to the BootstrapMethods of this symbol table. Does nothing if the * constant pool already contains a similar item. * - * @param name a method name. - * @param descriptor a method descriptor. - * @param bootstrapMethodHandle a bootstrap method handle. + * @param name a method name. + * @param descriptor a method descriptor. + * @param bootstrapMethodHandle a bootstrap method handle. * @param bootstrapMethodArguments the bootstrap method arguments. * @return a new or already existing Symbol with the given value. */ @@ -895,11 +892,11 @@ final class SymbolTable { * Adds a CONSTANT_Dynamic or a CONSTANT_InvokeDynamic_info to the constant pool of this symbol * table. Does nothing if the constant pool already contains a similar item. * - * @param tag one of {@link Symbol#CONSTANT_DYNAMIC_TAG} or {@link - * Symbol#CONSTANT_INVOKE_DYNAMIC_TAG}. - * @param name a method name. - * @param descriptor a field descriptor for CONSTANT_DYNAMIC_TAG) or a method descriptor for - * CONSTANT_INVOKE_DYNAMIC_TAG. + * @param tag one of {@link Symbol#CONSTANT_DYNAMIC_TAG} or + * {@link Symbol#CONSTANT_INVOKE_DYNAMIC_TAG}. + * @param name a method name. + * @param descriptor a field descriptor for CONSTANT_DYNAMIC_TAG) or a method descriptor + * for CONSTANT_INVOKE_DYNAMIC_TAG. * @param bootstrapMethodIndex the index of a bootstrap method in the BootstrapMethods attribute. * @return a new or already existing Symbol with the given value. */ @@ -927,12 +924,12 @@ final class SymbolTable { * Adds a new CONSTANT_Dynamic_info or CONSTANT_InvokeDynamic_info to the constant pool of this * symbol table. * - * @param tag one of {@link Symbol#CONSTANT_DYNAMIC_TAG} or {@link - * Symbol#CONSTANT_INVOKE_DYNAMIC_TAG}. - * @param index the constant pool index of the new Symbol. - * @param name a method name. - * @param descriptor a field descriptor for CONSTANT_DYNAMIC_TAG or a method descriptor for - * CONSTANT_INVOKE_DYNAMIC_TAG. + * @param tag one of {@link Symbol#CONSTANT_DYNAMIC_TAG} or + * {@link Symbol#CONSTANT_INVOKE_DYNAMIC_TAG}. + * @param index the constant pool index of the new Symbol. + * @param name a method name. + * @param descriptor a field descriptor for CONSTANT_DYNAMIC_TAG or a method descriptor + * for CONSTANT_INVOKE_DYNAMIC_TAG. * @param bootstrapMethodIndex the index of a bootstrap method in the BootstrapMethods attribute. */ private void addConstantDynamicOrInvokeDynamicReference( @@ -972,11 +969,11 @@ final class SymbolTable { * CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table. Does * nothing if the constant pool already contains a similar item. * - * @param tag one of {@link Symbol#CONSTANT_CLASS_TAG}, {@link Symbol#CONSTANT_STRING_TAG}, {@link - * Symbol#CONSTANT_METHOD_TYPE_TAG}, {@link Symbol#CONSTANT_MODULE_TAG} or {@link - * Symbol#CONSTANT_PACKAGE_TAG}. + * @param tag one of {@link Symbol#CONSTANT_CLASS_TAG}, {@link Symbol#CONSTANT_STRING_TAG}, + * {@link Symbol#CONSTANT_METHOD_TYPE_TAG}, {@link Symbol#CONSTANT_MODULE_TAG} or + * {@link Symbol#CONSTANT_PACKAGE_TAG}. * @param value an internal class name, an arbitrary string, a method descriptor, a module or a - * package name, depending on tag. + * package name, depending on tag. * @return a new or already existing Symbol with the given value. */ private Symbol addConstantUtf8Reference(final int tag, final String value) { @@ -997,11 +994,11 @@ final class SymbolTable { * CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table. * * @param index the constant pool index of the new Symbol. - * @param tag one of {@link Symbol#CONSTANT_CLASS_TAG}, {@link Symbol#CONSTANT_STRING_TAG}, {@link - * Symbol#CONSTANT_METHOD_TYPE_TAG}, {@link Symbol#CONSTANT_MODULE_TAG} or {@link - * Symbol#CONSTANT_PACKAGE_TAG}. + * @param tag one of {@link Symbol#CONSTANT_CLASS_TAG}, {@link Symbol#CONSTANT_STRING_TAG}, + * {@link Symbol#CONSTANT_METHOD_TYPE_TAG}, {@link Symbol#CONSTANT_MODULE_TAG} or + * {@link Symbol#CONSTANT_PACKAGE_TAG}. * @param value an internal class name, an arbitrary string, a method descriptor, a module or a - * package name, depending on tag. + * package name, depending on tag. */ private void addConstantUtf8Reference(final int index, final int tag, final String value) { add(new Entry(index, tag, value, hash(tag, value))); @@ -1015,7 +1012,7 @@ final class SymbolTable { * Adds a bootstrap method to the BootstrapMethods attribute of this symbol table. Does nothing if * the BootstrapMethods already contains a similar bootstrap method. * - * @param bootstrapMethodHandle a bootstrap method handle. + * @param bootstrapMethodHandle a bootstrap method handle. * @param bootstrapMethodArguments the bootstrap method arguments. * @return a new or already existing Symbol with the given value. */ @@ -1042,11 +1039,11 @@ final class SymbolTable { int bootstrapMethodOffset = bootstrapMethodsAttribute.length; bootstrapMethodsAttribute.putShort( addConstantMethodHandle( - bootstrapMethodHandle.getTag(), - bootstrapMethodHandle.getOwner(), - bootstrapMethodHandle.getName(), - bootstrapMethodHandle.getDesc(), - bootstrapMethodHandle.isInterface()) + bootstrapMethodHandle.getTag(), + bootstrapMethodHandle.getOwner(), + bootstrapMethodHandle.getName(), + bootstrapMethodHandle.getDesc(), + bootstrapMethodHandle.isInterface()) .index); bootstrapMethodsAttribute.putShort(numBootstrapArguments); @@ -1071,8 +1068,9 @@ final class SymbolTable { * the BootstrapMethods already contains a similar bootstrap method (more precisely, reverts the * content of {@link #bootstrapMethods} to remove the last, duplicate bootstrap method). * - * @param offset the offset of the last bootstrap method in {@link #bootstrapMethods}, in bytes. - * @param length the length of this bootstrap method in {@link #bootstrapMethods}, in bytes. + * @param offset the offset of the last bootstrap method in {@link #bootstrapMethods}, in + * bytes. + * @param length the length of this bootstrap method in {@link #bootstrapMethods}, in bytes. * @param hashCode the hash code of this bootstrap method. * @return a new or already existing Symbol with the given value. */ @@ -1136,9 +1134,9 @@ final class SymbolTable { * Adds an {@link Frame#ITEM_UNINITIALIZED} type in the type table of this symbol table. Does * nothing if the type table already contains a similar type. * - * @param value an internal class name. - * @param bytecodeOffset the bytecode offset of the NEW instruction that created this {@link - * Frame#ITEM_UNINITIALIZED} type value. + * @param value an internal class name. + * @param bytecodeOffset the bytecode offset of the NEW instruction that created this + * {@link Frame#ITEM_UNINITIALIZED} type value. * @return the index of a new or already existing type Symbol with the given value. */ int addUninitializedType(final String value, final int bytecodeOffset) { @@ -1162,11 +1160,11 @@ final class SymbolTable { * already contains a similar type. * * @param typeTableIndex1 a {@link Symbol#TYPE_TAG} type, specified by its index in the type - * table. + * table. * @param typeTableIndex2 another {@link Symbol#TYPE_TAG} type, specified by its index in the type - * table. + * table. * @return the index of a new or already existing {@link Symbol#TYPE_TAG} type Symbol, - * corresponding to the common super class of the given types. + * corresponding to the common super class of the given types. */ int addMergedType(final int typeTableIndex1, final int typeTableIndex2) { long data = @@ -1192,9 +1190,10 @@ final class SymbolTable { * Adds the given type Symbol to {@link #typeTable}. * * @param entry a {@link Symbol#TYPE_TAG} or {@link Symbol#UNINITIALIZED_TYPE_TAG} type symbol. - * The index of this Symbol must be equal to the current value of {@link #typeCount}. + * The index of this Symbol must be equal to the current value of + * {@link #typeCount}. * @return the index in {@link #typeTable} where the given type was added, which is also equal to - * entry's index by hypothesis. + * entry's index by hypothesis. */ private int addTypeInternal(final Entry entry) { if (typeTable == null) { @@ -1259,12 +1258,14 @@ final class SymbolTable { */ private static class Entry extends Symbol { - /** The hash code of this entry. */ + /** + * The hash code of this entry. + */ final int hashCode; /** - * Another entry (and so on recursively) having the same hash code (modulo the size of {@link - * #entries}) as this one. + * Another entry (and so on recursively) having the same hash code (modulo the size of + * {@link #entries}) as this one. */ Entry next; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Type.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Type.java index 9882a7110e6e85ca5ab29e4c594534d1a5e19ca3..1b4c231f9a0d2535f53b8ba34d112fba902439e3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Type.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/Type.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; import java.lang.reflect.Constructor; @@ -21,74 +9,120 @@ import java.lang.reflect.Method; */ public final class Type { - /** The sort of the {@code void} type. See {@link #getSort}. */ + /** + * The sort of the {@code void} type. See {@link #getSort}. + */ public static final int VOID = 0; - /** The sort of the {@code boolean} type. See {@link #getSort}. */ + /** + * The sort of the {@code boolean} type. See {@link #getSort}. + */ public static final int BOOLEAN = 1; - /** The sort of the {@code char} type. See {@link #getSort}. */ + /** + * The sort of the {@code char} type. See {@link #getSort}. + */ public static final int CHAR = 2; - /** The sort of the {@code byte} type. See {@link #getSort}. */ + /** + * The sort of the {@code byte} type. See {@link #getSort}. + */ public static final int BYTE = 3; - /** The sort of the {@code short} type. See {@link #getSort}. */ + /** + * The sort of the {@code short} type. See {@link #getSort}. + */ public static final int SHORT = 4; - /** The sort of the {@code int} type. See {@link #getSort}. */ + /** + * The sort of the {@code int} type. See {@link #getSort}. + */ public static final int INT = 5; - /** The sort of the {@code float} type. See {@link #getSort}. */ + /** + * The sort of the {@code float} type. See {@link #getSort}. + */ public static final int FLOAT = 6; - /** The sort of the {@code long} type. See {@link #getSort}. */ + /** + * The sort of the {@code long} type. See {@link #getSort}. + */ public static final int LONG = 7; - /** The sort of the {@code double} type. See {@link #getSort}. */ + /** + * The sort of the {@code double} type. See {@link #getSort}. + */ public static final int DOUBLE = 8; - /** The sort of array reference types. See {@link #getSort}. */ + /** + * The sort of array reference types. See {@link #getSort}. + */ public static final int ARRAY = 9; - /** The sort of object reference types. See {@link #getSort}. */ + /** + * The sort of object reference types. See {@link #getSort}. + */ public static final int OBJECT = 10; - /** The sort of method types. See {@link #getSort}. */ + /** + * The sort of method types. See {@link #getSort}. + */ public static final int METHOD = 11; - /** The (private) sort of object reference types represented with an internal name. */ + /** + * The (private) sort of object reference types represented with an internal name. + */ private static final int INTERNAL = 12; - /** The descriptors of the primitive types. */ + /** + * The descriptors of the primitive types. + */ private static final String PRIMITIVE_DESCRIPTORS = "VZCBSIFJD"; - /** The {@code void} type. */ + /** + * The {@code void} type. + */ public static final Type VOID_TYPE = new Type(VOID, PRIMITIVE_DESCRIPTORS, VOID, VOID + 1); - /** The {@code boolean} type. */ + /** + * The {@code boolean} type. + */ public static final Type BOOLEAN_TYPE = new Type(BOOLEAN, PRIMITIVE_DESCRIPTORS, BOOLEAN, BOOLEAN + 1); - /** The {@code char} type. */ + /** + * The {@code char} type. + */ public static final Type CHAR_TYPE = new Type(CHAR, PRIMITIVE_DESCRIPTORS, CHAR, CHAR + 1); - /** The {@code byte} type. */ + /** + * The {@code byte} type. + */ public static final Type BYTE_TYPE = new Type(BYTE, PRIMITIVE_DESCRIPTORS, BYTE, BYTE + 1); - /** The {@code short} type. */ + /** + * The {@code short} type. + */ public static final Type SHORT_TYPE = new Type(SHORT, PRIMITIVE_DESCRIPTORS, SHORT, SHORT + 1); - /** The {@code int} type. */ + /** + * The {@code int} type. + */ public static final Type INT_TYPE = new Type(INT, PRIMITIVE_DESCRIPTORS, INT, INT + 1); - /** The {@code float} type. */ + /** + * The {@code float} type. + */ public static final Type FLOAT_TYPE = new Type(FLOAT, PRIMITIVE_DESCRIPTORS, FLOAT, FLOAT + 1); - /** The {@code long} type. */ + /** + * The {@code long} type. + */ public static final Type LONG_TYPE = new Type(LONG, PRIMITIVE_DESCRIPTORS, LONG, LONG + 1); - /** The {@code double} type. */ + /** + * The {@code double} type. + */ public static final Type DOUBLE_TYPE = new Type(DOUBLE, PRIMITIVE_DESCRIPTORS, DOUBLE, DOUBLE + 1); @@ -109,34 +143,34 @@ public final class Type { * cases. * *

For {@link #OBJECT} types, this field also contains the descriptor: the characters in - * [{@link #valueBegin},{@link #valueEnd}) contain the internal name, and those in [{@link - * #valueBegin} - 1, {@link #valueEnd} + 1) contain the descriptor. + * [{@link #valueBegin},{@link #valueEnd}) contain the internal name, and those in + * [{@link #valueBegin} - 1, {@link #valueEnd} + 1) contain the descriptor. */ private final String valueBuffer; /** - * The beginning index, inclusive, of the value of this Java field or method type in {@link - * #valueBuffer}. This value is an internal name for {@link #OBJECT} and {@link #INTERNAL} types, - * and a field or method descriptor in the other cases. + * The beginning index, inclusive, of the value of this Java field or method type in + * {@link #valueBuffer}. This value is an internal name for {@link #OBJECT} and {@link #INTERNAL} + * types, and a field or method descriptor in the other cases. */ private final int valueBegin; /** - * The end index, exclusive, of the value of this Java field or method type in {@link - * #valueBuffer}. This value is an internal name for {@link #OBJECT} and {@link #INTERNAL} types, - * and a field or method descriptor in the other cases. + * The end index, exclusive, of the value of this Java field or method type in + * {@link #valueBuffer}. This value is an internal name for {@link #OBJECT} and {@link #INTERNAL} + * types, and a field or method descriptor in the other cases. */ private final int valueEnd; /** * Constructs a reference type. * - * @param sort the sort of this type, see {@link #sort}. + * @param sort the sort of this type, see {@link #sort}. * @param valueBuffer a buffer containing the value of this field or method type. - * @param valueBegin the beginning index, inclusive, of the value of this field or method type in - * valueBuffer. - * @param valueEnd the end index, exclusive, of the value of this field or method type in - * valueBuffer. + * @param valueBegin the beginning index, inclusive, of the value of this field or method type in + * valueBuffer. + * @param valueEnd the end index, exclusive, of the value of this field or method type in + * valueBuffer. */ private Type(final int sort, final String valueBuffer, final int valueBegin, final int valueEnd) { this.sort = sort; @@ -249,7 +283,7 @@ public final class Type { /** * Returns the method {@link Type} corresponding to the given argument and return types. * - * @param returnType the return type of the method. + * @param returnType the return type of the method. * @param argumentTypes the argument types of the method. * @return the method {@link Type} corresponding to the given argument and return types. */ @@ -273,7 +307,7 @@ public final class Type { * * @param methodDescriptor a method descriptor. * @return the {@link Type} values corresponding to the argument types of the given method - * descriptor. + * descriptor. */ public static Type[] getArgumentTypes(final String methodDescriptor) { // First step: compute the number of argument types in methodDescriptor. @@ -388,10 +422,10 @@ public final class Type { * Returns the {@link Type} corresponding to the given field or method descriptor. * * @param descriptorBuffer a buffer containing the field or method descriptor. - * @param descriptorBegin the beginning index, inclusive, of the field or method descriptor in - * descriptorBuffer. - * @param descriptorEnd the end index, exclusive, of the field or method descriptor in - * descriptorBuffer. + * @param descriptorBegin the beginning index, inclusive, of the field or method descriptor in + * descriptorBuffer. + * @param descriptorEnd the end index, exclusive, of the field or method descriptor in + * descriptorBuffer. * @return the {@link Type} corresponding to the given type descriptor. */ private static Type getTypeInternal( @@ -538,7 +572,7 @@ public final class Type { /** * Returns the descriptor corresponding to the given argument and return types. * - * @param returnType the return type of the method. + * @param returnType the return type of the method. * @param argumentTypes the argument types of the method. * @return the descriptor corresponding to the given argument and return types. */ @@ -589,7 +623,7 @@ public final class Type { /** * Appends the descriptor of the given class to the given string builder. * - * @param clazz the class whose descriptor must be computed. + * @param clazz the class whose descriptor must be computed. * @param stringBuilder the string builder to which the descriptor must be appended. */ private static void appendDescriptor(final Class clazz, final StringBuilder stringBuilder) { @@ -634,9 +668,9 @@ public final class Type { /** * Returns the sort of this type. * - * @return {@link #VOID}, {@link #BOOLEAN}, {@link #CHAR}, {@link #BYTE}, {@link #SHORT}, {@link - * #INT}, {@link #FLOAT}, {@link #LONG}, {@link #DOUBLE}, {@link #ARRAY}, {@link #OBJECT} or - * {@link #METHOD}. + * @return {@link #VOID}, {@link #BOOLEAN}, {@link #CHAR}, {@link #BYTE}, {@link #SHORT}, + * {@link #INT}, {@link #FLOAT}, {@link #LONG}, {@link #DOUBLE}, {@link #ARRAY}, {@link #OBJECT} + * or {@link #METHOD}. */ public int getSort() { return sort == INTERNAL ? OBJECT : sort; @@ -660,7 +694,7 @@ public final class Type { * Returns the size of values of this type. This method must not be used for method types. * * @return the size of values of this type, i.e., 2 for {@code long} and {@code double}, 0 for - * {@code void} and 1 otherwise. + * {@code void} and 1 otherwise. */ public int getSize() { switch (sort) { @@ -689,9 +723,9 @@ public final class Type { * should only be used for method types. * * @return the size of the arguments of the method (plus one for the implicit this argument), - * argumentsSize, and the size of its return value, returnSize, packed into a single int i = - * {@code (argumentsSize << 2) | returnSize} (argumentsSize is therefore equal to {@code - * i >> 2}, and returnSize to {@code i & 0x03}). + * argumentsSize, and the size of its return value, returnSize, packed into a single int i = + * {@code (argumentsSize << 2) | returnSize} (argumentsSize is therefore equal to + * {@code i >> 2}, and returnSize to {@code i & 0x03}). */ public int getArgumentsAndReturnSizes() { return getArgumentsAndReturnSizes(getDescriptor()); @@ -702,9 +736,9 @@ public final class Type { * * @param methodDescriptor a method descriptor. * @return the size of the arguments of the method (plus one for the implicit this argument), - * argumentsSize, and the size of its return value, returnSize, packed into a single int i = - * {@code (argumentsSize << 2) | returnSize} (argumentsSize is therefore equal to {@code - * i >> 2}, and returnSize to {@code i & 0x03}). + * argumentsSize, and the size of its return value, returnSize, packed into a single int i = + * {@code (argumentsSize << 2) | returnSize} (argumentsSize is therefore equal to + * {@code i >> 2}, and returnSize to {@code i & 0x03}). */ public static int getArgumentsAndReturnSizes(final String methodDescriptor) { int argumentsSize = 1; @@ -743,11 +777,11 @@ public final class Type { * method types. * * @param opcode a JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, - * IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR and - * IRETURN. + * IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR + * and IRETURN. * @return an opcode that is similar to the given opcode, but adapted to this {@link Type}. For - * example, if this type is {@code float} and {@code opcode} is IRETURN, this method returns - * FRETURN. + * example, if this type is {@code float} and {@code opcode} is IRETURN, this method returns + * FRETURN. */ public int getOpcode(final int opcode) { if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypePath.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypePath.java index 0ece532785e9970c3146fa0fca10247b6d63ce7a..36cb6ead8457187e42c00034a3e21db51084c87e 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypePath.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypePath.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -18,16 +6,24 @@ package cn.universal.core.engine.asm; */ public final class TypePath { - /** A type path step that steps into the element type of an array type. See {@link #getStep}. */ + /** + * A type path step that steps into the element type of an array type. See {@link #getStep}. + */ public static final int ARRAY_ELEMENT = 0; - /** A type path step that steps into the nested type of a class type. See {@link #getStep}. */ + /** + * A type path step that steps into the nested type of a class type. See {@link #getStep}. + */ public static final int INNER_TYPE = 1; - /** A type path step that steps into the bound of a wildcard type. See {@link #getStep}. */ + /** + * A type path step that steps into the bound of a wildcard type. See {@link #getStep}. + */ public static final int WILDCARD_BOUND = 2; - /** A type path step that steps into a type argument of a generic type. See {@link #getStep}. */ + /** + * A type path step that steps into a type argument of a generic type. See {@link #getStep}. + */ public static final int TYPE_ARGUMENT = 3; /** @@ -36,20 +32,22 @@ public final class TypePath { * structure in this array is given by {@link #typePathOffset}. * * @see JVMS - * 4.7.20.2 + * href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.20.2">JVMS + * 4.7.20.2 */ private final byte[] typePathContainer; - /** The offset of the first byte of the type_path JVMS structure in {@link #typePathContainer}. */ + /** + * The offset of the first byte of the type_path JVMS structure in {@link #typePathContainer}. + */ private final int typePathOffset; /** * Constructs a new TypePath. * * @param typePathContainer a byte array containing a type_path JVMS structure. - * @param typePathOffset the offset of the first byte of the type_path structure in - * typePathContainer. + * @param typePathOffset the offset of the first byte of the type_path structure in + * typePathContainer. */ TypePath(final byte[] typePathContainer, final int typePathOffset) { this.typePathContainer = typePathContainer; @@ -70,8 +68,8 @@ public final class TypePath { * Returns the value of the given step of this path. * * @param index an index between 0 and {@link #getLength()}, exclusive. - * @return one of {@link #ARRAY_ELEMENT}, {@link #INNER_TYPE}, {@link #WILDCARD_BOUND}, or {@link - * #TYPE_ARGUMENT}. + * @return one of {@link #ARRAY_ELEMENT}, {@link #INNER_TYPE}, {@link #WILDCARD_BOUND}, or + * {@link #TYPE_ARGUMENT}. */ public int getStep(final int index) { // Returns the type_path_kind of the path element of the given index. @@ -95,7 +93,7 @@ public final class TypePath { * object. * * @param typePath a type path in string form, in the format used by {@link #toString()}. May be - * {@literal null} or empty. + * {@literal null} or empty. * @return the corresponding TypePath object, or {@literal null} if the path is empty. */ public static TypePath fromString(final String typePath) { @@ -137,8 +135,8 @@ public final class TypePath { /** * Returns a string representation of this type path. {@link #ARRAY_ELEMENT} steps are represented - * with '[', {@link #INNER_TYPE} steps with '.', {@link #WILDCARD_BOUND} steps with '*' and {@link - * #TYPE_ARGUMENT} steps with their type argument index in decimal form followed by ';'. + * with '[', {@link #INNER_TYPE} steps with '.', {@link #WILDCARD_BOUND} steps with '*' and + * {@link #TYPE_ARGUMENT} steps with their type argument index in decimal form followed by ';'. */ @Override public String toString() { @@ -170,7 +168,7 @@ public final class TypePath { * ByteVector. * * @param typePath a TypePath instance, or {@literal null} for empty paths. - * @param output where the type path must be put. + * @param output where the type path must be put. */ static void put(final TypePath typePath, final ByteVector output) { if (typePath == null) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypeReference.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypeReference.java index 73c93d0bac36db6cdb45298a9aa00c9645c16a2b..61446f7e66ecd49b4a30bcc331a12e939289ab24 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypeReference.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/TypeReference.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm; /** @@ -21,14 +9,14 @@ package cn.universal.core.engine.asm; public class TypeReference { /** - * The sort of type references that target a type parameter of a generic class. See {@link - * #getSort}. + * The sort of type references that target a type parameter of a generic class. See + * {@link #getSort}. */ public static final int CLASS_TYPE_PARAMETER = 0x00; /** - * The sort of type references that target a type parameter of a generic method. See {@link - * #getSort}. + * The sort of type references that target a type parameter of a generic method. See + * {@link #getSort}. */ public static final int METHOD_TYPE_PARAMETER = 0x01; @@ -50,10 +38,14 @@ public class TypeReference { */ public static final int METHOD_TYPE_PARAMETER_BOUND = 0x12; - /** The sort of type references that target the type of a field. See {@link #getSort}. */ + /** + * The sort of type references that target the type of a field. See {@link #getSort}. + */ public static final int FIELD = 0x13; - /** The sort of type references that target the return type of a method. See {@link #getSort}. */ + /** + * The sort of type references that target the return type of a method. See {@link #getSort}. + */ public static final int METHOD_RETURN = 0x14; /** @@ -62,8 +54,8 @@ public class TypeReference { public static final int METHOD_RECEIVER = 0x15; /** - * The sort of type references that target the type of a formal parameter of a method. See {@link - * #getSort}. + * The sort of type references that target the type of a formal parameter of a method. See + * {@link #getSort}. */ public static final int METHOD_FORMAL_PARAMETER = 0x16; @@ -74,14 +66,14 @@ public class TypeReference { public static final int THROWS = 0x17; /** - * The sort of type references that target the type of a local variable in a method. See {@link - * #getSort}. + * The sort of type references that target the type of a local variable in a method. See + * {@link #getSort}. */ public static final int LOCAL_VARIABLE = 0x40; /** - * The sort of type references that target the type of a resource variable in a method. See {@link - * #getSort}. + * The sort of type references that target the type of a resource variable in a method. See + * {@link #getSort}. */ public static final int RESOURCE_VARIABLE = 0x41; @@ -110,8 +102,8 @@ public class TypeReference { public static final int CONSTRUCTOR_REFERENCE = 0x45; /** - * The sort of type references that target the receiver type of a method reference. See {@link - * #getSort}. + * The sort of type references that target the receiver type of a method reference. See + * {@link #getSort}. */ public static final int METHOD_REFERENCE = 0x46; @@ -152,17 +144,18 @@ public class TypeReference { * specific method {@link MethodVisitor#visitLocalVariableAnnotation}). Thus, both structures can * be stored in an int. * - *

This int field stores target_type (called the TypeReference 'sort' in the public API of this + *

This int field stores target_type (called the TypeReference 'sort' in the public API of + * this * class) in its most significant byte, followed by the target_info fields. Depending on * target_type, 1, 2 or even 3 least significant bytes of this field are unused. target_info * fields which reference bytecode offsets are set to 0 (these offsets are ignored in ClassReader, * and recomputed in MethodWriter). * * @see JVMS - * 4.7.20 + * 4.7.20 * @see JVMS - * 4.7.20.1 + * href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.20.1">JVMS + * 4.7.20.1 */ private final int targetTypeAndInfo; @@ -170,7 +163,7 @@ public class TypeReference { * Constructs a new TypeReference. * * @param typeRef the int encoded value of the type reference, as received in a visit method - * related to type annotations, such as {@link ClassVisitor#visitTypeAnnotation}. + * related to type annotations, such as {@link ClassVisitor#visitTypeAnnotation}. */ public TypeReference(final int typeRef) { this.targetTypeAndInfo = typeRef; @@ -179,9 +172,9 @@ public class TypeReference { /** * Returns a type reference of the given sort. * - * @param sort one of {@link #FIELD}, {@link #METHOD_RETURN}, {@link #METHOD_RECEIVER}, {@link - * #LOCAL_VARIABLE}, {@link #RESOURCE_VARIABLE}, {@link #INSTANCEOF}, {@link #NEW}, {@link - * #CONSTRUCTOR_REFERENCE}, or {@link #METHOD_REFERENCE}. + * @param sort one of {@link #FIELD}, {@link #METHOD_RETURN}, {@link #METHOD_RECEIVER}, + * {@link #LOCAL_VARIABLE}, {@link #RESOURCE_VARIABLE}, {@link #INSTANCEOF}, + * {@link #NEW}, {@link #CONSTRUCTOR_REFERENCE}, or {@link #METHOD_REFERENCE}. * @return a type reference of the given sort. */ public static TypeReference newTypeReference(final int sort) { @@ -191,7 +184,7 @@ public class TypeReference { /** * Returns a reference to a type parameter of a generic class or method. * - * @param sort one of {@link #CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER}. + * @param sort one of {@link #CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER}. * @param paramIndex the type parameter index. * @return a reference to the given generic class or method type parameter. */ @@ -202,7 +195,7 @@ public class TypeReference { /** * Returns a reference to a type parameter bound of a generic class or method. * - * @param sort one of {@link #CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER}. + * @param sort one of {@link #CLASS_TYPE_PARAMETER} or {@link #METHOD_TYPE_PARAMETER}. * @param paramIndex the type parameter index. * @param boundIndex the type bound index within the above type parameters. * @return a reference to the given generic class or method type parameter bound. @@ -217,7 +210,7 @@ public class TypeReference { * class. * * @param itfIndex the index of an processer in the 'implements' clause of a class, or -1 to - * reference the super class of the class. + * reference the super class of the class. * @return a reference to the given super type of a class. */ public static TypeReference newSuperTypeReference(final int itfIndex) { @@ -248,7 +241,7 @@ public class TypeReference { * Returns a reference to the type of the exception declared in a 'catch' clause of a method. * * @param tryCatchBlockIndex the index of a try catch block (using the order in which they are - * visited with visitTryCatchBlock). + * visited with visitTryCatchBlock). * @return a reference to the type of the given exception. */ public static TypeReference newTryCatchReference(final int tryCatchBlockIndex) { @@ -259,9 +252,10 @@ public class TypeReference { * Returns a reference to the type of a type argument in a constructor or method call or * reference. * - * @param sort one of {@link #CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link - * #METHOD_INVOCATION_TYPE_ARGUMENT}, {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link - * #METHOD_REFERENCE_TYPE_ARGUMENT}. + * @param sort one of {@link #CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, + * {@link #METHOD_INVOCATION_TYPE_ARGUMENT}, + * {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or + * {@link #METHOD_REFERENCE_TYPE_ARGUMENT}. * @param argIndex the type argument index. * @return a reference to the type of the given type argument. */ @@ -272,14 +266,15 @@ public class TypeReference { /** * Returns the sort of this type reference. * - * @return one of {@link #CLASS_TYPE_PARAMETER}, {@link #METHOD_TYPE_PARAMETER}, {@link - * #CLASS_EXTENDS}, {@link #CLASS_TYPE_PARAMETER_BOUND}, {@link #METHOD_TYPE_PARAMETER_BOUND}, - * {@link #FIELD}, {@link #METHOD_RETURN}, {@link #METHOD_RECEIVER}, {@link - * #METHOD_FORMAL_PARAMETER}, {@link #THROWS}, {@link #LOCAL_VARIABLE}, {@link - * #RESOURCE_VARIABLE}, {@link #EXCEPTION_PARAMETER}, {@link #INSTANCEOF}, {@link #NEW}, - * {@link #CONSTRUCTOR_REFERENCE}, {@link #METHOD_REFERENCE}, {@link #CAST}, {@link - * #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT}, {@link - * #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link #METHOD_REFERENCE_TYPE_ARGUMENT}. + * @return one of {@link #CLASS_TYPE_PARAMETER}, {@link #METHOD_TYPE_PARAMETER}, + * {@link #CLASS_EXTENDS}, {@link #CLASS_TYPE_PARAMETER_BOUND}, + * {@link #METHOD_TYPE_PARAMETER_BOUND}, {@link #FIELD}, {@link #METHOD_RETURN}, + * {@link #METHOD_RECEIVER}, {@link #METHOD_FORMAL_PARAMETER}, {@link #THROWS}, + * {@link #LOCAL_VARIABLE}, {@link #RESOURCE_VARIABLE}, {@link #EXCEPTION_PARAMETER}, + * {@link #INSTANCEOF}, {@link #NEW}, {@link #CONSTRUCTOR_REFERENCE}, {@link #METHOD_REFERENCE}, + * {@link #CAST}, {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, + * {@link #METHOD_INVOCATION_TYPE_ARGUMENT}, {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or + * {@link #METHOD_REFERENCE_TYPE_ARGUMENT}. */ public int getSort() { return targetTypeAndInfo >>> 24; @@ -287,9 +282,9 @@ public class TypeReference { /** * Returns the index of the type parameter referenced by this type reference. This method must - * only be used for type references whose sort is {@link #CLASS_TYPE_PARAMETER}, {@link - * #METHOD_TYPE_PARAMETER}, {@link #CLASS_TYPE_PARAMETER_BOUND} or {@link - * #METHOD_TYPE_PARAMETER_BOUND}. + * only be used for type references whose sort is {@link #CLASS_TYPE_PARAMETER}, + * {@link #METHOD_TYPE_PARAMETER}, {@link #CLASS_TYPE_PARAMETER_BOUND} or + * {@link #METHOD_TYPE_PARAMETER_BOUND}. * * @return a type parameter index. */ @@ -298,10 +293,10 @@ public class TypeReference { } /** - * Returns the index of the type parameter bound, within the type parameter {@link - * #getTypeParameterIndex}, referenced by this type reference. This method must only be used for - * type references whose sort is {@link #CLASS_TYPE_PARAMETER_BOUND} or {@link - * #METHOD_TYPE_PARAMETER_BOUND}. + * Returns the index of the type parameter bound, within the type parameter + * {@link #getTypeParameterIndex}, referenced by this type reference. This method must only be + * used for type references whose sort is {@link #CLASS_TYPE_PARAMETER_BOUND} or + * {@link #METHOD_TYPE_PARAMETER_BOUND}. * * @return a type parameter bound index. */ @@ -314,7 +309,7 @@ public class TypeReference { * This method must only be used for type references whose sort is {@link #CLASS_EXTENDS}. * * @return the index of an processer in the 'implements' clause of a class, or -1 if this type - * reference references the type of the super class. + * reference references the type of the super class. */ public int getSuperTypeIndex() { return (short) ((targetTypeAndInfo & 0x00FFFF00) >> 8); @@ -332,8 +327,8 @@ public class TypeReference { /** * Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced - * by this type reference. This method must only be used for type references whose sort is {@link - * #THROWS}. + * by this type reference. This method must only be used for type references whose sort is + * {@link #THROWS}. * * @return the index of an exception in the 'throws' clause of a method. */ @@ -354,9 +349,9 @@ public class TypeReference { /** * Returns the index of the type argument referenced by this type reference. This method must only - * be used for type references whose sort is {@link #CAST}, {@link - * #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT}, {@link - * #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link #METHOD_REFERENCE_TYPE_ARGUMENT}. + * be used for type references whose sort is {@link #CAST}, + * {@link #CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}, {@link #METHOD_INVOCATION_TYPE_ARGUMENT}, + * {@link #CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}, or {@link #METHOD_REFERENCE_TYPE_ARGUMENT}. * * @return a type parameter index. */ @@ -377,9 +372,10 @@ public class TypeReference { /** * Puts the given target_type and target_info JVMS structures into the given ByteVector. * - * @param targetTypeAndInfo a target_type and a target_info structures encoded as in {@link - * #targetTypeAndInfo}. LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported. - * @param output where the type reference must be put. + * @param targetTypeAndInfo a target_type and a target_info structures encoded as in + * {@link #targetTypeAndInfo}. LOCAL_VARIABLE and RESOURCE_VARIABLE + * target types are not supported. + * @param output where the type reference must be put. */ static void putTarget(final int targetTypeAndInfo, final ByteVector output) { switch (targetTypeAndInfo >>> 24) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureReader.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureReader.java index 0bacfec69216b1143c1c5f6143442cd5112dab41..e8067a527e012505031deabb87dd1af888672876 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureReader.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureReader.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm.signature; import cn.universal.core.engine.asm.ClassVisitor; @@ -20,11 +8,13 @@ import cn.universal.core.engine.asm.MethodVisitor; * visit them with a SignatureVisitor. @Author Thomas Hallgren @Author Eric Bruneton * * @see JVMS - * 4.7.9.1 + * 4.7.9.1 */ public class SignatureReader { - /** The JVMS signature to be read. */ + /** + * The JVMS signature to be read. + */ private final String signatureValue; /** @@ -116,8 +106,8 @@ public class SignatureReader { * Makes the given visitor visit the signature of this {@link SignatureReader}. This signature is * the one specified in the constructor (see {@link #SignatureReader}). This method is intended to * be called on a {@link SignatureReader} that was created using a JavaTypeSignature, such - * as the signature parameter of the {@link ClassVisitor#visitField} or {@link - * MethodVisitor#visitLocalVariable} methods. + * as the signature parameter of the {@link ClassVisitor#visitField} or + * {@link MethodVisitor#visitLocalVariable} methods. * * @param signatureVisitor the visitor that must visit this signature. */ @@ -128,8 +118,8 @@ public class SignatureReader { /** * Parses a JavaTypeSignature and makes the given visitor visit it. * - * @param signature a string containing the signature that must be parsed. - * @param startOffset index of the first character of the signature to parsed. + * @param signature a string containing the signature that must be parsed. + * @param startOffset index of the first character of the signature to parsed. * @param signatureVisitor the visitor that must visit this signature. * @return the index of the first character after the parsed signature. */ diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureVisitor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureVisitor.java index 7e20a3e5cbce535b4d14604db399bcbef849ddb5..633dc6c7ee00261588c2e207a16c4ff0c17eb3ef 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureVisitor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureVisitor.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm.signature; import cn.universal.core.engine.asm.Opcodes; @@ -34,26 +22,33 @@ import cn.universal.core.engine.asm.Opcodes; */ public abstract class SignatureVisitor { - /** Wildcard for an "extends" type argument. */ + /** + * Wildcard for an "extends" type argument. + */ public static final char EXTENDS = '+'; - /** Wildcard for a "super" type argument. */ + /** + * Wildcard for a "super" type argument. + */ public static final char SUPER = '-'; - /** Wildcard for a normal type argument. */ + /** + * Wildcard for a normal type argument. + */ public static final char INSTANCEOF = '='; /** - * The ASM API version implemented by this visitor. The value of this field must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * The ASM API version implemented by this visitor. The value of this field must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. */ protected final int api; /** * Constructs a new {@link SignatureVisitor}. * - * @param api the ASM API version implemented by this visitor. Must be one of {@link - * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. + * @param api the ASM API version implemented by this visitor. Must be one of + * {@link Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or + * {@link Opcodes#ASM7}. */ public SignatureVisitor(final int api) { if (api != Opcodes.ASM9 @@ -73,7 +68,8 @@ public abstract class SignatureVisitor { * * @param name the name of the formal parameter. */ - public void visitFormalTypeParameter(final String name) {} + public void visitFormalTypeParameter(final String name) { + } /** * Visits the class bound of the last visited formal type parameter. @@ -143,14 +139,16 @@ public abstract class SignatureVisitor { * * @param descriptor the descriptor of the primitive type, or 'V' for {@code void} . */ - public void visitBaseType(final char descriptor) {} + public void visitBaseType(final char descriptor) { + } /** * Visits a signature corresponding to a type variable. * * @param name the name of the type variable. */ - public void visitTypeVariable(final String name) {} + public void visitTypeVariable(final String name) { + } /** * Visits a signature corresponding to an array type. @@ -166,17 +164,22 @@ public abstract class SignatureVisitor { * * @param name the internal name of the class or processer. */ - public void visitClassType(final String name) {} + public void visitClassType(final String name) { + } /** * Visits an inner class. * * @param name the local name of the inner class in its enclosing class. */ - public void visitInnerClassType(final String name) {} + public void visitInnerClassType(final String name) { + } - /** Visits an unbounded type argument of the last visited class or inner class type. */ - public void visitTypeArgument() {} + /** + * Visits an unbounded type argument of the last visited class or inner class type. + */ + public void visitTypeArgument() { + } /** * Visits a type argument of the last visited class or inner class type. @@ -188,6 +191,9 @@ public abstract class SignatureVisitor { return this; } - /** Ends the visit of a signature corresponding to a class or processer type. */ - public void visitEnd() {} + /** + * Ends the visit of a signature corresponding to a class or processer type. + */ + public void visitEnd() { + } } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureWriter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureWriter.java index cb1d65391b5378495124e46bb0cc8fa61f81a9ec..b0f9a0571e6a8f0533ad3d10ba6b2b350ad1d49b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureWriter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/asm/signature/SignatureWriter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.asm.signature; import cn.universal.core.engine.asm.Opcodes; @@ -19,17 +7,23 @@ import cn.universal.core.engine.asm.Opcodes; * Specification (JVMS). @Author Thomas Hallgren @Author Eric Bruneton * * @see JVMS - * 4.7.9.1 + * 4.7.9.1 */ public class SignatureWriter extends SignatureVisitor { - /** The builder used to construct the visited signature. */ + /** + * The builder used to construct the visited signature. + */ private final StringBuilder stringBuilder = new StringBuilder(); - /** Whether the visited signature contains formal type parameters. */ + /** + * Whether the visited signature contains formal type parameters. + */ private boolean hasFormals; - /** Whether the visited signature contains method parameter types. */ + /** + * Whether the visited signature contains method parameter types. + */ private boolean hasParameters; /** @@ -51,7 +45,9 @@ public class SignatureWriter extends SignatureVisitor { */ private int argumentStack; - /** Constructs a new {@link SignatureWriter}. */ + /** + * Constructs a new {@link SignatureWriter}. + */ public SignatureWriter() { super(/* latest api =*/ Opcodes.ASM9); } @@ -202,7 +198,9 @@ public class SignatureWriter extends SignatureVisitor { // Utility methods // ----------------------------------------------------------------------------------------------- - /** Ends the formal type parameters section of the signature. */ + /** + * Ends the formal type parameters section of the signature. + */ private void endFormals() { if (hasFormals) { hasFormals = false; @@ -210,7 +208,9 @@ public class SignatureWriter extends SignatureVisitor { } } - /** Ends the type arguments of a class or inner class type. */ + /** + * Ends the type arguments of a class or inner class type. + */ private void endArguments() { // If the top of the stack is 'true', this means that some type arguments have been visited for // the type whose visit is now ending. We therefore need to append a '>', and to pop one element diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/CompileCache.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/CompileCache.java index 5aeb545c5d8deaf945b33d546f6ba250c3e43e6a..4093e835dec88ce36c83fcb387a07ede2b19f0c4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/CompileCache.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/CompileCache.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.compile; import cn.universal.core.engine.MagicScript; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/Descriptor.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/Descriptor.java index 0008d646cc7794679d6853a229833aa224764394..4a7084fa65646df53a62677ebe968648a6d1a7be 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/Descriptor.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/Descriptor.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.compile; import cn.universal.core.engine.asm.Type; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompileException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompileException.java index 3ada139f25d686f920f2935adde7977b9e9cd853..ce364c07eeb3f1dee0dc6936b692c51df1065076 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompileException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompileException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.compile; public class MagicScriptCompileException extends RuntimeException { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompiler.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompiler.java index 8e5374e34f12e22ff37c4538ea87c2bdf7f39864..ddd069f1dbf28346c4bb285310003046d5251819 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompiler.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/compile/MagicScriptCompiler.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.compile; import cn.universal.core.engine.MagicScriptContext; @@ -46,7 +34,9 @@ import java.util.Set; import java.util.Stack; import java.util.concurrent.atomic.AtomicLong; -/** 脚本编译器 */ +/** + * 脚本编译器 + */ public class MagicScriptCompiler implements Opcodes { private static final AtomicLong COUNTER = new AtomicLong(1); @@ -55,16 +45,24 @@ public class MagicScriptCompiler implements Opcodes { private final Long id = COUNTER.getAndIncrement(); - /** < <= == === != !=== >= > 等操作符处理器 */ + /** + * < <= == === != !=== >= > 等操作符处理器 + */ private static final Handle OPERATOR_HANDLE = makeHandle(OperatorHandle.class); - /** << >> >>> & ^ | 运算 */ + /** + * << >> >>> & ^ | 运算 + */ private static final Handle BIT_HANDLE = makeHandle(BitHandle.class); - /** 方法调用、lambda调用、函数调用处理器 */ + /** + * 方法调用、lambda调用、函数调用处理器 + */ private static final Handle FUNCTION_HANDLE = makeHandle(FunctionCallHandle.class); - /** + - * / % 处理器 */ + /** + * + - * / % 处理器 + */ private static final Handle ARITHMETIC_HANDLE = makeHandle(ArithmeticHandle.class); private final Stack methodVisitors = new Stack<>(); @@ -77,9 +75,11 @@ public class MagicScriptCompiler implements Opcodes { private final Set varIndices; - /** -1 ~ 5的int值 */ + /** + * -1 ~ 5的int值 + */ private static final int[] ICONST = { - ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5 + ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5 }; private final List spans = new ArrayList<>(); @@ -125,7 +125,7 @@ public class MagicScriptCompiler implements Opcodes { /** * 创建方法 * - * @param access 访问属性 + * @param access 访问属性 * @param methodName 方法名 * @param descriptor 方法描述 */ @@ -143,34 +143,46 @@ public class MagicScriptCompiler implements Opcodes { return tempIndex++; } - /** 获取lambda函数下标 */ + /** + * 获取lambda函数下标 + */ public int getFunctionIndex() { return ++functionIndex; } - /** 标识continue和break位置 */ + /** + * 标识continue和break位置 + */ public MagicScriptCompiler markLabel(Label start, Label end) { - labelStack.push(new Label[] {start, end}); + labelStack.push(new Label[]{start, end}); return this; } - /** 消除标记 */ + /** + * 消除标记 + */ public MagicScriptCompiler exitLabel() { labelStack.pop(); return this; } - /** 跳转到continue位置 */ + /** + * 跳转到continue位置 + */ public MagicScriptCompiler start() { return jump(GOTO, labelStack.peek()[0]); } - /** 跳转到break位置 */ + /** + * 跳转到break位置 + */ public MagicScriptCompiler end() { return jump(GOTO, labelStack.peek()[1]); } - /** 访问AST节点 */ + /** + * 访问AST节点 + */ public MagicScriptCompiler visit(Node node) { // 对于赋值语句的特殊处理 if (node instanceof AssigmentOperation) { @@ -183,7 +195,9 @@ public class MagicScriptCompiler implements Opcodes { return compile(node, false); } - /** 编译AST节点 */ + /** + * 编译AST节点 + */ public MagicScriptCompiler compile(Node node) { return compile(node, false); } @@ -227,7 +241,7 @@ public class MagicScriptCompiler implements Opcodes { * 编译AST节点 * * @param node AST节点 - * @param pop 是否需要弹出栈顶 + * @param pop 是否需要弹出栈顶 */ public MagicScriptCompiler compile(Node node, boolean pop) { if (node == null) { @@ -279,44 +293,58 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 访问 */ + /** + * 访问 + */ public MagicScriptCompiler visit(List nodes) { nodes.forEach(this::visit); return this; } - /** 编译 */ + /** + * 编译 + */ public MagicScriptCompiler compile(List nodes) { nodes.forEach(it -> compile(it, true)); return this; } - /** 加载this */ + /** + * 加载this + */ public MagicScriptCompiler load0() { self().visitVarInsn(ALOAD, 0); return this; } - /** 加载context */ + /** + * 加载context + */ public MagicScriptCompiler load1() { self().visitVarInsn(ALOAD, 1); return this; } - /** 加载context */ + /** + * 加载context + */ public void newArrayList() { this.typeInsn(NEW, ArrayList.class) .insn(DUP) .invoke(INVOKESPECIAL, ArrayList.class, "", void.class); } - /** 加载Variables */ + /** + * 加载Variables + */ public MagicScriptCompiler load2() { self().visitVarInsn(ALOAD, 2); return this; } - /** 加载3号变量,一般指异常(临时变量) */ + /** + * 加载3号变量,一般指异常(临时变量) + */ public MagicScriptCompiler load3() { self().visitVarInsn(ALOAD, 3); return this; @@ -327,14 +355,18 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 加载变量 */ + /** + * 加载变量 + */ public MagicScriptCompiler load(int index) { return load2() .visitInt(index) .invoke(INVOKEVIRTUAL, Variables.class, "getValue", Object.class, int.class); } - /** 加载变量 */ + /** + * 加载变量 + */ public MagicScriptCompiler load(VarIndex varIndex) { return load(varIndex.getIndex()); } @@ -367,13 +399,17 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 跳转 */ + /** + * 跳转 + */ public MagicScriptCompiler jump(int opcode, Label label) { self().visitJumpInsn(opcode, label); return this; } - /** 移除变量 */ + /** + * 移除变量 + */ public MagicScriptCompiler remove(VarIndex varIndex) { if (varIndex == null) { return this; @@ -381,7 +417,9 @@ public class MagicScriptCompiler implements Opcodes { return remove(varIndex.getName()); } - /** 移除变量 */ + /** + * 移除变量 + */ public MagicScriptCompiler remove(String name) { List varList = vars.peek(); int index = varList.indexOf(name); @@ -391,41 +429,55 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 配合pre_store使用,保存至数组中 */ + /** + * 配合pre_store使用,保存至数组中 + */ public MagicScriptCompiler store() { return invoke(INVOKEVIRTUAL, Variables.class, "setValue", void.class, int.class, Object.class); } - /** 配合pre_store使用,保存至数组中 */ + /** + * 配合pre_store使用,保存至数组中 + */ public MagicScriptCompiler store(VarIndex varIndex) { return varIndex.isScoped() ? scopeStore() : store(); } - /** 配合pre_store使用,保存至数组中 */ + /** + * 配合pre_store使用,保存至数组中 + */ public MagicScriptCompiler scopeStore() { return invoke( INVOKEVIRTUAL, Variables.class, "setScopeValue", void.class, int.class, Object.class); } - /** 保存变量 */ + /** + * 保存变量 + */ public MagicScriptCompiler store(int index) { self().visitVarInsn(ASTORE, index); return this; } - /** 保存变量 */ + /** + * 保存变量 + */ public MagicScriptCompiler frame( int type, int numLocal, Object[] local, int numStack, Object[] stack) { self().visitFrame(type, numLocal, local, numStack, stack); return this; } - /** 写变量前的准备 */ + /** + * 写变量前的准备 + */ public MagicScriptCompiler pre_store(int index) { return load2().visitInt(index); } - /** 写变量前的准备 */ + /** + * 写变量前的准备 + */ public MagicScriptCompiler pre_store(VarIndex varIndex) { return pre_store(varIndex.getIndex()); } @@ -517,7 +569,7 @@ public class MagicScriptCompiler implements Opcodes { * invokedynamic调用 * * @param methodName 方法名 - * @param arguments 参数个数 + * @param arguments 参数个数 */ public MagicScriptCompiler call(String methodName, int arguments) { self() @@ -544,12 +596,16 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 将int值装箱 */ + /** + * 将int值装箱 + */ public MagicScriptCompiler asInteger() { return invoke(INVOKESTATIC, Integer.class, "valueOf", Integer.class, int.class); } - /** 将boolean值装箱 */ + /** + * 将boolean值装箱 + */ public MagicScriptCompiler asBoolean() { return invoke(INVOKESTATIC, Boolean.class, "valueOf", Boolean.class, boolean.class); } @@ -557,10 +613,10 @@ public class MagicScriptCompiler implements Opcodes { /** * 调用方法 * - * @param opcode 调用类型 - * @param target 目标类 - * @param method 方法名 - * @param returnType 返回值类型 + * @param opcode 调用类型 + * @param target 目标类 + * @param method 方法名 + * @param returnType 返回值类型 * @param argumentTypes 参数类型 */ public MagicScriptCompiler invoke( @@ -571,11 +627,11 @@ public class MagicScriptCompiler implements Opcodes { /** * 调用方法 * - * @param opcode 调用类型 - * @param target 目标类 - * @param method 方法名 - * @param isInterface 是否是接口 - * @param returnType 返回值类型 + * @param opcode 调用类型 + * @param target 目标类 + * @param method 方法名 + * @param isInterface 是否是接口 + * @param returnType 返回值类型 * @param argumentTypes 参数类型 */ public MagicScriptCompiler invoke( @@ -609,7 +665,9 @@ public class MagicScriptCompiler implements Opcodes { self().visitIntInsn(opcode, operand); } - /** 编译数组 */ + /** + * 编译数组 + */ public MagicScriptCompiler newArray(List values) { int size = values.size(); visitInt(size).typeInsn(ANEWARRAY, Object.class); @@ -619,7 +677,9 @@ public class MagicScriptCompiler implements Opcodes { return this; } - /** 编译int值 */ + /** + * 编译int值 + */ public MagicScriptCompiler visitInt(int value) { if (value >= -1 && value <= 5) { insn(ICONST[value + 1]); @@ -756,7 +816,9 @@ public class MagicScriptCompiler implements Opcodes { return classWriter.toByteArray(); } - /** 获取类名 */ + /** + * 获取类名 + */ public String getClassName() { return "MagicScript_" + id; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/constant/SafeRule.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/constant/SafeRule.java index 471d1bdb328b7fd4386ce17e9d378f65b417754e..dcb156a44cd0463d4928045724ea3c67f8ac97e6 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/constant/SafeRule.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/constant/SafeRule.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.constant; import java.util.Set; @@ -18,7 +6,6 @@ import java.util.stream.Stream; /** * @Author Aleo - * * @version 1.0 * @since 2023/5/19 */ diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/BooleanImplicitConvert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/BooleanImplicitConvert.java index a0a71cd4e13c7294638c343b091e8b2df1645207..4f66b8542a0fb64bc40b20cda21b4b96812814d1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/BooleanImplicitConvert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/BooleanImplicitConvert.java @@ -1,21 +1,11 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.convert; import cn.universal.core.engine.parsing.ast.literal.BooleanLiteral; import cn.universal.core.engine.runtime.Variables; -/** 任意值到boolean类型的隐式转换 */ +/** + * 任意值到boolean类型的隐式转换 + */ public class BooleanImplicitConvert implements ClassImplicitConvert { @Override diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/ClassImplicitConvert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/ClassImplicitConvert.java index 639b08c06d43ed56c1f3a41ada9909fe986cfd64..808f30f35f44a9b587f855bbeeb024b4f6a879f5 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/ClassImplicitConvert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/ClassImplicitConvert.java @@ -1,29 +1,23 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.convert; import cn.universal.core.engine.runtime.Variables; public interface ClassImplicitConvert { - /** 转换顺序 */ + /** + * 转换顺序 + */ default int sort() { return Integer.MAX_VALUE; } - /** 是否支持隐式自动转换 */ + /** + * 是否支持隐式自动转换 + */ boolean support(Class from, Class to); - /** 转换 */ + /** + * 转换 + */ Object convert(Variables variables, Object source, Class target); } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/CollectionImplicitConvert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/CollectionImplicitConvert.java index 8dcd98b60d8ab3a591d21e41b52751506062d36f..aee7ab7128dd70b9dfcc30ef24be81f7caacc96d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/CollectionImplicitConvert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/CollectionImplicitConvert.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.convert; import cn.universal.core.engine.functions.StreamExtension; @@ -21,7 +9,9 @@ import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; -/** 集合、数组隐式转换 */ +/** + * 集合、数组隐式转换 + */ public class CollectionImplicitConvert implements ClassImplicitConvert { private Class fromClazz; @@ -31,13 +21,13 @@ public class CollectionImplicitConvert implements ClassImplicitConvert { @Override public boolean support(Class from, Class to) { if ((from.isArray() - || Collection.class.isAssignableFrom(from) - || Iterator.class.isAssignableFrom(from) - || Enumeration.class.isAssignableFrom(from)) + || Collection.class.isAssignableFrom(from) + || Iterator.class.isAssignableFrom(from) + || Enumeration.class.isAssignableFrom(from)) && (to.isArray() - || Collection.class.isAssignableFrom(to) - || Iterator.class.isAssignableFrom(to) - || Enumeration.class.isAssignableFrom(to))) { + || Collection.class.isAssignableFrom(to) + || Iterator.class.isAssignableFrom(to) + || Enumeration.class.isAssignableFrom(to))) { return (fromClazz = getGenericType(from)) != null && !JavaReflection.isPrimitiveAssignableFrom(fromClazz, fromClazz) && (toClazz = getGenericType(to)) != null diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/FunctionalImplicitConvert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/FunctionalImplicitConvert.java index e9c4cd3c1fe31b287fdd77b29ef45f18393afa7c..f524694002ffa2f911dfdeff3ca49d8e19338eba 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/FunctionalImplicitConvert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/FunctionalImplicitConvert.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.convert; import cn.universal.core.engine.runtime.Variables; @@ -18,7 +6,9 @@ import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.util.function.Function; -/** 脚本内部lambda到Java函数式的转换 */ +/** + * 脚本内部lambda到Java函数式的转换 + */ public class FunctionalImplicitConvert implements ClassImplicitConvert { private final ClassLoader classLoader = FunctionalImplicitConvert.class.getClassLoader(); @@ -43,7 +33,7 @@ public class FunctionalImplicitConvert implements ClassImplicitConvert { if (aClass.isArray() && aClass.getComponentType() == Object.class) { param = (Object[]) args; } else { - param = new Object[] {args}; + param = new Object[]{args}; } } return function.apply(variables, param); @@ -51,7 +41,7 @@ public class FunctionalImplicitConvert implements ClassImplicitConvert { } return Proxy.newProxyInstance( classLoader, - new Class[] {target}, + new Class[]{target}, (proxy, method, args) -> { if (Modifier.isAbstract(method.getModifiers())) { return function.apply(variables, args); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/MapImplicitConvert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/MapImplicitConvert.java index 49bf9848e70abca7107b1ba043e3304df1f59570..07d779e7d26f0a1bb4e5a49fac17ac9965916e80 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/MapImplicitConvert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/convert/MapImplicitConvert.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.convert; import cn.universal.core.engine.functions.MapExtension; @@ -20,7 +8,9 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.Map; -/** Map到Bean的隐式转换 */ +/** + * Map到Bean的隐式转换 + */ public class MapImplicitConvert implements ClassImplicitConvert { @Override diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/DebugTimeoutException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/DebugTimeoutException.java index edf2e7b473b9405c7b95b46435ece042bd24e0fc..8189193e6175231249e4d0e3fe27aa72312c8ddf 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/DebugTimeoutException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/DebugTimeoutException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class DebugTimeoutException extends RuntimeException { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ExceptionUtils.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ExceptionUtils.java index 3fc674bbb9c2b2943f34beecb7d2646a0ee87d37..5036d41987ef123048c0eedd7707f8cfb4aef9c4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ExceptionUtils.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ExceptionUtils.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class ExceptionUtils { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicExitException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicExitException.java index 3824b381bccf91448d6edeaccc22240636eb0dda..42b26d1108f8efdf933ef9594d00901bb37a4973 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicExitException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicExitException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; import cn.universal.core.engine.runtime.ExitValue; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptAssertException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptAssertException.java index 46bdb6b888a888226b57a930e049dc6683b17c56..571775519174787bbc19637354853a80d7741e39 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptAssertException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptAssertException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class MagicScriptAssertException extends RuntimeException { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptException.java index 7944d7045943114fbea7648eeab5cb130561c22e..9884a2d920add349c51e91d8231c0d1bab0995d9 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; import cn.universal.core.engine.parsing.Span; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptRuntimeException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptRuntimeException.java index 1824e465a5cd21db48aee53a3166ab66e6fccc74..4718dcef24855bc9da9d3ad91f703de3001d5855 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptRuntimeException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/MagicScriptRuntimeException.java @@ -1,20 +1,9 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class MagicScriptRuntimeException extends RuntimeException { - public MagicScriptRuntimeException() {} + public MagicScriptRuntimeException() { + } public MagicScriptRuntimeException(String message) { super(message); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/RegexpLiteralException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/RegexpLiteralException.java index 17089a971f4f39c3ccd7ddcad970761244d7a03b..f498131a3af8e2fc1512c3aa8ccb3d4ce210c333 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/RegexpLiteralException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/RegexpLiteralException.java @@ -1,15 +1,5 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; -public class RegexpLiteralException extends RuntimeException {} +public class RegexpLiteralException extends RuntimeException { + +} diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ResourceNotFoundException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ResourceNotFoundException.java index 86c11614a99e924a0c7e9d7e41b1503a51274582..3abfd9cc945b152d92d1732f32a77e4385d9e664 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ResourceNotFoundException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/ResourceNotFoundException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class ResourceNotFoundException extends RuntimeException { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/StringLiteralException.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/StringLiteralException.java index b70213a337379dbb5e79af9deddd228b7c97a3ea..b2b0d697b35291af83632943a91e008564d9c179 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/StringLiteralException.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/exception/StringLiteralException.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.exception; public class StringLiteralException extends RuntimeException { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ArrayFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ArrayFunctions.java index ae8db43414ac191fb1665b6477ae1f9a4f1cd9e4..f2292f1fad8ceb6bf5f55afb9525ec418ad724fc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ArrayFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ArrayFunctions.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ClassExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ClassExtension.java index 64967e9d1135a1a164567a01035e1875e67e95cc..7e36a03bd4430bd14e3f3006abc4ef499d719f95 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ClassExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ClassExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/CollectionFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/CollectionFunctions.java index 69164a53285752cb5a3f92d3b894d77a2d03b520..ca07af8b91f73c2ca05fbbfb8f235e82b2146137 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/CollectionFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/CollectionFunctions.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; import cn.universal.core.engine.annotation.Function; import java.util.Iterator; -/** 集合相关函数 */ +/** + * 集合相关函数 + */ public class CollectionFunctions { @Function diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DateExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DateExtension.java index 5d961ce9c870a55ba80d87182eedbfa20c0d850d..56d72174c14871645e9049a1f644634f9d2dc811 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DateExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DateExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -18,7 +6,9 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Date; -/** Date扩展 */ +/** + * Date扩展 + */ public class DateExtension { private static final ZoneId SYSTEM_ZONE_ID = ZoneId.systemDefault(); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicAttribute.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicAttribute.java index 2df5082fb62bd82af4c621d440fb4abb25f37a85..072140f96a6ef6b8d63bb60a2ab0f71707eb4538 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicAttribute.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicAttribute.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.exception.MagicScriptRuntimeException; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicMethod.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicMethod.java index a9d3130f615bb2fe69fd7846aa9cf7b00e68227b..915a14d345cc8fa22c6d5f4063f2f06feddae07c 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicMethod.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicMethod.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import java.util.List; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicModuleImport.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicModuleImport.java index e1f12852dc6c82cd4f2c0e7a3b10cc4721ca0c5e..5e3d14e3a600a5c1574aec89702bd67fc55d6e0a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicModuleImport.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/DynamicModuleImport.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ExtensionMethod.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ExtensionMethod.java index 622399a904b42259409a111b9d6e3b586fcd4139..6917586c581ccac109f87689876bbd47505761fe 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ExtensionMethod.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ExtensionMethod.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import java.util.Collections; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MagicScriptFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MagicScriptFunctions.java index 1663aa65cbfeff7a21f7a3166d812e3b3e6357e9..436d75cff475df535177cbdb8f7dfd4b8bee1dad 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MagicScriptFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MagicScriptFunctions.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; import cn.universal.core.engine.annotation.Function; import java.util.UUID; -/** 脚本能力扩展 */ +/** + * 脚本能力扩展 + */ public class MagicScriptFunctions { @Comment("生成uuid字符串,不包含`-`") diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MapExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MapExtension.java index 4dad209a728847b58f740af7ad9903d2d1f42c8d..1349aa93f2239ab8e3f4d370d8b8bbfc0107e579 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MapExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/MapExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -53,9 +41,9 @@ public class MapExtension { public static List asList( Map source, @Comment(name = "mapping", value = "映射函数,如:(key,value,source)=>{'k' : key,'v' : value}") - Function mapping) { + Function mapping) { List result = new ArrayList<>(); - source.forEach((key, value) -> result.add(mapping.apply(new Object[] {key, value, source}))); + source.forEach((key, value) -> result.add(mapping.apply(new Object[]{key, value, source}))); return result; } @@ -87,8 +75,8 @@ public class MapExtension { public Map each( Map source, @Comment(name = "function", value = "循环函数,如:(key,value,source)=>map['xx'] = key;") - Function function) { - source.forEach((key, value) -> function.apply(new Object[] {key, value, source})); + Function function) { + source.forEach((key, value) -> function.apply(new Object[]{key, value, source})); return source; } @@ -136,12 +124,12 @@ public class MapExtension { Map source, @Comment(name = "separator", value = "key与value之间的连接符,如=") String separator, @Comment(name = "mapping", value = "转换方法,如:(key,value)=>key + '=' + value || ''") - Function mapping) { + Function mapping) { Set> entries = source.entrySet(); StringBuilder builder = new StringBuilder(); for (Map.Entry entry : entries) { builder.append( - Objects.toString(mapping.apply(new Object[] {entry.getKey(), entry.getValue()}), "")); + Objects.toString(mapping.apply(new Object[]{entry.getKey(), entry.getValue()}), "")); builder.append(separator); } if (entries.size() > 0) { @@ -175,7 +163,7 @@ public class MapExtension { public Map sort( Map source, @Comment(name = "comparator", value = "比较器,如:(k1,k2,v1,v2)=>k1.compareTo(k2);") - Function comparator) { + Function comparator) { Set keys = source.keySet(); Map sortedMap = new LinkedHashMap<>(); keys.stream() @@ -183,7 +171,7 @@ public class MapExtension { (Comparator) (o1, o2) -> ObjectConvertExtension.asInt( - comparator.apply(new Object[] {o1, o2, source.get(o1), source.get(o2)}), 0)) + comparator.apply(new Object[]{o1, o2, source.get(o1), source.get(o2)}), 0)) .forEach( key -> { sortedMap.put(key, source.get(key)); @@ -214,7 +202,7 @@ public class MapExtension { Map result = new LinkedHashMap<>(); Set> entries = source.entrySet(); for (Map.Entry entry : entries) { - result.put(functional.apply(new Object[] {entry.getKey()}), entry.getValue()); + result.put(functional.apply(new Object[]{entry.getKey()}), entry.getValue()); } return result; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/NumberExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/NumberExtension.java index 9d4dbe3f749b34fee06290c77290fd2e24497fcf..4d50b4d9cff9d942ca4c69064586ce247331a1f1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/NumberExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/NumberExtension.java @@ -1,26 +1,17 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; import java.math.BigDecimal; import java.math.RoundingMode; -/** Number类型扩展 */ +/** + * Number类型扩展 + */ public class NumberExtension { @Comment("四舍五入保留N位小数") - public static double round(Number number, @Comment(name = "num", value = "规定小数的位数") int num) { + public static double round(Number number, + @Comment(name = "num", value = "规定小数的位数") int num) { return new BigDecimal("" + number.doubleValue()) .setScale(num, RoundingMode.HALF_UP) .doubleValue(); @@ -47,7 +38,8 @@ public class NumberExtension { } @Comment("转为百分比") - public static String asPercent(Number number, @Comment(name = "num", value = "规定小数的位数") int num) { + public static String asPercent(Number number, + @Comment(name = "num", value = "规定小数的位数") int num) { return new BigDecimal(number.doubleValue() * 100).setScale(num, RoundingMode.HALF_UP).toString() + "%"; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectConvertExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectConvertExtension.java index eca6806c898c7c5f5f9966b419510c91b0bc13ee..1ae0d0854bafed3103157cdde22da5e2b221b414 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectConvertExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectConvertExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -18,7 +6,9 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -/** 类型转换 */ +/** + * 类型转换 + */ public class ObjectConvertExtension { /** @@ -43,7 +33,8 @@ public class ObjectConvertExtension { */ @Comment("将对象转为double类型") public static double asDouble( - Object val, @Comment(name = "defaultValue", value = "转换失败时的默认值") double defaultValue) { + Object val, + @Comment(name = "defaultValue", value = "转换失败时的默认值") double defaultValue) { try { return asDecimal(val).doubleValue(); } catch (Exception e) { @@ -66,19 +57,25 @@ public class ObjectConvertExtension { } } - /** 转String */ + /** + * 转String + */ @Comment("将对象转为String类型") public static String asString(Object val) { return asString(val, null); } - /** 转Date */ + /** + * 转Date + */ @Comment("将对象转为Date类型,默认字符串格式为yyyy-MM-dd HH:mm:ss") public static Date asDate(Object val) { return asDate(val, "yyyy-MM-dd HH:mm:ss"); } - /** 转BigDecimal */ + /** + * 转BigDecimal + */ @Comment("将对象转为BigDecimal类型") public static BigDecimal asDecimal(Object val) { if (val instanceof BigDecimal) { @@ -87,10 +84,13 @@ public class ObjectConvertExtension { return new BigDecimal(asString(val)); } - /** 转BigDecimal */ + /** + * 转BigDecimal + */ @Comment("将对象转为BigDecimal类型") public static BigDecimal asDecimal( - Object val, @Comment(name = "defaultVal", value = "转换失败时的默认值") BigDecimal defaultVal) { + Object val, + @Comment(name = "defaultVal", value = "转换失败时的默认值") BigDecimal defaultVal) { if (val instanceof BigDecimal) { return (BigDecimal) val; } @@ -101,10 +101,13 @@ public class ObjectConvertExtension { } } - /** 转Date */ + /** + * 转Date + */ @Comment("将对象转为Date类型,支持String、10位、13位时间戳") public static Date asDate( - Object val, @Comment(name = "format", value = "日期格式,如yyyy-MM-dd HH:mm:ss") String format) { + Object val, + @Comment(name = "format", value = "日期格式,如yyyy-MM-dd HH:mm:ss") String format) { if (val == null) { return null; } @@ -137,29 +140,38 @@ public class ObjectConvertExtension { */ @Comment("将对象转为String类型") public static String asString( - Object val, @Comment(name = "defaultValue", value = "转换失败时的默认值") String defaultValue) { + Object val, + @Comment(name = "defaultValue", value = "转换失败时的默认值") String defaultValue) { return val == null ? defaultValue : val.toString(); } - /** 转int */ + /** + * 转int + */ @Comment("将值转换为int类型,转换失败时为0") public int asInt(Object val) { return asInt(val, 0); } - /** 转double */ + /** + * 转double + */ @Comment("将对象转为double类型,转换失败时为0.0") public double asDouble(Object val) { return asDouble(val, 0.0); } - /** 转long */ + /** + * 转long + */ @Comment("将对象转为long类型,转换失败时为0L") public long asLong(Object val) { return asLong(val, 0L); } - /** 转byte */ + /** + * 转byte + */ @Comment("将对象转为byte类型,转换失败时默认为0") public byte asByte(Object val) { return asByte(val, (byte) 0); @@ -180,7 +192,9 @@ public class ObjectConvertExtension { } } - /** 转short */ + /** + * 转short + */ @Comment("将对象转为short类型,转换失败时默认为0") public short asShort(Object val) { return asShort(val, (short) 0); @@ -193,7 +207,8 @@ public class ObjectConvertExtension { */ @Comment("将对象转为short类型") public short asShort( - Object val, @Comment(name = "defaultValue", value = "转换失败时的默认值") short defaultValue) { + Object val, + @Comment(name = "defaultValue", value = "转换失败时的默认值") short defaultValue) { try { return asDecimal(val).shortValue(); } catch (Exception e) { @@ -201,7 +216,9 @@ public class ObjectConvertExtension { } } - /** 转float */ + /** + * 转float + */ @Comment("将对象转为float类型,转换失败默认为0.0f") public float asFloat(Object val) { return asFloat(val, 0.0f); @@ -214,7 +231,8 @@ public class ObjectConvertExtension { */ @Comment("将对象转为float类型") public float asFloat( - Object val, @Comment(name = "defaultValue", value = "转换失败时的默认值") float defaultValue) { + Object val, + @Comment(name = "defaultValue", value = "转换失败时的默认值") float defaultValue) { try { return asDecimal(val).floatValue(); } catch (Exception e) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectTypeConditionExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectTypeConditionExtension.java index 7e529f6759c44c3b89d19a2ea27e8b2619644853..c1a07a6f5b09c42a4012e8b808d4a0090ed9fd12 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectTypeConditionExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/ObjectTypeConditionExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -19,19 +7,26 @@ import java.util.Date; import java.util.List; import java.util.Map; -/** 类型判断 */ +/** + * 类型判断 + */ public class ObjectTypeConditionExtension { - /** 判断是否是目标类型 */ + /** + * 判断是否是目标类型 + */ @Comment("判断对象是否为指定类型的对象") - public static boolean is(Object target, @Comment(name = "clazz", value = "目标类型") Class clazz) { + public static boolean is(Object target, + @Comment(name = "clazz", value = "目标类型") Class clazz) { if (target == null || clazz == null) { return false; } return clazz.isAssignableFrom(target.getClass()); } - /** 判断是否是数组 */ + /** + * 判断是否是数组 + */ @Comment("判断对象是否是数组") public static boolean isArray(Object target) { if (target instanceof Class) { @@ -40,7 +35,9 @@ public class ObjectTypeConditionExtension { return target.getClass().isArray(); } - /** 判断是否是集合 */ + /** + * 判断是否是集合 + */ @Comment("判断对象是否是集合") public static boolean isCollection(Object target) { if (target instanceof Class) { @@ -49,7 +46,9 @@ public class ObjectTypeConditionExtension { return Collection.class.isAssignableFrom(target.getClass()); } - /** 判断是否是Map */ + /** + * 判断是否是Map + */ @Comment("判断对象是否是Map") public static boolean isMap(Object target) { if (target instanceof Class) { @@ -58,14 +57,16 @@ public class ObjectTypeConditionExtension { return Map.class.isAssignableFrom(target.getClass()); } - /** 判断是否是目标类型 */ + /** + * 判断是否是目标类型 + */ @Comment("判断对象是否为指定类型的对象,type为null时 返回false,支持类名缩写") public boolean is( Object target, @Comment( - name = "type", - value = "类名或全类名或string、int、double、float、long、byte、short、bigdecimal、boolean") - String type) { + name = "type", + value = "类名或全类名或string、int、double、float、long、byte、short、bigdecimal、boolean") + String type) { if (type == null) { return false; } @@ -105,61 +106,81 @@ public class ObjectTypeConditionExtension { return "decimal".equalsIgnoreCase(type) && clazz == BigDecimal.class; } - /** 判断是否是String */ + /** + * 判断是否是String + */ @Comment("判断对象是否是String类型") public boolean isString(Object target) { return is(target, String.class); } - /** 判断是否是int */ + /** + * 判断是否是int + */ @Comment("判断对象是否是int类型") public boolean isInt(Object target) { return is(target, Integer.class); } - /** 判断是否是double */ + /** + * 判断是否是double + */ @Comment("判断对象是否是double类型") public boolean isDouble(Object target) { return is(target, Double.class); } - /** 判断是否是long */ + /** + * 判断是否是long + */ @Comment("判断对象是否是long类型") public boolean isLong(Object target) { return is(target, Long.class); } - /** 判断是否是byte */ + /** + * 判断是否是byte + */ @Comment("判断对象是否是byte类型") public boolean isByte(Object target) { return is(target, Byte.class); } - /** 判断是否是short */ + /** + * 判断是否是short + */ @Comment("判断对象是否是short类型") public boolean isShort(Object target) { return is(target, Short.class); } - /** 判断是否是boolean */ + /** + * 判断是否是boolean + */ @Comment("判断对象是否是boolean类型") public boolean isBoolean(Object target) { return is(target, Boolean.class); } - /** 判断是否是BigDecimal */ + /** + * 判断是否是BigDecimal + */ @Comment("判断对象是否是BigDecimal类型") public boolean isDecimal(Object target) { return is(target, BigDecimal.class); } - /** 判断是否是Date */ + /** + * 判断是否是Date + */ @Comment("判断对象是否是Date类型") public boolean isDate(Object target) { return is(target, Date.class); } - /** 判断是否是List */ + /** + * 判断是否是List + */ @Comment("判断对象是否是List") public boolean isList(Object target) { if (target instanceof Class) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/PatternExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/PatternExtension.java index 41683bfeb4faedf29a3b9db69c7e214b2ae8db6a..b8ed06289cea239dd211154db9b4005ced31a4fc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/PatternExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/PatternExtension.java @@ -1,25 +1,16 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; import java.util.regex.Pattern; -/** Pattern 扩展 */ +/** + * Pattern 扩展 + */ public class PatternExtension { @Comment("校验文本是否符合正则") - public boolean test(Pattern pattern, @Comment(name = "source", value = "目标字符串") String source) { + public boolean test(Pattern pattern, + @Comment(name = "source", value = "目标字符串") String source) { return source != null && pattern.matcher(source).find(); } } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StreamExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StreamExtension.java index 4e9cc2dac9330c6146019cc4a976cb028b2bf7ca..17d6d8e23771be012666b024dbe228690e23a11a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StreamExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StreamExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -38,7 +26,9 @@ import java.util.stream.Stream; public class StreamExtension { - /** 将对象转为List */ + /** + * 将对象转为List + */ @Comment("将对象转为List") public static List arrayLikeToList(Object arrayLike) { if (arrayLike == null) { @@ -64,7 +54,9 @@ public class StreamExtension { throw new MagicScriptException("不支持的类型:" + arrayLike.getClass()); } - /** 将list拼接起来 */ + /** + * 将list拼接起来 + */ @Comment("将集合使用连接符拼接起来") public static String join( Object target, @Comment(name = "separator", value = "拼接符,如`,`") String separator) { @@ -183,12 +175,12 @@ public class StreamExtension { public Object map( Object target, @Comment(name = "function", value = "转换函数,如提取属性`(item)=>item.xxx`") - Function function) { + Function function) { List objects = arrayLikeToList(target); List results = new ArrayList<>(objects.size()); for (int i = 0, len = objects.size(); i < len; i++) { Object object = objects.get(i); - results.add(function.apply(new Object[] {object, i, len})); + results.add(function.apply(new Object[]{object, i, len})); } return toOriginType(target, results); } @@ -202,12 +194,12 @@ public class StreamExtension { public Object filter( Object target, @Comment(name = "function", value = "过滤条件,如`(item)=>item.xxx == 1`") - Function function) { + Function function) { List objects = arrayLikeToList(target); List results = new ArrayList<>(objects.size()); for (int i = 0, len = objects.size(); i < len; i++) { Object object = objects.get(i); - if (BooleanLiteral.isTrue(function.apply(new Object[] {object, i, len}))) { + if (BooleanLiteral.isTrue(function.apply(new Object[]{object, i, len}))) { results.add(object); } } @@ -218,11 +210,11 @@ public class StreamExtension { public Object find( Object target, @Comment(name = "function", value = "匹配条件,如`(item)=>item.xxx == 1`") - Function function) { + Function function) { List objects = arrayLikeToList(target); for (int i = 0, len = objects.size(); i < len; i++) { Object object = objects.get(i); - if (BooleanLiteral.isTrue(function.apply(new Object[] {object, i, len}))) { + if (BooleanLiteral.isTrue(function.apply(new Object[]{object, i, len}))) { return object; } } @@ -233,11 +225,11 @@ public class StreamExtension { public int findIndex( Object target, @Comment(name = "function", value = "匹配条件,如`(item)=>item.xxx == 1`") - Function function) { + Function function) { List objects = arrayLikeToList(target); for (int i = 0, len = objects.size(); i < len; i++) { Object object = objects.get(i); - if (BooleanLiteral.isTrue(function.apply(new Object[] {object, i, len}))) { + if (BooleanLiteral.isTrue(function.apply(new Object[]{object, i, len}))) { return i; } } @@ -265,7 +257,7 @@ public class StreamExtension { Map map = new LinkedHashMap<>(size); for (int i = 0; i < size; i++) { Object item = target.get(i); - Object[] parameters = new Object[] {item, i, size}; + Object[] parameters = new Object[]{item, i, size}; map.put(mappingKey.apply(parameters), mappingValue.apply(parameters)); } return map; @@ -287,30 +279,34 @@ public class StreamExtension { public Object each( Object target, @Comment(name = "function", value = "循环函数,如循环添加属性`(item)=>{item.xxx = 'newVal'}`") - Function function) { + Function function) { List objects = arrayLikeToList(target); List results = new ArrayList<>(objects.size()); for (int i = 0, len = objects.size(); i < len; i++) { Object object = objects.get(i); - function.apply(new Object[] {object, i, len}); + function.apply(new Object[]{object, i, len}); results.add(object); } return toOriginType(target, results); } - /** 排序 */ + /** + * 排序 + */ @Comment(value = "将集合进行排序,并返回新集合", origin = true) public Object sort( Object target, @Comment(name = "function", value = "排序函数,如从大到小`(a,b)=>a-b`") - Function function) { + Function function) { List objects = arrayLikeToList(target); objects.sort( - (o1, o2) -> ObjectConvertExtension.asInt(function.apply(new Object[] {o1, o2}), 0)); + (o1, o2) -> ObjectConvertExtension.asInt(function.apply(new Object[]{o1, o2}), 0)); return toOriginType(target, objects); } - /** 反转 */ + /** + * 反转 + */ @Comment(value = "将集合进行反转操作", origin = true) public Object reserve(Object target) { List objects = arrayLikeToList(target); @@ -318,7 +314,9 @@ public class StreamExtension { return toOriginType(target, objects); } - /** 将list打乱 */ + /** + * 将list打乱 + */ @Comment(value = "将集合的顺序打乱", origin = true) public Object shuffle(Object target) { List objects = arrayLikeToList(target); @@ -354,12 +352,12 @@ public class StreamExtension { public Object distinct( Object target, @Comment(name = "condition", value = "去重转换器,如根据id去重 `item=>item.id`") - Function condition) { + Function condition) { List list = arrayLikeToList(target); List result = new ArrayList<>(list.size()); Set sets = new LinkedHashSet<>(list.size()); for (Object e : list) { - Object res = condition.apply(new Object[] {e}); + Object res = condition.apply(new Object[]{e}); if (!sets.contains(res)) { sets.add(res); result.add(e); @@ -368,13 +366,17 @@ public class StreamExtension { return toOriginType(target, result); } - /** 将list拼接起来 */ + /** + * 将list拼接起来 + */ @Comment("将集合使用`,`拼接起来") public String join(Object target) { return join(target, ","); } - /** 取最大值 */ + /** + * 取最大值 + */ @Comment("取出集合最大值,如果找不到返回`null`") public Object max(Object target) { return arrayLikeToList(target).stream() @@ -383,7 +385,9 @@ public class StreamExtension { .orElse(null); } - /** 取最小值 */ + /** + * 取最小值 + */ @Comment("取出集合最小值,如果找不到返回`null`") public Object min(Object target) { return arrayLikeToList(target).stream() @@ -392,7 +396,9 @@ public class StreamExtension { .orElse(null); } - /** 取平均值 */ + /** + * 取平均值 + */ @Comment("取出集合平均值,如果无法计算返回`null`") public Double avg(Object target) { OptionalDouble average = @@ -403,7 +409,9 @@ public class StreamExtension { return average.isPresent() ? average.getAsDouble() : null; } - /** 累计求和 */ + /** + * 累计求和 + */ @Comment("对集合进行累加操作") public Number sum(Object target) { return arrayLikeToList(target).stream() @@ -421,7 +429,7 @@ public class StreamExtension { public Map> group( Object target, @Comment(name = "condition", value = "分组条件,如`item=>item.xxx + '_' + item.yyy`") - Function condition) { + Function condition) { return arrayLikeToList(target).stream() .collect( Collectors.groupingBy( @@ -434,15 +442,15 @@ public class StreamExtension { * 分组 * * @param condition 分组条件 - * @param mapping 结果映射 + * @param mapping 结果映射 */ @Comment("对集合进行分组并转换") public Map group( Object target, @Comment(name = "condition", value = "分组条件,如`item=>item.xxx + '_' + item.yyy`") - Function condition, + Function condition, @Comment(name = "mapping", value = "转换函数,如分组求和`(list)=>list.sum()`") - Function mapping) { + Function mapping) { return arrayLikeToList(target).stream() .collect( Collectors.groupingBy( @@ -455,8 +463,8 @@ public class StreamExtension { /** * 合并两个集合,类似sql join 操作 * - * @param source 左表 - * @param target 右表 + * @param source 左表 + * @param target 右表 * @param condition 条件 */ @Comment("将两个集合关联起来") @@ -464,7 +472,7 @@ public class StreamExtension { Object source, @Comment(name = "target", value = "另一个集合") Object target, @Comment(name = "condition", value = "关联条件,如:`(left,right)=>left.xxx = right.xxx`") - Function condition) { + Function condition) { return join( source, target, @@ -486,19 +494,19 @@ public class StreamExtension { /** * 合并两个集合,类似 sql join 操作 * - * @param source 左表 - * @param target 右表 + * @param source 左表 + * @param target 右表 * @param condition 条件 - * @param mapping 映射 + * @param mapping 映射 */ @Comment("将两个集合关联并转换") public List join( Object source, @Comment(name = "target", value = "另一个集合") Object target, @Comment(name = "condition", value = "关联条件,如:`(left,right)=>left.xxx == right.xxx`") - Function condition, + Function condition, @Comment(name = "mapping", value = "映射函数,如:`(left,right)=>{xxx : left.xxx, yyy : right.yyy}`") - Function mapping) { + Function mapping) { if (target == null) { return null; } @@ -542,7 +550,7 @@ public class StreamExtension { @Comment(name = "condition", value = "判断条件") Function condition) { List objects = arrayLikeToList(source); for (int i = 0, size = objects.size(); i < size; i++) { - if (!BooleanLiteral.isTrue(condition.apply(new Object[] {objects.get(i), i}))) { + if (!BooleanLiteral.isTrue(condition.apply(new Object[]{objects.get(i), i}))) { return false; } } @@ -555,7 +563,7 @@ public class StreamExtension { @Comment(name = "condition", value = "判断条件") Function condition) { List objects = arrayLikeToList(source); for (int i = 0, size = objects.size(); i < size; i++) { - if (BooleanLiteral.isTrue(condition.apply(new Object[] {objects.get(i), i}))) { + if (BooleanLiteral.isTrue(condition.apply(new Object[]{objects.get(i), i}))) { return true; } } @@ -577,7 +585,7 @@ public class StreamExtension { public Object reduce( Object source, @Comment(name = "reduceFunction", value = "处理函数,如累加计算:`(val,item)=>val + item`") - Function reduceFunction) { + Function reduceFunction) { List objects = arrayLikeToList(source); if (objects.isEmpty()) { return null; @@ -588,7 +596,7 @@ public class StreamExtension { } Object result = objects.get(0); for (int i = 1; i < size; i++) { - result = reduceFunction.apply(new Object[] {result, objects.get(i)}); + result = reduceFunction.apply(new Object[]{result, objects.get(i)}); } return result; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringExtension.java index e720b22b1d5f4585912448bb3e398b022fc61a67..35033e5b42b5525505c96eb6906eb9ad0c850730 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; @@ -18,11 +6,14 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -/** String 扩展 */ +/** + * String 扩展 + */ public class StringExtension { @Comment("校验文本是否符合正则") - public boolean match(String source, @Comment(name = "pattern", value = "正则表达式") Pattern pattern) { + public boolean match(String source, + @Comment(name = "pattern", value = "正则表达式") Pattern pattern) { return pattern.matcher(source).find(); } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringFunctions.java index 5b6535a2d67121844190031f40faddc523876271..363a4d9c3d2599a03b6a69cb071847992ccf3fd3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/StringFunctions.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/TemporalAccessorExtension.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/TemporalAccessorExtension.java index 33c3f50a53fe4b709430aaec2dccfd9cdbfe8e4f..3fbe992b31074961b0889cc010d9e49fb51e9562 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/TemporalAccessorExtension.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/TemporalAccessorExtension.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/AggregationFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/AggregationFunctions.java index 66ba3115e0f7e55935c998775d7afe99b560541d..b5caf78e8d2d631f57aab07508f141dcf770f303 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/AggregationFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/AggregationFunctions.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions.linq; import cn.universal.core.engine.annotation.Comment; @@ -21,7 +9,9 @@ import java.util.Map; import java.util.OptionalDouble; import java.util.function.BinaryOperator; -/** 聚合函数 */ +/** + * 聚合函数 + */ public class AggregationFunctions { @Function diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/LinqFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/LinqFunctions.java index e15cb1bbbbcebce0b9f0f06d3f0441c957e720e7..ccd0f25ace56d59681f00debd6677389a5e45287 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/LinqFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/LinqFunctions.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions.linq; import cn.universal.core.engine.annotation.Comment; @@ -19,7 +7,9 @@ import cn.universal.core.engine.functions.TemporalAccessorExtension; import java.time.temporal.TemporalAccessor; import java.util.Date; -/** Linq中的函数 */ +/** + * Linq中的函数 + */ public class LinqFunctions { @Function diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/MathFunctions.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/MathFunctions.java index 999e76abd58e41257d0191728a8aa48804025aa7..d96fb4843d222161fc5d7bfd9553339ed4ba23eb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/MathFunctions.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/functions/linq/MathFunctions.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.functions.linq; import cn.universal.core.engine.annotation.Comment; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/CharacterStream.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/CharacterStream.java index dbcc78bf875e5b0f639cfbbeeee14a277dd723e3..3c81aca58837d7cd19ef7a9fadf08107178f8fee 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/CharacterStream.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/CharacterStream.java @@ -1,18 +1,8 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; -/** 对字符串进行封装,提供匹配、跳过方法,方便词法解析。 */ +/** + * 对字符串进行封装,提供匹配、跳过方法,方便词法解析。 + */ public class CharacterStream { private final String source; @@ -49,23 +39,29 @@ public class CharacterStream { * 截取字符串 * * @param startIndex 开始位置 - * @param endIndex 结束位置 + * @param endIndex 结束位置 */ public String substring(int startIndex, int endIndex) { return this.source.substring(startIndex, endIndex); } - /** 是否有下一个字符 */ + /** + * 是否有下一个字符 + */ public boolean hasMore() { return index < end; } - /** 根据开始位置、结束位置返回Span */ + /** + * 根据开始位置、结束位置返回Span + */ public Span getSpan(int start, int end) { return new Span(this.source, start, end); } - /** 返回下一个字符 */ + /** + * 返回下一个字符 + */ public char consume() { if (!hasMore()) { throw new RuntimeException("No more characters in stream."); @@ -73,7 +69,9 @@ public class CharacterStream { return source.charAt(index++); } - /** 返回是否是以给定的字符串开头 */ + /** + * 返回是否是以给定的字符串开头 + */ public boolean match(String needle, boolean consume) { int needleLength = needle.length(); if (needleLength + index > end) { @@ -108,7 +106,9 @@ public class CharacterStream { return false; } - /** 返回是否是数字 */ + /** + * 返回是否是数字 + */ public boolean matchDigit(boolean consume) { if (index >= end) { return false; @@ -123,7 +123,9 @@ public class CharacterStream { return false; } - /** 返回是否以标识符开头 */ + /** + * 返回是否以标识符开头 + */ public boolean matchIdentifierStart(boolean consume) { if (index >= end) { return false; @@ -157,7 +159,9 @@ public class CharacterStream { return false; } - /** 跳过一行 */ + /** + * 跳过一行 + */ public void skipLine() { while (index < end) { if (source.charAt(index++) == '\n') { @@ -166,7 +170,9 @@ public class CharacterStream { } } - /** 直到给定的字符串之前全部跳过 */ + /** + * 直到给定的字符串之前全部跳过 + */ public boolean skipUntil(String chars) { while (index < end) { boolean matched = true; @@ -184,7 +190,9 @@ public class CharacterStream { return false; } - /** 跳过空白字符 */ + /** + * 跳过空白字符 + */ public void skipWhiteSpace() { while (index < end) { char c = source.charAt(index); @@ -196,17 +204,23 @@ public class CharacterStream { } } - /** 记录当前位置为Span的开始位置 */ + /** + * 记录当前位置为Span的开始位置 + */ public void startSpan() { spanStart = index; } - /** 根据当前位置返回Span */ + /** + * 根据当前位置返回Span + */ public Span endSpan() { return new Span(source, spanStart, index); } - /** 根据当前位置 - offset 返回 Span */ + /** + * 根据当前位置 - offset 返回 Span + */ public Span endSpan(int offset) { return new Span(source, spanStart, index + offset); } @@ -215,12 +229,16 @@ public class CharacterStream { return new Span(source, start, end); } - /** 返回当前位置 */ + /** + * 返回当前位置 + */ public int getPosition() { return index; } - /** 重置当前位置 */ + /** + * 重置当前位置 + */ public void reset(int position) { index = position; } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/GenericTokenParser.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/GenericTokenParser.java index 3d0bd15346b40b678d4720d815f1a67da0cab487..37d390e3d5af5d13a120683c3b95560dcef64e88 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/GenericTokenParser.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/GenericTokenParser.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import java.util.function.Function; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/LiteralToken.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/LiteralToken.java index dbeb957758c61ac0d05d142431206d137c14d4e9..5b12e6a9a10e6d021ead9b785c6081e4816e1c04 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/LiteralToken.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/LiteralToken.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; public class LiteralToken extends Token { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Parser.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Parser.java index a41dd556a440637256787f7ef80bf0304857e46e..6a6c0b2b8ddb43c7f2523dae746eef2432855b1c 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Parser.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Parser.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import static cn.universal.core.engine.parsing.TokenType.And; @@ -140,67 +128,69 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -/** 语法解析器 */ +/** + * 语法解析器 + */ public class Parser { public static final String ANONYMOUS_VARIABLE = "-anonymous"; private static final TokenType[][] BINARY_OPERATOR_PRECEDENCE = - new TokenType[][] { - new TokenType[] {Assignment}, - new TokenType[] { - RShift2Equal, - RShiftEqual, - LShiftEqual, - XorEqual, - BitOrEqual, - BitAndEqual, - PercentEqual, - ForwardSlashEqual, - AsteriskEqual, - MinusEqual, - PlusEqual - }, - new TokenType[] {Or, SqlOr}, - new TokenType[] {And, SqlAnd}, - new TokenType[] {BitOr}, - new TokenType[] {Xor}, - new TokenType[] {BitAnd}, - new TokenType[] {EqualEqualEqual, Equal, NotEqualEqual, NotEqual, SqlNotEqual}, - new TokenType[] {Less, LessEqual, Greater, GreaterEqual, InstanceOf}, - new TokenType[] {Plus, Minus}, - new TokenType[] {LShift, RShift, Rshift2}, - new TokenType[] {Asterisk, ForwardSlash, Percentage} + new TokenType[][]{ + new TokenType[]{Assignment}, + new TokenType[]{ + RShift2Equal, + RShiftEqual, + LShiftEqual, + XorEqual, + BitOrEqual, + BitAndEqual, + PercentEqual, + ForwardSlashEqual, + AsteriskEqual, + MinusEqual, + PlusEqual + }, + new TokenType[]{Or, SqlOr}, + new TokenType[]{And, SqlAnd}, + new TokenType[]{BitOr}, + new TokenType[]{Xor}, + new TokenType[]{BitAnd}, + new TokenType[]{EqualEqualEqual, Equal, NotEqualEqual, NotEqual, SqlNotEqual}, + new TokenType[]{Less, LessEqual, Greater, GreaterEqual, InstanceOf}, + new TokenType[]{Plus, Minus}, + new TokenType[]{LShift, RShift, Rshift2}, + new TokenType[]{Asterisk, ForwardSlash, Percentage} }; private static final TokenType[][] LINQ_BINARY_OPERATOR_PRECEDENCE = - new TokenType[][] { - new TokenType[] { - RShift2Equal, - RShiftEqual, - LShiftEqual, - XorEqual, - BitOrEqual, - BitAndEqual, - PercentEqual, - ForwardSlashEqual, - AsteriskEqual, - MinusEqual, - PlusEqual - }, - new TokenType[] {Or, SqlOr}, - new TokenType[] {And, SqlAnd}, - new TokenType[] {BitOr}, - new TokenType[] {Xor}, - new TokenType[] {BitAnd}, - new TokenType[] {Assignment, EqualEqualEqual, Equal, NotEqualEqual, NotEqual, SqlNotEqual}, - new TokenType[] {Less, LessEqual, Greater, GreaterEqual, InstanceOf}, - new TokenType[] {Plus, Minus}, - new TokenType[] {LShift, RShift, Rshift2}, - new TokenType[] {ForwardSlash, Asterisk, Percentage} + new TokenType[][]{ + new TokenType[]{ + RShift2Equal, + RShiftEqual, + LShiftEqual, + XorEqual, + BitOrEqual, + BitAndEqual, + PercentEqual, + ForwardSlashEqual, + AsteriskEqual, + MinusEqual, + PlusEqual + }, + new TokenType[]{Or, SqlOr}, + new TokenType[]{And, SqlAnd}, + new TokenType[]{BitOr}, + new TokenType[]{Xor}, + new TokenType[]{BitAnd}, + new TokenType[]{Assignment, EqualEqualEqual, Equal, NotEqualEqual, NotEqual, SqlNotEqual}, + new TokenType[]{Less, LessEqual, Greater, GreaterEqual, InstanceOf}, + new TokenType[]{Plus, Minus}, + new TokenType[]{LShift, RShift, Rshift2}, + new TokenType[]{ForwardSlash, Asterisk, Percentage} }; private static final TokenType[] UNARY_OPERATORS = - new TokenType[] { - MinusMinus, PlusPlus, BitNot, - Minus, Plus, Not + new TokenType[]{ + MinusMinus, PlusPlus, BitNot, + Minus, Plus, Not }; private static final List KEYWORDS = Arrays.asList( @@ -312,7 +302,8 @@ public class Parser { } } // consume semi-colons as statement delimiters - while (stream.match(";", true)) {} + while (stream.match(";", true)) { + } return result; } @@ -1271,7 +1262,9 @@ public class Parser { return target; } - /** Does not consume the closing parentheses. */ + /** + * Does not consume the closing parentheses. + */ private List parseArguments() { stream.expect(LeftParantheses); List arguments = new ArrayList(); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/RegexpToken.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/RegexpToken.java index a41c30eac818476a4f766fef3cfbfd557963238e..3caf632cf76a01750db3bc91d47fa3faac1e2825 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/RegexpToken.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/RegexpToken.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; public class RegexpToken extends Token { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Span.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Span.java index 01b90c423acc983ef82d31ded49fe4ae634e2d26..61bb552c2fc2cc0d1b3806662aefb4efac2afe95 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Span.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Span.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import java.util.Objects; @@ -19,16 +7,24 @@ import java.util.Objects; */ public class Span { - /** the source string this span refers to */ + /** + * the source string this span refers to + */ private final String source; - /** Cached String instance to reduce pressure on GC */ + /** + * Cached String instance to reduce pressure on GC + */ private final String cachedText; - /** start index in source string, starting at 0 */ + /** + * start index in source string, starting at 0 + */ private final int start; - /** end index in source string, exclusive, starting at 0 */ + /** + * end index in source string, exclusive, starting at 0 + */ private final int end; private Line line; @@ -80,22 +76,30 @@ public class Span { this.cachedText = source.substring(this.start, this.end); } - /** Returns the text referenced by this span */ + /** + * Returns the text referenced by this span + */ public String getText() { return cachedText; } - /** Returns the index of the first character of this span. */ + /** + * Returns the index of the first character of this span. + */ public int getStart() { return start; } - /** Returns the index of the last character of this span plus 1. */ + /** + * Returns the index of the last character of this span plus 1. + */ public int getEnd() { return end; } - /** Returns the source string this span references. */ + /** + * Returns the source string this span references. + */ public String getSource() { return source; } @@ -187,7 +191,9 @@ public class Span { return Objects.hash(source, cachedText, start, end, line); } - /** A line within a Source */ + /** + * A line within a Source + */ public static class Line { private final String source; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Token.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Token.java index 21eb01c350f3c70e6c1b70404bb53447a48ca8c7..8376bc3eeb7072e7d03715c00f894419dd10197f 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Token.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Token.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; public class Token { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenStream.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenStream.java index 454adc5f21234179a9c155d200e16b83d1d01f8d..26e1eb5635c31fc3adde2cfebf5e4d83936e1f9d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenStream.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenStream.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -/** 对List进行封装,提供匹配相关方法,方便语法解析 */ +/** + * 对List进行封装,提供匹配相关方法,方便语法解析 + */ public class TokenStream { private final List tokens; @@ -32,32 +22,44 @@ public class TokenStream { this.end = tokens.size(); } - /** 当前是否可读 */ + /** + * 当前是否可读 + */ public boolean hasMore() { return index < end; } - /** 是否有下一个Token */ + /** + * 是否有下一个Token + */ public boolean hasNext() { return index + 1 < end; } - /** 是否有前一个Token */ + /** + * 是否有前一个Token + */ public boolean hasPrev() { return index > 0; } - /** 标记当前位置,和resetIndex搭配使用。 */ + /** + * 标记当前位置,和resetIndex搭配使用。 + */ public int makeIndex() { return index; } - /** 重置当前位置,和makeIndex搭配使用 */ + /** + * 重置当前位置,和makeIndex搭配使用 + */ public void resetIndex(int index) { this.index = index; } - /** 无条件消耗掉当前Token */ + /** + * 无条件消耗掉当前Token + */ public Token consume() { if (!hasMore()) { throw new RuntimeException("流已经遍历完毕"); @@ -65,7 +67,9 @@ public class TokenStream { return tokens.get(index++); } - /** 获取下一个Token并改变当前位置 */ + /** + * 获取下一个Token并改变当前位置 + */ public Token next() { if (!hasMore()) { throw new RuntimeException("流已经遍历完毕"); @@ -73,7 +77,9 @@ public class TokenStream { return tokens.get(++index); } - /** 获取前一个Token并改变当前位置 */ + /** + * 获取前一个Token并改变当前位置 + */ public Token prev() { if (index == 0) { throw new RuntimeException("流已经遍历完毕"); @@ -81,7 +87,9 @@ public class TokenStream { return tokens.get(--index); } - /** 获取前一个Token,不改变当前位置 */ + /** + * 获取前一个Token,不改变当前位置 + */ public Token getPrev() { if (index == 0) { throw new RuntimeException("流已经遍历完毕"); @@ -89,7 +97,9 @@ public class TokenStream { return tokens.get(index - 1); } - /** 期待下一个Token是给定的类型中之一 */ + /** + * 期待下一个Token是给定的类型中之一 + */ public Token expect(TokenType... types) { if (!match(true, types)) { Token token = index < tokens.size() ? tokens.get(index) : null; @@ -115,7 +125,9 @@ public class TokenStream { } } - /** 获取全部注释 */ + /** + * 获取全部注释 + */ public List comments() { return tokens.stream() .filter(it -> it.getType() == TokenType.Comment) @@ -123,7 +135,9 @@ public class TokenStream { .collect(Collectors.toList()); } - /** 期待下一个Token为指定类型 */ + /** + * 期待下一个Token为指定类型 + */ public Token expect(TokenType type) { if (!match(type, true)) { Token token = index < tokens.size() ? tokens.get(index) : null; @@ -131,7 +145,8 @@ public class TokenStream { if (span == null) { MagicScriptError.error("期待 '" + type.getError() + "', 但是流已经遍历完毕", this); } else { - MagicScriptError.error("期待 '" + type.getError() + "', 获得 '" + token.getText() + "'", span); + MagicScriptError.error("期待 '" + type.getError() + "', 获得 '" + token.getText() + "'", + span); } return null; // 执行不到这里 } else { @@ -139,7 +154,9 @@ public class TokenStream { } } - /** 期待匹配字符串 */ + /** + * 期待匹配字符串 + */ public Token expect(String text) { return expect(text, false); } @@ -195,7 +212,7 @@ public class TokenStream { /** * 匹配指定字符串 * - * @param consume 匹配成功后是否改变当前位置 + * @param consume 匹配成功后是否改变当前位置 * @param ignoreCase 是否忽略大小写 */ public boolean match(List texts, boolean consume, boolean ignoreCase) { @@ -210,7 +227,7 @@ public class TokenStream { /** * 匹配指定字符串 * - * @param consume 匹配成功后是否改变当前位置 + * @param consume 匹配成功后是否改变当前位置 * @param ignoreCase 是否忽略大小写 */ public boolean match(String text, boolean consume, boolean ignoreCase) { @@ -262,7 +279,7 @@ public class TokenStream { /** * 匹配指定字符串 * - * @param consume 匹配成功后是否改变当前位置 + * @param consume 匹配成功后是否改变当前位置 * @param ignoreCase 是否忽略大小写 */ public boolean match(boolean consume, boolean ignoreCase, String... tokenTexts) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenType.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenType.java index 94418f95350ce1bcaeb5173db4f830d721ba1e0d..6aae2da1d69bac0a709ff7e83b71c8e432f16a2b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenType.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/TokenType.java @@ -1,20 +1,10 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import java.util.Arrays; -/** Token类型 */ +/** + * Token类型 + */ public enum TokenType { // @off Spread("...", "..."), diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Tokenizer.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Tokenizer.java index 54e3c579ff666fc9a4482438f2ed8bf2eb40cb92..13887598d6fba99a1a27ea8c0a03fcb1fdd314d6 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Tokenizer.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/Tokenizer.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import cn.universal.core.engine.MagicScriptError; @@ -117,17 +105,20 @@ public class Tokenizer { if (stream.match("```", true)) { stream.startSpan(); if (stream.matchIdentifierStart(true)) { - while (stream.matchIdentifierPart(true)) {} + while (stream.matchIdentifierPart(true)) { + } Span language = stream.endSpan(); tokens.add(new Token(TokenType.Language, language)); stream.startSpan(); if (!stream.skipUntil("```")) { - MagicScriptError.error("```需要以```结尾", stream.endSpan(), new StringLiteralException()); + MagicScriptError.error("```需要以```结尾", stream.endSpan(), + new StringLiteralException()); } tokens.add(new Token(TokenType.Language, stream.endSpan(-3))); return true; } else { - MagicScriptError.error("```后需要标识语言类型", stream.endSpan(), new StringLiteralException()); + MagicScriptError.error("```后需要标识语言类型", stream.endSpan(), + new StringLiteralException()); } } return false; @@ -162,7 +153,8 @@ public class Tokenizer { stream.consume(); } if (!matchedEndQuote) { - MagicScriptError.error("模板字符串没有结束符`", stream.endSpan(), new StringLiteralException()); + MagicScriptError.error("模板字符串没有结束符`", stream.endSpan(), + new StringLiteralException()); } Span stringSpan = stream.endSpan(begin, stream.getPosition()); int end = stream.getPosition() - 1; @@ -179,7 +171,8 @@ public class Tokenizer { private static boolean tokenizerIdentifier(CharacterStream stream, List tokens) { if (stream.matchIdentifierStart(true)) { stream.startSpan(); - while (stream.matchIdentifierPart(true)) {} + while (stream.matchIdentifierPart(true)) { + } Span identifierSpan = stream.endSpan(); identifierSpan = stream.getSpan(identifierSpan.getStart() - 1, identifierSpan.getEnd()); if ("true".equals(identifierSpan.getText()) || "false".equals(identifierSpan.getText())) { @@ -228,7 +221,8 @@ public class Tokenizer { if (stream.matchAny(true, "x", "X")) { // 0x 16进制 while (stream.matchDigit(true) || stream.matchAny( - true, "A", "B", "C", "D", "E", "F", "a", "b", "c", "d", "e", "f", "_")) {} + true, "A", "B", "C", "D", "E", "F", "a", "b", "c", "d", "e", "f", "_")) { + } if (stream.matchAny(true, "L", "l")) { Span span = stream.endSpan(); String text = span.getText(); @@ -242,7 +236,8 @@ public class Tokenizer { tokens.add(autoNumberType(stream.endSpan(), 16)); return true; } else if (stream.matchAny(true, "b", "B")) { // 二进制 - while (stream.matchAny(true, "0", "1", "_")) {} + while (stream.matchAny(true, "0", "1", "_")) { + } if (stream.matchAny(true, "L", "l")) { Span span = stream.endSpan(); String text = span.getText(); @@ -261,10 +256,12 @@ public class Tokenizer { if (stream.matchDigit(false)) { TokenType type = TokenType.IntegerLiteral; stream.startSpan(); - while (stream.matchDigit(true) || stream.match("_", true)) {} + while (stream.matchDigit(true) || stream.match("_", true)) { + } if (stream.match(TokenType.Period.getLiteral(), true)) { type = TokenType.DoubleLiteral; - while (stream.matchDigit(true) || stream.match("_", true)) {} + while (stream.matchDigit(true) || stream.match("_", true)) { + } } if (stream.matchAny(true, "b", "B")) { if (type == TokenType.DoubleLiteral) { @@ -332,7 +329,8 @@ public class Tokenizer { } if (!matchedEndQuote) { MagicScriptError.error( - "字符串没有结束符" + tokenType.getError(), stream.endSpan(), new StringLiteralException()); + "字符串没有结束符" + tokenType.getError(), stream.endSpan(), + new StringLiteralException()); } Span stringSpan = stream.endSpan(); stringSpan = diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarIndex.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarIndex.java index fe3bb387131f1f3f893ad0dd22067fdc02ef0340..ea5f130ff473ec4ef3c18b0fd8cf49393a0fa04f 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarIndex.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarIndex.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import java.util.Objects; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarScope.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarScope.java index dd26bde36e9232b50b150ab56135d095878e8bd0..46b33ca08ccc17edb0fb3fe5a02d15746c09b0e5 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarScope.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/VarScope.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing; import java.util.ArrayList; @@ -22,7 +10,8 @@ public class VarScope extends ArrayList { this.parent = parent; } - public VarScope() {} + public VarScope() { + } public VarScope push() { return new VarScope(this); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/BinaryOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/BinaryOperation.java index 0523525b05196719ff97ec053d8a32c8df4085d8..b2d7475cc7d9fce1045d5640f36688dcceeeb1fa 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/BinaryOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/BinaryOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.MagicScriptError; @@ -58,7 +46,8 @@ public abstract class BinaryOperation extends Expression { if (operator.getType().isModifiable() && left instanceof VariableAccess && ((VariableAccess) left).getVarIndex().isReadonly()) { - MagicScriptError.error("const定义的变量不能被修改", new Span(left.getSpan(), right.getSpan())); + MagicScriptError.error("const定义的变量不能被修改", + new Span(left.getSpan(), right.getSpan())); } Expression expression = null; Span span = new Span(left.getSpan(), right.getSpan()); @@ -179,7 +168,9 @@ public abstract class BinaryOperation extends Expression { return expression; } - /** 比较两个值 1 左边大 0 相等 -1 右边大 -2 无法比较 */ + /** + * 比较两个值 1 左边大 0 相等 -1 右边大 -2 无法比较 + */ public static int compare(Object left, Object right) { if (left == null && right == null) { return -2; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Expression.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Expression.java index df8a087d70a1931b59f89a37894c094321797f77..7eab158c7f13ad25e5c1cb1cf432bbb3fe7be995 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Expression.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Expression.java @@ -1,20 +1,10 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.parsing.Span; -/** 表达式 */ +/** + * 表达式 + */ public abstract class Expression extends Node { public Expression(Span span) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/LanguageExpression.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/LanguageExpression.java index 6acfd34fff843ddcee60199f8fc4d956ef269f75..66851a77f71158983ef8d519ac56615a1d003abc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/LanguageExpression.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/LanguageExpression.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Literal.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Literal.java index ae1ac05aad4a79946e88a89aa8c5c747f1f40e79..fcd77a46605c5d638561226f8cde994105660dd7 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Literal.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Literal.java @@ -1,21 +1,11 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; -/** 常量 */ +/** + * 常量 + */ public abstract class Literal extends Expression { protected Object value = null; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Node.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Node.java index 4674921082429289add9ef9f51513dbb77416004..c79f02aa4a66bef0dc22fb04951e21ef8082d74b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Node.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/Node.java @@ -1,28 +1,22 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.asm.Opcodes; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; -/** 节点 */ +/** + * 节点 + */ public abstract class Node implements Opcodes { - /** 对应的文本 */ + /** + * 对应的文本 + */ private final Span span; - /** 在Linq中 */ + /** + * 在Linq中 + */ private boolean inLinq; public Node(Span span) { @@ -42,7 +36,8 @@ public abstract class Node implements Opcodes { return getClass().getSimpleName() + ":" + span.getText(); } - public void visitMethod(MagicScriptCompiler compiler) {} + public void visitMethod(MagicScriptCompiler compiler) { + } public void compile(MagicScriptCompiler compiler) { throw new UnsupportedOperationException(this.getClass().getSimpleName() + "不支持编译"); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/TernaryOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/TernaryOperation.java index 066b225b6ac76325ad0cd33c02c5031c0d856e33..fd50415add6a474c761efda467d6c08edef8981a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/TernaryOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/TernaryOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.asm.Label; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/UnaryOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/UnaryOperation.java index 0dbb41751b8494c1f8e0f1f5053946dd3bb870ec..57014d1ebecb878bbfb7fa758a60064dffc5ad82 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/UnaryOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/UnaryOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.MagicScriptError; @@ -22,7 +10,9 @@ import cn.universal.core.engine.runtime.handle.BitHandle; import cn.universal.core.engine.runtime.handle.OperatorHandle; import java.util.function.Supplier; -/** 一元操作符 */ +/** + * 一元操作符 + */ public class UnaryOperation extends Expression { private final UnaryOperator operator; @@ -120,22 +110,34 @@ public class UnaryOperation extends Expression { } public enum UnaryOperator { - /** ! */ + /** + * ! + */ Not, - /** - */ + /** + * - + */ Negate, - /** + */ + /** + * + + */ Positive, - /** ++ */ + /** + * ++ + */ PlusPlus, - /** -- */ + /** + * -- + */ MinusMinus, - /** ~ */ + /** + * ~ + */ BitNot; public static UnaryOperator getOperator(Token op) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/VariableSetter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/VariableSetter.java index 98405e5281cb4510c8fcec4e3f3ac1dbbc0ff6f6..2d6d8d3ccfbcf0d0168f041006b1bba2c85540b9 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/VariableSetter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/VariableSetter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AddOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AddOperation.java index 6c796b31451f06fbc0cf02c95c5553c52eb93f32..e096607791e4f6d08fc2bb1e79b1dca45ec08a1b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AddOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AddOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** + 运算 */ +/** + * + 运算 + */ public class AddOperation extends BinaryOperation { public AddOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AndOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AndOperation.java index 1438d5d79d1e8bb75257667efa746cba1989a76b..420b20e16db709c516d5e47faeb2bab65abaa7b2 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AndOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AndOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.asm.Label; @@ -19,7 +7,9 @@ import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; import cn.universal.core.engine.runtime.handle.OperatorHandle; -/** && 操作 */ +/** + * && 操作 + */ public class AndOperation extends BinaryOperation { public AndOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AssigmentOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AssigmentOperation.java index a508420d3e35b95fe36bf5a39cd682578b319955..5ab4ba07aed74c519d65db7dc0c622cd4f993027 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AssigmentOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/AssigmentOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.MagicScriptError; @@ -20,7 +8,9 @@ import cn.universal.core.engine.parsing.ast.Expression; import cn.universal.core.engine.parsing.ast.VariableSetter; import cn.universal.core.engine.parsing.ast.statement.VariableAccess; -/** = 操作 */ +/** + * = 操作 + */ public class AssigmentOperation extends BinaryOperation { public AssigmentOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitAndOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitAndOperation.java index 8927db3d2f28ed9844c2ee0303b3e18f3bf878e1..1d6c179a29f5349a0bf66f1d70468fc04bacd754 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitAndOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitAndOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** & */ +/** + * & + */ public class BitAndOperation extends BinaryOperation { public BitAndOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitOrOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitOrOperation.java index b378819a12c50da64c9ebb588f3516e05c001721..8156f8d40cb8780fdd1cccc7cab8cca793d73cc2 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitOrOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/BitOrOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** | */ +/** + * | + */ public class BitOrOperation extends BinaryOperation { public BitOrOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/DivisionOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/DivisionOperation.java index 009bc26dca63a18708ce8d6c6c0095be2a36fdaf..2d41d0d4eef8de4924dd8a404a8889ce8d2050bf 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/DivisionOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/DivisionOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** / 操作 */ +/** + * / 操作 + */ public class DivisionOperation extends BinaryOperation { public DivisionOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/EqualOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/EqualOperation.java index b2bf3ded64a99be8fa15ebf9dcc3df7ee8f6d6dd..073c2419b52ff2d88ea99d643cba19dd1088e241 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/EqualOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/EqualOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** ==、===操作 */ +/** + * ==、===操作 + */ public class EqualOperation extends BinaryOperation { protected final boolean accurate; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterEqualOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterEqualOperation.java index 3b207705c877e1bcbc31793c04bc0d43c9314774..ec1d3a720f7ae8621dd48c3f1bb8ad3e116fc5b1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterEqualOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterEqualOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** >=操作 */ +/** + * >=操作 + */ public class GreaterEqualOperation extends BinaryOperation { public GreaterEqualOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterOperation.java index 4cf76c8a58264e07f07a87f73e4cca605ba85ba0..c80b06dbb42f372410c671b766e485084f05791f 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/GreaterOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** > 运算 */ +/** + * > 运算 + */ public class GreaterOperation extends BinaryOperation { public GreaterOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/InstanceofOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/InstanceofOperation.java index 748d055f2c9797a77627048aac9b6256aa0a8046..3b0b7afba183045333ff6d39b5bd75577d413f81 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/InstanceofOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/InstanceofOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -18,7 +6,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** instanceof */ +/** + * instanceof + */ public class InstanceofOperation extends BinaryOperation { public InstanceofOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LShiftOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LShiftOperation.java index bc0ccfb91f76509043c33edd3df0fb6a95e6b12d..97be1ff6ec85e8405a04b59420510c9f649b1d42 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LShiftOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LShiftOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** << */ +/** + * << + */ public class LShiftOperation extends BinaryOperation { public LShiftOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessEqualOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessEqualOperation.java index be69b7a09b44355871b335843c776ada8a86455d..f779c21b9c2b58121829968dd1b0fec907649618 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessEqualOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessEqualOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** <= 运算 */ +/** + * <= 运算 + */ public class LessEqualOperation extends BinaryOperation { public LessEqualOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessOperation.java index 730bcabeabd4303f622f0bd9af3b1386d4f6ac78..63bdd0a12c01fc908f2db7a66785de7cef4187c4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/LessOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** < */ +/** + * < + */ public class LessOperation extends BinaryOperation { public LessOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/ModuloOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/ModuloOperation.java index 50f243f69b1b776bc9295ba01285ebb049af8668..68525a6b37e9f62ad2342bce99f32893092c9440 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/ModuloOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/ModuloOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** % 运算 */ +/** + * % 运算 + */ public class ModuloOperation extends BinaryOperation { public ModuloOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/MultiplicationOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/MultiplicationOperation.java index ddc4ec487428ec0ce3d8976831d96155cb6372fd..9069cea5c1df70ac830da506f688c9401d5a675b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/MultiplicationOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/MultiplicationOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** * 运算 */ +/** + * 运算 + */ public class MultiplicationOperation extends BinaryOperation { public MultiplicationOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/NotEqualOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/NotEqualOperation.java index 0e8ab64ad88fbd6c2de7ab2d5250ff8dbe382a13..a4f044e97580932259c2eb21475775b6cef282a4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/NotEqualOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/NotEqualOperation.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Expression; -/** !=、!==操作 */ +/** + * !=、!==操作 + */ public class NotEqualOperation extends EqualOperation { public NotEqualOperation( diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/OrOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/OrOperation.java index 3b6b67ab91ed613f81f0050e9c2456a37de80351..ea974bc8a3e4ca9581a72e7dc013a467797b44bc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/OrOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/OrOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.asm.Label; @@ -19,7 +7,9 @@ import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; import cn.universal.core.engine.runtime.handle.OperatorHandle; -/** || 操作 */ +/** + * || 操作 + */ public class OrOperation extends BinaryOperation { public OrOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShift2Operation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShift2Operation.java index a6aff96de3cc9d663147cf1f957adae0e857e8d2..869e969a775d65dee58ab6912a70ec760168fa63 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShift2Operation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShift2Operation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** >>> */ +/** + * >>> + */ public class RShift2Operation extends BinaryOperation { public RShift2Operation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShiftOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShiftOperation.java index 190d12beefafb7016dd03702e6ae7219122a9eac..5ba0d0d943ae498cce2df852e9cb6a46264f65a8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShiftOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/RShiftOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** >> */ +/** + * >> + */ public class RShiftOperation extends BinaryOperation { public RShiftOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/SubtractionOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/SubtractionOperation.java index 1a45a5e51e13687d524ccb714a6799b79fdcda71..a9c270e31010a36f7cb4d809bb6499bbcd01ef8f 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/SubtractionOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/SubtractionOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** - 操作 */ +/** + * - 操作 + */ public class SubtractionOperation extends BinaryOperation { public SubtractionOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/XorOperation.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/XorOperation.java index f475dca1977eacdae7e76e7344884dc5f11f9533..e7a4696b88141d4801cf6550d64053563650f55d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/XorOperation.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/binary/XorOperation.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.binary; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.BinaryOperation; import cn.universal.core.engine.parsing.ast.Expression; -/** ^ */ +/** + * ^ + */ public class XorOperation extends BinaryOperation { public XorOperation(Expression leftOperand, Span span, Expression rightOperand) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqExpression.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqExpression.java index e98915ba26b76e5478b870204ae6f6a413571c67..08957a77afc17a5d8d3c0c50264b5db5a7194156 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqExpression.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqExpression.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -43,7 +31,7 @@ public class LinqExpression extends Expression { compiler .compile( expression instanceof MemberAccess - && ((MemberAccess) expression).isWhole() + && ((MemberAccess) expression).isWhole() ? ((MemberAccess) expression).getObject() : expression) .insn(ARETURN)); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqField.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqField.java index 0096f4cd020833fe6cee2272b1fa7b5b3780af62..eeefc0c1979b0aff167b526dd13933c92a943aad 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqField.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqField.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.parsing.Span; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqJoin.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqJoin.java index f4ab7987771b05759891b1a8b88c842468eb78b8..8a0c5c58d37d2064c978f64de5eaed8d1c45532a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqJoin.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqJoin.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqOrder.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqOrder.java index 69c7ce678aebb0f0e9f4fae7c37dd739ea2240d7..6443e74e91ff4925275a22a3e22a7a1964b1a098 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqOrder.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqOrder.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.parsing.Span; @@ -18,7 +6,9 @@ import cn.universal.core.engine.parsing.ast.Expression; public class LinqOrder extends LinqField { - /** 1 正序 -1 倒序 */ + /** + * 1 正序 -1 倒序 + */ private final int order; public LinqOrder(Span span, Expression expression, VarIndex alias, int order) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqSelect.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqSelect.java index 2a511d071bad937ab007cc9f79756925d7368c2a..4486712572e987a690b9ed326630d3bdafa34edd 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqSelect.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/LinqSelect.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.MagicScriptError; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/WholeLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/WholeLiteral.java index 44717feb7694c8a0cbc1b91ae8d868020fc2ecd7..11279e2e250b1f719d5a91792345b4366f377e33 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/WholeLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/linq/WholeLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.linq; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BigDecimalLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BigDecimalLiteral.java index da316e26e04269ba973a0fc29a3d4343aa53b347..26fc93d53e8592697cf80c89a0cd3ef019d593e3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BigDecimalLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BigDecimalLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; import java.math.BigDecimal; -/** int常量 */ +/** + * int常量 + */ public class BigDecimalLiteral extends Literal { public BigDecimalLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BooleanLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BooleanLiteral.java index 492b887f816481d5605db4b9113ab9c1f34feed9..565a82762417963cea030b3160c2d3d8079774ce 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BooleanLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/BooleanLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -19,7 +7,9 @@ import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; -/** boolean常量 */ +/** + * boolean常量 + */ public class BooleanLiteral extends Literal { public BooleanLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ByteLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ByteLiteral.java index 1b93aae8ef9242a54f13b883974f1a4aba3ebd35..e39129741775eb249369570b188a4575f4a4c532 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ByteLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ByteLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** byte常量 */ +/** + * byte常量 + */ public class ByteLiteral extends Literal { private byte value; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/DoubleLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/DoubleLiteral.java index c2d9a484df556f9f84b1940cc96c021912e1a547..4112f9eb54f0ff0b8de389037db5775626f675c3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/DoubleLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/DoubleLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** double常量 */ +/** + * double常量 + */ public class DoubleLiteral extends Literal { public DoubleLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/FloatLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/FloatLiteral.java index 8fee9f7ca0f027fa2897817f0bda71c12ea8a4b6..c4ee74cf3a335669297b3095b4cbf989de0d785d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/FloatLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/FloatLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** float常量 */ +/** + * float常量 + */ public class FloatLiteral extends Literal { public FloatLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/IntegerLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/IntegerLiteral.java index 1d5e2290ebe442fa1caa9e2ccdbcdac3adef4302..ac15e55811b8ee2ae4f709e51808f80717667f91 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/IntegerLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/IntegerLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** int常量 */ +/** + * int常量 + */ public class IntegerLiteral extends Literal { public IntegerLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ListLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ListLiteral.java index edde25ce73a75eb8a5e622b8befe795afea9707e..d2ddfa62eb39e721aa45961800ff99101c05b75d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ListLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ListLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -19,7 +7,9 @@ import cn.universal.core.engine.parsing.ast.Literal; import cn.universal.core.engine.parsing.ast.statement.Spread; import java.util.List; -/** List常量 */ +/** + * List常量 + */ public class ListLiteral extends Literal { public final List values; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/LongLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/LongLiteral.java index 296a8ad054b48a53e5568daeadf3f89a7ecdbbd8..f13d1ab00a626e301fcf42fd11b8383ce1e44504 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/LongLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/LongLiteral.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** long 常量 */ +/** + * long 常量 + */ public class LongLiteral extends Literal { public LongLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/MapLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/MapLiteral.java index 5e91afb6c50f8cd74bcdd91fc9bbb1eb705817d1..ae718c075b43a66abe067368ea3459fe859caeb4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/MapLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/MapLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -20,7 +8,9 @@ import cn.universal.core.engine.parsing.ast.statement.Spread; import java.util.List; import java.util.Objects; -/** map常量 */ +/** + * map常量 + */ public class MapLiteral extends Literal { private final List keys; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/NullLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/NullLiteral.java index 1c99c95862be84ddcf6afd7dce58af833126c983..d898aa277548d19f8462e6f752818dc8dac2714b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/NullLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/NullLiteral.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** null 常量 */ +/** + * null 常量 + */ public class NullLiteral extends Literal { public NullLiteral(Span span) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/RegexpLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/RegexpLiteral.java index 9418a1ff62408049d36569d66cbd1452f24d9042..618a9801850e9ae068e7183d401cb641a0f84e06 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/RegexpLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/RegexpLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -18,7 +6,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; import java.util.regex.Pattern; -/** 正则常量 */ +/** + * 正则常量 + */ public class RegexpLiteral extends Literal { private int flag; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ShortLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ShortLiteral.java index 4a13bee100f6c86792902f2b952e489b9bf055b2..f288c072022976a903669ea50197595fa86a5826 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ShortLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/ShortLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -17,7 +5,9 @@ import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Literal; -/** short 常量 */ +/** + * short 常量 + */ public class ShortLiteral extends Literal { public ShortLiteral(Span literal) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/StringLiteral.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/StringLiteral.java index 5eff5afc66fcb32f1ff460ee51ff63ea20852bff..51fa63f762ecdca3901ba168389969a4902a30ba 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/StringLiteral.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/literal/StringLiteral.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.literal; import cn.universal.core.engine.MagicScriptError; @@ -22,7 +10,9 @@ import java.util.List; import java.util.Objects; import java.util.StringJoiner; -/** String 常量 */ +/** + * String 常量 + */ public class StringLiteral extends Literal { private final Token token; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Assert.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Assert.java index a603946e6a48c3e8f68fa25a14df12438362d013..3ea48125817c2f4529f911e108b03f0604282ae4 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Assert.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Assert.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.asm.Label; @@ -20,7 +8,9 @@ import cn.universal.core.engine.parsing.ast.Node; import cn.universal.core.engine.runtime.handle.OperatorHandle; import java.util.List; -/** assert expr : expr[,expr][,expr][,expr] */ +/** + * assert expr : expr[,expr][,expr][,expr] + */ public class Assert extends Node { private final Expression condition; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/AsyncCall.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/AsyncCall.java index 4cac49fd006928e2fbda6ab5def1976b4ce01703..8e26c5b65b021f030c12cb240c29e62b5c8c6adb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/AsyncCall.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/AsyncCall.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -27,10 +15,14 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; -/** 异步调用 */ +/** + * 异步调用 + */ public class AsyncCall extends Expression { - /** 默认线程池大小(CPU核心数 * 2) */ + /** + * 默认线程池大小(CPU核心数 * 2) + */ private static ThreadPoolExecutor threadPoolExecutor = setThreadPoolExecutorSize(Runtime.getRuntime().availableProcessors() * 2); diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Break.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Break.java index 969c97c496ca52cf9f40c69f64675f4b75368bfc..31f98ea2b601abe6cfb08448f71696bc827a69e7 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Break.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Break.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Node; -/** break 语句 */ +/** + * break 语句 + */ public class Break extends Node { public Break(Span span) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ClassConverter.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ClassConverter.java index 4f4d2015f7e6fdaa07f935cfae24e2d75a895a63..a4a7294c4a13a6d892ca44ace20c66dcabc72a2b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ClassConverter.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ClassConverter.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Continue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Continue.java index 4293d3f4278cc2be93118883defcecfbae889a61..3ab22896c0fad2669754af50b4ccf4396c25db44 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Continue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Continue.java @@ -1,22 +1,12 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Node; -/** continue语句 */ +/** + * continue语句 + */ public class Continue extends Node { public Continue(Span span) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Exit.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Exit.java index 44064ea0b4a8393f56789daf9c97a33f83c8ab36..aec375e07fc950decfe358d8e2975d9f1eb46e74 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Exit.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Exit.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ForStatement.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ForStatement.java index abd533b15e7d4f7013b70b06fe5f302558abc61e..55ef056f10f8ec5ef28e9a6db5cdf98b83ed0326 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ForStatement.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/ForStatement.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.asm.Label; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/FunctionCall.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/FunctionCall.java index 9a6f5e06ee7abb638f36f670b55e581309be2c59..ec8413c5e6d40008b9fdeb9cc3682b0fc0f5a455 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/FunctionCall.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/FunctionCall.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/IfStatement.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/IfStatement.java index 8a63b10b00fd6aa6119aa592d47c1b979c6814e5..2a694dc4ddef9a84713b7e7e7595c63a4cfe3378 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/IfStatement.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/IfStatement.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.asm.Label; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Import.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Import.java index 7a52700937412cd8fdd379f37d5f6614e1138467..e1023ac3754d0b5286ad00b0ae3aff2560d32910 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Import.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Import.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.MagicResourceLoader; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/LambdaFunction.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/LambdaFunction.java index c4d91ac902f1145336d993cff7df6f8f823c2ff4..7325a9b1cfbd873d405ebac57402c9f027a9b7b3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/LambdaFunction.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/LambdaFunction.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -47,7 +35,9 @@ public class LambdaFunction extends Expression { return parameters; } - /** 访问lambda方法 */ + /** + * 访问lambda方法 + */ private void compileMethod(MagicScriptCompiler compiler) { compiler.load0().lambda(methodName); } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MapOrArrayAccess.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MapOrArrayAccess.java index 3e898c53a1ee5f53bae67f053e236cae39821c11..d4cd7f362056d4296d518ce64616fa10554f9c8b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MapOrArrayAccess.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MapOrArrayAccess.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MemberAccess.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MemberAccess.java index 76493a13406bf2b4f277a923ebcbdc54c688fe4a..5f29b1c33dad376c45242c55bbb1480eb4e768b3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MemberAccess.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MemberAccess.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MethodCall.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MethodCall.java index 4631c8338fc05f45807706d412033d5868c91e6c..bb66e43c79aff6ebc9b24db6658361210caf141e 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MethodCall.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/MethodCall.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/NewStatement.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/NewStatement.java index bb10a81a9ddc4ab0bcadbf4a727f99acbfa8c34e..dbbc53ea15ac1747993005095277e32289deede3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/NewStatement.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/NewStatement.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Return.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Return.java index 569d7feec8817a93fb210187607ec92f1a2b38b6..71a557ba09f31ca5d5a3eb298fec689d35e49ade 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Return.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Return.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Spread.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Spread.java index 383f5dae9aea9aa55271a1d048e5426c33f05cc2..62d135fda40a83549517672af316cfebbdcef8c3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Spread.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Spread.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; @@ -17,7 +5,9 @@ import cn.universal.core.engine.parsing.Span; import cn.universal.core.engine.parsing.ast.Expression; import cn.universal.core.engine.runtime.SpreadValue; -/** 展开语法 Spread syntax (...) */ +/** + * 展开语法 Spread syntax (...) + */ public class Spread extends Expression { private final Expression target; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Throw.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Throw.java index 5fcfe678ff28f0f38418b828732cfae53c71095c..49010e20bfb270fbd28ee69560942c2cd1a3f889 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Throw.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/Throw.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/TryStatement.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/TryStatement.java index b67f4583a71d452e1513bb82f4adeb621a6577e1..dcafef22f75925d19f833e3ba9e8c2a40c8df519 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/TryStatement.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/TryStatement.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.asm.Label; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableAccess.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableAccess.java index 5a4ac53941e60d46249c16999ff05789e4ac91e3..b9f26aa5359f8e30a6f5df38d80be54dc1869873 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableAccess.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableAccess.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDefine.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDefine.java index 0dffdd520ea0d2d1ecbfbf526a4f892c7ed84c04..46e45ad004105f6b0a52e976980b9abdc132bddc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDefine.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDefine.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDestructuringDefine.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDestructuringDefine.java index 851f37c8f4981cdd2e583e2339ba2de4e2b81a7e..ca3ff21931ff06a79cd442f49719c6fb1d721e6d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDestructuringDefine.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/VariableDestructuringDefine.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.compile.MagicScriptCompiler; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/WhileStatement.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/WhileStatement.java index 24b15db1000d158b71c037ebadbab5f3ed1d3862..f0b5e8d75535bf94391e929115d41ad7244d76d0 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/WhileStatement.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/parsing/ast/statement/WhileStatement.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.parsing.ast.statement; import cn.universal.core.engine.asm.Label; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/ConstructorInvoker.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/ConstructorInvoker.java index ff43646609a011bca16e4cbcf37566fa042b2ed2..3c5cd68a17c7072353fba58f41cd76d69c8b553d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/ConstructorInvoker.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/ConstructorInvoker.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.reflection; import java.lang.reflect.Constructor; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaInvoker.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaInvoker.java index 7fd6460d5848f21ea600f002390dd96cda974fab..adb49a684ad59faec37dee8592525e37fc0f31bb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaInvoker.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaInvoker.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.reflection; import cn.universal.core.engine.convert.ClassImplicitConvert; @@ -152,14 +140,16 @@ public class JavaInvoker { /** * 给参数设置隐式转换方法 * - * @param index 索引 + * @param index 索引 * @param classImplicitConvert 转换方法 */ protected void addClassImplicitConvert(int index, ClassImplicitConvert classImplicitConvert) { converts.put(index, classImplicitConvert); } - /** 预处理参数,用来实现隐式转换 */ + /** + * 预处理参数,用来实现隐式转换 + */ protected Object[] processArguments(Variables variables, Object[] arguments) { int count = this.executable.getParameterCount(); int maxIndex = Integer.MAX_VALUE; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaReflection.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaReflection.java index c392b346a829eaeb569305a9caa08a05688772be..6e653356e7bb5cacafad537e93c50264549509b1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaReflection.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/JavaReflection.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.reflection; import cn.universal.core.engine.convert.BooleanImplicitConvert; @@ -333,7 +321,9 @@ public class JavaReflection { return foundInvoker; } - /** Returns the method best matching the given signature, including type coercion, or null. */ + /** + * Returns the method best matching the given signature, including type coercion, or null. + */ public static JavaInvoker findInvoker( Class cls, String name, Class[] parameterTypes) { List> methodList = new ArrayList<>(); @@ -357,7 +347,9 @@ public class JavaReflection { return findInvoker(cls, name, new Class[0]); } - /** 是否可以自动装修拆箱 */ + /** + * 是否可以自动装修拆箱 + */ public static boolean isPrimitiveAssignableFrom(Class from, Class to) { if ((from == Boolean.class || from == boolean.class) && (to == boolean.class || to == Boolean.class)) { @@ -386,7 +378,9 @@ public class JavaReflection { && (to == char.class || to == Character.class); } - /** 获取String类型的参数描述 */ + /** + * 获取String类型的参数描述 + */ public static String[] getStringTypes(Object[] objects) { String[] parameterTypes = new String[objects == null ? 0 : objects.length]; if (objects != null) { @@ -398,7 +392,9 @@ public class JavaReflection { return parameterTypes; } - /** 是否可以自动隐式转换 https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html */ + /** + * 是否可以自动隐式转换 https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html + */ private static boolean isCoercible(Class from, Class to) { if (from == Integer.class || from == int.class) { return to == float.class @@ -472,7 +468,7 @@ public class JavaReflection { /** * 获取内部类 * - * @param obj 目标对象,可以是实例,可以是Class + * @param obj 目标对象,可以是实例,可以是Class * @param name 内部类名称 */ public static Object getInnerClass(Object obj, String name) { @@ -490,7 +486,7 @@ public class JavaReflection { /** * 获取字段 * - * @param obj 目标对象可以是实例,可以是Class + * @param obj 目标对象可以是实例,可以是Class * @param name 字段名称 * @return */ @@ -539,7 +535,9 @@ public class JavaReflection { return field; } - /** 注册隐式转换器 */ + /** + * 注册隐式转换器 + */ public static void registerImplicitConvert(ClassImplicitConvert classImplicitConvert) { CONVERTS.add(classImplicitConvert); } @@ -547,7 +545,7 @@ public class JavaReflection { /** * 注册扩展方法 * - * @param target 目标类 + * @param target 目标类 * @param extensionObject 实现类 */ public static void registerMethodExtension(Class target, Object extensionObject) { @@ -738,10 +736,16 @@ public class JavaReflection { return findMethodInvoker(methodList, getParameterTypes(null, arguments)); } - /** NULL值 */ - public static final class Null {} + /** + * NULL值 + */ + public static final class Null { + + } - /** 方法签名 */ + /** + * 方法签名 + */ private static class MethodSignature { private final String name; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/MethodInvoker.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/MethodInvoker.java index 2ac7d6eb832a4561a97aba67465b059c45694137..1b78ac446a166b00583cb4af514f4f005cb61296 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/MethodInvoker.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/reflection/MethodInvoker.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.reflection; import java.lang.reflect.InvocationTargetException; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/ExitValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/ExitValue.java index 44c28ced94bc18a12ad5b8f34c807249849b0fe4..8456981b0d6097f5ff982fd01e270697be1385e0 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/ExitValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/ExitValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; public class ExitValue { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptClassLoader.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptClassLoader.java index 11c6805605999775ed3332befeee23d7eed20602..6adfab9644fcf254001ab20c49a159e09f999b9d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptClassLoader.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptClassLoader.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; public class MagicScriptClassLoader extends ClassLoader { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptRuntime.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptRuntime.java index d11e21b18b3dbe72406f4697dd8735a0daf7946c..e442166156ffb81803577e204cc6bdb3468a73dc 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptRuntime.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptRuntime.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptVariableAccessRuntime.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptVariableAccessRuntime.java index 8268479e57063d41cb23d3b045c905e671fbaa1c..82fbbfbaac46991d0e1eba59be85a06ee6f2ab78 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptVariableAccessRuntime.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/MagicScriptVariableAccessRuntime.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/RuntimeContext.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/RuntimeContext.java index 755189947c1dabafd6122bf9a5aa4c0de9976c36..c41bae21f288657ee7c886953f6a66256fd12d37 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/RuntimeContext.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/RuntimeContext.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/SpreadValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/SpreadValue.java index 8de04ec2341de023c0d289aff3c3927ebb2c72ee..bb7a085db324d76375c6ac6ed216e662c64dca91 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/SpreadValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/SpreadValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; public class SpreadValue { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/Variables.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/Variables.java index 2595fbc8e5eb33ed30d6b7853ce1a9908a632328..67c6279d0371a19a50e83f598c555beb1ac3ef7e 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/Variables.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/Variables.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime; import cn.universal.core.engine.MagicScriptContext; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLambdaFunction.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLambdaFunction.java index bd374ebe0dd7f347a216ae6a41b62dbd4420b917..6684e6cbc9a0a8a87a998e202e7cf7283c6d9ce1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLambdaFunction.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLambdaFunction.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.function; import cn.universal.core.engine.runtime.Variables; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLanguageFunction.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLanguageFunction.java index 62fc3ca7469b7d3df62621f49a7772fc6a01eefb..8d645df641a7fa7e65f93a461e7899c7b10dccd8 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLanguageFunction.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/function/MagicScriptLanguageFunction.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.function; import cn.universal.core.engine.MagicResourceLoader; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/ArithmeticHandle.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/ArithmeticHandle.java index eb8f51a065a20bfd8689bea588ec96748c300f84..907c64c5673ad0c058745f7ec492a146c5dee866 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/ArithmeticHandle.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/ArithmeticHandle.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.handle; import static java.lang.invoke.MethodHandles.catchException; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/BitHandle.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/BitHandle.java index 2ab24c1b8fbaa0c1e1bf67c4ff8ec3b497098e86..69363622d3436da7d4017267d0324a7b0b79eeea 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/BitHandle.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/BitHandle.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.handle; import static java.lang.invoke.MethodHandles.catchException; @@ -809,6 +797,7 @@ public class BitHandle { private static Object reject(Object a, Object b, String symbol) throws IllegalArgumentException { throw new IllegalArgumentException( String.format( - "操作符 `%s` 不支持 (%s,%s) 类型", symbol, a.getClass().getName(), b.getClass().getName())); + "操作符 `%s` 不支持 (%s,%s) 类型", symbol, a.getClass().getName(), + b.getClass().getName())); } } diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/FunctionCallHandle.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/FunctionCallHandle.java index 59036e936df411351ae174093c58754194720549..9eee00a0959dc327d4e9af4fc7eac1a2f5463edd 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/FunctionCallHandle.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/FunctionCallHandle.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.handle; import static java.lang.invoke.MethodType.methodType; @@ -195,7 +183,8 @@ public class FunctionCallHandle { return method.invoke0(target, runtimeContext, args); } throw new NoSuchMethodException( - String.format("找不到函数%s(%s)", name, String.join(",", JavaReflection.getStringTypes(args)))); + String.format("找不到函数%s(%s)", name, + String.join(",", JavaReflection.getStringTypes(args)))); } public static Object invoke_method( @@ -229,7 +218,7 @@ public class FunctionCallHandle { MethodInvoker invoker = new MethodInvoker( DynamicMethod.class.getDeclaredMethod("execute", String.class, List.class)); - Object[] newArgumentValues = new Object[] {name, Arrays.asList(args)}; + Object[] newArgumentValues = new Object[]{name, Arrays.asList(args)}; return invoker.invoke0(target, runtimeContext, newArgumentValues); } try { @@ -315,7 +304,8 @@ public class FunctionCallHandle { } throw new MagicScriptRuntimeException( String.format( - "在%s中找不到属性%s或者方法get%s、方法is%s,内部类%s", target, name, methodName, methodName, name)); + "在%s中找不到属性%s或者方法get%s、方法is%s,内部类%s", target, name, methodName, + methodName, name)); } public static Object call_async( @@ -449,9 +439,10 @@ public class FunctionCallHandle { JavaInvoker invoker = JavaReflection.getMethod(target, "set" + methodName, value); if (invoker == null) { throw new MagicScriptRuntimeException( - String.format("在%s中找不到属性%s或者方法set%s", target.getClass(), name, methodName)); + String.format("在%s中找不到属性%s或者方法set%s", target.getClass(), name, + methodName)); } - invoker.invoke0(target, runtimeContext, new Object[] {value}); + invoker.invoke0(target, runtimeContext, new Object[]{value}); } } return value; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/MethodCallSite.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/MethodCallSite.java index 5152b83235166da3074d353d305ffaebbba44dd3..3cb666c1497837c4368046be520f42eb8328f391 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/MethodCallSite.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/MethodCallSite.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.handle; import java.lang.invoke.MethodHandle; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/OperatorHandle.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/OperatorHandle.java index d45f6b45fdd4f348fca6b63ba158cfdf4f528873..2226ad1b8c29f142d196b347b629f92fbb35ddfb 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/OperatorHandle.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/handle/OperatorHandle.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.handle; import static java.lang.invoke.MethodHandles.catchException; @@ -1285,7 +1273,8 @@ public class OperatorHandle { private static Object reject(Object a, Object b, String symbol) throws IllegalArgumentException { throw new IllegalArgumentException( String.format( - "操作符 `%s` 不支持 (%s,%s) 类型", symbol, a.getClass().getName(), b.getClass().getName())); + "操作符 `%s` 不支持 (%s,%s) 类型", symbol, a.getClass().getName(), + b.getClass().getName())); } public static Object map_or_array_access(int[] target, Number key) { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayKeyValueIterator.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayKeyValueIterator.java index e26c547eb5a91adecb8cc4bf42139f0eeae411f3..4406241904ed4d49024b18d4b06b99b9d9e3c53d 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayKeyValueIterator.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayKeyValueIterator.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.lang; public class ArrayKeyValueIterator extends ArrayValueIterator implements KeyIterator { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayValueIterator.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayValueIterator.java index 5f111fbc0571b316f2e85730359467915d20ecd2..7a9a9012febda24453c6b5bce0e7fd441db754e3 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayValueIterator.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/ArrayValueIterator.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.lang; import java.lang.reflect.Array; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyIterator.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyIterator.java index b45e6480096ffc7502772c7090baa76038927868..9ddb2253176276deeaa8f9b9374fda658f06a300 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyIterator.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyIterator.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.lang; public interface KeyIterator { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyValueIterator.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyValueIterator.java index b7521d16cb48e056f319507057ee673c79d08c99..23f4d89cfc6b93b26d08bed353298d58baec4ef6 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyValueIterator.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/KeyValueIterator.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.lang; import java.util.Iterator; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/MapKeyValueIterator.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/MapKeyValueIterator.java index 5b704e16c7096e828919a72b1e23c79bdffa28c4..55307b2f144ac8ecffe87ddd66f1bd8d93ac226b 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/MapKeyValueIterator.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/lang/MapKeyValueIterator.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.lang; import java.util.Iterator; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/JoinValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/JoinValue.java index 75ce9a0393ca52f240cbc9dbcad7ee75fbf6f7c6..55e3140c1337bb43027a00a551d485df1dd02407 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/JoinValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/JoinValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; public class JoinValue { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQBuilder.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQBuilder.java index ca5e5a60fe5be7ec4dc801d8c03d8c1ba3477f5f..8e2c2a9b7b680680536416e890f9ccf6cea56a91 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQBuilder.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQBuilder.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.functions.MapExtension; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQJoinValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQJoinValue.java index 3d54a7fddf940f52a6804b40a902e9c8e90a1135..a330d6256b432ffbee2e3d3c2f533d37497f7c0a 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQJoinValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQJoinValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.runtime.function.MagicScriptLambdaFunction; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQOrder.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQOrder.java index f984f993ac3e203a14f085827f8e3a59ded04bbb..5e9f670d1f9c5efd5fc4a24b28bd964cb2a09d45 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQOrder.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/LinQOrder.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.runtime.function.MagicScriptLambdaFunction; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/OrderValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/OrderValue.java index d98b2cbce431965765ced2721bf083f85e4021dc..839dad4fdaa5466879f583f838cecc9083856005 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/OrderValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/OrderValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; public class OrderValue { diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/Record.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/Record.java index 60a2b367c0ff10bbd356866c17af100519599ed0..e52f0ddceb101a267a76a51f35791f86ba8665c1 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/Record.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/Record.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.runtime.Variables; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectField.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectField.java index 656c399f13c10a54184e0a23e6725d49f2420f92..27cdfe272b07d75d1eb8fcb34592ad9f10fd9542 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectField.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectField.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.runtime.function.MagicScriptLambdaFunction; diff --git a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectValue.java b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectValue.java index 5947829e6db8ce0598d340d1006059823f6480e4..dfc3838af7f02575070422e2843f221e8a39aff5 100644 --- a/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectValue.java +++ b/cn-universal-framework/cn-universal-core/src/main/java/cn/universal/core/engine/runtime/linq/SelectValue.java @@ -1,15 +1,3 @@ -/* - * - * Copyright (c) 2025, IoT-Universal. All Rights Reserved. - * - * @Description: 本文件由 Aleo 开发并拥有版权,未经授权严禁擅自商用、复制或传播。 - * @Author: Aleo - * @Email: wo8335224@gmail.com - * @Wechat: outlookFil - * - * - */ - package cn.universal.core.engine.runtime.linq; import cn.universal.core.engine.parsing.ast.BinaryOperation;