Bug 320358 - Exception in UnresolvedType.signatureToName during compilation
Summary: Exception in UnresolvedType.signatureToName during compilation
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.6.10   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-20 04:44 EDT by Emond Papegaaij CLA
Modified: 2010-08-20 10:56 EDT (History)
1 user (show)

See Also:


Attachments
Core dump (67.96 KB, application/octet-stream)
2010-07-20 04:45 EDT, Emond Papegaaij CLA
no flags Details
Minimal showcase (6.73 KB, application/octet-stream)
2010-07-23 03:20 EDT, Emond Papegaaij CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emond Papegaaij CLA 2010-07-20 04:44:25 EDT
Build Identifier: 

During compilation of our project, we get a '(BCException) Bad type signature: ;'. The ajcore dump is attached to this bug. Unfortunately, I cannot share the project itself.


Reproducible: Always
Comment 1 Emond Papegaaij CLA 2010-07-20 04:45:06 EDT
Created attachment 174714 [details]
Core dump
Comment 2 Andrew Clement CLA 2010-07-20 15:42:15 EDT
From the exception in the dump:


org.aspectj.weaver.BCException: Bad type signature: ;
when weaving type nl.topicus.eduarte.web.pages.shared.RapportageConfiguratiePage$1$1
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=2411 AopXmls=#0
	at org.aspectj.weaver.UnresolvedType.signatureToName(UnresolvedType.java:738)
	at org.aspectj.weaver.UnresolvedType.signatureToName(UnresolvedType.java:704)

looks like that type RapportageConfiguratiePage$1$1 (first anonymous inner of the first anonymous inner of RapportageConfiguratiePage) is referring to a parameterized type and the signature being dealt with is 'unusual' (and not handled properly).  Is that type doing anything unusual with parameterized types?
Comment 3 Emond Papegaaij CLA 2010-07-21 04:56:07 EDT
There is some generics going on there, but nothing unusual. This is the constructor call of that inner type:
new MultiEntityRapportageGenereerLink<R, S, ZF>

With:

public class MultiEntityRapportageGenereerLink
<R extends IdObject, S extends IdObject, ZF extends DetachableZoekFilter<S>>
extends AbstractRapportageGenereerLink

public interface DetachableZoekFilter<T> extends ZoekFilter<T>, IDetachable

public interface ZoekFilter<T>

The main class is declared as:
public class RapportageConfiguratiePage
<R extends IBijlageKoppelEntiteit< ? extends BijlageEntiteit>,
 S extends IdObject, ZF extends DetachableZoekFilter<S>>
extends AbstractDynamicContextPage<Void> implements IEditPage

With:

public interface IBijlageKoppelEntiteit<T extends BijlageEntiteit> extends IdObject


I tried to create a minimal testcase, but cutting down the code seems to fix the problem. I also noticed that continuing the compilation seems to go fine, as if classes are compiled in the wrong order. The dump also seems to indicate this, as the class you mentioned, seems to be compiled before its superclass.
Comment 4 Emond Papegaaij CLA 2010-07-21 10:09:30 EDT
I'm still unable to create a minimal testcase, but I did find some strange behaviour: the bug is only triggered with certain file names. Renaming a class fixes the problem, which is quite strange, because that does not change the structure of the code in any way.
Comment 5 Andrew Clement CLA 2010-07-21 10:50:56 EDT
renaming a type can adjust the ordering in which files are compiled, and that can trigger issues as at different stages of compilation the files are represented by different data structures.
Comment 6 Emond Papegaaij CLA 2010-07-23 03:20:12 EDT
Created attachment 175041 [details]
Minimal showcase

