* @return true if there is an overrides rather than a 'hides' relationship
*/
static boolean isVisibilityOverride(int methodMods, ResolvedMember inheritedMethod, boolean inSamePackage) {
- if (inheritedMethod.isStatic()) {
+ int inheritedModifiers = inheritedMethod.getModifiers();
+ if (Modifier.isStatic(inheritedModifiers)) {
return false;
}
- if (methodMods == inheritedMethod.getModifiers()) {
+ if (methodMods == inheritedModifiers) {
return true;
}
- if (inheritedMethod.isPrivate()) {
+ if (Modifier.isPrivate(inheritedModifiers)) {
return false;
}
- boolean isPackageVisible = !inheritedMethod.isPrivate() && !inheritedMethod.isProtected() && !inheritedMethod.isPublic();
+ boolean isPackageVisible = !Modifier.isPrivate(inheritedModifiers) && !Modifier.isProtected(inheritedModifiers) && !Modifier.isPublic(inheritedModifiers);
if (isPackageVisible && !inSamePackage) {
return false;
}
InstructionFactory fact = gen.getFactory();
Type fieldType = BcelWorld.makeBcelType(field.getType());
- if (field.isStatic()) {
+ if (Modifier.isStatic(field.getModifiers())) {
il.append(InstructionFactory.createLoad(fieldType, 0));
il.append(fact.createFieldAccess(gen.getClassName(), field.getName(), fieldType, Constants.PUTSTATIC));
} else {
} else if (onInterface && gen.getType().isTopmostImplementor(onType)) {
// wew know that we can't be static since we don't allow statics on
// interfaces
- if (field.isStatic()) {
+ if (Modifier.isStatic(field.getModifiers())) {
throw new RuntimeException("unimplemented");
}
weaver.addInitializer(this);
public static Instruction createSuperInvoke(InstructionFactory fact, BcelWorld world, Member signature) {
short kind;
- if (signature.isInterface()) {
+ if (Modifier.isInterface(signature.getModifiers())) {
throw new RuntimeException("bad");
- } else if (signature.isPrivate() || signature.getName().equals("<init>")) {
+ } else if (Modifier.isPrivate(signature.getModifiers()) || signature.getName().equals("<init>")) {
throw new RuntimeException("unimplemented, possibly bad");
- } else if (signature.isStatic()) {
+ } else if (Modifier.isStatic(signature.getModifiers())) {
throw new RuntimeException("bad");
} else {
kind = Constants.INVOKESPECIAL;
// XXX don't need the world now
public static Instruction createInvoke(InstructionFactory fact, BcelWorld world, Member signature) {
short kind;
- if (signature.isInterface()) {
+ int signatureModifiers = signature.getModifiers();
+ if (Modifier.isInterface(signatureModifiers)) {
kind = Constants.INVOKEINTERFACE;
- } else if (signature.isStatic()) {
+ } else if (Modifier.isStatic(signatureModifiers)) {
kind = Constants.INVOKESTATIC;
- } else if (signature.isPrivate() || signature.getName().equals("<init>")) {
+ } else if (Modifier.isPrivate(signatureModifiers) || signature.getName().equals("<init>")) {
kind = Constants.INVOKESPECIAL;
} else {
kind = Constants.INVOKEVIRTUAL;
public static Instruction createGet(InstructionFactory fact, Member signature) {
short kind;
- if (signature.isStatic()) {
+ if (Modifier.isStatic(signature.getModifiers())) {
kind = Constants.GETSTATIC;
} else {
kind = Constants.GETFIELD;
package org.aspectj.weaver;
+import java.lang.reflect.Modifier;
+
import junit.framework.TestCase;
import org.aspectj.testing.util.TestUtil;
}
private void isStaticTest(Member m, boolean b) {
- assertEquals(m + " is static", b, m.isStatic());
+ assertEquals(m + " is static", b, Modifier.isStatic(m.getModifiers()));
}
private void isConstructorTest(Member m, boolean b) {
assertEquals(m + " is constructor", b, m.getKind() == Member.CONSTRUCTOR);
}
private void isPrivateTest(Member m, boolean b) {
- assertEquals(m + " is private", b, m.isPrivate());
+ assertEquals(m + " is private", b, Modifier.isPrivate(m.getModifiers()));
}
private void isInterfaceTest(Member m, boolean b) {
- assertEquals(m + " is interface", b, m.isInterface());
+ assertEquals(m + " is interface", b, Modifier.isInterface(m.getModifiers()));
}
private void returnTypeTest(Member m, UnresolvedType returnType) {
assertEquals(m + " return type", returnType, m.getReturnType());