List of usage examples for org.objectweb.asm Opcodes ACC_PRIVATE
int ACC_PRIVATE
To view the source code for org.objectweb.asm Opcodes ACC_PRIVATE.
Click Source Link
From source file:org.spockframework.compiler.AstUtil.java
License:Apache License
public static void setVisibility(MethodNode method, int visibility) { int modifiers = method.getModifiers(); modifiers &= ~(Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE); method.setModifiers(modifiers | visibility); }
From source file:org.spockframework.compiler.AstUtil.java
License:Apache License
public static int getVisibility(FieldNode field) { return field.getModifiers() & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE); }
From source file:org.spockframework.compiler.AstUtil.java
License:Apache License
public static void setVisibility(FieldNode field, int visibility) { int modifiers = field.getModifiers(); modifiers &= ~(Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE); field.setModifiers(modifiers | visibility); }
From source file:org.spockframework.compiler.SpecRewriter.java
License:Apache License
private int determineVisibilityForSharedFieldAccessor(Field field) { if (field.getOwner() == null) { // true field int visibility = AstUtil.getVisibility(field.getAst()); if (visibility == Opcodes.ACC_PRIVATE) visibility = Opcodes.ACC_PROTECTED; return visibility; } else { // property return Opcodes.ACC_PUBLIC; }// w ww .j ava 2 s.c o m }
From source file:org.spockframework.compiler.SpecRewriter.java
License:Apache License
public void visitMethod(Method method) { this.method = method; methodHasCondition = false;/*from w w w . j a va 2s .com*/ movedStatsBackToMethod = false; if (method instanceof FixtureMethod) { checkFieldAccessInFixtureMethod(method); // de-virtualize method s.t. multiple fixture methods along hierarchy can be called independently AstUtil.setVisibility(method.getAst(), Opcodes.ACC_PRIVATE); } else if (method instanceof FeatureMethod) { transplantMethod(method); handleWhereBlock(method); } }
From source file:org.spockframework.compiler.SpecRewriter.java
License:Apache License
private FixtureMethod getInitializerMethod() { if (spec.getInitializerMethod() == null) { // method is private s.t. multiple initializer methods along hierarchy can be called independently MethodNode gMethod = new MethodNode(InternalIdentifiers.INITIALIZER_METHOD, Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, ClassHelper.DYNAMIC_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement()); spec.getAst().addMethod(gMethod); FixtureMethod method = new FixtureMethod(spec, gMethod); method.addBlock(new AnonymousBlock(method)); spec.setInitializerMethod(method); }/*from w ww. java 2 s.com*/ return spec.getInitializerMethod(); }
From source file:org.spockframework.compiler.SpecRewriter.java
License:Apache License
private FixtureMethod getSharedInitializerMethod() { if (spec.getSharedInitializerMethod() == null) { // method is private s.t. multiple initializer methods along hierarchy can be called independently MethodNode gMethod = new MethodNode(InternalIdentifiers.SHARED_INITIALIZER_METHOD, Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC, ClassHelper.DYNAMIC_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement()); spec.getAst().addMethod(gMethod); FixtureMethod method = new FixtureMethod(spec, gMethod); method.addBlock(new AnonymousBlock(method)); spec.setSharedInitializerMethod(method); }//from www . j a va 2 s .c om return spec.getSharedInitializerMethod(); }
From source file:org.spongepowered.asm.mixin.injection.code.Injector.java
License:MIT License
protected void invokeMethod(InsnList insns, MethodNode methodNode) { boolean isPrivate = (methodNode.access & Opcodes.ACC_PRIVATE) != 0; int invokeOpcode = this.isStatic ? Opcodes.INVOKESTATIC : isPrivate ? Opcodes.INVOKESPECIAL : Opcodes.INVOKEVIRTUAL; insns.add(new MethodInsnNode(invokeOpcode, this.classNode.name, methodNode.name, methodNode.desc, false)); }
From source file:org.spongepowered.asm.mixin.transformer.ClassInfo.java
License:MIT License
/** * Initialise a ClassInfo from the supplied {@link ClassNode} * //from w w w. j a va2s. c om * @param classNode Class node to inspect */ private ClassInfo(ClassNode classNode) { this.name = classNode.name; this.superName = classNode.superName != null ? classNode.superName : ClassInfo.JAVA_LANG_OBJECT; this.methods = new HashSet<Method>(); this.fields = new ArrayList<String>(); this.isInterface = ((classNode.access & Opcodes.ACC_INTERFACE) != 0); this.interfaces = Collections.unmodifiableList(classNode.interfaces); this.access = classNode.access; this.isMixin = classNode instanceof MixinClassNode; this.mixin = this.isMixin ? ((MixinClassNode) classNode).getMixin() : null; for (MethodNode method : classNode.methods) { this.addMethod(method, this.isMixin); } String outerName = classNode.outerClass; if (outerName == null) { for (FieldNode field : classNode.fields) { if ((field.access & Opcodes.ACC_SYNTHETIC) != 0) { if (field.name.startsWith("this$")) { outerName = field.desc; if (outerName.startsWith("L")) { outerName = outerName.substring(1, outerName.length() - 1); } } } else if ((field.access & Opcodes.ACC_PRIVATE) == 0) { this.fields.add(field.name + "()" + field.desc); } } } this.outerName = outerName; }
From source file:org.spongepowered.asm.mixin.transformer.ClassInfo.java
License:MIT License
private void addMethod(MethodNode method, boolean injected) { if (!method.name.startsWith("<") && (method.access & Opcodes.ACC_PRIVATE) == 0 && (method.access & Opcodes.ACC_STATIC) == 0) { this.methods.add(new Method(method, injected)); }/*from ww w . j a v a 2s.c om*/ }