Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Create a field private Set<TargetEntity> ref; and map it as an association field (OneToOne, OneTomany, ManyToOne or ManyToMany) 2. Set the FetchType to a non-default value in JPA Details view. 3. Select any of the CascadeType options in JPA Details view => The cascade type definition is not added to the annotation in the Java file but the toggle in the JPA Details view is selected. The following exception is listed in the ErrorLog view: eclipse.buildId=I20080617-2000 java.version=1.6.0_06 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_CH Framework arguments: -showlocation Command-line arguments: -os win32 -ws win32 -arch x86 -data D:\Daten\eclipse34\Test\workspace -showlocation Error Sun Jul 20 09:41:00 CEST 2008 Unhandled event loop exception org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:111) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:97) at org.eclipse.text.edits.TextEdit.<init>(TextEdit.java:148) at org.eclipse.text.edits.ReplaceEdit.<init>(ReplaceEdit.java:36) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.shifEdit(ASTRewriteFormatter.java:375) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.shifEdit(ASTRewriteFormatter.java:389) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatNode(ASTRewriteFormatter.java:366) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.getFormattedResult(ASTRewriteFormatter.java:184) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doTextInsert(ASTRewriteAnalyzer.java:1021) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:501) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:435) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteNodeList(ASTRewriteAnalyzer.java:926) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:3208) at org.eclipse.jdt.core.dom.NormalAnnotation.accept0(NormalAnnotation.java:163) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisit(ASTRewriteAnalyzer.java:290) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisitList(ASTRewriteAnalyzer.java:328) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:322) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:335) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2005) at org.eclipse.jdt.core.dom.FieldDeclaration.accept0(FieldDeclaration.java:279) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisit(ASTRewriteAnalyzer.java:290) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisitList(ASTRewriteAnalyzer.java:328) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:322) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:335) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1334) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:467) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisit(ASTRewriteAnalyzer.java:290) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisitList(ASTRewriteAnalyzer.java:328) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:322) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:335) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1314) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:209) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478) at org.eclipse.jdt.core.dom.InternalASTRewrite.rewriteAST(InternalASTRewrite.java:93) at org.eclipse.jdt.core.dom.AST.rewrite(AST.java:2860) at org.eclipse.jdt.core.dom.CompilationUnit.rewrite(CompilationUnit.java:906) at org.eclipse.jpt.core.internal.utility.jdt.JDTMember.edit_(JDTMember.java:176) at org.eclipse.jpt.core.internal.utility.jdt.JDTMember.edit(JDTMember.java:142) at org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter.edit(MemberAnnotationElementAdapter.java:71) at org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter.setValue(MemberAnnotationElementAdapter.java:51) at org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter.setValue(ShortCircuitAnnotationElementAdapter.java:91) at org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter.setValue(ShortCircuitAnnotationElementAdapter.java:54) at org.eclipse.jpt.core.internal.resource.java.AbstractRelationshipMappingAnnotation.setCascadeTypes(AbstractRelationshipMappingAnnotation.java:229) at org.eclipse.jpt.core.internal.resource.java.AbstractRelationshipMappingAnnotation.setCascade(AbstractRelationshipMappingAnnotation.java:246) at org.eclipse.jpt.core.internal.resource.java.AbstractRelationshipMappingAnnotation.setCascadeAll(AbstractRelationshipMappingAnnotation.java:167) at org.eclipse.jpt.core.internal.context.java.JavaCascade.setAll(JavaCascade.java:43) at org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite$1.setValue_(CascadeComposite.java:83) at org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite$1.setValue_(CascadeComposite.java:1) at org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter.setValue(PropertyAspectAdapter.java:152) at org.eclipse.jpt.ui.internal.swt.BooleanButtonModelAdapter.buttonSelected(BooleanButtonModelAdapter.java:195) at org.eclipse.jpt.ui.internal.swt.BooleanButtonModelAdapter$2.widgetSelected(BooleanButtonModelAdapter.java:140) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) A similar exception also occurs if you change the sequence of modifications and you first check one of the toggles for the CascadeType and after that you try to set the FetchType to a non-default value. Always the second modification is not replcted in the Java source file and leed to an exception added to the error log.
The same prolem can also be reproduced with setting the optional flag to a non-default value and either setting the FetchType or CascadeType. It seems that as soon as one annotation attribute has been set no second attribute can be set anymore in the same annotation.
With a simple use case I am not able to reproduce this. Could you attach an entire file that shows this issue? It seems like a strange one, and not one others have reported.
Created attachment 107885 [details] Project I could reproduce the problem with as javax.persistence provider I used ejb3-persistence.jar from Hibernate Annotations 3.3
Hi, could you try opening this project in a new clean workspace? I am still unable to reproduce this problem. It really appears that it is a JDT bug(since the exception occurs in JDT code) and maybe there is some preference you have set that is causing the problem.
You were right. With a new workspace everything works fine. I also found the problem and could fix all my other workspaces. It was a code formatting template i once created with Eclipse 3.3. As soon as i activated it, the exceptions apeared. After i have recreated this formatter based on an Eclipse 3.4 built-in formatter i had no problems anymore. This also solved the problems i reported with Bug# 241472!!! Thanks for help
Glad to hear you fixed the problem, closing this bug
I run again into the same problem. It happens, if in a Java formatter definition on the 'New Llines' tab in the section 'Insert new line' the toggle 'in empty class body' is NOT checked. As soon as i check this button, everything is working fine. All the other check buttons do not seem to have any influence on the behaviour of the JPA Details view.
Reassigning to JDT, will attach a test project that shows the problem. If you are inserting annotation values in source, setting the JDT preference FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION to false causes the annotation value pair not to be inserted. In my test project I start with a field with the annotation @Basic(fetch=FetchType.EAGER). I am trying to add the member value pair optional=true. The exception shown in comment #1 is hit and the member value pair is not added.
Created attachment 110265 [details] test project - one failing test
Reproduced. I'll investigate.
David, The bug might actually come from the code formatter that returns too many edits.
*** This bug has been marked as a duplicate of bug 234583 ***
Verified for 3.5M2 using I20080914-2000 and test project from comment 9