com.sun.tools.classfile.Descriptor Java Examples
The following examples show how to use
com.sun.tools.classfile.Descriptor.
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: CheckACC_STRICTFlagOnclinitTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #2
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #3
Source File: CheckACC_STRICTFlagOnclinitTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #4
Source File: CheckACC_STRICTFlagOnclinitTest.java From hottub with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #5
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #6
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From hottub with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #7
Source File: CheckACC_STRICTFlagOnclinitTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #8
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #9
Source File: CheckACC_STRICTFlagOnclinitTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #10
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #11
Source File: CheckACC_STRICTFlagOnclinitTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #12
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #13
Source File: CheckACC_STRICTFlagOnclinitTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #14
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #15
Source File: CheckACC_STRICTFlagOnDefaultMethodTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #16
Source File: CheckACC_STRICTFlagOnclinitTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
void check(String dir, String... fileNames) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { for (String fileName : fileNames) { ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName)); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } } }
Example #17
Source File: CheckACC_STRICTFlagOnPkgAccessClassTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void check() throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { ClassFile classFileToCheck = ClassFile.read(new File("Test.class")); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } }
Example #18
Source File: ClassWriter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
String getValue(Descriptor d) { try { return d.getValue(constant_pool); } catch (ConstantPoolException e) { return report(e); } }
Example #19
Source File: CheckACC_STRICTFlagOnPkgAccessClassTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void check() throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { ClassFile classFileToCheck = ClassFile.read(new File("Test.class")); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } }
Example #20
Source File: AnnotationWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void writeDescriptor(int index, boolean resolveIndices) { if (resolveIndices) { try { ConstantPool constant_pool = classWriter.getClassFile().constant_pool; Descriptor d = new Descriptor(index); print(d.getFieldType(constant_pool)); return; } catch (ConstantPoolException | InvalidDescriptor ignore) { } } print("#" + index); }
Example #21
Source File: DetectMutableStaticFields.java From hottub with GNU General Public License v2.0 | 5 votes |
void analyzeClassFile(ClassFile classFileToCheck) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { boolean enumClass = (classFileToCheck.access_flags.flags & ACC_ENUM) != 0; boolean nonFinalStaticEnumField; boolean nonFinalStaticField; currentFieldsToIgnore = classFieldsToIgnoreMap.get(classFileToCheck.getName()); for (Field field : classFileToCheck.fields) { if (ignoreField(field.getName(classFileToCheck.constant_pool))) { continue; } nonFinalStaticEnumField = (field.access_flags.flags & (ACC_ENUM | ACC_FINAL)) == 0; nonFinalStaticField = (field.access_flags.flags & ACC_STATIC) != 0 && (field.access_flags.flags & ACC_FINAL) == 0; if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) { errors.add("There is a mutable field named " + field.getName(classFileToCheck.constant_pool) + ", at class " + classFileToCheck.getName()); } } }
Example #22
Source File: DetectMutableStaticFields.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void analyzeClassFile(ClassFile classFileToCheck) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { boolean enumClass = (classFileToCheck.access_flags.flags & ACC_ENUM) != 0; boolean nonFinalStaticEnumField; boolean nonFinalStaticField; currentFieldsToIgnore = classFieldsToIgnoreMap.get(classFileToCheck.getName()); for (Field field : classFileToCheck.fields) { if (ignoreField(field.getName(classFileToCheck.constant_pool))) { continue; } nonFinalStaticEnumField = (field.access_flags.flags & (ACC_ENUM | ACC_FINAL)) == 0; nonFinalStaticField = (field.access_flags.flags & ACC_STATIC) != 0 && (field.access_flags.flags & ACC_FINAL) == 0; if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) { errors.add("There is a mutable field named " + field.getName(classFileToCheck.constant_pool) + ", at class " + classFileToCheck.getName()); } } }
Example #23
Source File: CheckACC_STRICTFlagOnPkgAccessClassTest.java From hottub with GNU General Public License v2.0 | 5 votes |
void check() throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { ClassFile classFileToCheck = ClassFile.read(new File("Test.class")); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } }
Example #24
Source File: ClassWriter.java From hottub with GNU General Public License v2.0 | 5 votes |
String getValue(Descriptor d) { try { return d.getValue(constant_pool); } catch (ConstantPoolException e) { return report(e); } }
Example #25
Source File: ClassWriter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
String getValue(Descriptor d) { try { return d.getValue(constant_pool); } catch (ConstantPoolException e) { return report(e); } }
Example #26
Source File: TestBCI.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
MethodInfo(ClassFile cf, Method m) { this.method = m; String name; String paramTypes; String returnType; LineNumberTable_attribute.Entry[] lineNumberTable; try { // method name name = m.getName(cf.constant_pool); // signature paramTypes = m.descriptor.getParameterTypes(cf.constant_pool); returnType = m.descriptor.getReturnType(cf.constant_pool); Code_attribute codeAttr = (Code_attribute) m.attributes.get(Attribute.Code); lineNumberTable = ((LineNumberTable_attribute) codeAttr.attributes.get(Attribute.LineNumberTable)).line_number_table; } catch (ConstantPoolException|Descriptor.InvalidDescriptor e) { throw new RuntimeException(e); } this.name = name; this.paramTypes = paramTypes; this.returnType = returnType; Arrays.stream(lineNumberTable).forEach(entry -> bciToLineNumbers.computeIfAbsent(entry.start_pc, _n -> new TreeSet<>()) .add(entry.line_number)); }
Example #27
Source File: DetectMutableStaticFields.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void analyzeClassFile(ClassFile classFileToCheck) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { boolean enumClass = (classFileToCheck.access_flags.flags & ACC_ENUM) != 0; boolean nonFinalStaticEnumField; boolean nonFinalStaticField; currentFieldsToIgnore = classFieldsToIgnoreMap.get(classFileToCheck.getName()); for (Field field : classFileToCheck.fields) { if (ignoreField(field.getName(classFileToCheck.constant_pool))) { continue; } nonFinalStaticEnumField = (field.access_flags.flags & (ACC_ENUM | ACC_FINAL)) == 0; nonFinalStaticField = (field.access_flags.flags & ACC_STATIC) != 0 && (field.access_flags.flags & ACC_FINAL) == 0; if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) { errors.add("There is a mutable field named " + field.getName(classFileToCheck.constant_pool) + ", at class " + classFileToCheck.getName()); } } }
Example #28
Source File: ClassWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
String getValue(Descriptor d) { try { return d.getValue(constant_pool); } catch (ConstantPoolException e) { return report(e); } }
Example #29
Source File: CheckACC_STRICTFlagOnPkgAccessClassTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void check() throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { ClassFile classFileToCheck = ClassFile.read(new File("Test.class")); for (Method method : classFileToCheck.methods) { if ((method.access_flags.flags & ACC_STRICT) == 0) { errors.add(String.format(offendingMethodErrorMessage, method.getName(classFileToCheck.constant_pool), classFileToCheck.getName())); } } }
Example #30
Source File: DetectMutableStaticFields.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void analyzeClassFile(ClassFile classFileToCheck) throws IOException, ConstantPoolException, Descriptor.InvalidDescriptor { boolean enumClass = (classFileToCheck.access_flags.flags & ACC_ENUM) != 0; boolean nonFinalStaticEnumField; boolean nonFinalStaticField; currentFieldsToIgnore = classFieldsToIgnoreMap.get(classFileToCheck.getName()); for (Field field : classFileToCheck.fields) { if (ignoreField(field.getName(classFileToCheck.constant_pool))) { continue; } nonFinalStaticEnumField = (field.access_flags.flags & (ACC_ENUM | ACC_FINAL)) == 0; nonFinalStaticField = (field.access_flags.flags & ACC_STATIC) != 0 && (field.access_flags.flags & ACC_FINAL) == 0; if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) { errors.add("There is a mutable field named " + field.getName(classFileToCheck.constant_pool) + ", at class " + classFileToCheck.getName()); } } }