Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 173395 Details for
Bug 316654
ITypeHierarchyChangedListener receive spurious callbacks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated pat
bug_316654.txt (text/plain), 6.29 KB, created by
Jay Arthanareeswaran
on 2010-07-05 05:05:05 EDT
(
hide
)
Description:
Updated pat
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-07-05 05:05:05 EDT
Size:
6.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java,v >retrieving revision 1.109 >diff -u -r1.109 TypeHierarchy.java >--- model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 25 Jun 2010 14:58:37 -0000 1.109 >+++ model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 5 Jul 2010 08:05:28 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -960,11 +960,11 @@ > } > } > } >- if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0 || (flags & IJavaElementDelta.F_CONTENT) > 0) { >+ if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0 || (flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) > 0) { > // 1. removed from classpath - if it contains packages we are interested in > // the the type hierarchy has changed > // 2. content of a jar changed - if it contains packages we are interested in >- // the the type hierarchy has changed >+ // then the type hierarchy has changed > IJavaElement[] pkgs = this.packageRegion.getElements(); > for (int i = 0; i < pkgs.length; i++) { > if (pkgs[i].getParent().equals(element)) { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java,v >retrieving revision 1.33 >diff -u -r1.33 TypeHierarchyNotificationTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 3 Nov 2009 15:21:55 -0000 1.33 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 5 Jul 2010 08:05:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -10,12 +10,14 @@ > *******************************************************************************/ > package org.eclipse.jdt.core.tests.model; > >+import java.io.File; > import java.io.IOException; > > import junit.framework.Test; > > import org.eclipse.core.resources.*; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.*; >@@ -1334,6 +1336,83 @@ > } > } > /** >+ * @bug 316654: ITypeHierarchyChangedListener receive spurious callbacks >+ * >+ * Test that a non-Java resource added to a folder package fragment root doesn't >+ * result in a type hierarchy changed event. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=316654" >+ * @throws CoreException >+ */ >+public void testBug316654() throws CoreException { >+ IJavaProject project = getJavaProject("TypeHierarchyNotification"); >+ ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java"); >+ IType type= cu.getType("X"); >+ ITypeHierarchy h = type.newTypeHierarchy(project, null); >+ h.addTypeHierarchyChangedListener(this); >+ IPath filePath = project.getProject().getFullPath().append("src").append("simplefile.txt"); >+ try { >+ createFile(filePath.toOSString(), "A simple text file"); >+ assertTrue("Should not receive change", !this.changeReceived); >+ } finally { >+ deleteFile(filePath.toOSString()); >+ h.removeTypeHierarchyChangedListener(this); >+ } >+} >+/** >+ * Additional test - Test that a relevant Java source resource change results in a type hierarchy >+ * change event. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=316654" >+ * @throws CoreException >+ */ >+public void testBug316654_a() throws CoreException { >+ IJavaProject project = getJavaProject("TypeHierarchyNotification"); >+ ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java"); >+ IType type= cu.getType("X"); >+ ITypeHierarchy h = type.newTypeHierarchy(project, null); >+ h.addTypeHierarchyChangedListener(this); >+ IPath filePath = project.getProject().getFullPath().append("src").append("p").append("Y.java"); >+ try { >+ createFile(filePath.toOSString(), >+ "package p;\n" + >+ "class Y extends X{\n" + >+ "}"); >+ assertOneChange(h); >+ } finally { >+ deleteFile(filePath.toOSString()); >+ h.removeTypeHierarchyChangedListener(this); >+ } >+} >+/** >+ * Additional test - Test that a relevant archive change results in a type hierarchy >+ * change event. >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=316654" >+ * @throws CoreException >+ */ >+public void testBug316654_b() throws CoreException { >+ IJavaProject project = getJavaProject("TypeHierarchyNotification"); >+ refreshExternalArchives(project); >+ File jarFile = new File(getExternalJCLPathString()); >+ long oldTimestamp = jarFile.lastModified(); >+ assertTrue("File does not exist", jarFile.exists()); >+ >+ IType throwableClass = getClassFile("TypeHierarchyNotification", getExternalJCLPathString(), "java.lang", "Throwable.class").getType(); >+ ITypeHierarchy h = throwableClass.newTypeHierarchy(project, null); >+ h.addTypeHierarchyChangedListener(this); >+ reset(); >+ >+ try { >+ jarFile.setLastModified(System.currentTimeMillis()); >+ refreshExternalArchives(project); >+ assertOneChange(h); >+ } finally { >+ jarFile.setLastModified(oldTimestamp); >+ h.removeTypeHierarchyChangedListener(this); >+ } >+} >+/** > * Make a note of the change > */ > public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 316654
:
171912
|
172902
|
173286
| 173395