Community
Participate
Working Groups
Steps to reproduce: 1. Install a J2EE 1.4-compatible server, such as JOnAS, JBoss or WebSphere 2. Add the server in Window -> Preferences -> Server -> Runtime Environments 3. Install the XDoclet support (1.2.1, 1.2.2 or 1.2.3) 4. Add the XDoclet support in Window -> Preferences -> Java EE -> XDoclet 5. Expand the XDoclet node and configure the ejbdoclet and webdoclet support for your installed server(s). 6. Create an EJB 2.1 project 6.1. Target it at the installed J2EE server 6.2. Choose "EJB Project with XDoclet" from Configurations 6.3. Choose "Add project to an EAR" and choose the previously created EAR project 6.4. Create a new XDoclet Enterprise JavaBean choose Session Bean as a type enter "test" for Java package Result: Bean file has no content at all. Exception in error log: eclipse.buildId=4.4.0.I20140515-1230 java.version=1.7.0_45 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86_64 org.eclipse.jst.j2ee.ejb.annotation.model Error Thu May 22 19:26:03 EEST 2014 Operation only supported in JLS8 and later AST java.lang.UnsupportedOperationException: Operation only supported in JLS8 and later AST at org.eclipse.jdt.core.dom.ASTNode.unsupportedIn2_3_4(ASTNode.java:1968) at org.eclipse.jdt.core.dom.AnnotatableType.annotations(AnnotatableType.java:99) at org.eclipse.jdt.internal.corext.codemanipulation.ImportReferencesCollector.visit(ImportReferencesCollector.java:203) at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:197) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:469) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:212) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.internal.corext.codemanipulation.ImportReferencesCollector.collect(ImportReferencesCollector.java:68) at org.eclipse.jdt.internal.corext.codemanipulation.ImportReferencesCollector.collect(ImportReferencesCollector.java:62) at org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext.getImportedNames(ContextSensitiveImportRewriteContext.java:226) at org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext.findInContext(ContextSensitiveImportRewriteContext.java:99) at org.eclipse.jdt.core.dom.rewrite.ImportRewrite.internalAddImport(ImportRewrite.java:941) at org.eclipse.jdt.core.dom.rewrite.ImportRewrite.addImport(ImportRewrite.java:639) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createThrownExceptions(StubUtility2.java:509) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createImplementationStub(StubUtility2.java:349) at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createImplementationStub(StubUtility2.java:315) at org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation.run(AddUnimplementedMethodsOperation.java:213) at org.eclipse.jst.j2ee.ejb.annotations.internal.classgen.EjbBuilder.createInheritedMethods(EjbBuilder.java:221) at org.eclipse.jst.j2ee.ejb.annotations.internal.classgen.EjbBuilder.createType(EjbBuilder.java:144) at org.eclipse.jst.j2ee.ejb.annotations.internal.xdoclet.provider.XDocletAnnotationProvider.generateSession(XDocletAnnotationProvider.java:130) at org.eclipse.jst.j2ee.ejb.annotation.internal.operations.AddSessionBeanOperation.execute(AddSessionBeanOperation.java:39) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207) at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1CatchThrowableRunnableWithProgress.run(DataModelWizard.java:220) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Hi Dimitar - was this a recent regression? I must admit - I don't test the xdoclet very often.
It would be good to see if this scenario worked in Luna RC1. I tracked some of the code in JDT, and all the changes I saw are from early 2013.
How do you create the AST that you pass into AddUnimplementedMethodsOperation? If you use AST.JLS<something> then you should replace it with AST.JLS8 (in all your code), even if the problem might be a bug in JDT Core (will have to investigate).
It really looks like a bug in JDT Core. Please wait for further instructions.
The bug is actually in JDT UI. org.eclipse.jdt.ui.actions.OverrideMethodsAction#createRunnable(..) is a legal way to create an AddUnimplementedMethodsOperation, and there's no restriction on the AST level there. Most of JDT UI only uses the latest AST level, but in this case, we have to support older levels as well. I've opened bug 435571 as a blocker of this bug. JDT UI will provide a fix in 4.4 RC3. Nevertheless, it would be advisable for WTP to switch to AST.JLS8, since you won't see Java 8 features in older levels, and rewrites of Java 8 code will likely be invalid.
(In reply to Roberto Sanchez Herrera from comment #2) > It would be good to see if this scenario worked in Luna RC1. The git history may be hard to understand since we merged branch BETA_JAVA8 into master between Eclipse SDK 4.4 M6 and M7. The problematic code in ImportReferencesCollector was first published in an official milestone in 4.4 M7 aka Luna RC0. I've attached a patch to bug 435571. Feedback on that would be very welcome.
(In reply to Chuck Bridgham from comment #1) > Hi Dimitar - was this a recent regression? I must admit - I don't test the > xdoclet very often. I am not sure when exactly, the last I have tested I had to use Eclipse SDK M6, since the current one had some test failures.
(In reply to Markus Keller from comment #5) > Nevertheless, it would be advisable for WTP to switch to AST.JLS8, since you > won't see Java 8 features in older levels, and rewrites of Java 8 code will > likely be invalid. Just to clarify: For Luna, it's probably too late to switch WTP to JLS8. By switching to JLS8, the ASTs will contain new kinds of ASTNodes, and deprecated APIs of concrete ASTNode classes will throw exceptions. E.g. calls to ArrayType#get/setComponentType(..) only work in JLS4 and earlier, but need to be replaced with ArrayType#get/setElementType(..) and ArrayType#dimensions() in JLS8 and later.
Please verify the fix for bug 435571 in http://download.eclipse.org/eclipse/downloads/drops4/S-4.4RC3-201405282000/ The final Eclipse SDK build is this Wednesday, so any follow-up problems would have to be reported and fixed right away.
Yep, the fix works Thanks