List of usage examples for org.objectweb.asm Opcodes ACC_PROTECTED
int ACC_PROTECTED
To view the source code for org.objectweb.asm Opcodes ACC_PROTECTED.
Click Source Link
From source file:org.summer.aop.PointcutExpressionParser.java
License:Open Source License
private static boolean matchVisibility(int access, String visibility) { if (visibility == null || "*".equals(visibility)) return true; // visibility is optional; the asterisk has the same effect as omitting the visibility switch (access) { case Opcodes.ACC_PUBLIC: return visibility.equals("public"); case Opcodes.ACC_PROTECTED: return visibility.equals("protected"); case Opcodes.ACC_PRIVATE: return visibility.equals("private"); case 0x0000:/*from ww w. j ava 2s . c om*/ return visibility.equals("package-private"); } return false; }
From source file:org.summer.aop.PointcutExpressionParser.java
License:Open Source License
private static boolean matchModifiersPattern(int access, String modifier1, String modifier2, String modifier3) { if (modifier1 == null && modifier2 == null && modifier3 == null) return true; // modifiers-pattern is optional if ("*".equals(modifier1)) modifier1 = null;//from w w w .ja va2s . com switch (access) { case Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("public")) && "static".equals(modifier2) && "final".equals(modifier3); case Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("protected")) && "static".equals(modifier2) && "final".equals(modifier3); case Opcodes.ACC_STATIC + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("package-private")) && "static".equals(modifier2) && "final".equals(modifier3); case Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("private")) && "static".equals(modifier2) && "final".equals(modifier3); case Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC: return (modifier1 == null || modifier1.equals("public")) && "static".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC: return (modifier1 == null || modifier1.equals("protected")) && "static".equals(modifier2) && modifier3 == null; case Opcodes.ACC_STATIC: return (modifier1 == null || modifier1.equals("package-private")) && "static".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC: return (modifier1 == null || modifier1.equals("private")) && "static".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("public")) && "final".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("protected")) && "final".equals(modifier2) && modifier3 == null; case Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("package-private")) && "final".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL: return (modifier1 == null || modifier1.equals("private")) && "final".equals(modifier2) && modifier3 == null; case Opcodes.ACC_PUBLIC: return (modifier1 == null || modifier1.equals("public")) && modifier2 == null && modifier3 == null; case Opcodes.ACC_PROTECTED: return (modifier1 == null || modifier1.equals("protected")) && modifier2 == null && modifier3 == null; case 0x0000: return (modifier1 == null || modifier1.equals("package-private")) && modifier2 == null && modifier3 == null; case Opcodes.ACC_PRIVATE: return (modifier1 == null || modifier1.equals("private")) && modifier2 == null && modifier3 == null; } return false; }
From source file:org.teavm.classlib.impl.report.JCLComparisonVisitor.java
License:Apache License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {//from w w w. j a va 2 s.co m if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) { jclClass = null; classReader = null; return; } String javaName = name.replace('/', '.'); int dotIndex = javaName.lastIndexOf('.'); String packageName = javaName.substring(0, dotIndex); String simpleName = javaName.substring(dotIndex + 1); jclPackage = packageMap.get(packageName); if (jclPackage == null) { jclPackage = new JCLPackage(packageName); jclPackage.status = JCLStatus.FOUND; packageMap.put(packageName, jclPackage); } classReader = classSource.get(javaName); jclClass = new JCLClass(simpleName); jclClass.status = classReader != null ? JCLStatus.FOUND : JCLStatus.MISSING; jclClass.visibility = (access & Opcodes.ACC_PROTECTED) != 0 ? JCLVisibility.PROTECTED : JCLVisibility.PUBLIC; if ((access & Opcodes.ACC_ANNOTATION) != 0) { jclClass.type = JCLClassType.ANNOTATION; } else if ((access & Opcodes.ACC_INTERFACE) != 0) { jclClass.type = JCLClassType.INTERFACE; } else if ((access & Opcodes.ACC_ENUM) != 0) { jclClass.type = JCLClassType.ENUM; } else { jclClass.type = JCLClassType.CLASS; } jclPackage.classes.add(jclClass); }
From source file:org.teavm.classlib.impl.report.JCLComparisonVisitor.java
License:Apache License
@Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { if (classReader == null || (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) { return null; }//from w ww .j a v a 2s .co m JCLItem item = new JCLItem(JCLItemType.FIELD, name + ":" + desc); FieldReader field = classReader.getField(name); item.status = field != null ? JCLStatus.FOUND : JCLStatus.MISSING; item.visibility = (access & Opcodes.ACC_PROTECTED) != 0 ? JCLVisibility.PROTECTED : JCLVisibility.PUBLIC; jclClass.items.add(item); if (item.status == JCLStatus.MISSING) { jclClass.status = JCLStatus.PARTIAL; } return null; }
From source file:org.teavm.classlib.impl.report.JCLComparisonVisitor.java
License:Apache License
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (classReader == null || (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) { return null; }//from w w w .ja v a2 s . c om JCLItem item = new JCLItem(JCLItemType.METHOD, name + desc); MethodReader method = findMethod(classReader, MethodDescriptor.parse(name + desc)); if (method == null) { item.status = JCLStatus.MISSING; } else { if ((access & Opcodes.ACC_ABSTRACT) == 0 && method.hasModifier(ElementModifier.ABSTRACT)) { item.status = JCLStatus.MISSING; } else { item.status = method.getOwnerName().equals(classReader.getName()) ? JCLStatus.FOUND : JCLStatus.PARTIAL; } } item.visibility = (access & Opcodes.ACC_PROTECTED) != 0 ? JCLVisibility.PROTECTED : JCLVisibility.PUBLIC; jclClass.items.add(item); if (item.status == JCLStatus.MISSING) { jclClass.status = JCLStatus.PARTIAL; } return null; }
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); }/* ww w. jav 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:org.wisdom.ipojo.module.WisdomModelVisitorTest.java
License:Apache License
@Test public void parseRegularModel() { Reporter reporter = new SystemReporter(); ComponentWorkbench workbench = mock(ComponentWorkbench.class); when(workbench.getType()).thenReturn(Type.getType(MyComponent.class)); when(workbench.getClassNode()).thenReturn(new ClassNode()); when(workbench.getElements()).thenReturn(elements); FieldNode node = new FieldNode(Opcodes.ACC_PROTECTED, "model", Type.getDescriptor(Crud.class), null, null); WisdomModelVisitor visitor = new WisdomModelVisitor(workbench, reporter, node); visitor.visit("value", "entity"); visitor.visitEnd();//from w w w . ja va 2 s . c om assertThat(elements).hasSize(1); Element element = elements.keySet().iterator().next(); assertThat(element.getName()).isEqualTo("requires"); assertThat(element.getAttribute("field")).isEqualTo("model"); assertThat(element.getAttribute("filter")).contains("=entity)"); }
From source file:org.wisdom.ipojo.module.WisdomModelVisitorTest.java
License:Apache License
@Test public void parseEmptyAnnotation() { Reporter reporter = new SystemReporter(); ComponentWorkbench workbench = mock(ComponentWorkbench.class); when(workbench.getType()).thenReturn(Type.getType(MyComponent.class)); when(workbench.getClassNode()).thenReturn(new ClassNode()); when(workbench.getElements()).thenReturn(elements); FieldNode node = new FieldNode(Opcodes.ACC_PROTECTED, "model", Type.getDescriptor(Crud.class), null, null); WisdomModelVisitor visitor = new WisdomModelVisitor(workbench, reporter, node); visitor.visitEnd();/* ww w.j a va2s. c o m*/ assertThat(elements).hasSize(0); }
From source file:org.wisdom.ipojo.module.WisdomModelVisitorTest.java
License:Apache License
@Test public void parseModelOnNotCrudField() { Reporter reporter = new SystemReporter(); ComponentWorkbench workbench = mock(ComponentWorkbench.class); when(workbench.getType()).thenReturn(Type.getType(MyComponent.class)); when(workbench.getClassNode()).thenReturn(new ClassNode()); when(workbench.getElements()).thenReturn(elements); FieldNode node = new FieldNode(Opcodes.ACC_PROTECTED, "model", Type.getDescriptor(String.class), null, null);// ww w . j a v a 2 s .c o m WisdomModelVisitor visitor = new WisdomModelVisitor(workbench, reporter, node); visitor.visit("value", "entity"); visitor.visitEnd(); assertThat(elements).hasSize(1); Element element = elements.keySet().iterator().next(); assertThat(element.getName()).isEqualTo("requires"); assertThat(element.getAttribute("field")).isEqualTo("model"); assertThat(element.getAttribute("filter")).contains("=entity)"); }
From source file:org.wisdom.ipojo.module.WisdomViewVisitorTest.java
License:Apache License
@Test public void parseRegularView() { Reporter reporter = new SystemReporter(); ComponentWorkbench workbench = mock(ComponentWorkbench.class); when(workbench.getType()).thenReturn(Type.getType(MyComponent.class)); when(workbench.getClassNode()).thenReturn(new ClassNode()); when(workbench.getElements()).thenReturn(elements); FieldNode node = new FieldNode(Opcodes.ACC_PROTECTED, "template", Type.getDescriptor(Template.class), null, null);// ww w .j a va2 s. c o m WisdomViewVisitor visitor = new WisdomViewVisitor(workbench, reporter, node); visitor.visit("value", "index"); visitor.visitEnd(); assertThat(elements).hasSize(1); Element element = elements.keySet().iterator().next(); assertThat(element.getName()).isEqualTo("requires"); assertThat(element.getAttribute("field")).isEqualTo("template"); assertThat(element.getAttribute("filter")).contains("(name=index)"); }