Java Code Examples for org.objectweb.asm.ClassReader#getAccess()
The following examples show how to use
org.objectweb.asm.ClassReader#getAccess() .
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: ASMReflector.java From meghanada-server with GNU General Public License v3.0 | 5 votes |
private static void readClassIndex( Map<ClassIndex, File> indexes, InputStream in, File file, boolean allowSuper) throws IOException { ClassReader classReader = new ClassReader(in); String className = ClassNameUtils.replaceSlash(classReader.getClassName()); boolean projectOutput = file.isDirectory(); int access = classReader.getAccess(); boolean isPublic = (Opcodes.ACC_PUBLIC & access) == Opcodes.ACC_PUBLIC; boolean isProtected = (Opcodes.ACC_PROTECTED & access) == Opcodes.ACC_PROTECTED; boolean isInterface = (Opcodes.ACC_INTERFACE & access) == Opcodes.ACC_INTERFACE; boolean isAnnotation = (Opcodes.ACC_ANNOTATION & access) == Opcodes.ACC_ANNOTATION; boolean isSuper = false; if (allowSuper) { isSuper = (Opcodes.ACC_SUPER & access) == Opcodes.ACC_SUPER; } if (projectOutput || (isPublic || isProtected || isSuper)) { String pkg = ClassNameUtils.getPackage(className); boolean onlyClassName = !preloadClassPackages.contains(pkg); ClassAnalyzeVisitor classAnalyzeVisitor = new ClassAnalyzeVisitor(className, onlyClassName, false); classReader.accept(classAnalyzeVisitor, 0); ClassIndex classIndex = classAnalyzeVisitor.getClassIndex(); if (!classIndex.isAnonymous) { classIndex.setInterface(isInterface); classIndex.setAnnotation(isAnnotation); indexes.put(classIndex, file); if (!onlyClassName) { innerCache.putIfAbsent(className, classAnalyzeVisitor.getMembers()); } } } }
Example 2
Source File: InternalUtils.java From coroutines with GNU Lesser General Public License v3.0 | 5 votes |
static ClassInformation getClassInformation(final InputStream is) throws IOException { ClassReader classReader = new ClassReader(is); String name = classReader.getClassName(); String superName = classReader.getSuperName(); String[] interfaces = classReader.getInterfaces(); boolean interfaceMarker = (classReader.getAccess() & Opcodes.ACC_INTERFACE) != 0; return new ClassInformation(name, superName, Arrays.asList(interfaces), interfaceMarker); }
Example 3
Source File: ClassHierarchy.java From tascalate-javaflow with Apache License 2.0 | 5 votes |
/** * Returns a ClassReader corresponding to the given class or interface. * * @param type * the internal name of a class or interface. * @return the ClassReader corresponding to 'type'. * @throws IOException * if the bytecode of 'type' cannot be loaded. */ private TypeInfo loadTypeInfo(String type) throws IOException { InputStream is = loader.getResourceAsStream(type + ".class"); try { ClassReader info = new ClassReader(is); return new TypeInfo(info.getClassName(), info.getSuperName(), info.getInterfaces(), (info.getAccess() & Opcodes.ACC_INTERFACE) != 0); } finally { is.close(); } }
Example 4
Source File: ClassHierarchy.java From tascalate-javaflow with Apache License 2.0 | 5 votes |
/** * Returns a ClassReader corresponding to the given class or interface. * * @param type * the internal name of a class or interface. * @return the ClassReader corresponding to 'type'. * @throws IOException * if the bytecode of 'type' cannot be loaded. */ private TypeInfo loadTypeInfo(String type) throws IOException { InputStream is = loader.getResourceAsStream(type + ".class"); try { ClassReader info = new ClassReader(is); return new TypeInfo(info.getClassName(), info.getSuperName(), info.getInterfaces(), (info.getAccess() & Opcodes.ACC_INTERFACE) != 0); } finally { is.close(); } }
Example 5
Source File: ClassHierarchy.java From tascalate-javaflow with Apache License 2.0 | 5 votes |
/** * Returns a ClassReader corresponding to the given class or interface. * * @param type * the internal name of a class or interface. * @return the ClassReader corresponding to 'type'. * @throws IOException * if the bytecode of 'type' cannot be loaded. */ private TypeInfo loadTypeInfo(String type) throws IOException { InputStream is = loader.getResourceAsStream(type + ".class"); try { ClassReader info = new ClassReader(is); return new TypeInfo(info.getClassName(), info.getSuperName(), info.getInterfaces(), (info.getAccess() & Opcodes.ACC_INTERFACE) != 0); } finally { is.close(); } }
Example 6
Source File: ClassInfo.java From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ClassInfo(ClassReader cr) { this.reader = cr; this.access = cr.getAccess(); this.type = Type.getObjectType(cr.getClassName()); }
Example 7
Source File: SafeClassWriter.java From JQF with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String getCommonSuperClass(final String type1, final String type2) { try { ClassReader info1 = typeInfo(type1); ClassReader info2 = typeInfo(type2); if ((info1.getAccess() & Opcodes.ACC_INTERFACE) != 0) { if (typeImplements(type2, info2, type1)) { return type1; } else { return "java/lang/Object"; } } if ((info2.getAccess() & Opcodes.ACC_INTERFACE) != 0) { if (typeImplements(type1, info1, type2)) { return type2; } else { return "java/lang/Object"; } } StringBuilder b1 = typeAncestors(type1, info1); StringBuilder b2 = typeAncestors(type2, info2); String result = "java/lang/Object"; int end1 = b1.length(); int end2 = b2.length(); while (true) { int start1 = b1.lastIndexOf(";", end1 - 1); int start2 = b2.lastIndexOf(";", end2 - 1); if (start1 != -1 && start2 != -1 && end1 - start1 == end2 - start2) { String p1 = b1.substring(start1 + 1, end1); String p2 = b2.substring(start2 + 1, end2); if (p1.equals(p2)) { result = p1; end1 = start1; end2 = start2; } else { return result; } } else { return result; } } } catch (IOException e) { throw new RuntimeException(e.toString()); } }
Example 8
Source File: ComputeClassWriter.java From tascalate-async-await with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String getCommonSuperClass(final String type1, final String type2) { try { ClassReader info1 = typeInfo(type1); ClassReader info2 = typeInfo(type2); if ((info1.getAccess() & Opcodes.ACC_INTERFACE) != 0) { if (typeImplements(type2, info2, type1)) { return type1; } if ((info2.getAccess() & Opcodes.ACC_INTERFACE) != 0) { if (typeImplements(type1, info1, type2)) { return type2; } } return "java/lang/Object"; } if ((info2.getAccess() & Opcodes.ACC_INTERFACE) != 0) { if (typeImplements(type1, info1, type2)) { return type2; } else { return "java/lang/Object"; } } StringBuilder b1 = typeAncestors(type1, info1); StringBuilder b2 = typeAncestors(type2, info2); String result = "java/lang/Object"; int end1 = b1.length(); int end2 = b2.length(); while (true) { int start1 = b1.lastIndexOf(";", end1 - 1); int start2 = b2.lastIndexOf(";", end2 - 1); if (start1 != -1 && start2 != -1 && end1 - start1 == end2 - start2) { String p1 = b1.substring(start1 + 1, end1); String p2 = b2.substring(start2 + 1, end2); if (p1.equals(p2)) { result = p1; end1 = start1; end2 = start2; } else { return result; } } else { return result; } } } catch (IOException e) { throw new RuntimeException(e.toString()); } }
Example 9
Source File: ComputeClassWriter.java From QuickTheories with Apache License 2.0 | 4 votes |
private static boolean isInterface(final ClassReader info1) { return (info1.getAccess() & Opcodes.ACC_INTERFACE) != 0; }
Example 10
Source File: ComputeClassWriter.java From pitest with Apache License 2.0 | 4 votes |
private static boolean isInterface(final ClassReader info1) { return (info1.getAccess() & Opcodes.ACC_INTERFACE) != 0; }
Example 11
Source File: ASMClassWriter.java From pinpoint with Apache License 2.0 | 4 votes |
private boolean isInterface(final ClassReader classReader) { return (classReader.getAccess() & Opcodes.ACC_INTERFACE) != 0; }