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

(-)model/org/eclipse/jdt/internal/core/JavadocContents.java (-6 / +4 lines)
Lines 378-390 Link Here
378
		}
378
		}
379
		IType declaringType = this.type;
379
		IType declaringType = this.type;
380
		if (declaringType.isMember()) {
380
		if (declaringType.isMember()) {
381
			int depth = 0;
382
			// might need to remove a part of the signature corresponding to the synthetic argument (only for constructor)
381
			// might need to remove a part of the signature corresponding to the synthetic argument (only for constructor)
383
			if (method.isConstructor() && !Flags.isStatic(declaringType.getFlags())) {
382
			if (method.isConstructor() && !Flags.isStatic(declaringType.getFlags())) {
384
				depth++;
385
			}
386
			if (depth != 0) {
387
				// depth is 1
388
				int indexOfOpeningParen = anchor.indexOf('(');
383
				int indexOfOpeningParen = anchor.indexOf('(');
389
				if (indexOfOpeningParen == -1) {
384
				if (indexOfOpeningParen == -1) {
390
					// should not happen as this is a method signature
385
					// should not happen as this is a method signature
Lines 395-402 Link Here
395
				int indexOfComma = anchor.indexOf(',', index);
390
				int indexOfComma = anchor.indexOf(',', index);
396
				if (indexOfComma != -1) {
391
				if (indexOfComma != -1) {
397
					index = indexOfComma + 2;
392
					index = indexOfComma + 2;
398
					anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
393
				} else {
394
					// no argument, but a synthetic argument
395
					index = anchor.indexOf(')', index);
399
				}
396
				}
397
				anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
400
			}
398
			}
401
		}
399
		}
402
		return anchor + JavadocConstants.ANCHOR_PREFIX_END;
400
		return anchor + JavadocConstants.ANCHOR_PREFIX_END;
(-)src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java (+40 lines)
Lines 86-91 Link Here
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"));
88
		suite.addTest(new AttachedJavadocTests("testBug354766"));
89
		suite.addTest(new AttachedJavadocTests("testBug354766_2"));
89
		return suite;
90
		return suite;
90
	}
91
	}
91
92
Lines 1004-1007 Link Here
1004
			this.project.setRawClasspath(entries, null);
1005
			this.project.setRawClasspath(entries, null);
1005
		}
1006
		}
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
	}
1007
}
1047
}

Return to bug 354766