java.lang.reflect.GenericSignatureFormatError Java Examples
The following examples show how to use
java.lang.reflect.GenericSignatureFormatError.
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: GenericSignatureParser.java From j2objc with Apache License 2.0 | 6 votes |
Type parseFieldTypeSignature() { // FieldTypeSignature ::= ClassTypeSignature | ArrayTypeSignature // | TypeVariableSignature. switch (symbol) { case 'L': return parseClassTypeSignature(); case '[': // ArrayTypeSignature ::= "[" TypSignature. scanSymbol(); return new GenericArrayTypeImpl(parseTypeSignature()); case 'T': return parseTypeVariableSignature(); default: throw new GenericSignatureFormatError(); } }
Example #2
Source File: MethodDescription.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public String getGenericSignature() { try { SignatureWriter signatureWriter = new SignatureWriter(); boolean generic = false; for (TypeDescription.Generic typeVariable : getTypeVariables()) { signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol()); boolean classBound = true; for (TypeDescription.Generic upperBound : typeVariable.getUpperBounds()) { upperBound.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(classBound ? signatureWriter.visitClassBound() : signatureWriter.visitInterfaceBound())); classBound = false; } generic = true; } for (TypeDescription.Generic parameterType : getParameters().asTypeList()) { parameterType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitParameterType())); generic = generic || !parameterType.getSort().isNonGeneric(); } TypeDescription.Generic returnType = getReturnType(); returnType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitReturnType())); generic = generic || !returnType.getSort().isNonGeneric(); TypeList.Generic exceptionTypes = getExceptionTypes(); if (!exceptionTypes.filter(not(ofSort(TypeDefinition.Sort.NON_GENERIC))).isEmpty()) { for (TypeDescription.Generic exceptionType : exceptionTypes) { exceptionType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitExceptionType())); generic = generic || !exceptionType.getSort().isNonGeneric(); } } return generic ? signatureWriter.toString() : NON_GENERIC_SIGNATURE; } catch (GenericSignatureFormatError ignored) { return NON_GENERIC_SIGNATURE; } }
Example #3
Source File: FieldDescription.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public String getGenericSignature() { TypeDescription.Generic fieldType = getType(); try { return fieldType.getSort().isNonGeneric() ? NON_GENERIC_SIGNATURE : fieldType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(new SignatureWriter())).toString(); } catch (GenericSignatureFormatError ignored) { return NON_GENERIC_SIGNATURE; } }
Example #4
Source File: GenericSignatureParser.java From j2objc with Apache License 2.0 | 5 votes |
void scanIdentifier() { if (!eof) { StringBuilder identBuf = new StringBuilder(32); if (!isStopSymbol(symbol)) { identBuf.append(symbol); do { char ch = buffer[pos]; if ((ch >= 'a') && (ch <= 'z') || (ch >= 'A') && (ch <= 'Z') || !isStopSymbol(ch)) { identBuf.append(ch); pos++; } else { identifier = identBuf.toString(); scanSymbol(); return; } } while (pos != buffer.length); identifier = identBuf.toString(); symbol = 0; eof = true; } else { // Ident starts with incorrect char. symbol = 0; eof = true; throw new GenericSignatureFormatError(); } } else { throw new GenericSignatureFormatError(); } }
Example #5
Source File: GenericSignatureParser.java From j2objc with Apache License 2.0 | 5 votes |
void expect(char c) { if (symbol == c) { scanSymbol(); } else { throw new GenericSignatureFormatError(); } }
Example #6
Source File: GenericSignatureParser.java From j2objc with Apache License 2.0 | 5 votes |
void scanSymbol() { if (!eof) { if (pos < buffer.length) { symbol = buffer[pos]; pos++; } else { symbol = 0; eof = true; } } else { throw new GenericSignatureFormatError(); } }
Example #7
Source File: TestGenerics.java From yGuard with MIT License | 5 votes |
public void run(){ new GenericSignatureFormatError(); ParameterizedType<MyStringType> pt = new ParameterizedType<MyStringType>(); pt.add(new MyStringType()); pt.add(new MyStringType(){}); for (MyType myType : pt.getList()){ System.out.println(); System.out.println("myType " + myType); System.out.println("Enclosed by " + myType.getClass().getEnclosingMethod()); System.out.println("Enclosed by " + myType.getClass().getEnclosingClass().getName()); } // Field[] fields = this.getClass().getDeclaredFields(); for (Field field : this.getClass().getDeclaredFields()){ System.out.println(); for (Annotation a : field.getAnnotations()){ System.out.println(a); } System.out.println(field); System.out.println("generic type " + field.getGenericType()); } for (TypeVariable tv : pt.getClass().getTypeParameters()){ System.out.println(); System.out.println(tv); for (Type t : tv.getBounds()){ System.out.println("bounds " + t); } } }
Example #8
Source File: SignatureParser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #9
Source File: AbstractTypeDescriptionTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test(expected = GenericSignatureFormatError.class) public void testMalformedMethodSignature() throws Exception { TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class)); assertThat(typeDescription.getDeclaredMethods().filter(isMethod()).size(), is(1)); typeDescription.getDeclaredMethods().filter(isMethod()).getOnly().getReturnType().getSort(); }
Example #10
Source File: AbstractTypeDescriptionTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test(expected = GenericSignatureFormatError.class) public void testMalformedFieldSignature() throws Exception { TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class)); assertThat(typeDescription.getDeclaredFields().size(), is(1)); typeDescription.getDeclaredFields().getOnly().getType().getSort(); }
Example #11
Source File: AbstractTypeDescriptionTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test(expected = GenericSignatureFormatError.class) public void testMalformedTypeSignature() throws Exception { TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class)); assertThat(typeDescription.getInterfaces().size(), is(1)); typeDescription.getInterfaces().getOnly().getSort(); }
Example #12
Source File: SignatureParser.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #13
Source File: SignatureParser.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #14
Source File: SignatureParser.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #15
Source File: SignatureParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #16
Source File: SignatureParser.java From hottub with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #17
Source File: SignatureParser.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #18
Source File: SignatureParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #19
Source File: SignatureParser.java From Bytecoder with Apache License 2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #20
Source File: SignatureParser.java From javaide with GNU General Public License v3.0 | 4 votes |
private Error error(String errorMsg) { if (DEBUG) System.out.println("Parse error:" + errorMsg); return new GenericSignatureFormatError(); }
Example #21
Source File: SignatureParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #22
Source File: SignatureParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #23
Source File: SignatureParser.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
private Error error(String errorMsg) { if (DEBUG) System.out.println("Parse error:" + errorMsg); return new GenericSignatureFormatError(); }
Example #24
Source File: SignatureParser.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #25
Source File: SignatureParser.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }
Example #26
Source File: SignatureParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private Error error(String errorMsg) { return new GenericSignatureFormatError("Signature Parse error: " + errorMsg + "\n\tRemaining input: " + remainder()); }