]> source.dussan.org Git - aspectj.git/commitdiff
FIXED: Bugzilla Bug 32421
authorjhugunin <jhugunin>
Thu, 6 Mar 2003 22:12:00 +0000 (22:12 +0000)
committerjhugunin <jhugunin>
Thu, 6 Mar 2003 22:12:00 +0000 (22:12 +0000)
   can't resolve nested public interfaces

FIXED: Bugzilla Bug 32399
   Incorrect binding of protected (marker) interfaces

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
tests/ajcTests.xml
tests/bugs/InnerPointcut.java [new file with mode: 0644]
tests/bugs/interfaceNames/TransactionTest.java [new file with mode: 0644]
tests/bugs/interfaceNames/sub/ExecutionMonitor.java [new file with mode: 0644]
tests/bugs/interfaceNames/sub/ObserverProtocol.aj [new file with mode: 0644]
tests/jimTests.xml
tests/new/EachObjectInDeepPackage.java

index d90f99781b5854e4343bb4922657737b1fe5e5b6..f21e96c69ae47f3c561e9cb8977dceda55fb97a7 100644 (file)
@@ -24,6 +24,7 @@ import org.aspectj.weaver.IHasPosition;
 import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.TypeX;
 import org.aspectj.weaver.World;
+import org.aspectj.weaver.patterns.*;
 import org.aspectj.weaver.patterns.FormalBinding;
 import org.aspectj.weaver.patterns.IScope;
 import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
@@ -60,6 +61,17 @@ public class EclipseScope implements IScope {
        
        
        public TypeX lookupType(String name, IHasPosition location) {
+               TypeBinding b = scope.getType(WildTypePattern.splitNames(name));
+               //FIXME need reasonable error handling...
+               if (!b.isValidBinding()) {
+                       return ResolvedTypeX.MISSING;
+               }
+               
+               //System.err.println("binding: " + b);
+               //  Binding(tokens, bits & RestrictiveFlagMASK, this)
+               return world.fromBinding(b);
+               
+               /*
                computeImports();
                
 //             System.out.println("lookup: " + name + " in " + 
@@ -98,6 +110,7 @@ public class EclipseScope implements IScope {
                }
 
                return resolveVisible(name);
+               */
        }
        
        
index a432861313959eae0c6c1a815b002daa6b153830..54261ece4c4b1fcfbeb6bfb3d1becfbaecb71fa5 100644 (file)
         <run class="WeaveLocal"/>
     </ajc-test>
     
+    <ajc-test dir="bugs" pr="32428" 
+               title="can't use pointcuts defined in inner aspects ">
+        <compile files="InnerPointcut.java"/>
+        <run class="InnerPointcut"/>
+    </ajc-test>
 
+    <ajc-test dir="bugs/interfaceNames" pr="32421" 
+               title="can't resolve nested public interfaces (also PR#32399)">
+        <compile files="TransactionTest.java,sub/ExecutionMonitor.java,sub/ObserverProtocol.aj"/>
+        <run class="TransactionTest"/>
+    </ajc-test>
 </suite>
diff --git a/tests/bugs/InnerPointcut.java b/tests/bugs/InnerPointcut.java
new file mode 100644 (file)
index 0000000..063a5eb
--- /dev/null
@@ -0,0 +1,20 @@
+// for Bug#:  32428 
+import org.aspectj.testing.Tester;
+
+
+public class InnerPointcut {
+       public static void main(String[] args) {
+               Tester.checkEqual(TrackTestCase.note, "ran");
+       }
+       
+       pointcut testcutOuter(): within(InnerPointcut);
+       
+    static aspect TrackTestCase {
+       static String note = "not run yet";
+        pointcut testcut() : execution(public void mai*(..));
+        before() : testcut() && testcutOuter() {
+               note = "ran";
+        }        
+    }
+
+}
diff --git a/tests/bugs/interfaceNames/TransactionTest.java b/tests/bugs/interfaceNames/TransactionTest.java
new file mode 100644 (file)
index 0000000..a8e8397
--- /dev/null
@@ -0,0 +1,30 @@
+import sub.ExecutionMonitor;
+import sub.ObserverProtocol;
+
+
+public class TransactionTest {
+       public static void main(String[] args) {
+       }
+       
+    static Transaction theTransaction;
+
+    private void assertCommitted() {
+        theTransaction.getCount("method-execution", "commit");
+    }
+
+    static aspect MonitorTest {
+        declare parents: Transaction implements ExecutionMonitor.MonitoredItem;
+    }
+}
+
+class Transaction {
+}
+
+aspect TransactionControl {
+    void begin() {
+        CommitObserver.aspectOf().add(this);
+    }
+    static aspect CommitObserver extends ObserverProtocol {
+        declare parents: TransactionControl implements Observer;
+    }
+}
diff --git a/tests/bugs/interfaceNames/sub/ExecutionMonitor.java b/tests/bugs/interfaceNames/sub/ExecutionMonitor.java
new file mode 100644 (file)
index 0000000..92f9d73
--- /dev/null
@@ -0,0 +1,11 @@
+package sub;
+
+public aspect ExecutionMonitor {
+    public interface MonitoredItem {
+        int getCount(String eventType, String eventName);
+    }
+
+    public int MonitoredItem.getCount(String eventType, String eventName) {
+            return 0;
+    } 
+}         
diff --git a/tests/bugs/interfaceNames/sub/ObserverProtocol.aj b/tests/bugs/interfaceNames/sub/ObserverProtocol.aj
new file mode 100644 (file)
index 0000000..8d558ad
--- /dev/null
@@ -0,0 +1,6 @@
+package sub;\r
+\r
+public abstract aspect ObserverProtocol {  \r
+    protected interface Observer { }\r
+    public void add(Observer o) {}\r
+}\r
index b8771ef2a2d66ff388462387dc824de774e1c913..e7e9b8b977819bb303aa5b176cf0e8f7a5c9bb56 100644 (file)
@@ -1,8 +1,6 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite>
 
-
-    
     <!--
     
 
index 9e52b4d08997f6ab78142e7f28e941fa3d902d89..2269af4ad11af785f8f552c218400c76eabef080 100644 (file)
@@ -1,9 +1,20 @@
+/*
+ * Modified this test case to reflect the fact that types in the default package
+ * can only be used in named packages if they are imported.
+ * 
+ * I believe that according to the 1.1 interpretation of the JLS that this import
+ * is also disallowed and there is no way to refer to types in the default package
+ * from a named package.
+ */
+
 package the.deep.pkg;
 
 import org.aspectj.testing.Tester;
+import EachObjectTarget;
 
 aspect Aspect pertarget(target(EachObjectTarget)) {
   before(): call(void foo(..)) {
+       EachObjectTarget t = null;
        Tester.check(true, "Dummy test");
   }
 }