Bug 259397 - Pasting AspectJ code snippets directly into a project doesn't work
Summary: Pasting AspectJ code snippets directly into a project doesn't work
Status: NEW
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 1.6.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-19 13:18 EST by Andrew Clement CLA
Modified: 2010-04-28 19:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2008-12-19 13:18:50 EST
If I copy this code to the clipboard:

package p;
class C {}

and paste it directly onto a selected AspectJ project, I get a package p created with a new file C.java inside.

If I copy this code to the clipboard:

package p;
aspect A {}

I get a package called snippet with a file Snippet.java created:

---
package snippet;

public class Snippet {
	public static void main(String[] args) {
		package p;
		aspect A {}
	}
}
---

Presumably it failed to correctly interpret what I was pasting in so guessed at it being just a snippet of code (this snippet behaviour is what happens if I paste something incomplete in, like simply "i=5;")
Comment 1 Andrew Eisenberg CLA 2008-12-19 14:11:23 EST
Yup.  This is a problem.  

Probably won't make it into 1.6.2 final, but I'll take a look at it and if this is easy to fix, then I will.
Comment 2 Andrew Eisenberg CLA 2009-02-06 16:48:33 EST
The problem is in o.e.jdt.internal.ui.refactoring.reorg.PasteAction.TextPaster.ParsedCu.parseCus.

This method takes a bunch of text and attempts to parse it into a compilation unit.  But it is using a Java parser and so it fails when there is AJ text in it.

The only way around this, as I see it, would be to advise this method and use an AJ parser instead.
Comment 3 Andrew Eisenberg CLA 2009-09-30 14:36:52 EDT
Move to the 2.0.2 release.
Comment 4 Andrew Eisenberg CLA 2010-04-28 19:20:17 EDT
No longer slated for the next release.