Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 354766 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java (+80 lines)
Lines 85-90 Link Here
85
		suite.addTest(new AttachedJavadocTests("testBug334652_2"));
85
		suite.addTest(new AttachedJavadocTests("testBug334652_2"));
86
		suite.addTest(new AttachedJavadocTests("testBug334652_3"));
86
		suite.addTest(new AttachedJavadocTests("testBug334652_3"));
87
		suite.addTest(new AttachedJavadocTests("testBug334652_4"));
87
		suite.addTest(new AttachedJavadocTests("testBug334652_4"));
88
		suite.addTest(new AttachedJavadocTests("testBug354766"));
89
		suite.addTest(new AttachedJavadocTests("testBug354766_2"));
88
		return suite;
90
		return suite;
89
	}
91
	}
90
92
Lines 964-967 Link Here
964
			this.project.setRawClasspath(entries, null);
966
			this.project.setRawClasspath(entries, null);
965
		}
967
		}
966
	}
968
	}
969
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=354766
970
	public void testBug354766() throws CoreException, IOException {
971
		IClasspathEntry[] entries = this.project.getRawClasspath();
972
973
		try {
974
			IClasspathAttribute attribute =
975
					JavaCore.newClasspathAttribute(
976
							IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
977
							"jar:platform:/resource/AttachedJavadocProject/bug354766_doc.zip!/");
978
					IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug354766.jar"), null, null, null, new IClasspathAttribute[] { attribute}, false);
979
			this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null);
980
			this.project.getResolvedClasspath(false);
981
982
			IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug354766.jar"));
983
			final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$InnerFinalException.class").getType();
984
			IMethod method = type.getMethod("foo", new String[0]);
985
			assertNotNull(method);
986
			assertTrue("Does not exist", method.exists());
987
988
			String javadoc = method.getAttachedJavadoc(null);
989
			assertNotNull(javadoc);
990
			assertEquals(
991
					"Wrong contents",
992
					"<H3>\r\n" + 
993
					"foo</H3>\r\n" + 
994
					"<PRE>\r\n" + 
995
					"public void <B>foo</B>()</PRE>\r\n" + 
996
					"<DL>\r\n" + 
997
					"<DD>Test method\r\n" + 
998
					"<P>\r\n" + 
999
					"<DD><DL>\r\n" + 
1000
					"</DL>\r\n" + 
1001
					"</DD>\r\n" + 
1002
					"</DL>\r\n",
1003
					javadoc);
1004
		} finally {
1005
			this.project.setRawClasspath(entries, null);
1006
		}
1007
	}
1008
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=354766
1009
	public void testBug354766_2() throws CoreException, IOException {
1010
		IClasspathEntry[] entries = this.project.getRawClasspath();
1011
	
1012
		try {
1013
			IClasspathAttribute attribute =
1014
					JavaCore.newClasspathAttribute(
1015
							IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
1016
							"jar:platform:/resource/AttachedJavadocProject/bug354766_doc.zip!/");
1017
					IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug354766.jar"), null, null, null, new IClasspathAttribute[] { attribute}, false);
1018
			this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null);
1019
			this.project.getResolvedClasspath(false);
1020
	
1021
			IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug354766.jar"));
1022
			final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$InnerFinalException.class").getType();
1023
			IMethod method = type.getMethod("InnerFinalException", new String[] { "Lcom.test.PublicAbstractClass;"});
1024
			assertNotNull(method);
1025
			assertTrue("Does not exist", method.exists());
1026
	
1027
			String javadoc = method.getAttachedJavadoc(null);
1028
			assertNotNull(javadoc);
1029
			assertEquals(
1030
					"Wrong contents",
1031
					"<H3>\r\n" + 
1032
					"PublicAbstractClass.InnerFinalException</H3>\r\n" + 
1033
					"<PRE>\r\n" + 
1034
					"public <B>PublicAbstractClass.InnerFinalException</B>()</PRE>\r\n" + 
1035
					"<DL>\r\n" + 
1036
					"<DD>javadoc for InnerFinalException()\r\n" + 
1037
					"<P>\r\n" + 
1038
					"</DL>\r\n" + 
1039
					"\r\n" + 
1040
					"<!-- ============ METHOD DETAIL ========== -->\r\n" + 
1041
					"\r\n",
1042
					javadoc);
1043
		} finally {
1044
			this.project.setRawClasspath(entries, null);
1045
		}
1046
	}
967
}
1047
}
(-)a/org.eclipse.jdt.core/buildnotes_jdt-core.html (-1 / +3 lines)
Added Link Here
79
</li>
79
</li>
80
</ul>
80
</ul>
81
<h3>Problem Reports Fixed</h3>
81
<h3>Problem Reports Fixed</h3>
82
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287164">287164</a>
82
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=354766">354766</a>
83
Javadoc content does not appear in content assist info window for non-static inner class constructors
84
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287164">287164</a>
83
Report build path error if source folder has other source folder as output folder
85
Report build path error if source folder has other source folder as output folder
84
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=359646">359646</a>
86
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=359646">359646</a>
85
Formatter fails silently if Java source contains 0x8000000000000000L
87
Formatter fails silently if Java source contains 0x8000000000000000L
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java (-5 / +4 lines)
Lines 376-388 Link Here
376
		}
376
		}
377
		IType declaringType = this.type;
377
		IType declaringType = this.type;
378
		if (declaringType.isMember()) {
378
		if (declaringType.isMember()) {
379
			int depth = 0;
380
			// might need to remove a part of the signature corresponding to the synthetic argument
379
			// might need to remove a part of the signature corresponding to the synthetic argument
381
			if (!Flags.isStatic(declaringType.getFlags())) {
380
			if (!Flags.isStatic(declaringType.getFlags())) {
382
				depth++;
383
			}
384
			if (depth != 0) {
385
				// depth is 1
386
				int indexOfOpeningParen = anchor.indexOf('(');
381
				int indexOfOpeningParen = anchor.indexOf('(');
387
				if (indexOfOpeningParen == -1) return null;
382
				if (indexOfOpeningParen == -1) return null;
388
				int index = indexOfOpeningParen;
383
				int index = indexOfOpeningParen;
Lines 390-395 Link Here
390
				int indexOfComma = anchor.indexOf(',', index);
385
				int indexOfComma = anchor.indexOf(',', index);
391
				if (indexOfComma != -1) {
386
				if (indexOfComma != -1) {
392
					index = indexOfComma + 2;
387
					index = indexOfComma + 2;
388
				
389
				} else {
390
					// no argument, but a synthetic argument
391
					index = anchor.indexOf(')', index);
393
				}
392
				}
394
				anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
393
				anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
395
			}
394
			}

Return to bug 354766