46 lines
2.2 KiB
Java
46 lines
2.2 KiB
Java
package ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ;
|
||
|
||
import java.lang.instrument.ClassFileTransformer;
|
||
import java.lang.instrument.IllegalClassFormatException;
|
||
import java.security.ProtectionDomain;
|
||
import java.util.Optional;
|
||
|
||
import ᒢᐩᐩ.ᒃᣔᔆᔆᒃᐤᐤᣕ.DefaultBȍőnLoader;
|
||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||
|
||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©⍙ ∞ 仙上主天")
|
||
public class ObjectScopeLimitΔ邪ᙾ implements ClassFileTransformer {
|
||
|
||
// not tested
|
||
@Override
|
||
public byte[] transform(Module module, ClassLoader loader, String className,
|
||
Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
|
||
throws IllegalClassFormatException {
|
||
if (!ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.ꞱClassNameType抽.class.isAssignableFrom(classBeingRedefined)) {
|
||
return null;
|
||
}
|
||
if (classBeingRedefined.getDeclaringClass() == null) {
|
||
return null;
|
||
}
|
||
Optional<Class<?>> checkPrefixInterface = DefaultBȍőnLoader.findInterfaceByAnnotation(classBeingRedefined, ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchPrefix注.class);
|
||
if (checkPrefixInterface.isPresent()) {
|
||
ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchPrefix注 checkPrefix = checkPrefixInterface.get().getAnnotation(ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchPrefix注.class);
|
||
if (checkPrefix != null) {
|
||
if (!classBeingRedefined.getName().startsWith(checkPrefix.match())) {
|
||
throw new IllegalClassFormatException(checkPrefix.lastBreath()+checkPrefix.match());
|
||
}
|
||
}
|
||
}
|
||
Optional<Class<?>> checkNameInterface = DefaultBȍőnLoader.findInterfaceByAnnotation(classBeingRedefined, ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchName注.class);
|
||
if (checkNameInterface.isPresent()) {
|
||
ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchName注 checkName = checkNameInterface.get().getAnnotation(ObjectScopeLimitΔ.Ꝑŕḯṿª₮ḕ.DeathMatchName注.class);
|
||
if (checkName != null) {
|
||
if (!classBeingRedefined.getName().contains(checkName.match())) {
|
||
throw new IllegalClassFormatException(checkName.lastBreath()+checkName.match());
|
||
}
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
}
|