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.formulacompiler.compiler.internal.bytecode.CacheCompiler.java
License:Open Source License
void compile() throws CompilerException { // private boolean h$<x> cw().visitField(Opcodes.ACC_PRIVATE, this.cachedIndicatorName, Type.BOOLEAN_TYPE.getDescriptor(), null, null).visitEnd();/* w w w . j a va2s . co m*/ // private <type> c$<x> cw().visitField(Opcodes.ACC_PRIVATE, this.cacheName, this.type.getDescriptor(), null, null).visitEnd(); // if (!h$<x>) { final Label skipCachedComputation = mv().newLabel(); mv().loadThis(); mv().getField(classType(), this.cachedIndicatorName, Type.BOOLEAN_TYPE); mv().visitJumpInsn(Opcodes.IFNE, skipCachedComputation); // c$<x> = <value>; mv().loadThis(); compileValue(); mv().putField(classType(), this.cacheName, this.type); // h$<x> = true; mv().loadThis(); mv().push(true); mv().putField(classType(), this.cachedIndicatorName, Type.BOOLEAN_TYPE); // } // return c$<x>; mv().mark(skipCachedComputation); mv().loadThis(); mv().getField(classType(), this.cacheName, this.type); // In reset(), do: if (this.section.hasReset()) { // h$<x> = false; final GeneratorAdapter r = this.section.resetter(); r.loadThis(); r.push(false); r.putField(classType(), this.cachedIndicatorName, Type.BOOLEAN_TYPE); } }
From source file:org.formulacompiler.compiler.internal.bytecode.FactoryCompiler.java
License:Open Source License
private void buildEnvironmentField() { newField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, ByteCodeEngineCompiler.ENV_MEMBER_NAME, ByteCodeEngineCompiler.ENV_DESC); }
From source file:org.formulacompiler.compiler.internal.bytecode.SectionCompiler.java
License:Open Source License
void compileAccessTo(SubSectionCompiler _sub) throws CompilerException { newField(Opcodes.ACC_PRIVATE, _sub.getterName(), _sub.arrayDescriptor()); new SubSectionLazyGetterCompiler(this, _sub).compile(); final CallFrame[] callsToImplement = _sub.model().getCallsToImplement(); for (CallFrame callToImplement : callsToImplement) { new SubSectionOutputAccessorCompiler(this, _sub, callToImplement).compile(); }/*www . java 2 s . com*/ // In reset(), do: if (hasReset()) { // $<section> = null; final GeneratorAdapter r = resetter(); r.loadThis(); r.visitInsn(Opcodes.ACONST_NULL); r.putField(classType(), _sub.getterName(), _sub.arrayType()); } }
From source file:org.formulacompiler.compiler.internal.bytecode.SectionCompiler.java
License:Open Source License
private void buildInputMember() { if (!hasInputs()) throw new IllegalStateException(); newField(Opcodes.ACC_FINAL + Opcodes.ACC_PRIVATE, INPUTS_MEMBER_NAME, inputType().getDescriptor()); }
From source file:org.formulacompiler.compiler.internal.bytecode.SectionCompiler.java
License:Open Source License
private void buildSectionInfoMember() { if (!isComputationListenerEnabled()) throw new IllegalStateException(); newField(Opcodes.ACC_FINAL + Opcodes.ACC_PRIVATE, SECTION_INFO_MEMBER_NAME, SECTION_INFO_DESC); }
From source file:org.formulacompiler.compiler.internal.bytecode.SubSectionCompiler.java
License:Open Source License
private void buildIndex() { newField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, INDEX_MEMBER_NAME, INDEX_TYPE.getDescriptor()); }
From source file:org.freud.analysed.classbytecode.parser.asm.AsmElement.java
License:Apache License
@Override public boolean isPrivate() { return isAccessModifier(Opcodes.ACC_PRIVATE); }
From source file:org.glassfish.pfl.tf.spi.EnhancedClassDataASMImpl.java
License:Open Source License
private void scanMethods() { final List<MethodNode> methods = currentClass.methods; Map<String, String> mmnToDescriptions = new HashMap<String, String>(); Map<String, TimingPointType> mmnToTPT = new HashMap<String, TimingPointType>(); Map<String, String> mmnToTPN = new HashMap<String, String>(); Map<String, String> mmnToAnnotationName = new HashMap<String, String>(); for (MethodNode mn : methods) { final String mname = mn.name; final String mdesc = util.getFullMethodDescriptor(mn); String monitoredMethodMMAnno = null; String shortClassName = className; int index = shortClassName.lastIndexOf('/'); if (index >= 0) { shortClassName = className.substring(index + 1); }// ww w. j a v a2s.c om String description = "Timer for method " + mname + " in class " + shortClassName; // default TimingPointType tpt = TimingPointType.BOTH; // default for non-InfoMethod String tpName = mname; // default for non-InfoMethod boolean hasMethodInfoAnno = false; final List<AnnotationNode> annotations = mn.visibleAnnotations; if (annotations != null) { for (AnnotationNode an : annotations) { final String aname = Type.getType(an.desc).getInternalName(); if (aname.equals(DESCRIPTION_NAME)) { Object value = getAttribute(an, "value"); if (value != null && value instanceof String) { description = (String) value; } } else if (aname.equals(INFO_METHOD_NAME)) { // set the correct default for InfoMethod! tpt = TimingPointType.NONE; // Check for private method! if (!util.hasAccess(mn.access, Opcodes.ACC_PRIVATE)) { util.error("Method " + mdesc + " for Class " + currentClass.name + " is a non-private @InfoMethod," + " which is not allowed"); } hasMethodInfoAnno = true; Object value = getAttribute(an, "tpType"); if (value != null && value instanceof String[]) { String[] enumData = (String[]) value; if (enumData.length == 2) { // [0] is desc, [1] is value tpt = TimingPointType.valueOf(enumData[1]); } } Object value2 = getAttribute(an, "tpName"); String tpn = ""; if ((value2 != null) && value2 instanceof String) { tpn = (String) value2; } if (tpt != TimingPointType.NONE) { if (tpn.length() == 0) { util.error("Method " + mdesc + " for Class " + currentClass.name + " is an info method with timing point type " + tpt + " but no tpName was specified"); } else { tpName = tpn; } } } else if (annoNamesForClass.contains(aname)) { if (monitoredMethodMMAnno == null) { monitoredMethodMMAnno = aname; } else { util.error("Method " + mdesc + " for Class " + currentClass.name + "has multiple MM annotations"); } } else if (annotationNames.contains(aname)) { util.error("Method " + mdesc + " for Class " + currentClass.name + " has an MM annotation which " + "is not on its class"); } } if (hasMethodInfoAnno && monitoredMethodMMAnno != null) { util.error("Method " + mdesc + " for Class " + currentClass.name + " has both @InfoMethod annotation and" + " a MM annotation"); } // This check is not really essential, but it simplifies // passing information to later phases for code generation // if we can assume that all @InfoMethod annotated methods // are non-static. (Simply because we only need to look for // INVOKESPECIAL). final boolean isStatic = util.hasAccess(mn.access, Opcodes.ACC_STATIC); if (hasMethodInfoAnno && isStatic) { util.error("Method " + mdesc + " for Class " + currentClass.name + " is a static method, but must not be"); } // TF Annotations are not permitted on constructors if (mname.equals("<init>")) { if (hasMethodInfoAnno) { util.error("Constructors must not have an " + "@InfoMethod annotations"); } else if (monitoredMethodMMAnno != null) { util.error("Constructors must not have an " + "MM annotation"); } } // This will be a null value for InfoMethods, which is what // we want. mmnToAnnotationName.put(mname, monitoredMethodMMAnno); // We could have a method at this point that is annotated with // something OTHER than tracing annotations. Do not add // such methods to the ECD. if (hasMethodInfoAnno || (monitoredMethodMMAnno != null)) { // Both infoMethods and MM annotated methods go into // methodNames methodNames.add(mname); mmnToDescriptions.put(mname, description); mmnToTPT.put(mname, tpt); mmnToTPN.put(mname, tpName); if (hasMethodInfoAnno) { infoMethodDescs.add(mdesc); } else { mmMethodDescs.add(mdesc); methodToAnno.put(mdesc, monitoredMethodMMAnno); } } } } Collections.sort(methodNames); for (String str : methodNames) { methodDescriptions.add(mmnToDescriptions.get(str)); methodTPTs.add(mmnToTPT.get(str)); methodAnnoList.add(mmnToAnnotationName.get(str)); methodTPNames.add(mmnToTPN.get(str)); } if (util.getDebug()) { util.msg("\tinfoMethodDescs = " + infoMethodDescs); util.msg("\tmmMethodDescs = " + mmMethodDescs); util.msg("\tmethodNames = " + methodNames); util.msg("\tmethodToAnno = " + methodToAnno); util.msg("\tmethodDescriptions = " + methodDescriptions); util.msg("\tmethodTPTs = " + methodTPTs); util.msg("\tmethodTPNs = " + methodTPNames); } }
From source file:org.glassfish.pfl.tf.tools.enhancer.ClassEnhancer.java
License:Open Source License
@Override public void visitEnd() { info(2, "visitEnd"); // Add the additional fields final String desc = Type.getDescriptor(SynchronizedHolder.class); final int acc = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC; // Signature is actually L../SynchronizedHolder;<L.../MethodMonitor;> // where the ... are replaced with appropriate packages. Not // that we actually need a signature here. final String sig = null; for (String fname : ecd.getAnnotationToHolderName().values()) { info(2, "Adding field " + fname + " of type " + desc); cv.visitField(acc, fname, desc, sig, null); }/* w w w . j a v a 2s . co m*/ if (!hasStaticInitializer) { info(2, "creating static init"); int siacc = Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE; MethodVisitor mv = cv.visitMethod(siacc, "<clinit>", "()V", null, null); if (util.getDebug()) { mv = new SimpleMethodTracer(mv, util); } MethodAdapter ma = new StaticInitVisitor(siacc, "()V", mv, util, ecd); ma.visitCode(); ma.visitInsn(Opcodes.RETURN); // Only if creating a <clinit>! ma.visitMaxs(0, 0); ma.visitEnd(); } super.visitEnd(); ecd.updateInfoDesc(); }
From source file:org.gradle.api.internal.tasks.compile.incremental.analyzer.ClassDependenciesVisitor.java
License:Apache License
private static boolean isPrivate(int access) { return (access & Opcodes.ACC_PRIVATE) != 0; }