List of usage examples for org.objectweb.asm Opcodes ACC_FINAL
int ACC_FINAL
To view the source code for org.objectweb.asm Opcodes ACC_FINAL.
Click Source Link
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
private void writeBegin() { final int compute = ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS; final int version = Opcodes.V1_7; final int access = Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER | Opcodes.ACC_FINAL; final String base = BASE_CLASS_TYPE.getInternalName(); final String name = CLASS_TYPE.getInternalName(); writer = new ClassWriter(compute); writer.visit(version, access, name, null, base, null); writer.visitSource(source, null);/* ww w . ja v a 2 s. c om*/ }
From source file:org.elasticsearch.plan.a.Writer.java
License:Apache License
private void writeBegin() { final int compute = ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS; final int version = Opcodes.V1_7; final int access = Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC; final String base = BASE_CLASS_TYPE.getInternalName(); final String name = CLASS_TYPE.getInternalName(); writer = new ClassWriter(compute); writer.visit(version, access, name, null, base, null); writer.visitSource(source, null);/* w ww. j a v a2 s. co m*/ }
From source file:org.enerj.enhancer.MetaData.java
License:Open Source License
/** * Determine if the access modifiers are static or final. * /*from w w w . j a v a2 s. c o m*/ * @param someModifiers the ASM Opcodes.ACC_* modifiers. * * @return true if the modifiers represent static or final. */ // TODO Refactor to ASMUtil private static boolean isStaticOrFinal(int someModifiers) { return (someModifiers & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC || (someModifiers & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL; }
From source file:org.evosuite.graphs.cfg.CFGClassAdapter.java
License:Open Source License
/** {@inheritDoc} */ @Override// w w w . ja va2 s . c o m public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { if ((access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) { RemoveFinalClassAdapter.finalClasses.add(name.replace('/', '.')); } // We are removing final access to allow mocking // TODO: Is this redundant wrt RemoveFinalClassAdapter? super.visit(version, access & ~Opcodes.ACC_FINAL, name, signature, superName, interfaces); if (superName.equals("java/lang/Enum")) isEnum = true; }
From source file:org.evosuite.instrumentation.CreateClassResetClassAdapter.java
License:Open Source License
/** {@inheritDoc} */ @Override/*from ww w .jav a2 s.c om*/ public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { if (name.equals("serialVersionUID")) { definesUid = true; } if (hasStaticModifier(access)) { StaticField staticField = new StaticField(); staticField.name = name; staticField.desc = desc; staticField.value = value; static_fields.add(staticField); } if (!isInterface && removeFinalModifierOnStaticFields) { int newAccess = access & (~Opcodes.ACC_FINAL); return super.visitField(newAccess, name, desc, signature, value); } else { if (hasFinalModifier(access)) finalFields.add(name); return super.visitField(access, name, desc, signature, value); } }
From source file:org.evosuite.instrumentation.CreateClassResetClassAdapter.java
License:Open Source License
private boolean hasFinalModifier(int access) { return (access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL; }
From source file:org.evosuite.instrumentation.CreateClassResetClassAdapter.java
License:Open Source License
private void createSerialisableUID() { // Only add this for serialisable classes if (serialUID < 0) return;/*from w w w .j a v a 2 s.c o m*/ /* * If the class is serializable, then adding a hashCode will change the serialVersionUID * if it is not defined in the class. Hence, if it is not defined, we have to define it to * avoid problems in serialising the class. */ logger.info("Adding serialId to class {}", className); visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL, "serialVersionUID", "J", null, serialUID); }
From source file:org.evosuite.instrumentation.NonTargetClassAdapter.java
License:Open Source License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {// ww w.j av a 2 s. c o m if ((access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) { RemoveFinalClassAdapter.finalClasses.add(name.replace('/', '.')); } // We are removing final access to allow mocking super.visit(version, access & ~Opcodes.ACC_FINAL, name, signature, superName, interfaces); }
From source file:org.evosuite.instrumentation.NonTargetClassAdapter.java
License:Open Source License
/** {@inheritDoc} */ @Override//from w w w . ja va 2s. c om public MethodVisitor visitMethod(int access, String name, String desc, String signature, final String[] exceptions) { MethodVisitor mv = super.visitMethod(access & ~Opcodes.ACC_FINAL, name, desc, signature, exceptions); mv = new JSRInlinerAdapter(mv, access, name, desc, signature, exceptions); if (!"<clinit>".equals(name)) mv = new YieldAtLineNumberMethodAdapter(mv, className, name); return mv; //new ArrayAllocationLimitMethodAdapter(mv, className, name, access, desc); }
From source file:org.evosuite.instrumentation.NonTargetClassAdapter.java
License:Open Source License
@Override public void visitInnerClass(String name, String outerName, String innerName, int access) { if ((access & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) { RemoveFinalClassAdapter.finalClasses.add(name.replace('/', '.')); }//from w w w.j av a 2 s . c om // We are removing final access to allow mocking super.visitInnerClass(name, outerName, innerName, access & ~Opcodes.ACC_FINAL); }