Template with Import > New Class Exception

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Template with Import > New Class Exception

Jayet, Patrick
Hi all,

I have noticed a problem in 2.1.0 with respect to code templates. This makes the creation of a groovy class impossible (with the corresponding wizard), if there is an import statement (any import) in the template 'New Java Files' (current mechanism available for templating IMO).

Here is a test case:
1. Fresh install of Eclipse 3.6.1 with Greclipse 2.1.0 (or dev build for 3.6)
2. Add an import statement (e.g. 'import java.lang.*'):
  - 'Preferences' > 'Java' > 'Code Style' > 'Code Templates'
  - Edit template under 'Code' and 'New Java files'
  - add the import statement
3. New Groovy project, then new Groovy class

We get an error dialog 'Creation of element failed. See error log for more details'. See the stack trace below.

Is this a known problem? Is there a fix or patch for that, which I can use upon 2.1.0? (That's a blocker for me ATM).

Thanks in advance.
Cheers,

Patrick

---
Root exception:
java.lang.IllegalArgumentException
 at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2617)
 at org.eclipse.jdt.core.dom.ASTConverter.setQualifiedNameNameAndSourceRanges(ASTConverter.java:4949)
 at org.eclipse.jdt.core.dom.ASTConverter.convertImport(ASTConverter.java:2885)
 at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1326)
 at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:291)
 at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1201)
 at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createASTForImports(NewTypeWizardPage.java:2112)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1978)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizardPage.createType(NewClassWizardPage.java:111)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizard.finishPage(NewClassWizard.java:64)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Template with Import > New Class Exception

Andrew Eisenberg
No, I have not seen this before.  I just briefly tried to reproduce this and could not.  However, my setup isn't exactly the same as yours, so I'll try again.

In the meantime, you can create a Java class, and then convert it to Groovy: "Alt-J G"  or Right-click -> Groovy -> Convert to Groovy File Extension.

On Fri, Nov 12, 2010 at 9:26 AM, Jayet, Patrick <[hidden email]> wrote:
Hi all,

I have noticed a problem in 2.1.0 with respect to code templates. This makes the creation of a groovy class impossible (with the corresponding wizard), if there is an import statement (any import) in the template 'New Java Files' (current mechanism available for templating IMO).

Here is a test case:
1. Fresh install of Eclipse 3.6.1 with Greclipse 2.1.0 (or dev build for 3.6)
2. Add an import statement (e.g. 'import java.lang.*'):
 - 'Preferences' > 'Java' > 'Code Style' > 'Code Templates'
 - Edit template under 'Code' and 'New Java files'
 - add the import statement
3. New Groovy project, then new Groovy class

We get an error dialog 'Creation of element failed. See error log for more details'. See the stack trace below.

Is this a known problem? Is there a fix or patch for that, which I can use upon 2.1.0? (That's a blocker for me ATM).

Thanks in advance.
Cheers,

Patrick

---
Root exception:
java.lang.IllegalArgumentException
 at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2617)
 at org.eclipse.jdt.core.dom.ASTConverter.setQualifiedNameNameAndSourceRanges(ASTConverter.java:4949)
 at org.eclipse.jdt.core.dom.ASTConverter.convertImport(ASTConverter.java:2885)
 at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1326)
 at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:291)
 at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1201)
 at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createASTForImports(NewTypeWizardPage.java:2112)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1978)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizardPage.createType(NewClassWizardPage.java:111)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizard.finishPage(NewClassWizard.java:64)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Template with Import > New Class Exception

Andrew Eisenberg
Interesting...I am now getting the exception, but only on a new and empty project. To track, I created:
http://jira.codehaus.org/browse/GRECLIPSE-887

On Fri, Nov 12, 2010 at 10:10 AM, Andrew Eisenberg <[hidden email]> wrote:
No, I have not seen this before.  I just briefly tried to reproduce this and could not.  However, my setup isn't exactly the same as yours, so I'll try again.

In the meantime, you can create a Java class, and then convert it to Groovy: "Alt-J G"  or Right-click -> Groovy -> Convert to Groovy File Extension.


On Fri, Nov 12, 2010 at 9:26 AM, Jayet, Patrick <[hidden email]> wrote:
Hi all,

I have noticed a problem in 2.1.0 with respect to code templates. This makes the creation of a groovy class impossible (with the corresponding wizard), if there is an import statement (any import) in the template 'New Java Files' (current mechanism available for templating IMO).

