Community
Participate
Working Groups
Using 0214, Take the file attached to this message and try to delete all fields. The delete operation is called for each field instead of calling the delete operation for all fields at the same time. At least this operation should be batched. The bug 32111 has been reported for a bug in JDT/Core. This bug will be fixed today. So if you take our head you should be able to run the operation without getting an error.
Created attachment 3550 [details] Use the source files in this zip file Test case.
SourceReferenceAction.run should perform the action inside a workspace runnable passed tio JavaCore.run().
my test case: class A{ int w1; int w2; } calling ISourceReference.delete on the 2 fields inside 1 JavaCore.run batch sends out 1 delta [Working copy] A.java[*]: {CHILDREN | FINE GRAINED} A[*]: {CHILDREN | FINE GRAINED} w2[-]: {} although both elements are deleted from the source please comment on that
This is what I get with the test case I submitted: FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} TypeRelated[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} FieldRelated[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} MethodRelated[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} ConstructorRelated[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} ImportRelated[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} Internal[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} Syntax[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} IgnoreCategoriesMask[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} Unclassified[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} ObjectHasNoSuperclass[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} UndefinedType[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} NotVisibleType[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} AmbiguousType[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 -------------------------------------------------------------------------------- --------------------------------------- FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} UsingDeprecatedType[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@11adeb 7 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener @5e9f1 The outliner is refreshed after each deletion. The reconcile is called too many times. Why this operation doesn't use the IJavaModel.delete method? All deleted fields appear in the deltas.
Hacking the code to replace the delete calls on each field with a IJavaModel.delete gives the following deltas: FIRING PRE_AUTO_BUILD Delta [Thread[main,5,main]]: <NONE> FIRING POST_CHANGE Delta [Thread[main,5,main]]: <NONE> FIRING POST_RECONCILE Delta [Thread[main,5,main]]: [Working copy] IProblem.java[*]: {CHILDREN | FINE GRAINED} IProblem[*]: {CHILDREN | FINE GRAINED} UnreachableCatch[-]: {} DuplicateModifierForVariable[-]: {} CannotImportPackage[-]: {} InterfaceCannotHaveInitializers[-]: {} ReturnTypeInheritedNameHidesEnclosingName[-]: {} InvalidBreak[-]: {} CannotDefineStaticInitializerInLocalType[-]: {} ExceptionTypeAmbiguous[-]: {} VoidMethodReturnsValue[-]: {} UndefinedLabel[-]: {} TooManyFields[-]: {} MethodRequiresBody[-]: {} ArgumentTypeCannotBeVoidArray[-]: {} InvalidCharacterConstant[-]: {} ClassExtendFinalClass[-]: {} ArrayConstantsOnlyInArrayInitializers[-]: {} IsClassPathCorrect[-]: {} UnusedPrivateField[-]: {} DuplicateNestedType[-]: {} CannotThrowNull[-]: {} InvalidOctal[-]: {} ObjectHasNoSuperclass[-]: {} DuplicateCase[-]: {} OverridingDeprecatedMethod[-]: {} InvalidTypeToSynchronized[-]: {} ArgumentIsNeverUsed[-]: {} NotVisibleConstructorInImplicitConstructorCall[-]: {} InheritedFieldHidesEnclosingName[-]: {} IncompatibleExceptionInThrowsClause[-]: {} ArrayReferenceRequired[-]: {} HierarchyHasProblems[-]: {} BytecodeExceeds64KLimitForConstructor[-]: {} ExpressionShouldBeAVariable[-]: {} ThisSuperDuringConstructorInvocation[-]: {} UnhandledException[-]: {} IllegalModifierForArgument[-]: {} IllegalModifierForField[-]: {} UnhandledExceptionInDefaultConstructor[-]: {} TooManyArgumentSlots[-]: {} IllegalVisibilityModifierCombinationForMemberType[-]: {} DuplicateMethod[-]: {} NoImplicitStringConversionForCharArrayExpression[-]: {} ThisInStaticContext[-]: {} MethodReducesVisibility[-]: {} SuperclassNotFound[-]: {} AmbiguousConstructorInImplicitConstructorCall[-]: {} IllegalModifierForLocalClass[-]: {} NativeMethodsCannotBeStrictfp[-]: {} UsingDeprecatedConstructor[-]: {} AmbiguousField[-]: {} SuperclassInternalNameProvided[-]: {} NotVisibleMethod[-]: {} DuplicateBlankFinalFieldInitialization[-]: {} InterfaceNotFound[-]: {} NonStaticAccessToStaticField[-]: {} ReturnTypeInternalNameProvided[-]: {} IllegalVisibilityModifierForInterfaceMemberType[-]: {} ConflictingImport[-]: {} ExceptionTypeNotVisible[-]: {} OuterLocalMustBeFinal[-]: {} TypeRelated[-]: {} VariableTypeCannotBeVoidArray[-]: {} IllegalModifierForVariable[-]: {} InterfaceInheritedNameHidesEnclosingName[-]: {} InstanceMethodDuringConstructorInvocation[-]: {} ReturnTypeAmbiguous[-]: {} ParsingErrorOnKeyword[-]: {} IllegalModifierCombinationFinalVolatileForField[-]: {} CannotThrowType[-]: {} UnusedPrivateMethod[-]: {} ArgumentTypeNotVisible[-]: {} InvalidTypeExpression[-]: {} ArgumentTypeAmbiguous[-]: {} ImportNotFound[-]: {} NeedToEmulateFieldWriteAccess[-]: {} EndOfSource[-]: {} InvalidUnicodeEscape[-]: {} IllegalEnclosingInstanceSpecification[-]: {} IllegalModifierForClass[-]: {} CodeSnippetMissingMethod[-]: {} ReturnTypeNotFound[-]: {} UnexpectedStaticModifierForField[-]: {} InvalidOperator[-]: {} DuplicateModifierForMethod[-]: {} NotVisibleConstructorInDefaultConstructor[-]: {} UndefinedName[-]: {} Syntax[-]: {} IllegalModifierForMemberInterface[-]: {} NoMessageSendOnArrayType[-]: {} CannotDefineInterfaceInLocalType[-]: {} InterfaceCannotHaveConstructors[-]: {} PackageCollidesWithType[-]: {} Unclassified[-]: {} AbstractMethodCannotBeOverridden[-]: {} ExceptionTypeNotFound[-]: {} InvalidUnaryExpression[-]: {} DuplicateFinalLocalInitialization[-]: {} UndefinedType[-]: {} UndefinedConstructorInImplicitConstructorCall[-]: {} IllegalPrimitiveOrArrayTypeForEnclosingInstance[-]: {} MustSpecifyPackage[-]: {} CannotUseSuperInCodeSnippet[-]: {} AmbiguousConstructor[-]: {} TooManyConstantsInConstantPool[-]: {} NeedToEmulateFieldReadAccess[-]: {} NeedToEmulateMethodAccess[-]: {} MethodButWithConstructorName[-]: {} AmbiguousMethod[-]: {} UseAssertAsAnIdentifier[-]: {} NonStaticAccessToStaticMethod[-]: {} FieldTypeNotVisible[-]: {} DuplicateDefaultCase[-]: {} UndefinedConstructorInDefaultConstructor[-]: {} InvalidEscape[-]: {} UnterminatedComment[-]: {} DirectInvocationOfAbstractMethod[-]: {} Task[-]: {} InvalidParenthesizedExpression[-]: {} IllegalStaticModifierForMemberType[-]: {} NonBlankFinalLocalAssignment[-]: {} IncompatibleReturnTypeForNonInheritedInterfaceMethod[-]: {} SuperclassMustBeAClass[-]: {} UndefinedMethod[-]: {} TooManyMethods[-]: {} NotVisibleConstructor[-]: {} NotVisibleField[-]: {} ImportInheritedNameHidesEnclosingName[-]: {} NeedToEmulateConstructorAccess[-]: {} SuperclassAmbiguous[-]: {} ImportInternalNameProvided[-]: {} MissingSemiColon[-]: {} ParsingError[-]: {} NumericValueOutOfRange[-]: {} TypeCollidesWithPackage[-]: {} CodeCannotBeReached[-]: {} FieldTypeAmbiguous[-]: {} FinalFieldAssignment[-]: {} InvalidClassInstantiation[-]: {} InvalidExpressionAsStatement[-]: {} IllegalVisibilityModifierCombinationForMethod[-]: {} SuperclassInheritedNameHidesEnclosingName[-]: {} AmbiguousConstructorInDefaultConstructor[-]: {} IncompatibleTypesInEqualityOperator[-]: {} MaskedCatch[-]: {} BytecodeExceeds64KLimit[-]: {} InitializerMustCompleteNormally[-]: {} ConstructorRelated[-]: {} ArgumentTypeInternalNameProvided[-]: {} FieldTypeInheritedNameHidesEnclosingName[-]: {} UninitializedLocalVariable[-]: {} IncorrectEnclosingInstanceReference[-]: {} ExceptionTypeInternalNameProvided[-]: {} FieldTypeInternalNameProvided[-]: {} MissingReturnType[-]: {} DuplicateSuperInterface[-]: {} UninitializedBlankFinalField[-]: {} HierarchyCircularitySelfReference[-]: {} MustDefineEitherDimensionExpressionsOrInitializer[-]: {} NonStaticFieldFromStaticInvocation[-]: {} UsingDeprecatedType[-]: {} ImportRelated[-]: {} UnusedPrivateConstructor[-]: {} DuplicateModifierForArgument[-]: {} HierarchyCircularity[-]: {} MissingEnclosingInstance[-]: {} InvalidVoidExpression[-]: {} CannotHideAnInstanceMethodWithAStaticMethod[-]: {} OverridingNonVisibleMethod[-]: {} NoFieldOnBaseType[-]: {} VariableTypeCannotBeVoid[-]: {} CannotAllocateVoidArray[-]: {} IllegalModifierForMethod[-]: {} UndefinedField[-]: {} RedefinedLocal[-]: {} InvalidContinue[-]: {} InheritedMethodHidesEnclosingName[-]: {} InvalidInput[-]: {} StaticInheritedMethodConflicts[-]: {} IncompatibleTypesInConditionalOperator[-]: {} BytecodeExceeds64KLimitForClinit[-]: {} IllegalModifierForInterfaceField[-]: {} UnexpectedStaticModifierForMethod[-]: {} ParsingErrorNoSuggestion[-]: {} InvalidFloat[-]: {} ObjectCannotHaveSuperTypes[-]: {} UnhandledExceptionInImplicitConstructorCall[-]: {} InterfaceNotVisible[-]: {} TooManyLocalVariableSlots[-]: {} InheritedMethodReducesVisibility[-]: {} SuperclassNotVisible[-]: {} MethodRelated[-]: {} IllegalCast[-]: {} ShouldReturnValue[-]: {} InheritedTypeHidesEnclosingName[-]: {} ExceptionTypeInheritedNameHidesEnclosingName[-]: {} ArgumentTypeCannotBeVoid[-]: {} RecursiveConstructorInvocation[-]: {} StaticMethodRequested[-]: {} ArgumentTypeNotFound[-]: {} Internal[-]: {} HidingEnclosingType[-]: {} CannotReturnInInitializer[-]: {} UnterminatedString[-]: {} IllegalModifierForInterfaceMethod[-]: {} MissingEnclosingInstanceForConstructorCall[-]: {} IllegalModifierForMemberClass[-]: {} LocalVariableIsNeverUsed[-]: {} IllegalModifierCombinationFinalAbstractForClass[-]: {} EnclosingInstanceInConstructorCall[-]: {} FieldTypeNotFound[-]: {} ArgumentTypeInheritedNameHidesEnclosingName[-]: {} BodyForAbstractMethod[-]: {} IncompatibleReturnType[-]: {} ParameterMismatch[-]: {} InvalidNullToSynchronized[-]: {} ReturnTypeCannotBeVoidArray[-]: {} TooManyArrayDimensions[-]: {} AbstractMethodInAbstractClass[-]: {} ReferenceToForwardField[-]: {} DuplicateField[-]: {} PublicClassMustMatchFileName[-]: {} UndefinedConstructor[-]: {} StringConstantIsExceedingUtf8Limit[-]: {} NonExternalizedStringLiteral[-]: {} NonConstantExpression[-]: {} TooManyBytesForStringConstant[-]: {} AbstractMethodMustBeImplemented[-]: {} InstanceFieldDuringConstructorInvocation[-]: {} UnmatchedBracket[-]: {} InvalidHexa[-]: {} UnusedImport[-]: {} IncompatibleExceptionInInheritedMethodThrowsClause[-]: {} NoMessageSendOnBaseType[-]: {} InterfaceAmbiguous[-]: {} DuplicateModifierForType[-]: {} IllegalDimension[-]: {} UnusedPrivateType[-]: {} UsingDeprecatedMethod[-]: {} CodeSnippetMissingClass[-]: {} FinalMethodCannotBeOverridden[-]: {} RedefinedArgument[-]: {} CannotOverrideAStaticMethodWithAnInstanceMethod[-]: {} InterfaceInternalNameProvided[-]: {} NotVisibleType[-]: {} IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod[-]: {} DuplicateImport[-]: {} CannotDefineDimensionExpressionsWithInit[-]: {} FinalOuterLocalAssignment[-]: {} FieldRelated[-]: {} AmbiguousType[-]: {} NullSourceString[-]: {} AnonymousClassCannotExtendFinalClass[-]: {} InternalTypeNameProvided[-]: {} IncorrectSwitchType[-]: {} UsingDeprecatedField[-]: {} IgnoreCategoriesMask[-]: {} IllegalAbstractModifierCombinationForMethod[-]: {} AssignmentHasNoEffect[-]: {} DuplicateModifierForField[-]: {} MethodReturnsVoid[-]: {} ImportNotVisible[-]: {} IllegalModifierForInterface[-]: {} ParsingErrorOnKeywordNoSuggestion[-]: {} DuplicateTypes[-]: {} TypeMismatch[-]: {} ReturnTypeNotVisible[-]: {} PackageIsNotExpectedPackage[-]: {} TooManySyntheticArgumentSlots[-]: {} IllegalVisibilityModifierCombinationForField[-]: {} BodyForNativeMethod[-]: {} ImportAmbiguous[-]: {} SuperInterfaceMustBeAnInterface[-]: {} DuplicateLabel[-]: {} Listener #1=org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider@145f5e3 Listener #2=org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$ElementChangedListener@19b2faf It is much, much faster. So there is clearly room for improvements in the UI code. I do get the 273 deletions in the deltas. Move back to JDT/UI.
i thought JavaCore.run would do the trick but then the delta is missing will have a look at IJavaModel.delete
blocked by bug 32219 i mean, not really blocked but bug 32219 is trivial to fix so i'll wait for it
Adam, please open a bug for the problem described in comment #3
enteres as bug 32225
fixed