<!-- contains valid tests that the compiler has never passed --> | <!-- contains valid tests that the compiler has never passed --> | ||||
<suite> | <suite> | ||||
<ajc-test dir="bugs/privilege" | |||||
title="omnibus privileged access" | |||||
comment="from mail ~Problem with interfaces...~; add pr when bug submitted" | |||||
> | |||||
<compile files="packageProtected/concern/ContextUser.java, | |||||
packageProtected/concern/BaseTarget.java, | |||||
packageProtected/core/Base.java"/> | |||||
<run class="packageProtected.core.Base"/> | |||||
<run class="packageProtected.concern.BaseTarget"/> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs" | <ajc-test dir="bugs" | ||||
title="after returning type incompatible with join point return type" | title="after returning type incompatible with join point return type" | ||||
pr="42668" | pr="42668" |
package packageProtected.concern; | |||||
public class BaseTarget { | |||||
// ---- same as Base | |||||
int default_int; | |||||
public int public_int; | |||||
protected int protected_int; | |||||
private int private_int; | |||||
void default_method() { } | |||||
public void public_method() { } | |||||
protected void protected_method() { } | |||||
private void private_method() { } | |||||
void default_method(Object unused) { } | |||||
public void public_method(Object unused) { } | |||||
protected void protected_method(Object unused) { } | |||||
private void private_method(Object unused) { } | |||||
void default_method(Object unused, Object second) { } | |||||
public void public_method(Object unused, Object second) { } | |||||
protected void protected_method(Object unused, Object second) { } | |||||
private void private_method(Object unused, Object second) { } | |||||
static int default_staticInt; | |||||
public static int public_staticInt; | |||||
protected static int protected_staticInt; | |||||
private static int private_staticInt; | |||||
static void default_staticMethod() { } | |||||
public static void public_staticMethod() { } | |||||
protected static void protected_staticMethod() { } | |||||
private static void private_staticMethod() { } | |||||
static void default_staticMethod(Object unused) { } | |||||
public static void public_staticMethod(Object unused) { } | |||||
protected static void protected_staticMethod(Object unused) { } | |||||
private static void private_staticMethod(Object unused) { } | |||||
static void default_staticMethod(Object unused, Object second) { } | |||||
public static void public_staticMethod(Object unused, Object second) { } | |||||
protected static void protected_staticMethod(Object unused, Object second) { } | |||||
private static void private_staticMethod(Object unused, Object second) { } | |||||
// ---- end of same as Base | |||||
public void trigger(BaseTarget me) { | |||||
} | |||||
public static void main(String[] args) { | |||||
BaseTarget user = new BaseTarget(); | |||||
user.trigger(new BaseTarget()); | |||||
} | |||||
} |
package packageProtected.concern; | |||||
import packageProtected.core.Base; | |||||
/** @testcase PR#XXX omnibus privileged access */ | |||||
public privileged aspect ContextUser { | |||||
pointcut call2trigger(Base argument): | |||||
execution(* Base.trigger(..)) | |||||
&& args(argument); | |||||
before(Base base): call2trigger(base) { | |||||
int i = base.private_int | |||||
+ base.default_int | |||||
+ base.protected_int | |||||
+ base.public_int; | |||||
base.private_method(); | |||||
base.default_method(); | |||||
base.protected_method(); | |||||
base.public_method(); | |||||
base.private_method(null); | |||||
base.default_method(null); | |||||
base.protected_method(null); | |||||
base.public_method(null); | |||||
base.private_method(null, null); | |||||
base.default_method(null, null); | |||||
base.protected_method(null, null); | |||||
base.public_method(null, null); | |||||
i = Base.private_staticInt | |||||
+ Base.default_staticInt | |||||
+ Base.protected_staticInt | |||||
+ Base.public_staticInt; | |||||
Base.private_staticMethod(); | |||||
Base.default_staticMethod(); | |||||
Base.protected_staticMethod(); | |||||
Base.public_staticMethod(); | |||||
Base.private_staticMethod(null); | |||||
Base.default_staticMethod(null); | |||||
Base.protected_staticMethod(null); | |||||
Base.public_staticMethod(null); | |||||
Base.private_staticMethod(null, null); | |||||
Base.default_staticMethod(null, null); | |||||
Base.protected_staticMethod(null, null); | |||||
Base.public_staticMethod(null, null); | |||||
} | |||||
pointcut call2trigger_samePackage(BaseTarget arg): | |||||
execution(* BaseTarget.trigger(..)) | |||||
&& args(arg); | |||||
before(BaseTarget base): call2trigger_samePackage(base) { | |||||
int i = base.private_int | |||||
+ base.default_int | |||||
+ base.protected_int | |||||
+ base.public_int; | |||||
base.private_method(); | |||||
base.default_method(); | |||||
base.protected_method(); | |||||
base.public_method(); | |||||
base.private_method(null); | |||||
base.default_method(null); | |||||
base.protected_method(null); | |||||
base.public_method(null); | |||||
base.private_method(null, null); | |||||
base.default_method(null, null); | |||||
base.protected_method(null, null); | |||||
base.public_method(null, null); | |||||
i = BaseTarget.private_staticInt | |||||
+ BaseTarget.default_staticInt | |||||
+ BaseTarget.protected_staticInt | |||||
+ BaseTarget.public_staticInt; | |||||
BaseTarget.private_staticMethod(); | |||||
BaseTarget.default_staticMethod(); | |||||
BaseTarget.protected_staticMethod(); | |||||
BaseTarget.public_staticMethod(); | |||||
BaseTarget.private_staticMethod(null); | |||||
BaseTarget.default_staticMethod(null); | |||||
BaseTarget.protected_staticMethod(null); | |||||
BaseTarget.public_staticMethod(null); | |||||
BaseTarget.private_staticMethod(null, null); | |||||
BaseTarget.default_staticMethod(null, null); | |||||
BaseTarget.protected_staticMethod(null, null); | |||||
BaseTarget.public_staticMethod(null, null); | |||||
} | |||||
} |
package packageProtected.core; | |||||
public class Base { | |||||
int default_int; | |||||
public int public_int; | |||||
protected int protected_int; | |||||
private int private_int; | |||||
void default_method() { } | |||||
public void public_method() { } | |||||
protected void protected_method() { } | |||||
private void private_method() { } | |||||
void default_method(Object unused) { } | |||||
public void public_method(Object unused) { } | |||||
protected void protected_method(Object unused) { } | |||||
private void private_method(Object unused) { } | |||||
void default_method(Object unused, Object second) { } | |||||
public void public_method(Object unused, Object second) { } | |||||
protected void protected_method(Object unused, Object second) { } | |||||
private void private_method(Object unused, Object second) { } | |||||
static int default_staticInt; | |||||
public static int public_staticInt; | |||||
protected static int protected_staticInt; | |||||
private static int private_staticInt; | |||||
static void default_staticMethod() { } | |||||
public static void public_staticMethod() { } | |||||
protected static void protected_staticMethod() { } | |||||
private static void private_staticMethod() { } | |||||
static void default_staticMethod(Object unused) { } | |||||
public static void public_staticMethod(Object unused) { } | |||||
protected static void protected_staticMethod(Object unused) { } | |||||
private static void private_staticMethod(Object unused) { } | |||||
static void default_staticMethod(Object unused, Object second) { } | |||||
public static void public_staticMethod(Object unused, Object second) { } | |||||
protected static void protected_staticMethod(Object unused, Object second) { } | |||||
private static void private_staticMethod(Object unused, Object second) { } | |||||
public void trigger(Base me) { | |||||
} | |||||
public static void main(String[] args) { | |||||
Base user = new Base(); | |||||
user.trigger(new Base()); | |||||
} | |||||
} |