]> source.dussan.org Git - aspectj.git/commitdiff
242797: a testcase
authoraclement <aclement>
Wed, 13 Aug 2008 16:12:26 +0000 (16:12 +0000)
committeraclement <aclement>
Wed, 13 Aug 2008 16:12:26 +0000 (16:12 +0000)
12 files changed:
tests/bugs162/pr242797/case1/CMEFinder.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/ClassUtils.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/Finder.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/H2Deployment.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/Localized.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/LocalizedFinder.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/OnetElement.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/OnetFinder.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/Partitioned.java [new file with mode: 0644]
tests/bugs162/pr242797/case1/PartitionedFinder.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
tests/src/org/aspectj/systemtest/ajc162/ajc162.xml

diff --git a/tests/bugs162/pr242797/case1/CMEFinder.java b/tests/bugs162/pr242797/case1/CMEFinder.java
new file mode 100644 (file)
index 0000000..a7bb5f4
--- /dev/null
@@ -0,0 +1,9 @@
+import java.util.List;
+
+public class CMEFinder extends OnetFinder<CMEStub, PartitionedCME, LocalizedCME, ContentModelElement>{
+} 
+
+class CMEStub {}
+class PartitionedCME implements Partitioned{ }
+class LocalizedCME implements Localized {}
+class ContentModelElement extends OnetElement {} 
\ No newline at end of file
diff --git a/tests/bugs162/pr242797/case1/ClassUtils.java b/tests/bugs162/pr242797/case1/ClassUtils.java
new file mode 100644 (file)
index 0000000..496255d
--- /dev/null
@@ -0,0 +1,4 @@
+
+public class ClassUtils {
+       public static Class guessGenericType(Class c) { return c; }
+}
diff --git a/tests/bugs162/pr242797/case1/Finder.java b/tests/bugs162/pr242797/case1/Finder.java
new file mode 100644 (file)
index 0000000..68021e5
--- /dev/null
@@ -0,0 +1,2 @@
+public interface Finder {
+}
diff --git a/tests/bugs162/pr242797/case1/H2Deployment.java b/tests/bugs162/pr242797/case1/H2Deployment.java
new file mode 100644 (file)
index 0000000..6b80df4
--- /dev/null
@@ -0,0 +1,5 @@
+import java.util.List;
+public class H2Deployment {
+       public static H2Deployment instance() { return new H2Deployment(); }
+       List<String> getPartitionOrder(Class c) { return null;}
+}
diff --git a/tests/bugs162/pr242797/case1/Localized.java b/tests/bugs162/pr242797/case1/Localized.java
new file mode 100644 (file)
index 0000000..ba6076c
--- /dev/null
@@ -0,0 +1 @@
+public interface Localized {}
diff --git a/tests/bugs162/pr242797/case1/LocalizedFinder.java b/tests/bugs162/pr242797/case1/LocalizedFinder.java
new file mode 100644 (file)
index 0000000..983cbd9
--- /dev/null
@@ -0,0 +1,2 @@
+public interface LocalizedFinder<L extends Localized> extends Finder {
+}
diff --git a/tests/bugs162/pr242797/case1/OnetElement.java b/tests/bugs162/pr242797/case1/OnetElement.java
new file mode 100644 (file)
index 0000000..7091a54
--- /dev/null
@@ -0,0 +1,3 @@
+public class OnetElement<T> implements Partitioned,Localized {
+
+}
diff --git a/tests/bugs162/pr242797/case1/OnetFinder.java b/tests/bugs162/pr242797/case1/OnetFinder.java
new file mode 100644 (file)
index 0000000..ddcbba9
--- /dev/null
@@ -0,0 +1,2 @@
+public abstract class OnetFinder<S,P extends Partitioned<?>, L extends Localized, O extends OnetElement<?>> implements Finder,PartitionedFinder<O>,LocalizedFinder<O> {
+}
diff --git a/tests/bugs162/pr242797/case1/Partitioned.java b/tests/bugs162/pr242797/case1/Partitioned.java
new file mode 100644 (file)
index 0000000..fba526c
--- /dev/null
@@ -0,0 +1,9 @@
+public interface Partitioned<A> {
+       public String getPartitionId();
+}
+aspect PartitionedI {
+       public String Partitioned<A>.getPartitionId() {
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/tests/bugs162/pr242797/case1/PartitionedFinder.java b/tests/bugs162/pr242797/case1/PartitionedFinder.java
new file mode 100644 (file)
index 0000000..02ad16b
--- /dev/null
@@ -0,0 +1,34 @@
+import java.util.List;
+
+public interface PartitionedFinder<P extends Partitioned<?>> extends Finder {
+//     public <T extends Localized> List<T> bestLanguageMatch(List<T> list, List<String> languageOrder);
+       public <T extends Partitioned<?>> List<T> bestPartitionMatch(List<T> list, List<String> partitionOrder);
+}
+
+aspect PartitionedFinderAspect {
+
+    public Class<? extends P> PartitionedFinder<P>.getPartitionedType(){
+            return ClassUtils.guessGenericType(getClass());
+    }
+
+    public List<String> PartitionedFinder<P>.getPartitionOrder(){
+            return H2Deployment.instance().getPartitionOrder(getPartitionedType());
+    }
+
+    public <T extends Partitioned<?>> List<T> PartitionedFinder<P>.bestPartitionMatch(List<T> list, List<String> partitionOrder){
+            return new OrderComparator<T, String>(partitionOrder){
+
+                    @Override
+                    public String getOrdering(T partitioned){
+                            return partitioned.getPartitionId();
+                    }
+
+            }.bestMatch(list);
+    }
+}
+
+class OrderComparator<A,B> {
+       OrderComparator(List<String> ls) {}
+       public String getOrdering(A a) {return "";}
+       List bestMatch(List l) {return null;}
+}
index 1b278cb6c674bd51eb554ed13f9b85c0ddbdd0e3..0871d5b86fc9492e001ebd269138978ee75bbd02 100644 (file)
@@ -19,6 +19,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
        // AspectJ1.6.2 
+       public void testGenericItds_pr242797_1() { runTest("generic itds - 1"); }
 //     public void testParamAnnosPipelining_pr241847() { runTest("param annos pipelining");}
 //     public void testParamAnnoInner_pr241861() { runTest("param annotation inner class"); }
        public void testAnnotationDecp_pr239441() { runTest("annotation decp"); }
index dc9d4bf8c0c76d4758480fe73217f902d1aa2d5d..1fc19bbbfc8de85fff0680b510f558ab7a1e9352 100644 (file)
@@ -3,13 +3,18 @@
 <!-- AspectJ v1.6.2 Tests -->
 <suite>
 
-       <ajc-test dir="bugs162/pr241847" title="param annos pipelining">
+    <ajc-test dir="bugs162/pr242797/case1" title="generic itds - 1">
+        <compile files="ClassUtils.java CMEFinder.java Finder.java H2Deployment.java Localized.java LocalizedFinder.java OnetElement.java OnetFinder.java Partitioned.java PartitionedFinder.java" options="-1.5">
+        </compile>
+    </ajc-test> 
+       <ajc-test dir="bugs162/pr241847" title="param annos pipelining">
        <compile files="Asp.aj Ann.java CC.java II.java LongLong.java" options="-1.5 -showWeaveInfo">
                <message kind="weave" text="Join point 'method-execution(void LongLong.m1(java.lang.String))' in Type 'LongLong' (LongLong.java:2) advised by before advice from 'Asp' (Asp.aj:5)"/>
                <message kind="weave" line="3"/>
        </compile>
     </ajc-test>    
-
+    
        <ajc-test dir="bugs162/pr239441" title="annotation decp">
        <compile files="Test3.java SampleAspect.java" options="-1.5 -showWeaveInfo -XhasMember">
        </compile>