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 61310 Details for
Bug 178039
Separate advanced verbose for container and variable initialization from regular verbose
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
178039.txt (text/plain), 37.47 KB, created by
Jerome Lanneluc
on 2007-03-19 12:52:34 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-03-19 12:52:34 EDT
Size:
37.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/SetVariablesOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetVariablesOperation.java,v >retrieving revision 1.4 >diff -u -r1.4 SetVariablesOperation.java >--- model/org/eclipse/jdt/internal/core/SetVariablesOperation.java 8 Mar 2007 09:33:02 -0000 1.4 >+++ model/org/eclipse/jdt/internal/core/SetVariablesOperation.java 19 Mar 2007 14:10:47 -0000 >@@ -43,12 +43,8 @@ > checkCanceled(); > try { > beginTask("", 1); //$NON-NLS-1$ >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable SET - setting variables\n" + //$NON-NLS-1$ >- " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(this.variableNames) + '\n' +//$NON-NLS-1$ >- " values: " + org.eclipse.jdt.internal.compiler.util.Util.toString(this.variablePaths)); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) >+ verbose_set_variables(); > > JavaModelManager manager = JavaModelManager.getJavaModelManager(); > if (manager.variablePutIfInitializingWithSameValue(this.variableNames, this.variablePaths)) >@@ -142,13 +138,9 @@ > > JavaProject affectedProject = (JavaProject) projectsToUpdate.next(); > >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable SET - updating affected project due to setting variables\n" + //$NON-NLS-1$ >- " project: " + affectedProject.getElementName() + '\n' + //$NON-NLS-1$ >- " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(dbgVariableNames)); //$NON-NLS-1$ >- } > // force resolved classpath to be recomputed >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_update_project(dbgVariableNames, affectedProject); > affectedProject.getPerProjectInfo().resetResolvedClasspath(); > > // if needed, generate delta, update project ref, create markers, ... >@@ -161,10 +153,7 @@ > } > } catch (CoreException e) { > if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable SET - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$ >- " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(dbgVariableNames), //$NON-NLS-1$ >- System.err); >+ verbose_failure(dbgVariableNames); > e.printStackTrace(); > } > if (e instanceof JavaModelException) { >@@ -179,4 +168,26 @@ > } > } > >+ private void verbose_failure(String[] dbgVariableNames) { >+ Util.verbose( >+ "CPVariable SET - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$ >+ " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(dbgVariableNames), //$NON-NLS-1$ >+ System.err); >+ } >+ >+ private void verbose_update_project(String[] dbgVariableNames, >+ JavaProject affectedProject) { >+ Util.verbose( >+ "CPVariable SET - updating affected project due to setting variables\n" + //$NON-NLS-1$ >+ " project: " + affectedProject.getElementName() + '\n' + //$NON-NLS-1$ >+ " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(dbgVariableNames)); //$NON-NLS-1$ >+ } >+ >+ private void verbose_set_variables() { >+ Util.verbose( >+ "CPVariable SET - setting variables\n" + //$NON-NLS-1$ >+ " variables: " + org.eclipse.jdt.internal.compiler.util.Util.toString(this.variableNames) + '\n' +//$NON-NLS-1$ >+ " values: " + org.eclipse.jdt.internal.compiler.util.Util.toString(this.variablePaths)); //$NON-NLS-1$ >+ } >+ > } >Index: model/org/eclipse/jdt/internal/core/JavaProject.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v >retrieving revision 1.384 >diff -u -r1.384 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 2 Mar 2007 17:43:25 -0000 1.384 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 19 Mar 2007 14:10:47 -0000 >@@ -1884,13 +1884,8 @@ > */ > public IClasspathEntry[] getResolvedClasspath(boolean ignoreUnresolvedEntry) throws JavaModelException { > if (JavaModelManager.getJavaModelManager().isClasspathBeingResolved(this)) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPResolution: reentering raw classpath resolution, will use empty classpath instead" + //$NON-NLS-1$ >- " project: " + getElementName() + '\n' + //$NON-NLS-1$ >- " invocation stack trace:"); //$NON-NLS-1$ >- new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_reentering_classpath_resolution(); > return RESOLUTION_IN_PROGRESS; > } > PerProjectInfo perProjectInfo = getPerProjectInfo(); >@@ -1916,6 +1911,14 @@ > return resolvedClasspath; > } > >+ private void verbose_reentering_classpath_resolution() { >+ Util.verbose( >+ "CPResolution: reentering raw classpath resolution, will use empty classpath instead" + //$NON-NLS-1$ >+ " project: " + getElementName() + '\n' + //$NON-NLS-1$ >+ " invocation stack trace:"); //$NON-NLS-1$ >+ new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >+ } >+ > /** > * @see IJavaElement > */ >Index: model/org/eclipse/jdt/internal/core/SetContainerOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetContainerOperation.java,v >retrieving revision 1.6 >diff -u -r1.6 SetContainerOperation.java >--- model/org/eclipse/jdt/internal/core/SetContainerOperation.java 16 Mar 2007 18:28:58 -0000 1.6 >+++ model/org/eclipse/jdt/internal/core/SetContainerOperation.java 19 Mar 2007 14:10:47 -0000 >@@ -42,6 +42,8 @@ > beginTask("", 1); //$NON-NLS-1$ > if (JavaModelManager.CP_RESOLVE_VERBOSE) > verbose_set_container(); >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_set_container_invocation_trace(); > > JavaModelManager manager = JavaModelManager.getJavaModelManager(); > if (manager.containerPutIfInitializingWithSameEntries(this.containerPath, this.affectedProjects, this.respectiveContainers)) >@@ -100,7 +102,7 @@ > > JavaProject affectedProject = (JavaProject)modifiedProjects[i]; > if (affectedProject == null) continue; // was filtered out >- if (JavaModelManager.CP_RESOLVE_VERBOSE) >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) > verbose_update_project(affectedProject); > > // force resolved classpath to be recomputed >@@ -190,7 +192,13 @@ > return buffer.toString(); > } > }) + >- "\n }\n invocation stack trace:"); //$NON-NLS-1$ >+ "\n }");//$NON-NLS-1$ >+ } >+ >+ private void verbose_set_container_invocation_trace() { >+ Util.verbose( >+ "CPContainer SET - setting container\n" + //$NON-NLS-1$ >+ " invocation stack trace:"); //$NON-NLS-1$ > new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ > } > >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.362 >diff -u -r1.362 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 14 Mar 2007 08:18:47 -0000 1.362 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 19 Mar 2007 14:10:46 -0000 >@@ -175,6 +175,7 @@ > private static final String JAVAMODEL_DEBUG = JavaCore.PLUGIN_ID + "/debug/javamodel" ; //$NON-NLS-1$ > private static final String JAVAMODELCACHE_DEBUG = JavaCore.PLUGIN_ID + "/debug/javamodel/cache" ; //$NON-NLS-1$ > private static final String CP_RESOLVE_DEBUG = JavaCore.PLUGIN_ID + "/debug/cpresolution" ; //$NON-NLS-1$ >+ private static final String CP_RESOLVE_ADVANCED_DEBUG = JavaCore.PLUGIN_ID + "/debug/cpresolution/advanced" ; //$NON-NLS-1$ > private static final String ZIP_ACCESS_DEBUG = JavaCore.PLUGIN_ID + "/debug/zipaccess" ; //$NON-NLS-1$ > private static final String DELTA_DEBUG =JavaCore.PLUGIN_ID + "/debug/javadelta" ; //$NON-NLS-1$ > private static final String DELTA_DEBUG_VERBOSE =JavaCore.PLUGIN_ID + "/debug/javadelta/verbose" ; //$NON-NLS-1$ >@@ -537,73 +538,92 @@ > containerPut(project, containerPath, container); > return true; > } else { >+ if (CP_RESOLVE_VERBOSE) >+ verbose_missbehaving_container(containerPath, projects, respectiveContainers, container, newEntries, null/*no old entries*/); > return false; > } > final IClasspathEntry[] oldEntries = previousContainer.getClasspathEntries(); >- if (oldEntries.length != newEntries.length) >+ if (oldEntries.length != newEntries.length) { >+ if (CP_RESOLVE_VERBOSE) >+ verbose_missbehaving_container(containerPath, projects, respectiveContainers, container, newEntries, oldEntries); > return false; >+ } > for (int i = 0, length = newEntries.length; i < length; i++) { > if (!newEntries[i].equals(oldEntries[i])) { >- if (CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPContainer SET - missbehaving container\n" + //$NON-NLS-1$ >- " container path: " + containerPath + '\n' + //$NON-NLS-1$ >- " projects: {" +//$NON-NLS-1$ >- org.eclipse.jdt.internal.compiler.util.Util.toString( >- projects, >- new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >- public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } >- }) + >- "}\n values on previous session: {\n" +//$NON-NLS-1$ >- org.eclipse.jdt.internal.compiler.util.Util.toString( >- respectiveContainers, >- new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >- public String displayString(Object o) { >- StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ >- if (o == null) { >- buffer.append("<null>"); //$NON-NLS-1$ >- return buffer.toString(); >- } >- buffer.append(container.getDescription()); >- buffer.append(" {\n"); //$NON-NLS-1$ >- for (int j = 0; j < oldEntries.length; j++){ >- buffer.append(" "); //$NON-NLS-1$ >- buffer.append(oldEntries[j]); >- buffer.append('\n'); >- } >- buffer.append(" }"); //$NON-NLS-1$ >- return buffer.toString(); >- } >- }) + >- "}\n new values: {\n" +//$NON-NLS-1$ >- org.eclipse.jdt.internal.compiler.util.Util.toString( >- respectiveContainers, >- new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >- public String displayString(Object o) { >- StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ >- if (o == null) { >- buffer.append("<null>"); //$NON-NLS-1$ >- return buffer.toString(); >- } >- buffer.append(container.getDescription()); >- buffer.append(" {\n"); //$NON-NLS-1$ >- for (int j = 0; j < newEntries.length; j++){ >- buffer.append(" "); //$NON-NLS-1$ >- buffer.append(newEntries[j]); >- buffer.append('\n'); >- } >- buffer.append(" }"); //$NON-NLS-1$ >- return buffer.toString(); >- } >- }) + >- "\n }"); //$NON-NLS-1$ >- } >+ if (CP_RESOLVE_VERBOSE) >+ verbose_missbehaving_container(containerPath, projects, respectiveContainers, container, newEntries, oldEntries); > return false; > } > } > containerPut(project, containerPath, container); > return true; > } >+ >+ private void verbose_missbehaving_container( >+ IPath containerPath, >+ IJavaProject[] projects, >+ IClasspathContainer[] respectiveContainers, >+ final IClasspathContainer container, >+ final IClasspathEntry[] newEntries, >+ final IClasspathEntry[] oldEntries) { >+ Util.verbose( >+ "CPContainer SET - missbehaving container\n" + //$NON-NLS-1$ >+ " container path: " + containerPath + '\n' + //$NON-NLS-1$ >+ " projects: {" +//$NON-NLS-1$ >+ org.eclipse.jdt.internal.compiler.util.Util.toString( >+ projects, >+ new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >+ public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } >+ }) + >+ "}\n values on previous session: {\n" +//$NON-NLS-1$ >+ org.eclipse.jdt.internal.compiler.util.Util.toString( >+ respectiveContainers, >+ new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >+ public String displayString(Object o) { >+ StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ >+ if (o == null) { >+ buffer.append("<null>"); //$NON-NLS-1$ >+ return buffer.toString(); >+ } >+ buffer.append(container.getDescription()); >+ buffer.append(" {\n"); //$NON-NLS-1$ >+ if (oldEntries == null) { >+ buffer.append(" "); //$NON-NLS-1$ >+ buffer.append("<null>\n"); //$NON-NLS-1$ >+ } else { >+ for (int j = 0; j < oldEntries.length; j++){ >+ buffer.append(" "); //$NON-NLS-1$ >+ buffer.append(oldEntries[j]); >+ buffer.append('\n'); >+ } >+ } >+ buffer.append(" }"); //$NON-NLS-1$ >+ return buffer.toString(); >+ } >+ }) + >+ "}\n new values: {\n" +//$NON-NLS-1$ >+ org.eclipse.jdt.internal.compiler.util.Util.toString( >+ respectiveContainers, >+ new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >+ public String displayString(Object o) { >+ StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ >+ if (o == null) { >+ buffer.append("<null>"); //$NON-NLS-1$ >+ return buffer.toString(); >+ } >+ buffer.append(container.getDescription()); >+ buffer.append(" {\n"); //$NON-NLS-1$ >+ for (int j = 0; j < newEntries.length; j++){ >+ buffer.append(" "); //$NON-NLS-1$ >+ buffer.append(newEntries[j]); >+ buffer.append('\n'); >+ } >+ buffer.append(" }"); //$NON-NLS-1$ >+ return buffer.toString(); >+ } >+ }) + >+ "\n }"); //$NON-NLS-1$ >+ } > > private void containerRemoveInitializationInProgress(IJavaProject project, IPath containerPath) { > Map initializations = (Map)this.containerInitializationInProgress.get(); >@@ -1144,6 +1164,7 @@ > > public static boolean VERBOSE = false; > public static boolean CP_RESOLVE_VERBOSE = false; >+ public static boolean CP_RESOLVE_VERBOSE_ADVANCED = false; > public static boolean ZIP_ACCESS_VERBOSE = false; > > /** >@@ -1282,6 +1303,9 @@ > option = Platform.getDebugOption(CP_RESOLVE_DEBUG); > if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase(TRUE) ; > >+ option = Platform.getDebugOption(CP_RESOLVE_ADVANCED_DEBUG); >+ if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED = option.equalsIgnoreCase(TRUE) ; >+ > option = Platform.getDebugOption(DELTA_DEBUG); > if(option != null) DeltaProcessor.DEBUG = option.equalsIgnoreCase(TRUE) ; > >@@ -1777,31 +1801,34 @@ > if (previousContainerValues != null){ > IClasspathContainer previousContainer = (IClasspathContainer)previousContainerValues.get(containerPath); > if (previousContainer != null) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- StringBuffer buffer = new StringBuffer(); >- buffer.append("CPContainer INIT - reentering access to project container during its initialization, will see previous value\n"); //$NON-NLS-1$ >- buffer.append(" project: " + project.getElementName() + '\n'); //$NON-NLS-1$ >- buffer.append(" container path: " + containerPath + '\n'); //$NON-NLS-1$ >- buffer.append(" previous value: "); //$NON-NLS-1$ >- buffer.append(previousContainer.getDescription()); >- buffer.append(" {\n"); //$NON-NLS-1$ >- IClasspathEntry[] entries = previousContainer.getClasspathEntries(); >- if (entries != null){ >- for (int j = 0; j < entries.length; j++){ >- buffer.append(" "); //$NON-NLS-1$ >- buffer.append(entries[j]); >- buffer.append('\n'); >- } >- } >- buffer.append(" }"); //$NON-NLS-1$ >- Util.verbose(buffer.toString()); >- new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_reentering_project_container_access(containerPath, project, previousContainer); > return previousContainer; > } > } > return null; // break cycle if none found > } >+ >+ private void verbose_reentering_project_container_access( IPath containerPath, IJavaProject project, IClasspathContainer previousContainer) { >+ StringBuffer buffer = new StringBuffer(); >+ buffer.append("CPContainer INIT - reentering access to project container during its initialization, will see previous value\n"); //$NON-NLS-1$ >+ buffer.append(" project: " + project.getElementName() + '\n'); //$NON-NLS-1$ >+ buffer.append(" container path: " + containerPath + '\n'); //$NON-NLS-1$ >+ buffer.append(" previous value: "); //$NON-NLS-1$ >+ buffer.append(previousContainer.getDescription()); >+ buffer.append(" {\n"); //$NON-NLS-1$ >+ IClasspathEntry[] entries = previousContainer.getClasspathEntries(); >+ if (entries != null){ >+ for (int j = 0; j < entries.length; j++){ >+ buffer.append(" "); //$NON-NLS-1$ >+ buffer.append(entries[j]); >+ buffer.append('\n'); >+ } >+ } >+ buffer.append(" }"); //$NON-NLS-1$ >+ Util.verbose(buffer.toString()); >+ new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >+ } > > /** > * Returns a persisted container from previous session if any >@@ -1809,18 +1836,21 @@ > public IPath getPreviousSessionVariable(String variableName) { > IPath previousPath = (IPath)this.previousSessionVariables.get(variableName); > if (previousPath != null){ >- if (CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable INIT - reentering access to variable during its initialization, will see previous value\n" + //$NON-NLS-1$ >- " variable: "+ variableName + '\n' + //$NON-NLS-1$ >- " previous value: " + previousPath); //$NON-NLS-1$ >- new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >- } >+ if (CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_reentering_variable_access(variableName, previousPath); > return previousPath; > } > return null; // break cycle > } > >+ private void verbose_reentering_variable_access(String variableName, IPath previousPath) { >+ Util.verbose( >+ "CPVariable INIT - reentering access to variable during its initialization, will see previous value\n" + //$NON-NLS-1$ >+ " variable: "+ variableName + '\n' + //$NON-NLS-1$ >+ " previous value: " + previousPath); //$NON-NLS-1$ >+ new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >+ } >+ > /** > * Returns the temporary cache for newly opened elements for the current thread. > * Creates it if not already created. >@@ -2001,12 +2031,8 @@ > * Return the container for the given path and project. > */ > private IClasspathContainer initializeAllContainers(IJavaProject javaProjectToInit, IPath containerToInit) throws JavaModelException { >- if (CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPContainer INIT - batching containers initialization\n" + //$NON-NLS-1$ >- " project to init: " + javaProjectToInit.getElementName() + '\n' + //$NON-NLS-1$ >- " container path to init: " + containerToInit); //$NON-NLS-1$ >- } >+ if (CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_batching_containers_initialization(javaProjectToInit, containerToInit); > > // collect all container paths > final HashMap allContainerPaths = new HashMap(); >@@ -2116,20 +2142,22 @@ > return containerGet(javaProjectToInit, containerToInit); > } > >+ private void verbose_batching_containers_initialization(IJavaProject javaProjectToInit, IPath containerToInit) { >+ Util.verbose( >+ "CPContainer INIT - batching containers initialization\n" + //$NON-NLS-1$ >+ " project to init: " + javaProjectToInit.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path to init: " + containerToInit); //$NON-NLS-1$ >+ } >+ > IClasspathContainer initializeContainer(IJavaProject project, IPath containerPath) throws JavaModelException { > > IClasspathContainer container = null; > final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); > if (initializer != null){ >- if (CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPContainer INIT - triggering initialization\n" + //$NON-NLS-1$ >- " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >- " container path: " + containerPath + '\n' + //$NON-NLS-1$ >- " initializer: " + initializer + '\n' + //$NON-NLS-1$ >- " invocation stack trace:"); //$NON-NLS-1$ >- new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >- } >+ if (CP_RESOLVE_VERBOSE) >+ verbose_triggering_container_initialization(project, containerPath, initializer); >+ if (CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_triggering_container_initialization_invocation_trace(); > PerformanceStats stats = null; > if(JavaModelManager.PERF_CONTAINER_INITIALIZER) { > stats = PerformanceStats.getStats(JavaModelManager.CONTAINER_INITIALIZER_PERF, this); >@@ -2160,14 +2188,12 @@ > throw new JavaModelException(e); > } > } catch (RuntimeException e) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) > e.printStackTrace(); >- } > throw e; > } catch (Error e) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) > e.printStackTrace(); >- } > throw e; > } finally { > if(JavaModelManager.PERF_CONTAINER_INITIALIZER) { >@@ -2177,52 +2203,76 @@ > // just remove initialization in progress and keep previous session container so as to avoid a full build > // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=92588 > containerRemoveInitializationInProgress(project, containerPath); >- if (CP_RESOLVE_VERBOSE) { >- if (container == CONTAINER_INITIALIZATION_IN_PROGRESS) { >- Util.verbose( >- "CPContainer INIT - FAILED (initializer did not initialize container)\n" + //$NON-NLS-1$ >- " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >- " container path: " + containerPath + '\n' + //$NON-NLS-1$ >- " initializer: " + initializer); //$NON-NLS-1$ >- >- } else { >- Util.verbose( >- "CPContainer INIT - FAILED (see exception above)\n" + //$NON-NLS-1$ >- " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >- " container path: " + containerPath + '\n' + //$NON-NLS-1$ >- " initializer: " + initializer); //$NON-NLS-1$ >- } >- } >+ if (CP_RESOLVE_VERBOSE) >+ verbose_container_initialization_failed(project, containerPath, container, initializer); > } > } >- if (CP_RESOLVE_VERBOSE){ >- StringBuffer buffer = new StringBuffer(); >- buffer.append("CPContainer INIT - after resolution\n"); //$NON-NLS-1$ >- buffer.append(" project: " + project.getElementName() + '\n'); //$NON-NLS-1$ >- buffer.append(" container path: " + containerPath + '\n'); //$NON-NLS-1$ >- if (container != null){ >- buffer.append(" container: "+container.getDescription()+" {\n"); //$NON-NLS-2$//$NON-NLS-1$ >- IClasspathEntry[] entries = container.getClasspathEntries(); >- if (entries != null){ >- for (int i = 0; i < entries.length; i++){ >- buffer.append(" " + entries[i] + '\n'); //$NON-NLS-1$ >- } >- } >- buffer.append(" }");//$NON-NLS-1$ >- } else { >- buffer.append(" container: {unbound}");//$NON-NLS-1$ >+ if (CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_container_value_after_initialization(project, containerPath, container); >+ } else { >+ if (CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_no_container_initializer_found(project, containerPath); >+ } >+ return container; >+ } >+ >+ private void verbose_no_container_initializer_found(IJavaProject project, IPath containerPath) { >+ Util.verbose( >+ "CPContainer INIT - no initializer found\n" + //$NON-NLS-1$ >+ " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path: " + containerPath); //$NON-NLS-1$ >+ } >+ >+ private void verbose_container_value_after_initialization(IJavaProject project, IPath containerPath, IClasspathContainer container) { >+ StringBuffer buffer = new StringBuffer(); >+ buffer.append("CPContainer INIT - after resolution\n"); //$NON-NLS-1$ >+ buffer.append(" project: " + project.getElementName() + '\n'); //$NON-NLS-1$ >+ buffer.append(" container path: " + containerPath + '\n'); //$NON-NLS-1$ >+ if (container != null){ >+ buffer.append(" container: "+container.getDescription()+" {\n"); //$NON-NLS-2$//$NON-NLS-1$ >+ IClasspathEntry[] entries = container.getClasspathEntries(); >+ if (entries != null){ >+ for (int i = 0; i < entries.length; i++){ >+ buffer.append(" " + entries[i] + '\n'); //$NON-NLS-1$ > } >- Util.verbose(buffer.toString()); > } >+ buffer.append(" }");//$NON-NLS-1$ > } else { >- if (CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPContainer INIT - no initializer found\n" + //$NON-NLS-1$ >- " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >- " container path: " + containerPath); //$NON-NLS-1$ >- } >+ buffer.append(" container: {unbound}");//$NON-NLS-1$ > } >- return container; >+ Util.verbose(buffer.toString()); >+ } >+ >+ private void verbose_container_initialization_failed(IJavaProject project, IPath containerPath, IClasspathContainer container, ClasspathContainerInitializer initializer) { >+ if (container == CONTAINER_INITIALIZATION_IN_PROGRESS) { >+ Util.verbose( >+ "CPContainer INIT - FAILED (initializer did not initialize container)\n" + //$NON-NLS-1$ >+ " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path: " + containerPath + '\n' + //$NON-NLS-1$ >+ " initializer: " + initializer); //$NON-NLS-1$ >+ >+ } else { >+ Util.verbose( >+ "CPContainer INIT - FAILED (see exception above)\n" + //$NON-NLS-1$ >+ " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path: " + containerPath + '\n' + //$NON-NLS-1$ >+ " initializer: " + initializer); //$NON-NLS-1$ >+ } >+ } >+ >+ private void verbose_triggering_container_initialization(IJavaProject project, IPath containerPath, ClasspathContainerInitializer initializer) { >+ Util.verbose( >+ "CPContainer INIT - triggering initialization\n" + //$NON-NLS-1$ >+ " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path: " + containerPath + '\n' + //$NON-NLS-1$ >+ " initializer: " + initializer); //$NON-NLS-1$ >+ } >+ >+ private void verbose_triggering_container_initialization_invocation_trace() { >+ Util.verbose( >+ "CPContainer INIT - triggering initialization\n" + //$NON-NLS-1$ >+ " invocation trace:"); //$NON-NLS-1$ >+ new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ > } > > /** >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.569 >diff -u -r1.569 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 13 Mar 2007 16:20:11 -0000 1.569 >+++ model/org/eclipse/jdt/core/JavaCore.java 19 Mar 2007 14:10:44 -0000 >@@ -1601,27 +1601,20 @@ > for(int i = 0; i < extensions.length; i++){ > IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); > for(int j = 0; j < configElements.length; j++){ >- String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ >+ IConfigurationElement configurationElement = configElements[j]; >+ String initializerID = configurationElement.getAttribute("id"); //$NON-NLS-1$ > if (initializerID != null && initializerID.equals(containerID)){ >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPContainer INIT - found initializer\n" + //$NON-NLS-1$ >- " container ID: " + containerID + '\n' + //$NON-NLS-1$ >- " class: " + configElements[j].getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_found_container_initializer(containerID, configurationElement); > try { >- Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ >+ Object execExt = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$ > if (execExt instanceof ClasspathContainerInitializer){ > return (ClasspathContainerInitializer)execExt; > } > } catch(CoreException e) { > // executable extension could not be created: ignore this initializer > if (JavaModelManager.CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$ >- " container ID: " + containerID + '\n' + //$NON-NLS-1$ >- " class: " + configElements[j].getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$ >- System.err); >+ verbose_failed_to_instanciate_container_initializer(containerID, configurationElement); > e.printStackTrace(); > } > } >@@ -1632,6 +1625,21 @@ > return null; > } > >+ private static void verbose_failed_to_instanciate_container_initializer(String containerID, IConfigurationElement configurationElement) { >+ Util.verbose( >+ "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$ >+ " container ID: " + containerID + '\n' + //$NON-NLS-1$ >+ " class: " + configurationElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$ >+ System.err); >+ } >+ >+ private static void verbose_found_container_initializer(String containerID, IConfigurationElement configurationElement) { >+ Util.verbose( >+ "CPContainer INIT - found initializer\n" + //$NON-NLS-1$ >+ " container ID: " + containerID + '\n' + //$NON-NLS-1$ >+ " class: " + configurationElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ > /** > * Returns the path held in the given classpath variable. > * Returns <code>null</code> if unable to bind. >@@ -1666,14 +1674,10 @@ > // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused > final ClasspathVariableInitializer initializer = JavaCore.getClasspathVariableInitializer(variableName); > if (initializer != null){ >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$ >- " variable: " + variableName + '\n' + //$NON-NLS-1$ >- " initializer: " + initializer + '\n' + //$NON-NLS-1$ >- " invocation stack trace:"); //$NON-NLS-1$ >- new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) >+ verbose_triggering_variable_initialization(variableName, initializer); >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_triggering_variable_initialization_invocation_trace(); > manager.variablePut(variableName, JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS); // avoid initialization cycles > boolean ok = false; > try { >@@ -1683,37 +1687,55 @@ > > variablePath = manager.variableGet(variableName); // initializer should have performed side-effect > if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) return null; // break cycle (initializer did not init or reentering call) >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable INIT - after initialization\n" + //$NON-NLS-1$ >- " variable: " + variableName +'\n' + //$NON-NLS-1$ >- " variable path: " + variablePath); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_variable_value_after_initialization(variableName, variablePath); > manager.variablesWithInitializer.add(variableName); > ok = true; > } catch (RuntimeException e) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) > e.printStackTrace(); >- } > throw e; > } catch (Error e) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) > e.printStackTrace(); >- } > throw e; > } finally { > if (!ok) JavaModelManager.getJavaModelManager().variablePut(variableName, null); // flush cache > } > } else { >- if (JavaModelManager.CP_RESOLVE_VERBOSE){ >- Util.verbose( >- "CPVariable INIT - no initializer found\n" + //$NON-NLS-1$ >- " variable: " + variableName); //$NON-NLS-1$ >- } >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_no_variable_initializer_found(variableName); > } > return variablePath; > } > >+ private static void verbose_no_variable_initializer_found(String variableName) { >+ Util.verbose( >+ "CPVariable INIT - no initializer found\n" + //$NON-NLS-1$ >+ " variable: " + variableName); //$NON-NLS-1$ >+ } >+ >+ private static void verbose_variable_value_after_initialization(String variableName, IPath variablePath) { >+ Util.verbose( >+ "CPVariable INIT - after initialization\n" + //$NON-NLS-1$ >+ " variable: " + variableName +'\n' + //$NON-NLS-1$ >+ " variable path: " + variablePath); //$NON-NLS-1$ >+ } >+ >+ private static void verbose_triggering_variable_initialization(String variableName, ClasspathVariableInitializer initializer) { >+ Util.verbose( >+ "CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$ >+ " variable: " + variableName + '\n' + //$NON-NLS-1$ >+ " initializer: " + initializer); //$NON-NLS-1$ >+ } >+ >+ private static void verbose_triggering_variable_initialization_invocation_trace() { >+ Util.verbose( >+ "CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$ >+ " invocation trace:"); //$NON-NLS-1$ >+ new Exception("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$ >+ } >+ > /** > * Returns deprecation message of a given classpath variable. > * >@@ -1746,17 +1768,13 @@ > for(int i = 0; i < extensions.length; i++){ > IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); > for(int j = 0; j < configElements.length; j++){ >+ IConfigurationElement configElement = configElements[j]; > try { >- IConfigurationElement configElement = configElements[j]; > String varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$ > if (variable.equals(varAttribute)) { >- if (JavaModelManager.CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPVariable INIT - found initializer\n" + //$NON-NLS-1$ >- " variable: " + variable + '\n' + //$NON-NLS-1$ >- " class: " + configElements[j].getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ >+ if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED) >+ verbose_found_variable_initializer(variable, configElement); >+ Object execExt = configElement.createExecutableExtension("class"); //$NON-NLS-1$ > if (execExt instanceof ClasspathVariableInitializer){ > ClasspathVariableInitializer initializer = (ClasspathVariableInitializer)execExt; > String deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$ >@@ -1773,11 +1791,7 @@ > } catch(CoreException e){ > // executable extension could not be created: ignore this initializer > if (JavaModelManager.CP_RESOLVE_VERBOSE) { >- Util.verbose( >- "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$ >- " variable: " + variable + '\n' + //$NON-NLS-1$ >- " class: " + configElements[j].getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$ >- System.err); >+ verbose_failed_to_instanciate_variable_initializer(variable, configElement); > e.printStackTrace(); > } > } >@@ -1787,6 +1801,21 @@ > return null; > } > >+ private static void verbose_failed_to_instanciate_variable_initializer(String variable, IConfigurationElement configElement) { >+ Util.verbose( >+ "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$ >+ " variable: " + variable + '\n' + //$NON-NLS-1$ >+ " class: " + configElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$ >+ System.err); >+ } >+ >+ private static void verbose_found_variable_initializer(String variable, IConfigurationElement configElement) { >+ Util.verbose( >+ "CPVariable INIT - found initializer\n" + //$NON-NLS-1$ >+ " variable: " + variable + '\n' + //$NON-NLS-1$ >+ " class: " + configElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ > /** > * Returns the names of all known classpath variables. > * <p> >Index: .options >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/.options,v >retrieving revision 1.27 >diff -u -r1.27 .options >--- .options 2 Feb 2007 17:28:30 -0000 1.27 >+++ .options 19 Mar 2007 14:10:40 -0000 >@@ -16,6 +16,9 @@ > # Reports classpath variable initialization, and classpath container resolution > org.eclipse.jdt.core/debug/cpresolution=false > >+# Reports internals of classpath variable initialization, and classpath container resolution (to be used on the JDT/Core team request only) >+org.eclipse.jdt.core/debug/cpresolution/advanced=false >+ > # Report type hierarchy connections, refreshes and deltas > org.eclipse.jdt.core/debug/hierarchy=false >
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 178039
: 61310