@SuppressWarnings("unchecked") static Type from(IJavaType type) { if (type == IPrimitiveType.BOOLEAN) { return PrimitiveType.BOOLEAN; } else if (type == IPrimitiveType.BYTE) { return PrimitiveType.BYTE; } else if (type == IPrimitiveType.CHAR) { return PrimitiveType.CHAR; } else if (type == IPrimitiveType.DOUBLE) { return PrimitiveType.DOUBLE; } else if (type == IPrimitiveType.FLOAT) { return PrimitiveType.FLOAT; } else if (type == IPrimitiveType.INT) { return PrimitiveType.INT; } else if (type == IPrimitiveType.LONG) { return PrimitiveType.LONG; } else if (type == IPrimitiveType.SHORT) { return PrimitiveType.SHORT; } else if (type == IVoidType.DEFAULT) { return Type.create(null, Kind.VOID); } else if (type instanceof TypeWrapper) { return ((TypeWrapper<Type>)type).getType(); } throw new IllegalArgumentException("Not a Jandex wrapped typed!"); }
private static Type getType(Class clazz) { return Type.create( DotName.createSimple( clazz.getName() ), getTypeKind( clazz ) ); }
private static Type getType(Class clazz) { return Type.create( DotName.createSimple( clazz.getName() ), getTypeKind( clazz ) ); }
private Type readType(PackedDataInputStream stream) throws IOException { Type.Kind kind = Type.Kind.fromOrdinal(stream.readByte()); DotName name = classTable[stream.readPackedU32()]; return Type.create(name, kind); }
/** * @param i * @return * @throws SerianalyzerException */ static String makeSignature ( MethodInfo i, boolean fix ) throws SerianalyzerException { StringBuilder sb = new StringBuilder(); sb.append('('); ClassInfo declaringImpl = i.declaringClass(); if ( fix && "<init>".equals(i.name()) && declaringImpl.nestingType() == NestingType.INNER ) { //$NON-NLS-1$ // there seems to be some sort of bug, missing the the outer instance parameter in the constructor if ( !Modifier.isStatic(declaringImpl.flags()) ) { org.jboss.jandex.Type enclosingClass = org.jboss.jandex.Type.create(declaringImpl.enclosingClass(), Kind.CLASS); org.jboss.jandex.Type firstArg = i.parameters().size() > 0 ? i.parameters().get(0) : null; if ( firstArg instanceof TypeVariable ) { firstArg = firstArg.asTypeVariable().bounds().get(0); } if ( firstArg == null || !firstArg.equals(enclosingClass) ) { sb.append(toString(enclosingClass)); } } } for ( org.jboss.jandex.Type p : i.parameters() ) { sb.append(toString(p)); } sb.append(')'); sb.append(toString(i.returnType())); return sb.toString(); }