diff options
| author | 2018-12-08 11:21:18 +0100 | |
|---|---|---|
| committer | 2018-12-08 11:21:18 +0100 | |
| commit | 4bc3afe4ff08b9f0c08952ec7f6e0ac930280cc5 (patch) | |
| tree | 99e43aa385d7fa1248c7fe474c022db55c364592 /src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java | |
| parent | work around Procyon weirdness (diff) | |
| download | enigma-fork-4bc3afe4ff08b9f0c08952ec7f6e0ac930280cc5.tar.gz enigma-fork-4bc3afe4ff08b9f0c08952ec7f6e0ac930280cc5.tar.xz enigma-fork-4bc3afe4ff08b9f0c08952ec7f6e0ac930280cc5.zip | |
add barebones plugin framework, cleanup
Diffstat (limited to 'src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java b/src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java deleted file mode 100644 index 9ed6db9..0000000 --- a/src/main/java/cuchaz/enigma/bytecode/ClassProtectifier.java +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.bytecode; | ||
| 13 | |||
| 14 | import org.objectweb.asm.ClassVisitor; | ||
| 15 | import org.objectweb.asm.FieldVisitor; | ||
| 16 | import org.objectweb.asm.MethodVisitor; | ||
| 17 | |||
| 18 | public class ClassProtectifier extends ClassVisitor { | ||
| 19 | |||
| 20 | public ClassProtectifier(int api, ClassVisitor cv) { | ||
| 21 | super(api, cv); | ||
| 22 | } | ||
| 23 | |||
| 24 | @Override | ||
| 25 | public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { | ||
| 26 | access = protectify(access); | ||
| 27 | return super.visitMethod(access, name, desc, signature, exceptions); | ||
| 28 | } | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { | ||
| 32 | access = protectify(access); | ||
| 33 | return super.visitField(access, name, desc, signature, value); | ||
| 34 | } | ||
| 35 | |||
| 36 | @Override | ||
| 37 | public void visitInnerClass(String name, String outerName, String innerName, int access) { | ||
| 38 | access = protectify(access); | ||
| 39 | super.visitInnerClass(name, outerName, innerName, access); | ||
| 40 | } | ||
| 41 | |||
| 42 | private static int protectify(int access) { | ||
| 43 | AccessFlags accessFlags = new AccessFlags(access); | ||
| 44 | if (accessFlags.isPrivate()) { | ||
| 45 | accessFlags.setProtected(); | ||
| 46 | } | ||
| 47 | return accessFlags.getFlags(); | ||
| 48 | } | ||
| 49 | } | ||