/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ @Override public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
@Override public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
callSuper = !((CtConstructor)method).isClassInitializer();
callSuper = !((CtConstructor)method).isClassInitializer();
CtClass cc = declaringClass; cc.checkModify(); if (isClassInitializer()) throw new CannotCompileException("class initializer");
CtClass cc = declaringClass; cc.checkModify(); if (isClassInitializer()) throw new CannotCompileException("class initializer");
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
/** * Sets a constructor body. * * @param src the source code representing the constructor body. * It must be a single statement or block. * If it is <code>null</code>, the substituted * constructor body does nothing except calling * <code>super()</code>. */ public void setBody(String src) throws CannotCompileException { if (src == null) if (isClassInitializer()) src = ";"; else src = "super();"; super.setBody(src); }
public boolean instrumentConstructor(CtClass clazz, CtConstructor constructor) throws InterceptorException { if (constructor.isClassInitializer()) { return false; } try { addCounterIncrementer(clazz, constructor); return true; } catch (Exception e) { e.printStackTrace(); throw new InterceptorException( "Failed to add instance counter incrementor to constructor of class " + clazz); } }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
public CtConstructor getClassInitializer() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstructor cc = (CtConstructor)cons; if (cc.isClassInitializer()) return cc; } return null; }
if (constructor.isClassInitializer() || !isAdvisableConstructor(constructor, advisor))