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 187145 Details for
Bug 334652
Javadoc content not found for non-static inner class constructors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_334652.txt (text/plain), 12.14 KB, created by
Olivier Thomann
on 2011-01-19 15:08:47 EST
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2011-01-19 15:08:47 EST
Size:
12.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavadocContents.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java,v >retrieving revision 1.4 >diff -u -r1.4 JavadocContents.java >--- model/org/eclipse/jdt/internal/core/JavadocContents.java 19 Nov 2010 19:06:48 -0000 1.4 >+++ model/org/eclipse/jdt/internal/core/JavadocContents.java 19 Jan 2011 20:08:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 IBM Corporation and others. >+ * Copyright (c) 2009, 2011 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 >@@ -13,7 +13,6 @@ > import org.eclipse.jdt.core.Flags; > import org.eclipse.jdt.core.IField; > import org.eclipse.jdt.core.IJavaModelStatusConstants; >-import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.IMethod; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; >@@ -378,31 +377,19 @@ > IType declaringType = this.type; > if (declaringType.isMember()) { > int depth = 0; >- final String packageFragmentName = declaringType.getPackageFragment().getElementName(); > // might need to remove a part of the signature corresponding to the synthetic argument >- final IJavaProject javaProject = declaringType.getJavaProject(); >- char[][] typeNames = CharOperation.splitOn('.', typeQualifiedName.toCharArray()); >- if (!Flags.isStatic(declaringType.getFlags())) depth++; >- StringBuffer typeName = new StringBuffer(); >- for (int i = 0, max = typeNames.length; i < max; i++) { >- if (typeName.length() == 0) { >- typeName.append(typeNames[i]); >- } else { >- typeName.append('.').append(typeNames[i]); >- } >- IType resolvedType = javaProject.findType(packageFragmentName, String.valueOf(typeName)); >- if (resolvedType != null && resolvedType.isMember() && !Flags.isStatic(resolvedType.getFlags())) depth++; >+ if (!Flags.isStatic(declaringType.getFlags())) { >+ depth++; > } > if (depth != 0) { >+ // depth is 1 > int indexOfOpeningParen = anchor.indexOf('('); > if (indexOfOpeningParen == -1) return null; > int index = indexOfOpeningParen; > indexOfOpeningParen++; >- for (int i = 0; i < depth; i++) { >- int indexOfComma = anchor.indexOf(',', index); >- if (indexOfComma != -1) { >- index = indexOfComma + 2; >- } >+ int indexOfComma = anchor.indexOf(',', index); >+ if (indexOfComma != -1) { >+ index = indexOfComma + 2; > } > anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index); > } >#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.39 >diff -u -r1.39 AttachedJavadocTests.java >--- src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 30 Nov 2010 15:26:42 -0000 1.39 >+++ src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 19 Jan 2011 20:08:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -43,7 +43,7 @@ > private static final String DEFAULT_DOC_FOLDER = "doc"; > > static { >-// TESTS_NAMES = new String[] { "test010" }; >+// TESTS_NAMES = new String[] { "testBug334652_4" }; > // TESTS_NUMBERS = new int[] { 24 }; > // TESTS_RANGE = new int[] { 169, 180 }; > } >@@ -783,4 +783,149 @@ > this.project.setOptions(options); > } > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=334652 >+ public void testBug334652() throws CoreException, IOException { >+ IClasspathEntry[] entries = this.project.getRawClasspath(); >+ >+ try { >+ IClasspathAttribute attribute = >+ JavaCore.newClasspathAttribute( >+ IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, >+ "jar:platform:/resource/AttachedJavadocProject/bug334652_doc.zip!/NoJavaDocForInnerClass/doc"); >+ IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug334652.jar"), null, null, null, new IClasspathAttribute[] { attribute}, false); >+ this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null); >+ this.project.getResolvedClasspath(false); >+ >+ IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug334652.jar")); >+ final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$InnerFinalException.class").getType(); >+ IMethod method = type.getMethod("InnerFinalException", new String[] { "Lcom.test.PublicAbstractClass;", "Ljava.lang.String;", "Ljava.lang.String;"}); >+ assertNotNull(method); >+ assertTrue("Does not exist", method.exists()); >+ >+ String javadoc = method.getAttachedJavadoc(null); >+ assertNotNull(javadoc); >+ assertEquals("Wrong contents", "<H3>\r\n" + >+ "PublicAbstractClass.InnerFinalException</H3>\r\n" + >+ "<PRE>\r\n" + >+ "public <B>PublicAbstractClass.InnerFinalException</B>(java.lang.String property,\r\n" + >+ " java.lang.String msg)</PRE>\r\n" + >+ "<DL>\r\n" + >+ "<DD>javadoc for InnerFinalException(String property, String msg)\r\n" + >+ "<P>\r\n" + >+ "<DL>\r\n" + >+ "<DT><B>Parameters:</B><DD><CODE>property</CODE> - the property argument<DD><CODE>msg</CODE> - the message argument</DL>\r\n" + >+ "</DL>\r\n", javadoc); >+ } finally { >+ this.project.setRawClasspath(entries, null); >+ } >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=334652 >+ public void testBug334652_2() throws CoreException, IOException { >+ IClasspathEntry[] entries = this.project.getRawClasspath(); >+ >+ try { >+ IClasspathAttribute attribute = >+ JavaCore.newClasspathAttribute( >+ IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, >+ "jar:platform:/resource/AttachedJavadocProject/bug334652(2)_doc.zip!/doc"); >+ IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug334652(2).jar"), null, null, null, new IClasspathAttribute[] { attribute}, false); >+ this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null); >+ this.project.getResolvedClasspath(false); >+ >+ IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug334652(2).jar")); >+ final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$InnerFinalException.class").getType(); >+ IMethod method = type.getMethod("InnerFinalException", new String[] { "Ljava.lang.String;", "Ljava.lang.String;"}); >+ assertNotNull(method); >+ assertTrue("Does not exist", method.exists()); >+ >+ String javadoc = method.getAttachedJavadoc(null); >+ assertNotNull(javadoc); >+ assertEquals("Wrong contents", "<H3>\r\n" + >+ "PublicAbstractClass.InnerFinalException</H3>\r\n" + >+ "<PRE>\r\n" + >+ "public <B>PublicAbstractClass.InnerFinalException</B>(java.lang.String property,\r\n" + >+ " java.lang.String msg)</PRE>\r\n" + >+ "<DL>\r\n" + >+ "<DD>javadoc for InnerFinalException(String property, String msg)\r\n" + >+ "<P>\r\n" + >+ "<DL>\r\n" + >+ "<DT><B>Parameters:</B><DD><CODE>property</CODE> - the property argument<DD><CODE>msg</CODE> - the message argument</DL>\r\n" + >+ "</DL>\r\n", javadoc); >+ } finally { >+ this.project.setRawClasspath(entries, null); >+ } >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=334652 >+ public void testBug334652_3() throws CoreException, IOException { >+ IClasspathEntry[] entries = this.project.getRawClasspath(); >+ >+ try { >+ IClasspathAttribute attribute = >+ JavaCore.newClasspathAttribute( >+ IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, >+ "jar:platform:/resource/AttachedJavadocProject/bug334652(3)_doc.zip!/doc"); >+ IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug334652(3).jar"), null, null, null, new IClasspathAttribute[] { attribute}, false); >+ this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null); >+ this.project.getResolvedClasspath(false); >+ >+ IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug334652(3).jar")); >+ final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$A$InnerFinalException.class").getType(); >+ IMethod method = type.getMethod("InnerFinalException", new String[] { "Lcom.test.PublicAbstractClass$A;", "Ljava.lang.String;", "Ljava.lang.String;"}); >+ assertNotNull(method); >+ assertTrue("Does not exist", method.exists()); >+ >+ String javadoc = method.getAttachedJavadoc(null); >+ assertNotNull(javadoc); >+ assertEquals("Wrong contents", >+ "<H3>\r\n" + >+ "PublicAbstractClass.A.InnerFinalException</H3>\r\n" + >+ "<PRE>\r\n" + >+ "public <B>PublicAbstractClass.A.InnerFinalException</B>(java.lang.String property,\r\n" + >+ " java.lang.String msg)</PRE>\r\n" + >+ "<DL>\r\n" + >+ "<DD>javadoc for InnerFinalException(String property, String msg)\r\n" + >+ "<P>\r\n" + >+ "<DL>\r\n" + >+ "<DT><B>Parameters:</B><DD><CODE>property</CODE> - the property argument<DD><CODE>msg</CODE> - the message argument</DL>\r\n" + >+ "</DL>\r\n", javadoc); >+ } finally { >+ this.project.setRawClasspath(entries, null); >+ } >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=334652 >+ public void testBug334652_4() throws CoreException, IOException { >+ IClasspathEntry[] entries = this.project.getRawClasspath(); >+ >+ try { >+ IClasspathAttribute attribute = >+ JavaCore.newClasspathAttribute( >+ IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, >+ "jar:platform:/resource/AttachedJavadocProject/bug334652(4)_doc.zip!/doc"); >+ IClasspathEntry newEntry = JavaCore.newLibraryEntry(new Path("/AttachedJavadocProject/bug334652(4).jar"), null, null, null, new IClasspathAttribute[] { attribute}, false); >+ this.project.setRawClasspath(new IClasspathEntry[]{newEntry}, null); >+ this.project.getResolvedClasspath(false); >+ >+ IPackageFragmentRoot jarRoot = this.project.getPackageFragmentRoot(getFile("/AttachedJavadocProject/bug334652(4).jar")); >+ final IType type = jarRoot.getPackageFragment("com.test").getClassFile("PublicAbstractClass$A$InnerFinalException.class").getType(); >+ IMethod method = type.getMethod("InnerFinalException", new String[] { "Lcom.test.PublicAbstractClass$A;", "Ljava.lang.String;", "Ljava.lang.String;"}); >+ assertNotNull(method); >+ assertTrue("Does not exist", method.exists()); >+ >+ String javadoc = method.getAttachedJavadoc(null); >+ assertNotNull(javadoc); >+ assertEquals("Wrong contents", "<H3>\r\n" + >+ "PublicAbstractClass.A.InnerFinalException</H3>\r\n" + >+ "<PRE>\r\n" + >+ "public <B>PublicAbstractClass.A.InnerFinalException</B>(java.lang.String property,\r\n" + >+ " java.lang.String msg)</PRE>\r\n" + >+ "<DL>\r\n" + >+ "<DD>javadoc for InnerFinalException(String property, String msg)\r\n" + >+ "<P>\r\n" + >+ "<DL>\r\n" + >+ "<DT><B>Parameters:</B><DD><CODE>property</CODE> - the property argument<DD><CODE>msg</CODE> - the message argument</DL>\r\n" + >+ "</DL>\r\n", javadoc); >+ } finally { >+ this.project.setRawClasspath(entries, null); >+ } >+ } > }
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 334652
:
187115
| 187145 |
187146