@@ -681,18 +681,19 @@ class BcelClassWeaver implements IClassWeaver { | |||
* @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; | |||
} |
@@ -619,7 +619,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { | |||
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 { | |||
@@ -1792,7 +1792,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { | |||
} 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); |
@@ -128,11 +128,11 @@ public class Utility { | |||
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; | |||
@@ -145,11 +145,12 @@ public class Utility { | |||
// 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; | |||
@@ -165,7 +166,7 @@ public class Utility { | |||
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; |
@@ -15,6 +15,8 @@ | |||
package org.aspectj.weaver; | |||
import java.lang.reflect.Modifier; | |||
import junit.framework.TestCase; | |||
import org.aspectj.testing.util.TestUtil; | |||
@@ -145,16 +147,16 @@ public class MemberTestCase extends TestCase { | |||
} | |||
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()); |