Here is a test case:
1. Fresh install of Eclipse 3.6.1 with Greclipse 2.1.0 (or dev build for 3.6)
2. Add an import statement (e.g. 'import java.lang.*'):
 - 'Preferences' > 'Java' > 'Code Style' > 'Code Templates'
 - Edit template under 'Code' and 'New Java files'
 - add the import statement
3. New Groovy project, then new Groovy class

We get an error dialog 'Creation of element failed. See error log for more details'. See the stack trace below.

Is this a known problem? Is there a fix or patch for that, which I can use upon 2.1.0? (That's a blocker for me ATM).

Thanks in advance.
Cheers,

Patrick

---
Root exception:
java.lang.IllegalArgumentException
 at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2617)
 at org.eclipse.jdt.core.dom.ASTConverter.setQualifiedNameNameAndSourceRanges(ASTConverter.java:4949)
 at org.eclipse.jdt.core.dom.ASTConverter.convertImport(ASTConverter.java:2885)
 at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1326)
 at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:291)
 at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1201)
 at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createASTForImports(NewTypeWizardPage.java:2112)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1978)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizardPage.createType(NewClassWizardPage.java:111)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizard.finishPage(NewClassWizard.java:64)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Template with Import > New Class Exception

Andrew Eisenberg
BTW- this problem only happens when in the default package.

On Fri, Nov 12, 2010 at 10:32 AM, Andrew Eisenberg <[hidden email]> wrote:
Interesting...I am now getting the exception, but only on a new and empty project. To track, I created:
http://jira.codehaus.org/browse/GRECLIPSE-887


On Fri, Nov 12, 2010 at 10:10 AM, Andrew Eisenberg <[hidden email]> wrote:
No, I have not seen this before.  I just briefly tried to reproduce this and could not.  However, my setup isn't exactly the same as yours, so I'll try again.

In the meantime, you can create a Java class, and then convert it to Groovy: "Alt-J G"  or Right-click -> Groovy -> Convert to Groovy File Extension.


On Fri, Nov 12, 2010 at 9:26 AM, Jayet, Patrick <[hidden email]> wrote:
Hi all,

I have noticed a problem in 2.1.0 with respect to code templates. This makes the creation of a groovy class impossible (with the corresponding wizard), if there is an import statement (any import) in the template 'New Java Files' (current mechanism available for templating IMO).

Here is a test case:
1. Fresh install of Eclipse 3.6.1 with Greclipse 2.1.0 (or dev build for 3.6)
2. Add an import statement (e.g. 'import java.lang.*'):
 - 'Preferences' > 'Java' > 'Code Style' > 'Code Templates'
 - Edit template under 'Code' and 'New Java files'
 - add the import statement
3. New Groovy project, then new Groovy class

We get an error dialog 'Creation of element failed. See error log for more details'. See the stack trace below.

Is this a known problem? Is there a fix or patch for that, which I can use upon 2.1.0? (That's a blocker for me ATM).

Thanks in advance.
Cheers,

Patrick

---
Root exception:
java.lang.IllegalArgumentException
 at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2617)
 at org.eclipse.jdt.core.dom.ASTConverter.setQualifiedNameNameAndSourceRanges(ASTConverter.java:4949)
 at org.eclipse.jdt.core.dom.ASTConverter.convertImport(ASTConverter.java:2885)
 at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1326)
 at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:291)
 at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1201)
 at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createASTForImports(NewTypeWizardPage.java:2112)
 at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1978)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizardPage.createType(NewClassWizardPage.java:111)
 at org.codehaus.groovy.eclipse.wizards.NewClassWizard.finishPage(NewClassWizard.java:64)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





Reply | Threaded
Open this post in threaded view
|

AW: [groovy-eclipse-plugin-user] Template with Import > New Class Exception

Jayet, Patrick
Hi Andrew,

Yes, you are right. (At least on mac), that problem occurs for the default package (although I can remember testing that on Windows with different results, cannot check it right now though).

Thanks for the fix. When is the release 2.1.1 hitting the shelves? Otherwise I'll have to backport the fix to 2.1.0.

Have a nice day.
Cheers,

Patrick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Template with Import > New Class Exception

Andrew Eisenberg
We're expecting to release 2.1.1 in late December or early January.  However, you can get a snapshot release now from 



On Mon, Nov 15, 2010 at 12:48 AM, Jayet, Patrick <[hidden email]> wrote:
Hi Andrew,

Yes, you are right. (At least on mac), that problem occurs for the default package (although I can remember testing that on Windows with different results, cannot check it right now though).

Thanks for the fix. When is the release 2.1.1 hitting the shelves? Otherwise I'll have to backport the fix to 2.1.0.

Have a nice day.
Cheers,

Patrick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email