[102645] [open type] Open Type history shows stale visibility info in type history
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java
index af51fcf..50a8b24 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java
@@ -26,7 +26,8 @@
final String fName;
final String fPackage;
final char[][] fEnclosingNames;
- final int fModifiers;
+
+ int fModifiers;
public static final int UNRESOLVABLE_TYPE_INFO= 1;
public static final int JAR_FILE_ENTRY_TYPE_INFO= 2;
@@ -94,6 +95,15 @@
}
/**
+ * Sets the modifiers to the given value.
+ *
+ * @param modifiers the new modifiers
+ */
+ public void setModifiers(int modifiers) {
+ fModifiers= modifiers;
+ }
+
+ /**
* Returns the type name.
*
* @return the info's type name.
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfoHistory.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfoHistory.java
index 22f0ab3..8fab1b6 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfoHistory.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfoHistory.java
@@ -101,10 +101,14 @@
return true;
}
return processChildrenDelta(delta);
+ case IJavaElement.TYPE:
+ if (isChanged && (delta.getFlags() & IJavaElementDelta.F_MODIFIERS) != 0) {
+ return true;
+ }
+ // type children can be inner classes: fall through
case IJavaElement.JAVA_MODEL:
case IJavaElement.PACKAGE_FRAGMENT:
case IJavaElement.CLASS_FILE:
- case IJavaElement.TYPE: // type children can be inner classes
if (isRemoved) {
return true;
}
@@ -210,8 +214,12 @@
TypeInfo type= (TypeInfo)iter.next();
try {
IType jType= type.resolveType(scope);
- if (jType == null || !jType.exists())
+ if (jType == null || !jType.exists()) {
fHistroy.remove(type);
+ } else {
+ // copy over the modifiers since they may have changed
+ type.setModifiers(jType.getFlags());
+ }
} catch (JavaModelException e) {
fHistroy.remove(type);
}