I've finally managed to create a minimal case that still has the bug. It's a small maven project with 2 modules, commons and core. Commons is an aspect library dep of core (which is required to trigger the bug). Commons also contains 1 very simple aspect with a single 'declare error'. Most files in the tarball are empty, but still required to trigger the bug. I hope this helps.
Comment 7 Emond Papegaaij CLA 2010-07-23 03:58:56 EDT
Some more testing revealed that the name of the directory the tarball is extract to matters. On windows, you should extract the tarball to c:\eduarte (so the root pom.xml should be c:\eduarte\pom.xml), on Linux you should extract the tarball to /mnt/sda6/test/eduarte (with the pom.xml /mnt/sda6/test/eduarte/pom.xml). Some other directory names might also trigger the bug, but these are verified on several systems.
Comment 8 Andrew Clement CLA 2010-07-23 12:33:09 EDT
thanks for coming up with the testcase!

The signature that the weaver is choking on is due to the declaration:

Class< ? extends ZoekFilterDataAccessHelperCopy<S, ZoekFilterCopy<S>>>
Comment 9 Emond Papegaaij CLA 2010-07-23 15:39:03 EDT
Great to hear that the time I spent to create the testcase is not wasted and thanks for indicating the location in our code. It was quite to difficult to find the right set of files. It seems like the bug is triggered by a certain ordering of filenames in a hash. Do you have any idea if this can be fixed any time soon? For now, I've removed that method (it wasn't even used), which seems to help, but I'm afraid of hitting this bug in other places of the application. Signatures like that are not unusual in our application.
Comment 10 Andrew Clement CLA 2010-07-23 15:47:13 EDT
yes, things like this can behave differently depending on compile order (there are other routes to coming up with a signature).

I have the fix working for me (it is easy once I could see the failing signature), but I'm looking at making a few tests whilst I'm in that area of the code as the coverage is a bit lacking.
Comment 11 Andrew Clement CLA 2010-07-26 01:29:52 EDT
fix likely to be out this week.  My latest changes are triggering some test failures, but I suspect that means the tests need updating to the new (more correct) behaviour.
Comment 12 Andrew Clement CLA 2010-07-29 23:52:25 EDT
signature changes I want to make for now are in AspectJ (and should address this issue), when the build succeeds I'll try it out in AJDT and if that works, release a new AJDT.
Comment 13 Emond Papegaaij CLA 2010-07-30 02:23:00 EDT
That's good to hear. Is there any way we can use this build from Maven? I couldn't find a snapshot repository for the AspectJ compiler.
Comment 14 Andrew Clement CLA 2010-07-30 11:58:29 EDT
Per the AspectJ 1.6.9 readme:

http://www.eclipse.org/aspectj/doc/released/README-169.html

The snapshot repo is here:

<repository>
    <id>maven.springframework.org</id>
    <name>SpringSource snapshots</name>
    <url>http://maven.springframework.org/snapshot</url>
</repository>

And the build tag is 1.6.10.BUILD-SNAPSHOT

I just published a build there today, if you can confirm whether it fixes your situation that would be great.  It does include some radical changes besides the fix but I wanted to start sorting out the signature handling properly rather than continuing to patch it up.
Comment 15 Emond Papegaaij CLA 2010-07-30 15:41:55 EDT
I've reverted the method to its old signature and checked with 1.6.9 (still fails) and 1.6.10-SNAPSHOT (compiles fine). It seems the bug is fixed and the compiler did not choke on any other method signatures in our project.

Thanks for your very quick fix! We recently triggered a NPE in the Sun Java compiler, which was reported by someone else 1 year ago and still not fixed. We switched to the AspectJ compiler for that project, because it can compile the project.
Comment 16 Emond Papegaaij CLA 2010-08-02 02:39:18 EDT
Is the new AJDT available already? I don't see any updates in eclipse yet, and compilation is failing again due to the reverted signature.
Comment 17 Andrew Clement CLA 2010-08-02 10:53:16 EDT
there are some issues with the AJDT build process, the next build that actually succeeds will contain the changes
Comment 18 Andrew Clement CLA 2010-08-20 10:56:26 EDT
Fixed