private static boolean isPubCons(CtConstructor cons) { return !Modifier.isPrivate(cons.getModifiers()) && cons.isConstructor(); }
private static boolean isPubCons(CtConstructor cons) { return !Modifier.isPrivate(cons.getModifiers()) && cons.isConstructor(); }
int mods = constructor.getModifiers(); if ((mods & Modifier.PRIVATE) == 0) { out.writeUTF("<init>");
int mods = constructor.getModifiers(); if ((mods & Modifier.PRIVATE) == 0) { out.writeUTF("<init>");
for (int i = 0; i < cs.length; ++i) { CtConstructor c = cs[i]; int mod = c.getModifiers(); if (isInheritable(mod, superclazz)) { CtConstructor cons
private void ensureNullaryCtor(CtClass cc) throws NotFoundException, CannotCompileException { // Build a null-ary constructor if needed String clzname = cc.getSimpleName(); if( !hasExisting(clzname,"()V",cc.getDeclaredConstructors()) ) { String body = "public "+clzname+"() { }"; cc.addConstructor(CtNewConstructor.make(body,cc)); } else { CtConstructor ctor = cc.getConstructor("()V"); ctor.setModifiers(javassist.Modifier.setPublic(ctor.getModifiers())); } }
for (int i = 0; i < cs.length; ++i) { CtConstructor c = cs[i]; int mod = c.getModifiers(); if (isInheritable(mod, superclazz)) { CtConstructor cons
public int getModifiers() { return ctConstructor.getModifiers(); }
@Override public int getModifiers(CtConstructor obj) { return obj.getModifiers(); }
@Override public AccessSpecifier accessSpecifier() { return JavassistFactory.modifiersToAccessLevel(ctConstructor.getModifiers()); }
@Override public AccessSpecifier accessSpecifier() { return JavassistFactory.modifiersToAccessLevel(ctConstructor.getModifiers()); }
@Override public Modifier.Keyword accessSpecifier() { return JavassistFactory.modifiersToAccessLevel(ctConstructor.getModifiers()); }
public ConstructorMatcher(Advisor advisor, CtConstructor con, ASTStart start) throws NotFoundException { super(start, advisor.getManager()); this.advisor = advisor; this.start = start; this.conModifiers = con.getModifiers(); this.classname = con.getDeclaringClass().getName(); this.ctCon = con; }
@Override public boolean isPublic() { return Modifier.isPublic(getConstructor().getModifiers()); } }
private static boolean isPubCons(CtConstructor cons) { return !Modifier.isPrivate(cons.getModifiers()) && cons.isConstructor(); }
private static boolean isPubCons(CtConstructor cons) { return !Modifier.isPrivate(cons.getModifiers()) && cons.isConstructor(); }
private void buildConstructor(Element element, CtConstructor constructor) throws NotFoundException { Element constructorElement = document.createElement("constructor"); addModifiers(constructorElement, constructor.getModifiers()); buildExceptions(constructorElement, constructor); buildParameterTypes(constructorElement, constructor); element.appendChild(constructorElement); }
private static boolean isPubCons(CtConstructor cons) { return !Modifier.isPrivate(cons.getModifiers()) && cons.isConstructor(); }
private boolean hasInheritableConstructor(CtClass cls) throws NotFoundException { CtConstructor[] constructors = cls.getDeclaredConstructors(); if (constructors.length == 0) { return true; } for (CtConstructor ctConstructor : constructors) { int modifiers = ctConstructor.getModifiers(); if (!Modifier.isPackage(modifiers) && !Modifier.isPrivate(modifiers)) { return true; } } return false; }
private String[] getParameterNames(CtConstructor constructor) throws NotFoundException { MethodInfo methodInfo = constructor.getMethodInfo(); CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); LocalVariableAttribute attribute = (LocalVariableAttribute) codeAttribute.getAttribute("LocalVariableTable"); String[] paramNames = new String[constructor.getParameterTypes().length]; int pos = Modifier.isStatic(constructor.getModifiers()) ? 0 : 1; for (int i = 0; i < paramNames.length; i++) paramNames[i] = attribute.variableName(i + pos); return paramNames; } }