### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/BinaryMethod.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java,v retrieving revision 1.97 diff -u -r1.97 BinaryMethod.java --- model/org/eclipse/jdt/internal/core/BinaryMethod.java 22 Nov 2007 11:51:58 -0000 1.97 +++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 14 Mar 2008 10:14:16 -0000 @@ -251,19 +251,8 @@ try { javadocContents = extractJavadoc(declaringType, javadocContents); } catch(JavaModelException e) { - // ignore + javadocContents = null; } - } else { - // let's see if we can retrieve them from the debug infos - char[][] argumentNames = info.getArgumentNames(); - if (argumentNames != null && argumentNames.length == paramCount) { - String[] names = new String[paramCount]; - for (int i = 0; i < paramCount; i++) { - names[i] = new String(argumentNames[i]); - } - return this.parameterNames = names; - } - return getRawParameterNames(paramCount); } if (javadocContents != null && javadocContents != BinaryType.EMPTY_JAVADOC) { final int indexOfOpenParen = javadocContents.indexOf('('); @@ -651,8 +640,7 @@ indexOfBottom = contents.indexOf(JavadocConstants.END_OF_CLASS_DATA, indexOfEndLink); } if (indexOfBottom == -1) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, this)); - indexOfNextMethod = Math.min(indexOfNextMethod, indexOfBottom); - if (indexOfNextMethod == -1) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, this)); + indexOfNextMethod = indexOfNextMethod == -1 ? indexOfBottom : Math.min(indexOfNextMethod, indexOfBottom); return contents.substring(indexOfEndLink + JavadocConstants.ANCHOR_SUFFIX_LENGTH, indexOfNextMethod); } } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java,v retrieving revision 1.31 diff -u -r1.31 AttachedJavadocTests.java --- src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 21 Sep 2007 13:16:32 -0000 1.31 +++ src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 14 Mar 2008 10:14:19 -0000 @@ -35,6 +35,8 @@ import org.eclipse.jdt.core.JavaModelException; public class AttachedJavadocTests extends ModifyingResourceTests { + private static final String DEFAULT_DOC_FOLDER = "doc"; + static { // TESTS_NAMES = new String[] { "test010" }; // TESTS_NUMBERS = new int[] { 20 }; @@ -52,18 +54,9 @@ super(name); } - /** - * Create project and set the jar placeholder. - */ - public void setUpSuite() throws Exception { - super.setUpSuite(); - - this.project = setUpJavaProject("AttachedJavadocProject", "1.5"); //$NON-NLS-1$ - Map options = this.project.getOptions(true); - options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000"); //$NON-NLS-1$ - this.project.setOptions(options); + private void setJavadocLocationAttribute(String folderName) throws JavaModelException { IClasspathEntry[] entries = this.project.getRawClasspath(); - IResource resource = this.project.getProject().findMember("/doc/"); //$NON-NLS-1$ + IResource resource = this.project.getProject().findMember("/"+folderName+"/"); //$NON-NLS-1$ assertNotNull("doc folder cannot be null", resource); //$NON-NLS-1$ URI locationURI = resource.getLocationURI(); assertNotNull("doc folder cannot be null", locationURI); //$NON-NLS-1$ @@ -85,6 +78,18 @@ } } this.project.setRawClasspath(entries, null); + } + /** + * Create project and set the jar placeholder. + */ + public void setUpSuite() throws Exception { + super.setUpSuite(); + + this.project = setUpJavaProject("AttachedJavadocProject", "1.5"); //$NON-NLS-1$ + Map options = this.project.getOptions(true); + options.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "2000"); //$NON-NLS-1$ + this.project.setOptions(options); + this.setJavadocLocationAttribute(DEFAULT_DOC_FOLDER); IPackageFragmentRoot[] roots = this.project.getAllPackageFragmentRoots(); int count = 0; @@ -504,4 +509,30 @@ assertEquals("Wrong name", "arg0", paramNames[0]); //$NON-NLS-1$ assertEquals("Wrong name", "arg1", paramNames[1]); //$NON-NLS-1$ } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=221723 + // for a method + public void test023() throws JavaModelException { + try { + this.setJavadocLocationAttribute("specialDoc"); + + IPackageFragment packageFragment = this.root.getPackageFragment("p1.p2"); //$NON-NLS-1$ + assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ + IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$ + assertNotNull(classFile); + IType type = classFile.getType(); + IMethod method = type.getMethod("foo", new String[] {"I", "J", "Ljava.lang.String;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + assertTrue(method.exists()); + String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ + assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ + String[] paramNames = method.getParameterNames(); + assertNotNull(paramNames); + assertEquals("Wrong size", 3, paramNames.length); //$NON-NLS-1$ + assertEquals("Wrong name for first param", "i", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Wrong name for second param", "l", paramNames[1]); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Wrong name for third param", "s", paramNames[2]); //$NON-NLS-1$ //$NON-NLS-2$ + } finally { + this.setJavadocLocationAttribute(DEFAULT_DOC_FOLDER); + } + } } Index: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.html =================================================================== RCS file: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.html diff -N workspace/AttachedJavadocProject/specialDoc/p1/p2/X.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/AttachedJavadocProject/specialDoc/p1/p2/X.html 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,388 @@ + + + + + + +X + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +p1.p2 +
+Class X

