Bug 65870

Summary: [1.5] AST creation fails when created with comments
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sburoff
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Martin Aeschlimann CLA 2004-06-05 11:33:37 EDT
Cheetah 20040605

- I changed our code in NewTypeWizardPage.constructCUContent to use the JLS1.5 AST
- Create a new type -> UnsupportedOperationException
- the 'setComment' code can probbably be skipped (commented out) as also
getComment is not available anymore


Caused by: java.lang.UnsupportedOperationException: Operation only supported in
JLS2 AST
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java:73)
	at org.eclipse.jdt.core.dom.ASTNode.supportedOnlyIn2(ASTNode.java:1775)
	at org.eclipse.jdt.core.dom.Javadoc.setComment(Javadoc.java:235)
	at org.eclipse.jdt.core.dom.DocCommentParser.setComment(DocCommentParser.java:74)
	at org.eclipse.jdt.core.dom.DocCommentParser.parse(DocCommentParser.java:63)
	at org.eclipse.jdt.core.dom.DocCommentParser.parse(DocCommentParser.java:49)
	at org.eclipse.jdt.core.dom.ASTConverter.createComment(ASTConverter.java:2333)
	at org.eclipse.jdt.core.dom.ASTConverter.buildCommentsTable(ASTConverter.java:233)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:941)
	at org.eclipse.jdt.core.dom.ASTParser.convert(ASTParser.java:719)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:678)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at
org.eclipse.jdt.ui.wizards.NewTypeWizardPage.constructCUContent(NewTypeWizardPage.java:1583)
	at
org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1443)
	at
org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.finishPage(NewClassCreationWizard.java:55)
	at
org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:108)
	at
org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1673)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3312)
	at
org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:65)
	at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
Comment 1 Olivier Thomann CLA 2004-06-07 10:18:43 EDT
We should call the setComment(...) only if the astLevel is JLS2. For the
getComment(), there is nothing we can do.
All calls to getComment() are protected by checking that JLS level is JLS2.
Comment 2 Olivier Thomann CLA 2004-06-07 12:12:30 EDT
This will be fixed in the 1.5 stream only.
Comment 3 Olivier Thomann CLA 2004-06-07 13:35:20 EDT
Fixed and released in 1.5 stream
Comment 4 Luc Bourlier CLA 2004-06-10 13:26:14 EDT
*** Bug 66152 has been marked as a duplicate of this bug. ***