// We can't call up to a default access method if we aren't in the same
// package
if((access & (ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE)) == 0) {
if(!!!samePackage)
throw new RuntimeException(NLS.MESSAGES.getMessage("method.from.superclass.is.hidden", name, superToCopy.getName(), overridingClassType.getClassName()),
new UnableToProxyException(superToCopy));
}
//Safe to copy a call to this method!
Type superType = Type.getType(superToCopy);
// identify the target method parameters and return type
String methodStaticFieldName = "methodField" + AbstractWovenProxyAdapter.getSanitizedUUIDString();
transformedMethods.put(methodStaticFieldName, new TypeMethod(
superType, currentTransformMethod));
//Remember we need to copy the fake method *and* weave it, use a
//WovenProxyMethodAdapter as well as a CopyingMethodAdapter
MethodVisitor weaver = wovenProxyAdapter.getWeavingMethodVisitor(
access, name, desc, sig, exceptions, currentTransformMethod,
methodStaticFieldName, superType, false);
if(weaver instanceof AbstractWovenProxyMethodAdapter) {
//If we are weaving this method then we might have a problem. If it's a protected method and we
//aren't in the same package then we can't dispatch the call to another object. This may sound
//odd, but if class Super has a protected method foo(), then class Sub, that extends Super, cannot
//call ((Super)o).foo() in code (it can call super.foo()). If we are in the same package then this
//gets around the problem, but if not the class will fail verification.
if(!samePackage && (access & ACC_PROTECTED) != 0)
throw new RuntimeException(NLS.MESSAGES.getMessage("method.from.superclass.is.hidden", name, superToCopy.getName(), overridingClassType.getClassName()),
new UnableToProxyException(superToCopy));
mv = new CopyingMethodAdapter((GeneratorAdapter) weaver, superType, currentTransformMethod);
}
else {
//For whatever reason we aren't weaving this method. The call to super.xxx() will always work
mv = new CopyingMethodAdapter(new GeneratorAdapter(access, currentTransformMethod, mv),