+
+java.lang.Object
+  extended by p1.p2.X
+
+
+
+
public class X
extends java.lang.Object
+ + +

+Class X javadoc +

+ +

+


+ +

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+ classX.A + +
+          Javadoc for member type A
+ classX.B + +
+           
+ + + + + + + + + + + + + + + + + + +
+Field Summary
+ intf + +
+          Javadoc for field f
+ intf2 + +
+           
+ java.lang.Stringf3 + +
+          Real javadoc for f3
+  + + + + + + + + + + +
+Constructor Summary
X(int i) + +
+          Javadoc for constructor X(int)
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbar(java.util.ArrayList<java.lang.String> array) + +
+           
+ voidfoo(java.util.Enumeration enumeration) + +
+           
+ voidfoo(int i, + long l, + java.lang.String s) + +
+          Javadoc for method foo
+ voidfoo2() + +
+           
+ voidfoo2(java.lang.Integer i) + +
+          Javadoc for method foo2
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+f

+
+public int f
+
+
Javadoc for field f +

+

+
+
+
+ +

+f3

+
+public java.lang.String f3
+
+
Real javadoc for f3 +

+

+
+
+
+ +

+f2

+
+public int f2
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+X

+
+public X(int i)
+
+
Javadoc for constructor X(int) +

+

+ + + + + + + + +
+Method Detail
+ +

+foo2

+
+public void foo2(java.lang.Integer i)
+
+
Javadoc for method foo2 +

+

+
+
+
+
+ +

+foo2

+
+public void foo2()
+
+
+
+
+
+
+ +

+foo

+
+public void foo(java.util.Enumeration enumeration)
+
+
+
+
+
+
+ +

+bar

+
+public void bar(java.util.ArrayList<java.lang.String> array)
+
+
+
+
+
+
+ +

+foo

+
+public void foo(int i,
+                long l,
+                java.lang.String s)
+
+
Modified Javadoc for method foo +

+

+
Parameters:
i - the given int
l - the given long
s - the given string
+
+
+ +
+ + + + + + +
+ + + Index: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.B.html =================================================================== RCS file: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.B.html diff -N workspace/AttachedJavadocProject/specialDoc/p1/p2/X.B.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/AttachedJavadocProject/specialDoc/p1/p2/X.B.html 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,224 @@ + + + + + + +X.B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +p1.p2 +
+Class X.B

+
+java.lang.Object
+  extended by p1.p2.X.B
+
+
+
Enclosing class:
X
+
+
+
+
public class X.B
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
X.B() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+X.B

+
+public X.B()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + Index: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.A.html =================================================================== RCS file: workspace/AttachedJavadocProject/specialDoc/p1/p2/X.A.html diff -N workspace/AttachedJavadocProject/specialDoc/p1/p2/X.A.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/AttachedJavadocProject/specialDoc/p1/p2/X.A.html 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,230 @@ + + + + + + +X.A + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +p1.p2 +
+Class X.A

+
+java.lang.Object
+  extended by p1.p2.X.A
+
+
+
Enclosing class:
X
+
+
+
+
public class X.A
extends java.lang.Object
+ + +

+Javadoc for member type A +

+ +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
X.A(float f) + +
+          Javadoc for constructor of A
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+X.A

+
+public X.A(float f)
+
+
Javadoc for constructor of A +

+

+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + +