Bug 329833 - Replace DefaultTypePattern nodes with new AspectJ TypePattern nodes
Summary: Replace DefaultTypePattern nodes with new AspectJ TypePattern nodes
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 2.1.2   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 12:24 EST by Nieraj Singh CLA
Modified: 2010-11-23 16:31 EST (History)
1 user (show)

See Also:


Attachments
Minimal changes to AJDT to support AspectJ feature 329268 (12.82 KB, patch)
2010-11-14 19:51 EST, Nieraj Singh CLA
andrew.eisenberg: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nieraj Singh CLA 2010-11-09 12:24:31 EST
Build Identifier: I20100608-0911


The following AspectJ feature, 329268, introduces new types of TypePattern nodes. As AJDT still relies on DefaultTypePattern which the AspectJ feature no longer generates, AJDT must be updated to support the new type of TypePattern nodes.

AJDT breaks if the AspectJ feature is used, as AJDT is expecting DefaultTypePatterns, and due to this in certain places in AJSourceIndexerRequestor, ClassCastExceptions are thrown. AJDT should be swept to remove DefaultTypePattern and replace them with appropriate TypePattern nodes.

Example of where AJDT breaks with the TypePattern AspectJ feature:


java.lang.ClassCastException: org.aspectj.org.eclipse.jdt.core.dom.WildTypePattern cannot be cast to org.aspectj.org.eclipse.jdt.core.dom.DefaultTypePattern
at org.eclipse.ajdt.core.codeconversion.AJSourceIndexerRequestor.enterField(AJSourceIndexerRequestor.java:77)
at org.eclipse.jdt.internal.compiler.SourceElementNotifier.notifySourceElementRequestor(SourceElementNotifier.java:506)
at org.eclipse.jdt.internal.compiler.SourceElementNotifier.notifySourceElementRequestor(SourceElementNotifier.java:670)
at org.eclipse.jdt.internal.compiler.SourceElementNotifier.notifySourceElementRequestor(SourceElementNotifier.java:439)
at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:921)
at org.codehaus.jdt.groovy.integration.internal.MultiplexingIndexingParser.parseCompilationUnit(MultiplexingIndexingParser.java:83)
at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:68)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:72)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:466)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java:866)
at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:404)
at java.lang.Thread.run(Thread.java:619)




Reproducible: Always

Steps to Reproduce:
1. With the AspectJ patch from 329268 applied and built, in a runtime workbench create a new aspect:
public aspect AJTest {

	declare parents : Foo extends Bar;

	class Foo {
	}

	
	class Bar {
	}

}

2. Save it to compile.
3. ClassCastExcception thrown in AJSourceIndexerRequestor
Comment 1 Nieraj Singh CLA 2010-11-14 19:51:49 EST
Created attachment 183099 [details]
Minimal changes to AJDT to support AspectJ feature 329268

This patch contains bare minimum changes to AJDT to support new TypePattern nodes as defined in the AspectJ feature 329268, as well as some NPE fixes that occur in ExtraTypeReferenceFinder when searching for types.

This patch should only be applied after AspectJ feature 329268 has been committed to the AspectJ build. 

This patch only contains support for TypePattern nodes that contain identifiers, as well as AnyWithAnnotationTypePattern and TypeCategoryTypePattern. Additional visitor methods need to be implemented to handle the other new type pattern nodes in AJSourceIndexerRequestor.
Comment 2 Andrew Eisenberg CLA 2010-11-23 16:27:18 EST
Thanks for the patch  It has been applied.  I will be committing it shortly.
Comment 3 Andrew Eisenberg CLA 2010-11-23 16:28:24 EST
Comment on attachment 183099 [details]
Minimal changes to AJDT to support AspectJ feature 329268

iplog
Comment 4 Andrew Eisenberg CLA 2010-11-23 16:29:28 EST
Patch looks good.  Next step is to refactor AJDT so that it uses the enhance AspectJ ast nodes as described in bug 329268.