Java Code Examples for org.objectweb.asm.Opcodes#ACC_DEPRECATED
The following examples show how to use
org.objectweb.asm.Opcodes#ACC_DEPRECATED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassConstantsCollector.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
@Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { if ((access & Opcodes.ACC_SYNTHETIC) != 0) { cp.newUTF8("Synthetic"); } if ((access & Opcodes.ACC_DEPRECATED) != 0) { cp.newUTF8("Deprecated"); } cp.newUTF8(name); cp.newUTF8(desc); if (signature != null) { cp.newUTF8("Signature"); cp.newUTF8(signature); } if (exceptions != null) { cp.newUTF8("Exceptions"); for (int i = 0; i < exceptions.length; ++i) { cp.newClass(exceptions[i]); } } return new MethodConstantsCollector(cv.visitMethod(access, name, desc, signature, exceptions), cp); }
Example 2
Source File: ClassConstantsCollector.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
@Override public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { if ((access & Opcodes.ACC_SYNTHETIC) != 0) { cp.newUTF8("Synthetic"); } if ((access & Opcodes.ACC_DEPRECATED) != 0) { cp.newUTF8("Deprecated"); } cp.newUTF8(name); cp.newUTF8(desc); if (signature != null) { cp.newUTF8("Signature"); cp.newUTF8(signature); } if (value != null) { cp.newConst(value); } return new FieldConstantsCollector(cv.visitField(access, name, desc, signature, value), cp); }
Example 3
Source File: ClassConstantsCollector.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
@Override public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_DEPRECATED) != 0) { cp.newUTF8("Deprecated"); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { cp.newUTF8("Synthetic"); } cp.newClass(name); if (signature != null) { cp.newUTF8("Signature"); cp.newUTF8(signature); } if (superName != null) { cp.newClass(superName); } if (interfaces != null) { for (int i = 0; i < interfaces.length; ++i) { cp.newClass(interfaces[i]); } } cv.visit(version, access, name, signature, superName, interfaces); }
Example 4
Source File: Textifier.java From Concurnas with MIT License | 5 votes |
@Override public Textifier visitField( final int access, final String name, final String descriptor, final String signature, final Object value) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(FIELD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access); appendDescriptor(FIELD_DESCRIPTOR, descriptor); stringBuilder.append(' ').append(name); if (value != null) { stringBuilder.append(" = "); if (value instanceof String) { stringBuilder.append('\"').append(value).append('\"'); } else { stringBuilder.append(value); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 5
Source File: Textifier.java From JReFrameworker with MIT License | 5 votes |
@Override public Textifier visitField( final int access, final String name, final String descriptor, final String signature, final Object value) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(FIELD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access); appendDescriptor(FIELD_DESCRIPTOR, descriptor); stringBuilder.append(' ').append(name); if (value != null) { stringBuilder.append(" = "); if (value instanceof String) { stringBuilder.append('\"').append(value).append('\"'); } else { stringBuilder.append(value); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 6
Source File: ClassConstantsCollector.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { if ((access & Opcodes.ACC_SYNTHETIC) != 0) { cp.newUTF8("Synthetic"); } if ((access & Opcodes.ACC_DEPRECATED) != 0) { cp.newUTF8("Deprecated"); } cp.newUTF8(name); cp.newUTF8(desc); if (signature != null) { cp.newUTF8("Signature"); cp.newUTF8(signature); } if (exceptions != null) { cp.newUTF8("Exceptions"); for (int i = 0; i < exceptions.length; ++i) { cp.newClass(exceptions[i]); } } return new MethodConstantsCollector(cv.visitMethod(access, name, desc, signature, exceptions), cp); }
Example 7
Source File: Textifier.java From JReFrameworker with MIT License | 5 votes |
@Override public Textifier visitField( final int access, final String name, final String descriptor, final String signature, final Object value) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(FIELD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access); appendDescriptor(FIELD_DESCRIPTOR, descriptor); stringBuilder.append(' ').append(name); if (value != null) { stringBuilder.append(" = "); if (value instanceof String) { stringBuilder.append('\"').append(value).append('\"'); } else { stringBuilder.append(value); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 8
Source File: ClassScanner.java From forbidden-apis with Apache License 2.0 | 5 votes |
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.internalMainClassName = name; this.isDeprecated = (access & Opcodes.ACC_DEPRECATED) != 0; reportClassViolation(checkClassDefinition(name, superName, interfaces), "class declaration"); if (this.isDeprecated) { classSuppressed |= suppressAnnotations.matcher(DEPRECATED_TYPE.getClassName()).matches(); reportClassViolation(checkType(DEPRECATED_TYPE), "deprecation on class declaration"); } }
Example 9
Source File: IntegrationTestSupport.java From turbine with Apache License 2.0 | 5 votes |
private static void undeprecate(ClassNode n) { if (!isDeprecated(n.visibleAnnotations)) { n.access &= ~Opcodes.ACC_DEPRECATED; } n.methods.stream() .filter(m -> !isDeprecated(m.visibleAnnotations)) .forEach(m -> m.access &= ~Opcodes.ACC_DEPRECATED); n.fields.stream() .filter(f -> !isDeprecated(f.visibleAnnotations)) .forEach(f -> f.access &= ~Opcodes.ACC_DEPRECATED); }
Example 10
Source File: ClassConstantsCollector.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_DEPRECATED) != 0) { cp.newUTF8("Deprecated"); } if ((access & Opcodes.ACC_SYNTHETIC) != 0) { cp.newUTF8("Synthetic"); } cp.newClass(name); if (signature != null) { cp.newUTF8("Signature"); cp.newUTF8(signature); } if (superName != null) { cp.newClass(superName); } if (interfaces != null) { for (int i = 0; i < interfaces.length; ++i) { cp.newClass(interfaces[i]); } } cv.visit(version, access, name, signature, superName, interfaces); }
Example 11
Source File: AccessFlags.java From buck with Apache License 2.0 | 5 votes |
/** * Gets the access flags (see JVMS8 4.1, 4.5, 4.6) for the given element, from among those that * are common to all kinds of elements. */ private int getCommonAccessFlags(Element element) { try { int result = modifiersToAccessFlags(element.getModifiers()); if (elements.isDeprecated(element)) { result = result | Opcodes.ACC_DEPRECATED; } return result; } catch (CannotInferException e) { // We should never call this method with an inferred type. throw new AssertionError("Unexpected call to getAccessFlags with an inferred type.", e); } }
Example 12
Source File: Utils.java From Concurnas with MIT License | 5 votes |
public static int getAnnotationDependantExtraModifiers(Annotations annots) { if(null != annots){ boolean deprecated = false; for(com.concurnas.compiler.ast.Annotation ano : annots.annotations){ if(ScopeAndTypeChecker.const_Annotation_DeprecatedCls.equals(ano.getTaggedType())){ deprecated=true; break; } } if(deprecated){ return Opcodes.ACC_DEPRECATED; } } return 0; }
Example 13
Source File: MethodDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public int getActualModifiers() { return getModifiers() | (getDeclaredAnnotations().isAnnotationPresent(Deprecated.class) ? Opcodes.ACC_DEPRECATED : EMPTY_MASK); }
Example 14
Source File: Textifier.java From JByteMod-Beta with GNU General Public License v2.0 | 4 votes |
@Override public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_MODULE) != 0) { // visitModule will print the module return; } this.access = access; int major = version & 0xFFFF; int minor = version >>> 16; buf.setLength(0); buf.append("// class version ").append(major).append('.').append(minor).append(" (").append(version).append(")\n"); if ((access & Opcodes.ACC_DEPRECATED) != 0) { buf.append("// DEPRECATED\n"); } buf.append("// access flags 0x").append(Integer.toHexString(access).toUpperCase()).append('\n'); appendDescriptor(CLASS_SIGNATURE, signature); if (signature != null) { TraceSignatureVisitor sv = new TraceSignatureVisitor(access); SignatureReader r = new SignatureReader(signature); r.accept(sv); buf.append("// declaration: ").append(name).append(sv.getDeclaration()).append('\n'); } appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE)); if ((access & Opcodes.ACC_ANNOTATION) != 0) { buf.append("@interface "); } else if ((access & Opcodes.ACC_INTERFACE) != 0) { buf.append("interface "); } else if ((access & Opcodes.ACC_ENUM) == 0) { buf.append("class "); } appendDescriptor(INTERNAL_NAME, name); if (superName != null && !"java/lang/Object".equals(superName)) { buf.append(" extends "); appendDescriptor(INTERNAL_NAME, superName); buf.append(' '); } if (interfaces != null && interfaces.length > 0) { buf.append(" implements "); for (int i = 0; i < interfaces.length; ++i) { appendDescriptor(INTERNAL_NAME, interfaces[i]); buf.append(' '); } } buf.append(" {\n\n"); text.add(buf.toString()); }
Example 15
Source File: Engine.java From JReFrameworker with MIT License | 4 votes |
@SuppressWarnings("unused") private static String getAccessModifiers(int access){ LinkedList<String> modifiers = new LinkedList<String>(); if((Opcodes.ACC_ABSTRACT & access) == Opcodes.ACC_ABSTRACT){ modifiers.add("abstract"); } if((Opcodes.ACC_ANNOTATION & access) == Opcodes.ACC_ANNOTATION){ modifiers.add("annotation"); } if((Opcodes.ACC_BRIDGE & access) == Opcodes.ACC_BRIDGE){ modifiers.add("bridge"); } if((Opcodes.ACC_DEPRECATED & access) == Opcodes.ACC_DEPRECATED){ modifiers.add("deprecated"); } if((Opcodes.ACC_ENUM & access) == Opcodes.ACC_ENUM){ modifiers.add("enum"); } if((Opcodes.ACC_FINAL & access) == Opcodes.ACC_FINAL){ modifiers.add("final"); } if((Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE){ modifiers.add("interface"); } if((Opcodes.ACC_MANDATED & access) == Opcodes.ACC_MANDATED){ modifiers.add("mandated"); } if((Opcodes.ACC_NATIVE & access) == Opcodes.ACC_NATIVE){ modifiers.add("native"); } if((Opcodes.ACC_PRIVATE & access) == Opcodes.ACC_PRIVATE){ modifiers.add("private"); } if((Opcodes.ACC_PROTECTED & access) == Opcodes.ACC_PROTECTED){ modifiers.add("protected"); } if((Opcodes.ACC_PUBLIC & access) == Opcodes.ACC_PUBLIC){ modifiers.add("public"); } if((Opcodes.ACC_STATIC & access) == Opcodes.ACC_STATIC){ modifiers.add("static"); } if((Opcodes.ACC_STRICT & access) == Opcodes.ACC_STRICT){ modifiers.add("strict"); } if((Opcodes.ACC_SUPER & access) == Opcodes.ACC_SUPER){ modifiers.add("super"); } if((Opcodes.ACC_SYNCHRONIZED & access) == Opcodes.ACC_SYNCHRONIZED){ modifiers.add("synchronized"); } if((Opcodes.ACC_SYNTHETIC & access) == Opcodes.ACC_SYNTHETIC){ modifiers.add("synthetic"); } if((Opcodes.ACC_TRANSIENT & access) == Opcodes.ACC_TRANSIENT){ modifiers.add("transient"); } if((Opcodes.ACC_VARARGS & access) == Opcodes.ACC_VARARGS){ modifiers.add("varargs"); } if((Opcodes.ACC_VOLATILE & access) == Opcodes.ACC_VOLATILE){ modifiers.add("volatile"); } return modifiers.toString(); }
Example 16
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
@Override public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_MODULE) != 0) { // Modules are printed in visitModule. return; } this.access = access; int majorVersion = version & 0xFFFF; int minorVersion = version >>> 16; stringBuilder.setLength(0); stringBuilder .append("// class version ") .append(majorVersion) .append('.') .append(minorVersion) .append(" (") .append(version) .append(")\n"); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(DEPRECATED); } appendRawAccess(access); appendDescriptor(CLASS_SIGNATURE, signature); if (signature != null) { appendJavaDeclaration(name, signature); } appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE)); if ((access & Opcodes.ACC_ANNOTATION) != 0) { stringBuilder.append("@interface "); } else if ((access & Opcodes.ACC_INTERFACE) != 0) { stringBuilder.append("interface "); } else if ((access & Opcodes.ACC_ENUM) == 0) { stringBuilder.append("class "); } appendDescriptor(INTERNAL_NAME, name); if (superName != null && !"java/lang/Object".equals(superName)) { stringBuilder.append(" extends "); appendDescriptor(INTERNAL_NAME, superName); } if (interfaces != null && interfaces.length > 0) { stringBuilder.append(" implements "); for (int i = 0; i < interfaces.length; ++i) { appendDescriptor(INTERNAL_NAME, interfaces[i]); if (i != interfaces.length - 1) { stringBuilder.append(' '); } } } stringBuilder.append(" {\n\n"); text.add(stringBuilder.toString()); }
Example 17
Source File: Textifier.java From Concurnas with MIT License | 4 votes |
@Override public Textifier visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(METHOD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access & ~(Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT)); if ((access & Opcodes.ACC_NATIVE) != 0) { stringBuilder.append("native "); } if ((access & Opcodes.ACC_VARARGS) != 0) { stringBuilder.append("varargs "); } if ((access & Opcodes.ACC_BRIDGE) != 0) { stringBuilder.append("bridge "); } if ((this.access & Opcodes.ACC_INTERFACE) != 0 && (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == 0) { stringBuilder.append("default "); } stringBuilder.append(name); appendDescriptor(METHOD_DESCRIPTOR, descriptor); if (exceptions != null && exceptions.length > 0) { stringBuilder.append(" throws "); for (String exception : exceptions) { appendDescriptor(INTERNAL_NAME, exception); stringBuilder.append(' '); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }
Example 18
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
@Override public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_MODULE) != 0) { // Modules are printed in visitModule. return; } this.access = access; int majorVersion = version & 0xFFFF; int minorVersion = version >>> 16; stringBuilder.setLength(0); stringBuilder .append("// class version ") .append(majorVersion) .append('.') .append(minorVersion) .append(" (") .append(version) .append(")\n"); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(DEPRECATED); } appendRawAccess(access); appendDescriptor(CLASS_SIGNATURE, signature); if (signature != null) { appendJavaDeclaration(name, signature); } appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE)); if ((access & Opcodes.ACC_ANNOTATION) != 0) { stringBuilder.append("@interface "); } else if ((access & Opcodes.ACC_INTERFACE) != 0) { stringBuilder.append("interface "); } else if ((access & Opcodes.ACC_ENUM) == 0) { stringBuilder.append("class "); } appendDescriptor(INTERNAL_NAME, name); if (superName != null && !"java/lang/Object".equals(superName)) { stringBuilder.append(" extends "); appendDescriptor(INTERNAL_NAME, superName); } if (interfaces != null && interfaces.length > 0) { stringBuilder.append(" implements "); for (int i = 0; i < interfaces.length; ++i) { appendDescriptor(INTERNAL_NAME, interfaces[i]); if (i != interfaces.length - 1) { stringBuilder.append(' '); } } } stringBuilder.append(" {\n\n"); text.add(stringBuilder.toString()); }
Example 19
Source File: Textifier.java From Concurnas with MIT License | 4 votes |
@Override public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { if ((access & Opcodes.ACC_MODULE) != 0) { // Modules are printed in visitModule. return; } this.access = access; int majorVersion = version & 0xFFFF; int minorVersion = version >>> 16; stringBuilder.setLength(0); stringBuilder .append("// class version ") .append(majorVersion) .append('.') .append(minorVersion) .append(" (") .append(version) .append(")\n"); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(DEPRECATED); } appendRawAccess(access); appendDescriptor(CLASS_SIGNATURE, signature); if (signature != null) { appendJavaDeclaration(name, signature); } appendAccess(access & ~(Opcodes.ACC_SUPER | Opcodes.ACC_MODULE)); if ((access & Opcodes.ACC_ANNOTATION) != 0) { stringBuilder.append("@interface "); } else if ((access & Opcodes.ACC_INTERFACE) != 0) { stringBuilder.append("interface "); } else if ((access & Opcodes.ACC_ENUM) == 0) { stringBuilder.append("class "); } appendDescriptor(INTERNAL_NAME, name); if (superName != null && !"java/lang/Object".equals(superName)) { stringBuilder.append(" extends "); appendDescriptor(INTERNAL_NAME, superName); } if (interfaces != null && interfaces.length > 0) { stringBuilder.append(" implements "); for (int i = 0; i < interfaces.length; ++i) { appendDescriptor(INTERNAL_NAME, interfaces[i]); if (i != interfaces.length - 1) { stringBuilder.append(' '); } } } stringBuilder.append(" {\n\n"); text.add(stringBuilder.toString()); }
Example 20
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
@Override public Textifier visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { stringBuilder.setLength(0); stringBuilder.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { stringBuilder.append(tab).append(DEPRECATED); } stringBuilder.append(tab); appendRawAccess(access); if (signature != null) { stringBuilder.append(tab); appendDescriptor(METHOD_SIGNATURE, signature); stringBuilder.append(tab); appendJavaDeclaration(name, signature); } stringBuilder.append(tab); appendAccess(access & ~(Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT)); if ((access & Opcodes.ACC_NATIVE) != 0) { stringBuilder.append("native "); } if ((access & Opcodes.ACC_VARARGS) != 0) { stringBuilder.append("varargs "); } if ((access & Opcodes.ACC_BRIDGE) != 0) { stringBuilder.append("bridge "); } if ((this.access & Opcodes.ACC_INTERFACE) != 0 && (access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == 0) { stringBuilder.append("default "); } stringBuilder.append(name); appendDescriptor(METHOD_DESCRIPTOR, descriptor); if (exceptions != null && exceptions.length > 0) { stringBuilder.append(" throws "); for (String exception : exceptions) { appendDescriptor(INTERNAL_NAME, exception); stringBuilder.append(' '); } } stringBuilder.append('\n'); text.add(stringBuilder.toString()); return addNewTextifier(null); }