/** * Constructs a CannotCompileException with a * <code>NotFoundException</code>. */ public CannotCompileException(NotFoundException e) { this("cannot find " + e.getMessage(), e); }
public CompileError(NotFoundException e) { this("cannot find " + e.getMessage()); }
/** * Constructs a CannotCompileException with a * <code>NotFoundException</code>. */ public CannotCompileException(NotFoundException e) { this("cannot find " + e.getMessage(), e); }
public CompileError(NotFoundException e) { this("cannot find " + e.getMessage()); }
private Type resolveClassInfo(String info) throws BadBytecode { CtClass clazz = null; try { if (info.charAt(0) == '[') { clazz = Descriptor.toCtClass(info, classPool); } else { clazz = classPool.get(info); } } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + info); return Type.get(clazz); }
/** * Creates a new annotation. * If there already exists a class/interface with the same name, * the new interface overwrites that previous one. * * @param name a fully-qualified interface name. * Or null if the annotation has no super interface. * @throws RuntimeException if the existing interface is frozen. * @since 3.19 */ public CtClass makeAnnotation(String name) throws RuntimeException { try { CtClass cc = makeInterface(name, get("java.lang.annotation.Annotation")); cc.setModifiers(cc.getModifiers() | Modifier.ANNOTATION); return cc; } catch (NotFoundException e) { // should never happen. throw new RuntimeException(e.getMessage(), e); } }
private boolean alreadyEnhanced(CtClass managedCtClass) { try { for ( CtClass declaredInterface : managedCtClass.getInterfaces() ) { if ( PersistentAttributesHelper.isAssignable( declaredInterface, Managed.class.getName() ) ) { return true; } } return false; } catch ( NotFoundException e ) { throw new HibernateException( "Unable to transform class: " + e.getMessage() , e ); } }
private Type returnTypeFromDesc(String desc) throws BadBytecode { CtClass clazz = null; try { clazz = Descriptor.getReturnType(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain return type for descriptor [pos = " + lastPos + "]: " + desc); return Type.get(clazz); }
private Type typeFromDesc(String desc) throws BadBytecode { CtClass clazz = null; try { clazz = Descriptor.toCtClass(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + desc); return Type.get(clazz); }
/** * Creates a new annotation. * If there already exists a class/interface with the same name, * the new interface overwrites that previous one. * * @param name a fully-qualified interface name. * Or null if the annotation has no super interface. * @throws RuntimeException if the existing interface is frozen. * @since 3.19 */ public CtClass makeAnnotation(String name) throws RuntimeException { try { CtClass cc = makeInterface(name, get("java.lang.annotation.Annotation")); cc.setModifiers(cc.getModifiers() | Modifier.ANNOTATION); return cc; } catch (NotFoundException e) { // should never happen. throw new RuntimeException(e.getMessage(), e); } }
private Type resolveClassInfo(String info) throws BadBytecode { CtClass clazz = null; try { if (info.charAt(0) == '[') { clazz = Descriptor.toCtClass(info, classPool); } else { clazz = classPool.get(info); } } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + info); return Type.get(clazz); }
throw e; } catch (NotFoundException e) { throw new RuntimeException(e.getMessage(), e); } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e);
throw e; } catch (NotFoundException e) { throw new RuntimeException(e.getMessage(), e); } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e);
private Type[] paramTypesFromDesc(String desc) throws BadBytecode { CtClass classes[] = null; try { classes = Descriptor.getParameterTypes(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (classes == null) throw new BadBytecode("Could not obtain parameters for descriptor [pos = " + lastPos + "]: " + desc); Type[] types = new Type[classes.length]; for (int i = 0; i < types.length; i++) types[i] = Type.get(classes[i]); return types; }
private Type returnTypeFromDesc(String desc) throws BadBytecode { CtClass clazz = null; try { clazz = Descriptor.getReturnType(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain return type for descriptor [pos = " + lastPos + "]: " + desc); return Type.get(clazz); }
private Type typeFromDesc(String desc) throws BadBytecode { CtClass clazz = null; try { clazz = Descriptor.toCtClass(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (clazz == null) throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + desc); return Type.get(clazz); }
private Type[] paramTypesFromDesc(String desc) throws BadBytecode { CtClass classes[] = null; try { classes = Descriptor.getParameterTypes(desc, classPool); } catch (NotFoundException e) { throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage()); } if (classes == null) throw new BadBytecode("Could not obtain parameters for descriptor [pos = " + lastPos + "]: " + desc); Type[] types = new Type[classes.length]; for (int i = 0; i < types.length; i++) types[i] = Type.get(classes[i]); return types; }
private ExceptionInfo[] buildExceptionInfo(MethodInfo method) { ConstPool constPool = method.getConstPool(); ClassPool classes = clazz.getClassPool(); ExceptionTable table = method.getCodeAttribute().getExceptionTable(); ExceptionInfo[] exceptions = new ExceptionInfo[table.size()]; for (int i = 0; i < table.size(); i++) { int index = table.catchType(i); Type type; try { type = index == 0 ? Type.THROWABLE : Type.get(classes.get(constPool.getClassInfo(index))); } catch (NotFoundException e) { throw new IllegalStateException(e.getMessage()); } exceptions[i] = new ExceptionInfo(table.startPc(i), table.endPc(i), table.handlerPc(i), type); } return exceptions; }
throw e; } catch (NotFoundException e) { throw new RuntimeException(e.getMessage(), e); } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e);
private ExceptionInfo[] buildExceptionInfo(MethodInfo method) { ConstPool constPool = method.getConstPool(); ClassPool classes = clazz.getClassPool(); ExceptionTable table = method.getCodeAttribute().getExceptionTable(); ExceptionInfo[] exceptions = new ExceptionInfo[table.size()]; for (int i = 0; i < table.size(); i++) { int index = table.catchType(i); Type type; try { type = index == 0 ? Type.THROWABLE : Type.get(classes.get(constPool.getClassInfo(index))); } catch (NotFoundException e) { throw new IllegalStateException(e.getMessage()); } exceptions[i] = new ExceptionInfo(table.startPc(i), table.endPc(i), table.handlerPc(i), type); } return exceptions; }