Java Code Examples for jdk.internal.org.objectweb.asm.TypeReference#INSTANCEOF
The following examples show how to use
jdk.internal.org.objectweb.asm.TypeReference#INSTANCEOF .
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: CheckMethodAdapter.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 2
Source File: CheckMethodAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 3
Source File: CheckMethodAdapter.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitInsnAnnotation(typeRef, typePath, descriptor, visible)); }
Example 4
Source File: CheckMethodAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 5
Source File: CheckMethodAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 6
Source File: CheckMethodAdapter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 7
Source File: CheckMethodAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 8
Source File: CheckMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public AnnotationVisitor visitInsnAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkStartCode(); checkEndCode(); int sort = typeRef >>> 24; if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW && sort != TypeReference.CONSTRUCTOR_REFERENCE && sort != TypeReference.METHOD_REFERENCE && sort != TypeReference.CAST && sort != TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT && sort != TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT && sort != TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitInsnAnnotation(typeRef, typePath, desc, visible)); }
Example 9
Source File: Textifier.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }
Example 10
Source File: CheckClassAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 11
Source File: Textifier.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }
Example 12
Source File: Textifier.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }
Example 13
Source File: CheckClassAdapter.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 14
Source File: CheckClassAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 15
Source File: CheckClassAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 16
Source File: Textifier.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }
Example 17
Source File: CheckClassAdapter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 18
Source File: CheckClassAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Checks the reference to a type in a type annotation. * * @param typeRef * a reference to an annotated type. * @param typePath * the path to the annotated type argument, wildcard bound, array * element type, or static inner type within 'typeRef'. May be * <tt>null</tt> if the annotation targets 'typeRef' as a whole. */ static void checkTypeRefAndPath(int typeRef, TypePath typePath) { int mask = 0; switch (typeRef >>> 24) { case TypeReference.CLASS_TYPE_PARAMETER: case TypeReference.METHOD_TYPE_PARAMETER: case TypeReference.METHOD_FORMAL_PARAMETER: mask = 0xFFFF0000; break; case TypeReference.FIELD: case TypeReference.METHOD_RETURN: case TypeReference.METHOD_RECEIVER: case TypeReference.LOCAL_VARIABLE: case TypeReference.RESOURCE_VARIABLE: case TypeReference.INSTANCEOF: case TypeReference.NEW: case TypeReference.CONSTRUCTOR_REFERENCE: case TypeReference.METHOD_REFERENCE: mask = 0xFF000000; break; case TypeReference.CLASS_EXTENDS: case TypeReference.CLASS_TYPE_PARAMETER_BOUND: case TypeReference.METHOD_TYPE_PARAMETER_BOUND: case TypeReference.THROWS: case TypeReference.EXCEPTION_PARAMETER: mask = 0xFFFFFF00; break; case TypeReference.CAST: case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: mask = 0xFF0000FF; break; default: throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(typeRef >>> 24)); } if ((typeRef & ~mask) != 0) { throw new IllegalArgumentException("Invalid type reference 0x" + Integer.toHexString(typeRef)); } if (typePath != null) { for (int i = 0; i < typePath.getLength(); ++i) { int step = typePath.getStep(i); if (step != TypePath.ARRAY_ELEMENT && step != TypePath.INNER_TYPE && step != TypePath.TYPE_ARGUMENT && step != TypePath.WILDCARD_BOUND) { throw new IllegalArgumentException( "Invalid type path step " + i + " in " + typePath); } if (step != TypePath.TYPE_ARGUMENT && typePath.getStepArgument(i) != 0) { throw new IllegalArgumentException( "Invalid type path step argument for step " + i + " in " + typePath); } } } }
Example 19
Source File: Textifier.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }
Example 20
Source File: Textifier.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void appendTypeReference(final int typeRef) { TypeReference ref = new TypeReference(typeRef); switch (ref.getSort()) { case TypeReference.CLASS_TYPE_PARAMETER: buf.append("CLASS_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER: buf.append("METHOD_TYPE_PARAMETER ").append( ref.getTypeParameterIndex()); break; case TypeReference.CLASS_EXTENDS: buf.append("CLASS_EXTENDS ").append(ref.getSuperTypeIndex()); break; case TypeReference.CLASS_TYPE_PARAMETER_BOUND: buf.append("CLASS_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.METHOD_TYPE_PARAMETER_BOUND: buf.append("METHOD_TYPE_PARAMETER_BOUND ") .append(ref.getTypeParameterIndex()).append(", ") .append(ref.getTypeParameterBoundIndex()); break; case TypeReference.FIELD: buf.append("FIELD"); break; case TypeReference.METHOD_RETURN: buf.append("METHOD_RETURN"); break; case TypeReference.METHOD_RECEIVER: buf.append("METHOD_RECEIVER"); break; case TypeReference.METHOD_FORMAL_PARAMETER: buf.append("METHOD_FORMAL_PARAMETER ").append( ref.getFormalParameterIndex()); break; case TypeReference.THROWS: buf.append("THROWS ").append(ref.getExceptionIndex()); break; case TypeReference.LOCAL_VARIABLE: buf.append("LOCAL_VARIABLE"); break; case TypeReference.RESOURCE_VARIABLE: buf.append("RESOURCE_VARIABLE"); break; case TypeReference.EXCEPTION_PARAMETER: buf.append("EXCEPTION_PARAMETER ").append( ref.getTryCatchBlockIndex()); break; case TypeReference.INSTANCEOF: buf.append("INSTANCEOF"); break; case TypeReference.NEW: buf.append("NEW"); break; case TypeReference.CONSTRUCTOR_REFERENCE: buf.append("CONSTRUCTOR_REFERENCE"); break; case TypeReference.METHOD_REFERENCE: buf.append("METHOD_REFERENCE"); break; case TypeReference.CAST: buf.append("CAST ").append(ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT: buf.append("METHOD_INVOCATION_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: buf.append("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; case TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT: buf.append("METHOD_REFERENCE_TYPE_ARGUMENT ").append( ref.getTypeArgumentIndex()); break; } }