List of usage examples for org.objectweb.asm Opcodes ACC_NATIVE
int ACC_NATIVE
To view the source code for org.objectweb.asm Opcodes ACC_NATIVE.
Click Source Link
From source file:org.teavm.parsing.Parser.java
License:Apache License
public static void parseModifiers(int access, ElementHolder member) { if ((access & Opcodes.ACC_PRIVATE) != 0) { member.setLevel(AccessLevel.PRIVATE); } else if ((access & Opcodes.ACC_PROTECTED) != 0) { member.setLevel(AccessLevel.PROTECTED); } else if ((access & Opcodes.ACC_PUBLIC) != 0) { member.setLevel(AccessLevel.PUBLIC); }/*from www. j a v a 2 s . c om*/ if ((access & Opcodes.ACC_ABSTRACT) != 0) { member.getModifiers().add(ElementModifier.ABSTRACT); } if ((access & Opcodes.ACC_ANNOTATION) != 0) { member.getModifiers().add(ElementModifier.ANNOTATION); } if ((access & Opcodes.ACC_BRIDGE) != 0) { member.getModifiers().add(ElementModifier.BRIDGE); } if ((access & Opcodes.ACC_DEPRECATED) != 0) { member.getModifiers().add(ElementModifier.DEPRECATED); } if ((access & Opcodes.ACC_ENUM) != 0) { member.getModifiers().add(ElementModifier.ENUM); } if ((access & Opcodes.ACC_FINAL) != 0) { member.getModifiers().add(ElementModifier.FINAL); } if ((access & Opcodes.ACC_INTERFACE) != 0) { member.getModifiers().add(ElementModifier.INTERFACE); } if ((access & Opcodes.ACC_NATIVE) != 0) { member.getModifiers().add(ElementModifier.NATIVE); } if ((access & Opcodes.ACC_STATIC) != 0) { member.getModifiers().add(ElementModifier.STATIC); } if ((access & Opcodes.ACC_STRICT) != 0) { member.getModifiers().add(ElementModifier.STRICT); } if ((access & Opcodes.ACC_SUPER) != 0) { member.getModifiers().add(ElementModifier.SUPER); } if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) { member.getModifiers().add(ElementModifier.SYNCHRONIZED); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { member.getModifiers().add(ElementModifier.SYNTHETIC); } if ((access & Opcodes.ACC_TRANSIENT) != 0) { member.getModifiers().add(ElementModifier.TRANSIENT); } if ((access & Opcodes.ACC_VARARGS) != 0) { member.getModifiers().add(ElementModifier.VARARGS); } if ((access & Opcodes.ACC_VOLATILE) != 0) { member.getModifiers().add(ElementModifier.VOLATILE); } }
From source file:serianalyzer.SerianalyzerClassMethodVisitor.java
License:Open Source License
/** * {@inheritDoc}/*from w w w.jav a 2 s .co m*/ * * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, * java.lang.String[]) */ @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (this.ref.getMethod().equals(name) && this.ref.getSignature().equals(desc)) { if (this.log.isTraceEnabled()) { this.log.trace( String.format("Found %s::%s with signature %s", this.ref.getTypeNameString(), name, desc)); //$NON-NLS-1$ } if ((access & Opcodes.ACC_ABSTRACT) != 0) { return super.visitMethod(access, name, desc, signature, exceptions); } this.found = true; if ((access & Opcodes.ACC_NATIVE) != 0) { this.analyzer.getState().reportCall(this.ref); return super.visitMethod(access, name, desc, signature, exceptions); } return new SerianalyzerMethodVisitor(this, this.ref, this.actualType); } if (this.log.isTraceEnabled()) { this.log.trace(String.format("Mismatch %s %s %s vs. %s", name, desc, signature, this.ref)); //$NON-NLS-1$ } return super.visitMethod(access, name, desc, signature, exceptions); }
From source file:the.bytecode.club.bytecodeviewer.decompilers.bytecode.MethodNodeDecompiler.java
License:Open Source License
private static String getAccessString(int access) { // public, protected, private, abstract, static, // final, synchronized, native & strictfp are permitted List<String> tokens = new ArrayList<String>(); if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); if ((access & Opcodes.ACC_STATIC) != 0) tokens.add("static"); if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) tokens.add("synchronized"); if ((access & Opcodes.ACC_NATIVE) != 0) tokens.add("native"); if ((access & Opcodes.ACC_STRICT) != 0) tokens.add("strictfp"); if ((access & Opcodes.ACC_BRIDGE) != 0) tokens.add("bridge"); if ((access & Opcodes.ACC_VARARGS) != 0) tokens.add("varargs"); if (tokens.size() == 0) return ""; // hackery delimeters StringBuilder sb = new StringBuilder(tokens.get(0)); for (int i = 1; i < tokens.size(); i++) { sb.append(" "); sb.append(tokens.get(i));//w w w .j av a 2 s.c o m } return sb.toString(); }
From source file:the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses.java
License:Open Source License
@Override public void obfuscate() { int stringLength = 5;//getStringLength(); System.out.println("Obfuscating class names..."); classLoop: for (ClassNode c : BytecodeViewer.getLoadedClasses()) { /** As we dont want to rename classes that contain native dll methods */ for (Object o : c.methods) { MethodNode m = (MethodNode) o; /** As we dont want to rename any main-classes */ if (m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V") || m.name.equals("init") && c.superName.equals("java/applet/Applet")) continue classLoop; /* As we dont want to rename native dll methods */ if ((m.access & Opcodes.ACC_NATIVE) != 0) continue classLoop; }//from w ww. j ava 2 s . c o m String newName = generateUniqueName(stringLength); BytecodeViewer.refactorer.getHooks().addClass(new MappingData(c.name, newName)); /*ASMUtil_OLD.renameClassNode(c.name, newName); c.name = newName;*/ } System.out.println("Obfuscated class names."); }
From source file:the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods.java
License:Open Source License
@Override public void obfuscate() { int stringLength = getStringLength(); System.out.println("Obfuscating method names..."); for (ClassNode c : BytecodeViewer.getLoadedClasses()) { methodLoop: for (Object o : c.methods.toArray()) { MethodNode m = (MethodNode) o; /* As we dont want to rename native dll methods */ if ((m.access & Opcodes.ACC_NATIVE) != 0) continue methodLoop; if (m.access != Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED) { if (!m.name.equals("main") && !m.name.equals("<init>") && !m.name.equals("<clinit>")) { String newName = generateUniqueName(stringLength); BytecodeViewer.refactorer.getHooks() .addMethod(new MethodMappingData(c.name, new MappingData(m.name, newName), m.desc)); /*ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc, null, newName, null);*/ }//from w ww .ja va 2 s . c om } } } System.out.println("Obfuscated method names."); }
From source file:v6.java.preverifier.PreverificationClassNode.java
License:Open Source License
@Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodNode mn = new PreverifierMethodNode(this, access, name, desc, signature, exceptions); boolean isNativeError = !preverificationPolicy.areNativeMethodsAllowed() && ((access & Opcodes.ACC_NATIVE) != 0); boolean isFinalizerError = !preverificationPolicy.areFinalizersAllowed() && name.equals("finalize") && (Type.getArgumentTypes(desc).length == 0); PreverificationErrorType signatureErrorType = getMethodSignatureError(desc); boolean isInvalidMethodSignature = (signatureErrorType != PreverificationErrorType.NO_ERROR); if (isNativeError || isFinalizerError || isInvalidMethodSignature) { ClassNodeErrorInformation classInfo = new ClassNodeErrorInformation(this); MethodNodeErrorInformation methodInfo = new MethodNodeErrorInformation(classInfo, mn); PreverificationErrorLocation location = new PreverificationErrorLocation( PreverificationErrorLocationType.METHOD_SIGNATURE, classInfo, methodInfo, null, -1); if (isNativeError) { PreverificationError error = new PreverificationError(PreverificationErrorType.NATIVE, location, null);/*from w ww. j a va2 s . c o m*/ getErrorList().add(error); } if (isFinalizerError) { PreverificationError error = new PreverificationError(PreverificationErrorType.FINALIZERS, location, null); getErrorList().add(error); } if (isInvalidMethodSignature) { PreverificationError error = new PreverificationError(signatureErrorType, location, null); getErrorList().add(error); } } return mn; }
From source file:v6.java.preverifier.PreverifierMethodNode.java
License:Open Source License
public void visitEnd() { boolean hasNoCode = ((access & Opcodes.ACC_NATIVE) != 0) || ((access & Opcodes.ACC_ABSTRACT) != 0); if (hasNoCode) { classNode.methods.add(this); } else {/*from w w w . ja v a 2s.co m*/ MethodRewriter handler = new MethodRewriter(classNode, this); try { MethodNode updatedMethod = handler.getUpdatedMethod(); classNode.methods.add(updatedMethod); } catch (AnalyzerException e) { throw new RuntimeException("Method " + name + ": " + e.getMessage(), e); } } }