Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 96891 Details for
Bug 226567
Inter-type declaration with generic return type across packages causes return type incompatibility
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Workspace patch (tests/weaver) - fixes this bug
226567_patch.txt (text/plain), 9.00 KB, created by
Andrew Clement
on 2008-04-21 13:02:05 EDT
(
hide
)
Description:
Workspace patch (tests/weaver) - fixes this bug
Filename:
MIME Type:
Creator:
Andrew Clement
Created:
2008-04-21 13:02:05 EDT
Size:
9.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P tests >Index: src/org/aspectj/systemtest/ajc160/Ajc160Tests.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java,v >retrieving revision 1.38 >diff -u -r1.38 Ajc160Tests.java >--- src/org/aspectj/systemtest/ajc160/Ajc160Tests.java 7 Apr 2008 06:35:33 -0000 1.38 >+++ src/org/aspectj/systemtest/ajc160/Ajc160Tests.java 21 Apr 2008 17:01:11 -0000 >@@ -22,6 +22,9 @@ > public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { > > // AspectJ1.6.0rc1 >+ public void testPipelineCompilationGenericReturnType_pr226567() { >+ runTest("pipeline compilation and generic return type"); >+ } > public void testPipelineCompilationAnonymous_pr225916() { > runTest("pipeline compilation and anonymous type"); > } >Index: src/org/aspectj/systemtest/ajc160/ajc160.xml >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml,v >retrieving revision 1.35 >diff -u -r1.35 ajc160.xml >--- src/org/aspectj/systemtest/ajc160/ajc160.xml 7 Apr 2008 06:35:33 -0000 1.35 >+++ src/org/aspectj/systemtest/ajc160/ajc160.xml 21 Apr 2008 17:01:11 -0000 >@@ -3,6 +3,10 @@ > <!-- AspectJ v1.6.0 Tests --> > <suite> > >+ <ajc-test dir="bugs160/pr226567" title="pipeline compilation and generic return type"> >+ <compile files="BarAspect.aj Foo.java Bar.java" options="-1.5"/> >+ <compile files="BarAspect.aj Bar.java Foo.java" options="-1.5"/> >+ </ajc-test> > > <ajc-test dir="bugs160/pr225916" title="pipeline compilation and anonymous type"> > <compile files="Test.java TestMBean.java TestAspect.java" options="-showWeaveInfo"> >Index: bugs160/pr226567/Main.java >=================================================================== >RCS file: bugs160/pr226567/Main.java >diff -N bugs160/pr226567/Main.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugs160/pr226567/Main.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package c; >+ >+import b.Bar; >+import b.Foo; >+ >+public class Main { >+ >+ public static void main(String [] args) { >+ Foo foo = new Foo(); >+ System.out.println(foo instanceof Bar); >+ } >+} >Index: bugs160/pr226567/Foo.java >=================================================================== >RCS file: bugs160/pr226567/Foo.java >diff -N bugs160/pr226567/Foo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugs160/pr226567/Foo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+package b; >+ >+import java.util.ArrayList; >+import java.util.Collection; >+ >+public class Foo { >+ >+ public Collection<Foo> getFoos() { >+ return new ArrayList<Foo>() {{ add(new Foo()); }}; >+ } >+} >Index: bugs160/pr226567/Bar.java >=================================================================== >RCS file: bugs160/pr226567/Bar.java >diff -N bugs160/pr226567/Bar.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugs160/pr226567/Bar.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+package b; >+ >+import java.util.Collection; >+ >+ >+public interface Bar { >+ >+ public Collection<Foo> getFoos(); >+} >Index: bugs160/pr226567/BarAspect.aj >=================================================================== >RCS file: bugs160/pr226567/BarAspect.aj >diff -N bugs160/pr226567/BarAspect.aj >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugs160/pr226567/BarAspect.aj 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+package a; >+ >+import b.Bar; >+import b.Foo; >+ >+public aspect BarAspect { >+ >+ declare parents : Foo implements Bar; >+} >#P weaver >Index: src/org/aspectj/weaver/bcel/BcelTypeMunger.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java,v >retrieving revision 1.86 >diff -u -r1.86 BcelTypeMunger.java >--- src/org/aspectj/weaver/bcel/BcelTypeMunger.java 17 Jan 2008 00:24:51 -0000 1.86 >+++ src/org/aspectj/weaver/bcel/BcelTypeMunger.java 21 Apr 2008 17:01:14 -0000 >@@ -333,25 +333,25 @@ > */ > private boolean enforceDecpRule4_compatibleReturnTypes(BcelClassWeaver weaver, ResolvedMember superMethod, LazyMethodGen subMethod) { > boolean cont = true; >- String superReturnTypeSig = superMethod.getReturnType().getSignature(); >- String subReturnTypeSig = subMethod.getReturnType().getSignature(); >- superReturnTypeSig = superReturnTypeSig.replace('.','/'); >- subReturnTypeSig = subReturnTypeSig.replace('.','/'); >- if (!superReturnTypeSig.equals(subReturnTypeSig)) { >- // Allow for covariance - wish I could test this (need Java5...) >+ String superReturnTypeSig = superMethod.getGenericReturnType().getSignature(); // eg. >+ // Pjava/util/Collection<LFoo;> >+ String subReturnTypeSig = subMethod.getGenericReturnTypeSignature(); >+ superReturnTypeSig = superReturnTypeSig.replace('.', '/'); >+ subReturnTypeSig = subReturnTypeSig.replace('.', '/'); >+ if (!superReturnTypeSig.equals(subReturnTypeSig)) { >+ // Check for covariance > ResolvedType subType = weaver.getWorld().resolve(subMethod.getReturnType()); > ResolvedType superType = weaver.getWorld().resolve(superMethod.getReturnType()); > if (!superType.isAssignableFrom(subType)) { >- ISourceLocation sloc = subMethod.getSourceLocation(); > weaver.getWorld().getMessageHandler().handleMessage(MessageUtil.error( >- "The return type is incompatible with "+superMethod.getDeclaringType()+"."+superMethod.getName()+superMethod.getParameterSignature(), >- subMethod.getSourceLocation())); >+ "The return type is incompatible with " + superMethod.getDeclaringType() + "." + superMethod.getName() >+ + superMethod.getParameterSignature(), subMethod.getSourceLocation())); > // this just might be a better error message... > // "The return type '"+subReturnTypeSig+"' is incompatible with the overridden method "+superMethod.getDeclaringType()+"."+ > // superMethod.getName()+superMethod.getParameterSignature()+" which returns '"+superReturnTypeSig+"'", > cont=false; > } >- } >+ } > return cont; > } > >@@ -380,11 +380,14 @@ > } > > >+ /** >+ * Search the specified type for a particular method - do not use the return value in the comparison as it is not >+ * considered for overriding. >+ */ > private LazyMethodGen findMatchingMethod(LazyClassGen newParentTarget, ResolvedMember m) { > LazyMethodGen found = null; >- // Search the type for methods overriding super methods (methods that come from the new parent) >- // Don't use the return value in the comparison as overriding doesnt >- for (Iterator i = newParentTarget.getMethodGens().iterator(); i.hasNext() && found==null;) { >+ List methodGens = newParentTarget.getMethodGens(); >+ for (Iterator i = methodGens.iterator(); i.hasNext() && found == null;) { > LazyMethodGen gen = (LazyMethodGen) i.next(); > if (gen.getName().equals(m.getName()) && > gen.getParameterSignature().equals(m.getParameterSignature())) { >Index: src/org/aspectj/weaver/bcel/BcelMethod.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java,v >retrieving revision 1.47 >diff -u -r1.47 BcelMethod.java >--- src/org/aspectj/weaver/bcel/BcelMethod.java 25 Feb 2008 21:41:57 -0000 1.47 >+++ src/org/aspectj/weaver/bcel/BcelMethod.java 21 Apr 2008 17:01:13 -0000 >@@ -409,6 +409,9 @@ > return genericParameterTypes; > } > >+ /** >+ * Return the parameterized/generic return type or the normal return type if the method is not generic. >+ */ > public UnresolvedType getGenericReturnType() { > unpackGenericSignature(); > return genericReturnType; >Index: src/org/aspectj/weaver/bcel/LazyMethodGen.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java,v >retrieving revision 1.62 >diff -u -r1.62 LazyMethodGen.java >--- src/org/aspectj/weaver/bcel/LazyMethodGen.java 1 Aug 2006 12:40:34 -0000 1.62 >+++ src/org/aspectj/weaver/bcel/LazyMethodGen.java 21 Apr 2008 17:01:15 -0000 >@@ -887,6 +887,14 @@ > return name; > } > >+ public String getGenericReturnTypeSignature() { >+ if (memberView == null) { >+ return getReturnType().getSignature(); >+ } else { >+ return memberView.getGenericReturnType().getSignature(); >+ } >+ } >+ > public Type getReturnType() { > initialize(); > return returnType;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 226567
:
95604
| 96891