Browse Source

Fix for 451966: privileged aspects and itd on interfaces

tags/V1_8_5
Andy Clement 9 years ago
parent
commit
934f0b86c5

+ 5
- 4
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java View File

@@ -14,6 +14,7 @@ package org.aspectj.ajdt.internal.compiler.lookup;

import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.IPrivilegedHandler;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -99,10 +100,10 @@ public class InterTypeMethodBinding extends MethodBinding {
if (invocationType == declaringClass)
return true;

// if (invocationType.isPrivileged) {
// System.out.println("privileged access to: " + this);
// return true;
// }
if (invocationType.privilegedHandler != null) {
// it is a privileged aspect
return true;
}

if (isProtected()) {
throw new RuntimeException("unimplemented");

+ 11
- 1
tests/bugs185/451966/Code.java View File

@@ -1,7 +1,17 @@

public class Code {
public static void main(String []argv) {
new Bar().foo();
}
}
interface Common { }

interface Allergies extends Common { }
interface Allergies extends Common {
default public void foo() {
}
}

class Bar implements Allergies { }

aspect Y {
private boolean Common.instancesInvariant() {

+ 1
- 6
tests/src/org/aspectj/systemtest/ajc185/ajc185.xml View File

@@ -5,12 +5,7 @@

<ajc-test dir="bugs185/451966" title="itd interface">
<compile files="Code.java" options="-1.8"/>
<run class="One">
<stdout>
<line text="In instance check method doit()"/>
<line text="In advice()"/>
<line text="Method m() running"/>
</stdout>
<run class="Code">
</run>
</ajc-test>


Loading…
Cancel
Save