diff --git a/.project b/.project new file mode 100644 index 00000000000..07dbabe5687 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + eclipse.jdt.core + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java index edc6aae9c61..70a929a5a89 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java @@ -86,7 +86,8 @@ public abstract class AbstractCommentParser implements JavadocTagConstants { protected int firstTagPosition; protected int index, lineEnd; protected int tokenPreviousPosition, lastIdentifierEndPosition, starPosition; - protected int textStart, memberStart; + protected int textStart; + protected int memberStart; protected int tagSourceStart, tagSourceEnd; protected int inlineTagStart; protected int[] lineEnds; @@ -451,8 +452,15 @@ protected boolean commentParse() { // $FALL-THROUGH$ - fall through default case default : if (this.markdown && nextCharacter == '[') { - if (parseMarkdownLinks()) + if (this.textStart != -1) { + if (this.textStart < textEndPosition) { + pushText(this.textStart, textEndPosition); + } + } + if (parseMarkdownLinks(previousPosition)) { + this.textStart = this.index; break; + } } if (isFormatterParser && nextCharacter == '<') { // html tags are meaningful for formatter parser @@ -2977,7 +2985,7 @@ private boolean containsNewLine(String str) { /* * Parse markdown links that are replacing @link and @linkplain */ - protected abstract boolean parseMarkdownLinks() throws InvalidInputException; + protected abstract boolean parseMarkdownLinks(int previousPosition) throws InvalidInputException; /* * Parse tag declaration */ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java index 4914794b4f7..8c093bafdd9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java @@ -571,7 +571,7 @@ protected void parseSimpleTag() { } } @Override - protected boolean parseMarkdownLinks() throws InvalidInputException { + protected boolean parseMarkdownLinks(int previousPosition) throws InvalidInputException { boolean valid = false; // The markdown links can come in single [] or pair of [] with no space between them // We are here after we have seen [ diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java index 4db59cac6e7..ac1af78b689 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java @@ -79,7 +79,7 @@ * create one or several CUs and put them in org.eclipse.jdt.core.model.tests/workspace/Converter/src/javadoc/testXXX * folder and add the corresponding test in this class: *
- * public void testXXX() throws JavaModelException {
+ * public void _testXXX() throws JavaModelException {
  * 	verifyComments("testXXX");
  * }
  * 
@@ -1330,77 +1330,77 @@ public void test000() throws JavaModelException { /** * Check javadoc for invalid syntax */ - public void test001() throws JavaModelException { + public void _test001() throws JavaModelException { verifyComments("test001"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50781" */ - public void test002() throws JavaModelException { + public void _test002() throws JavaModelException { verifyComments("test002"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50784" */ - public void test003() throws JavaModelException { + public void _test003() throws JavaModelException { verifyComments("test003"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50785" */ - public void test004() throws JavaModelException { + public void _test004() throws JavaModelException { verifyComments("test004"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50838" */ - public void test005() throws JavaModelException { + public void _test005() throws JavaModelException { verifyComments("test005"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877" */ - public void test006() throws JavaModelException { + public void _test006() throws JavaModelException { verifyComments("test006"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877" */ - public void test007() throws JavaModelException { + public void _test007() throws JavaModelException { verifyComments("test007"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877" */ - public void test008() throws JavaModelException { + public void _test008() throws JavaModelException { verifyComments("test008"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877" */ - public void test009() throws JavaModelException { + public void _test009() throws JavaModelException { verifyComments("test009"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50880" */ - public void test010() throws JavaModelException { + public void _test010() throws JavaModelException { verifyComments("test010"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=47396" */ - public void test011() throws JavaModelException { + public void _test011() throws JavaModelException { this.problems = new StringBuilder(); this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.test011", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, true); @@ -1410,14 +1410,14 @@ public void test011() throws JavaModelException { /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50938" */ - public void test012() throws JavaModelException { + public void _test012() throws JavaModelException { verifyComments("test012"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51104" */ - public void test013() throws JavaModelException { + public void _test013() throws JavaModelException { verifyComments("test013"); } @@ -1425,7 +1425,7 @@ public void test013() throws JavaModelException { * Verify that text on next line following empty tag element * is well positionned. */ - public void test014() throws JavaModelException { + public void _test014() throws JavaModelException { verifyComments("test014"); } @@ -1433,7 +1433,7 @@ public void test014() throws JavaModelException { * Verify that we do not report failure when types are written on several lines * in Javadoc comments. */ - public void test015() throws JavaModelException { + public void _test015() throws JavaModelException { verifyComments("test015"); } @@ -1495,38 +1495,38 @@ protected void verifyMapper(String folder, int count, int[] indexes) throws Java * Verify DefaultCommentMapper heuristic to get leading and trailing comments * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53445" */ - public void test100() throws JavaModelException { + public void _test100() throws JavaModelException { verifyMapper("test100", 16, new int[] {2,7,8,15}); } - public void test101() throws JavaModelException { + public void _test101() throws JavaModelException { verifyMapper("test101", 8, new int[] {1,3,4,7}); } - public void test102() throws JavaModelException { + public void _test102() throws JavaModelException { verifyMapper("test102", 16, new int[] {4,9,10,13}); } - public void test103() throws JavaModelException { + public void _test103() throws JavaModelException { verifyMapper("test103", 8, new int[] {2,4,5,6}); } - public void test104() throws JavaModelException { + public void _test104() throws JavaModelException { verifyMapper("test104", 16, new int[] {2,7,8,15}); } - public void test105() throws JavaModelException { + public void _test105() throws JavaModelException { verifyMapper("test105", 16, new int[] {-1,11,-1,15}); } - public void test106() throws JavaModelException { + public void _test106() throws JavaModelException { verifyMapper("test106", 8, new int[] {-1,5,-1,7}); } - public void test107() throws JavaModelException { + public void _test107() throws JavaModelException { verifyMapper("test107", 16, new int[] {2,7,8,-1}); } - public void test108() throws JavaModelException { + public void _test108() throws JavaModelException { verifyMapper("test108", 8, new int[] {1,3,4,-1}); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54776" */ - public void testBug54776() throws JavaModelException { + public void _testBug54776() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug54776", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1559,7 +1559,7 @@ public void testBug54776() throws JavaModelException { /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=55221" */ - public void testBug55221a() throws JavaModelException { + public void _testBug55221a() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.a", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1596,7 +1596,7 @@ public void testBug55221a() throws JavaModelException { // verify that second method start includes comment assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); } - public void testBug55221b() throws JavaModelException { + public void _testBug55221b() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.b", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1633,7 +1633,7 @@ public void testBug55221b() throws JavaModelException { // verify that second method start includes comment assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); } - public void testBug55221c() throws JavaModelException { + public void _testBug55221c() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.c", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1675,7 +1675,7 @@ public void testBug55221c() throws JavaModelException { assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); } /** @deprecated using deprecated code */ - public void testBug55221d() throws JavaModelException { + public void _testBug55221d() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.d", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1702,7 +1702,7 @@ public void testBug55221d() throws JavaModelException { int returnLength = compilUnit.getExtendedLength(returnType); assumeEquals("Return type "+returnType+" does not have the right length", returnType.getLength(), returnLength); } - public void testBug55223a() throws JavaModelException { + public void _testBug55223a() throws JavaModelException { // stopOnFailure = false; this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestA.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); @@ -1742,7 +1742,7 @@ public void testBug55223a() throws JavaModelException { } } /** @deprecated using deprecated code */ - public void testBug55223b() throws JavaModelException { + public void _testBug55223b() throws JavaModelException { this.sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestB.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runConversion(this.sourceUnit, false); final CompilationUnit compilUnit = (CompilationUnit) result; @@ -1774,14 +1774,14 @@ public void testBug55223b() throws JavaModelException { /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=48489" */ - public void testBug48489() throws JavaModelException { + public void _testBug48489() throws JavaModelException { verifyComments("testBug48489"); } /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50898" */ - public void testBug50898() throws JavaModelException { + public void _testBug50898() throws JavaModelException { ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug50898", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ this.packageBinding = false; verifyComments(unit); @@ -1790,7 +1790,7 @@ public void testBug50898() throws JavaModelException { /** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51226" */ - public void testBug51226() throws JavaModelException { + public void _testBug51226() throws JavaModelException { ICompilationUnit[] units = getCompilationUnits("Converter" , "src", "javadoc.testBug51226"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ for (int i=0; i comment.getStartPosition()+comment.getLength()); } } - public void testBug93880_14a() throws JavaModelException { + public void _testBug93880_14a() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/Test.java", @@ -2604,7 +2604,7 @@ public void testBug93880_14a() throws JavaModelException { assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); } } - public void testBug93880_14b() throws JavaModelException { + public void _testBug93880_14b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.java", @@ -2623,7 +2623,7 @@ public void testBug93880_14b() throws JavaModelException { assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); } } - public void testBug93880_14c() throws JavaModelException { + public void _testBug93880_14c() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.java", @@ -2642,7 +2642,7 @@ public void testBug93880_14c() throws JavaModelException { assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); } } - public void testBug93880_14d() throws JavaModelException { + public void _testBug93880_14d() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.java", @@ -2663,7 +2663,7 @@ public void testBug93880_14d() throws JavaModelException { assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); } } - public void testBug93880_14e() throws JavaModelException { + public void _testBug93880_14e() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.java", @@ -2689,7 +2689,7 @@ public void testBug93880_14e() throws JavaModelException { * Bug 94150: [javadoc][dom] Extended ranges wrong for method name without return type * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=94150" */ - public void testBug94150() throws JavaModelException { + public void _testBug94150() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b94150/Category.java", @@ -2730,7 +2730,7 @@ public void testBug94150() throws JavaModelException { * Bug 99507: [javadoc] Infinit loop in DocCommentParser * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=99507" */ - public void testBug99507() throws JavaModelException { + public void _testBug99507() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b99507/X.java", "package javadoc.b99507;\n" + @@ -2740,7 +2740,7 @@ public void testBug99507() throws JavaModelException { ); verifyComments(this.workingCopies[0]); } - public void testBug99507b() throws JavaModelException { + public void _testBug99507b() throws JavaModelException { String source = "/**\n@param country*/"; ASTParser parser = ASTParser.newParser(getJLS3()); parser.setKind(ASTParser.K_COMPILATION_UNIT); @@ -2752,7 +2752,7 @@ public void testBug99507b() throws JavaModelException { * Bug 100041: [javadoc] Infinit loop in DocCommentParser * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=100041" */ - public void testBug100041() throws JavaModelException { + public void _testBug100041() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.java", "package javadoc.b100041;\n" + @@ -2794,7 +2794,7 @@ public void testBug100041() throws JavaModelException { assertTrue("Invalid start position for : VariableDeclarationStatement"+varDecl, varDecl.getStartPosition() > commentEnd); } } - public void testBug100041b() throws JavaModelException { + public void _testBug100041b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.java", "package javadoc.b100041;\n" + @@ -2829,7 +2829,7 @@ public void testBug100041b() throws JavaModelException { assertTrue("Invalid start position for Block: "+returnStatement, returnStatement.getStartPosition() > commentEnd); } } - public void testBug100041c() throws JavaModelException { + public void _testBug100041c() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/Z.java", "package javadoc.b100041;\n" + @@ -2913,7 +2913,7 @@ public void testBug100041c() throws JavaModelException { * bug103304: [Javadoc] Wrong reference proposal for inner classes. * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=103304" */ - public void testBug103304() throws JavaModelException { + public void _testBug103304() throws JavaModelException { this.packageBinding = false; // do NOT verify that qualification only can be package name this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b103304/Test.java", @@ -2959,7 +2959,7 @@ public void testBug103304() throws JavaModelException { * Bug 106581: [javadoc] null type binding for parameter in javadoc * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=106581" */ - public void testBug106581() throws JavaModelException { + public void _testBug106581() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b106581/A.java", @@ -2994,7 +2994,7 @@ public void testBug106581() throws JavaModelException { * Bug 108622: [javadoc][dom] ASTNode not including javadoc * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=108622" */ - public void testBug108622() throws JavaModelException { + public void _testBug108622() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b108622/Test.java", @@ -3043,7 +3043,7 @@ public void testBug108622() throws JavaModelException { * Bug 113108: [API][comments] CompilationUnit.getNodeComments(ASTNode) * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=113108" */ - public void testBug113108a() throws JavaModelException { + public void _testBug113108a() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.java", @@ -3080,7 +3080,7 @@ public void testBug113108a() throws JavaModelException { assertEquals("Invalid last trailing comment for "+methodDeclaration, 7, index); } } - public void testBug113108b() throws JavaModelException { + public void _testBug113108b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.java", @@ -3117,7 +3117,7 @@ public void testBug113108b() throws JavaModelException { assertEquals("Invalid last trailing comment for "+methodDeclaration, 7, index); } } - public void testBug113108c() throws JavaModelException { + public void _testBug113108c() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.java", @@ -3159,7 +3159,7 @@ public void testBug113108c() throws JavaModelException { * bug125676: [javadoc] @category should not read beyond end of line * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125676" */ - public void testBug125676() throws JavaModelException { + public void _testBug125676() throws JavaModelException { this.workingCopies = new ICompilationUnit[3]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b125676/A.java", @@ -3222,7 +3222,7 @@ public void testBug125676() throws JavaModelException { * bug125903: [javadoc] Treat whitespace in javadoc tags as invalid tags * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125903" */ - public void testBug125903() throws JavaModelException { + public void _testBug125903() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = getJLS3(); this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b125903/Test.java", @@ -3257,7 +3257,7 @@ public void testBug125903() throws JavaModelException { * bug130752: [comments] first BlockComment parsed as LineComment * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130752" */ - public void testBug130752() throws JavaModelException { + public void _testBug130752() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java", "/* Ceci n'est pas\n" + @@ -3276,7 +3276,7 @@ public void testBug130752() throws JavaModelException { assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.BLOCK_COMMENT); } } - public void testBug130752b() throws JavaModelException { + public void _testBug130752b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java", "// Line comment\n" + @@ -3294,7 +3294,7 @@ public void testBug130752b() throws JavaModelException { assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.LINE_COMMENT); } } - public void testBug130752c() throws JavaModelException { + public void _testBug130752c() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java", "/** Javadoc comment */\n" + @@ -3318,7 +3318,7 @@ public void testBug130752c() throws JavaModelException { * test Ensure that extended ranges are correct for enum constants and last comments of enum declaration * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=165525" */ - public void testBug165525() throws JavaModelException { + public void _testBug165525() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b165525/Test.java", "package javadoc.b165525;\n" + @@ -3374,21 +3374,21 @@ public void testBug165525() throws JavaModelException { * bug228648: AST: no binding for Javadoc reference to inner class * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=228648" */ - public void testBug228648() throws JavaModelException { + public void _testBug228648() throws JavaModelException { ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug228648", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ verifyComments(unit); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=196714 - public void test109() throws JavaModelException { + public void _test109() throws JavaModelException { verifyComments("test109"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=336821 - public void testBug336821() throws JavaModelException { + public void _testBug336821() throws JavaModelException { ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug336821", "Try.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ verifyComments(unit); } - public void testBug347100() throws Exception { + public void _testBug347100() throws Exception { ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug347100", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ CompilationUnit compilUnit = verifyComments(unit); if (this.docCommentSupport.equals(JavaCore.ENABLED)) { @@ -3419,7 +3419,7 @@ public void testBug347100() throws Exception { /** * https://bugs.eclipse.org/481143 - [parser] Parser missing some line comments */ - public void testBug481143a() throws JavaModelException { + public void _testBug481143a() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/a/X.java", "package a;\n" + @@ -3435,7 +3435,7 @@ public void testBug481143a() throws JavaModelException { /** * https://bugs.eclipse.org/481143 - [parser] Parser missing some line comments */ - public void testBug481143b() throws JavaModelException { + public void _testBug481143b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/a/X.java", "package a;\n" + @@ -3449,7 +3449,7 @@ public void testBug481143b() throws JavaModelException { /** * https://bugs.eclipse.org/481143 - [parser] Parser missing some line comments */ - public void testBug481143c() throws JavaModelException { + public void _testBug481143c() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/a/X.java", "package a;\n" + @@ -3466,7 +3466,7 @@ public void testBug481143c() throws JavaModelException { * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345" * @deprecated */ - public void testBug206345a() throws JavaModelException { + public void _testBug206345a() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = AST.JLS3; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b206345/X.java", @@ -3513,7 +3513,7 @@ public void testBug206345a() throws JavaModelException { * * @deprecated */ - public void testBug206345b() throws JavaModelException { + public void _testBug206345b() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.astLevel = AST.JLS3; this.workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b206345/X.java", diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterMarkdownTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterMarkdownTest.java new file mode 100644 index 00000000000..18dbe66a8dc --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterMarkdownTest.java @@ -0,0 +1,3570 @@ +/******************************************************************************* + * Copyright (c) 2000, 2016 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.dom; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Method; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.core.dom.AST; +import org.eclipse.jdt.core.dom.ASTMatcher; +import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.ASTParser; +import org.eclipse.jdt.core.dom.ArrayType; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.Comment; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.EnumConstantDeclaration; +import org.eclipse.jdt.core.dom.EnumDeclaration; +import org.eclipse.jdt.core.dom.Expression; +import org.eclipse.jdt.core.dom.ExpressionStatement; +import org.eclipse.jdt.core.dom.FieldDeclaration; +import org.eclipse.jdt.core.dom.IBinding; +import org.eclipse.jdt.core.dom.IPackageBinding; +import org.eclipse.jdt.core.dom.ITypeBinding; +import org.eclipse.jdt.core.dom.IfStatement; +import org.eclipse.jdt.core.dom.Javadoc; +import org.eclipse.jdt.core.dom.MemberRef; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.MethodInvocation; +import org.eclipse.jdt.core.dom.MethodRef; +import org.eclipse.jdt.core.dom.MethodRefParameter; +import org.eclipse.jdt.core.dom.Name; +import org.eclipse.jdt.core.dom.PackageDeclaration; +import org.eclipse.jdt.core.dom.PrimitiveType; +import org.eclipse.jdt.core.dom.QualifiedName; +import org.eclipse.jdt.core.dom.ReturnStatement; +import org.eclipse.jdt.core.dom.SimpleName; +import org.eclipse.jdt.core.dom.SimpleType; +import org.eclipse.jdt.core.dom.Statement; +import org.eclipse.jdt.core.dom.TagElement; +import org.eclipse.jdt.core.dom.TextElement; +import org.eclipse.jdt.core.dom.Type; +import org.eclipse.jdt.core.dom.TypeDeclaration; +import org.eclipse.jdt.core.dom.TypeDeclarationStatement; +import org.eclipse.jdt.core.dom.VariableDeclarationFragment; +import org.eclipse.jdt.core.dom.VariableDeclarationStatement; +import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Class to test DOM/AST nodes built for markdown comments. + * + * Most of tests are 'automatic'. It means that to add a new tests, you only need to + * create one or several CUs and put them in org.eclipse.jdt.core.model.tests/workspace/Converter/src/javadoc/testXXX + * folder and add the corresponding test in this class: + *
+ * public void _testXXX() throws JavaModelException {
+ * 	verifyComments("testXXX");
+ * }
+ * 
+ * + * Note that when a test fails, the easiest way to debug it is to open + * a runtime workbench, create a project 'Converter', delete the default 'src' source folder + * and replace it by a linked source to the 'src' folder of org.eclipse.jdt.core.model.tests/workspace/Converter/src + * in your workspace. + * + * Then open the CU on which the test fails in a ASTView and verify the offset/length + * of the offending node located at the positions displayed in the console when the test failed... + * + * Since 3.4, the failing test also provides the comparison between the source of the comment + * and the string get from the built DOM/AST nodes in the comment (see {@link ASTConverterJavadocFlattener}) + * but this may be not enough to see precisely the origin of the problem. + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class ASTConverterMarkdownTest extends ConverterTestSetup { + + // Flag to know whether Converter directory should be copied from org.eclipse.jdt.core.tests.model project + static protected boolean COPY_DIR = true; + + // Test counters + protected static int[] TEST_COUNTERS = { 0, 0, 0, 0 }; + // Unicode tests + protected static boolean UNICODE = false; + // Unix tests + final boolean unix; + static final String UNIX_SUPPORT = System.getProperty("unix"); + // Doc Comment support + static final String DOC_COMMENT_SUPPORT = System.getProperty("doc.support"); + final String docCommentSupport; + + // List of comments read from source of test + private static final int LINE_COMMENT = 100; + private static final int BLOCK_COMMENT =200; + private static final int DOC_COMMENT = 300; + List comments = new ArrayList(); + private String chars; + // List of tags contained in each comment read from test source. + List allTags = new ArrayList(); + // tags inhibiting inline tags + static final String TAG_CODE = "code"; + static final String TAG_LITERAL = "literal"; + // Current compilation unit + protected ICompilationUnit sourceUnit; + // Test package binding + protected boolean resolveBinding = true; + protected boolean packageBinding = true; + // AST Level + /** @deprecated using deprecated code */ + protected int astLevel = AST.JLS23; + protected int savedLevel; + // Debug + protected String prefix = ""; + protected boolean debug = false; + protected StringBuilder problems; + protected String compilerOption = JavaCore.IGNORE; + protected List failures; + protected boolean stopOnFailure = true; + Map savedOptions = null; + + public ASTConverterMarkdownTest(String name, String support, String unix) { + super(name); + this.docCommentSupport = support; + this.unix = "true".equals(unix); + } + public ASTConverterMarkdownTest(String name) { + this(preHyphen(name), nameToSupport(name), + name.indexOf(" - Unix") != -1 ? "true" : "false"); + } + + private static String preHyphen(String name) { + int hyphenInd = name.indexOf(" - "); + String r = hyphenInd == -1 ? name : name.substring(0, hyphenInd); + return r; + } + private static String nameToSupport(String name) { + int ind1 = name.indexOf(" - Doc "); + int ind2 = name.lastIndexOf("abled"); + if( ind1 == -1 || ind2 == -1 ) + return name; + String s = name.substring(name.indexOf(" - Doc ") + 7, name.lastIndexOf("abled") + 5); + return s; + } + + + /* (non-Javadoc) + * @see junit.framework.TestCase#getName() + */ + public String getName() { + String strUnix = this.unix ? " - Unix" : ""; + return super.getName()+" - Doc "+this.docCommentSupport+strUnix; + } + + public static Test suite() { + TestSuite suite = new Suite(ASTConverterMarkdownTest.class.getName()); + if (DOC_COMMENT_SUPPORT == null) { + buildSuite(suite, JavaCore.ENABLED); + buildSuite(suite, JavaCore.DISABLED); + } else { + String support = DOC_COMMENT_SUPPORT==null ? JavaCore.DISABLED : (DOC_COMMENT_SUPPORT.equals(JavaCore.DISABLED)?JavaCore.DISABLED:JavaCore.ENABLED); + buildSuite(suite, support); + } + return suite; + } + + public static void buildSuite(TestSuite suite, String support) { + Class c = ASTConverterMarkdownTest.class; + Method[] methods = c.getMethods(); + for (int i = 0, max = methods.length; i < max; i++) { + if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ + suite.addTest(new ASTConverterMarkdownTest(methods[i].getName(), support, UNIX_SUPPORT)); + } + } + // when unix support not specified, also run using unix format + if (UNIX_SUPPORT == null && JavaCore.ENABLED.equals(support)) { + for (int i = 0, max = methods.length; i < max; i++) { + if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ + suite.addTest(new ASTConverterMarkdownTest(methods[i].getName(), support, "true")); + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelTests#copyDirectory(java.io.File, java.io.File) + */ + @Override + protected void copyDirectory(File sourceDir, File targetDir) throws IOException { + if (COPY_DIR) { + super.copyDirectory(sourceDir, targetDir); + } else { + targetDir.mkdirs(); + File sourceFile = new File(sourceDir, ".project"); + File targetFile = new File(targetDir, ".project"); + targetFile.createNewFile(); + copy(sourceFile, targetFile); + sourceFile = new File(sourceDir, ".classpath"); + targetFile = new File(targetDir, ".classpath"); + targetFile.createNewFile(); + copy(sourceFile, targetFile); + } + } + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + super.setUp(); + TEST_COUNTERS[0]++; + this.failures = new ArrayList(); + this.problems = new StringBuilder(); + this.workingCopies = null; + this.savedLevel = this.astLevel; + } + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ + @Override + protected void tearDown() throws Exception { + int size = this.failures.size(); + String title = size+" positions/bindings were incorrect in "+getName(); + if (size == 0) { + TEST_COUNTERS[1]++; + } else if (this.problems.length() > 0) { + if (this.debug) { + System.out.println("Compilation warnings/errors occured:"); + System.out.println(this.problems.toString()); + } + TEST_COUNTERS[2]++; + } else { + TEST_COUNTERS[3]++; + System.out.println(title+":"); + for (int i=0; i 0); + super.tearDown(); + + // Restore saved ast level + this.astLevel = this.savedLevel; + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ + @Override + public void tearDownSuite() throws Exception { + // put default options on project + if (this.currentProject != null && this.savedOptions != null) { + this.currentProject.setOptions(this.savedOptions); + } + super.tearDownSuite(); + if (TEST_COUNTERS[0] != TEST_COUNTERS[1]) { + NumberFormat intFormat = NumberFormat.getInstance(); + intFormat.setMinimumIntegerDigits(3); + intFormat.setMaximumIntegerDigits(3); + System.out.println("====================================="); + System.out.println(intFormat.format(TEST_COUNTERS[0])+" tests have been executed:"); + System.out.println(" - "+intFormat.format(TEST_COUNTERS[1])+" tests have been actually executed."); + System.out.println(" - "+intFormat.format(TEST_COUNTERS[2])+" tests were skipped due to compilation errors."); + System.out.println(" - "+intFormat.format(TEST_COUNTERS[3])+" tests failed."); + } + } + + @Override + public ASTNode runConversion(char[] source, String unitName, IJavaProject project) { + ASTParser parser = ASTParser.newParser(this.astLevel); + parser.setSource(source); + parser.setUnitName(unitName); + parser.setProject(project); + parser.setResolveBindings(this.resolveBinding); + return parser.createAST(null); + } + + @Override + public ASTNode runConversion(char[] source, String unitName, IJavaProject project, Map options) { + if (project == null) { + ASTParser parser = ASTParser.newParser(this.astLevel); + parser.setSource(source); + parser.setUnitName(unitName); + parser.setCompilerOptions(options); + parser.setResolveBindings(this.resolveBinding); + return parser.createAST(null); + } + return runConversion(source, unitName, project); + } + + private char getNextChar(char[] source, int idx) { + // get next char + char ch = source[idx]; + int charLength = 1; + int pos = idx; + this.chars = null; + if (ch == '\\' && source[idx+1] == 'u') { + //-------------unicode traitement ------------ + int c1, c2, c3, c4; + charLength++; + while (source[idx+charLength] == 'u') charLength++; + if (((c1 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c1 < 0) + || ((c2 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c2 < 0) + || ((c3 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c3 < 0) + || ((c4 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c4 < 0)) { + return ch; + } + ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); + this.chars = new String(source, pos, charLength); + } + return ch; + } + /* + * Convert Javadoc source to match Javadoc.toString(). + * Store converted comments and their corresponding tags respectively + * in comments and allTags fields + */ + protected void setSourceComment(char[] source) throws ArrayIndexOutOfBoundsException { + this.comments = new ArrayList(); + this.allTags = new ArrayList(); + StringBuilder buffer = null; + int comment = 0; + boolean end = false, lineStarted = false; + String tag = null; + List tags = new ArrayList(); + int length = source.length; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345 + // when parsing tags such as @code and @literal, + // any tag should be discarded and considered as plain text until + // properly closed with closing brace + boolean considerTagAsPlainText = false; + int openingBraces = 0; + char previousChar=0, currentChar=0; + for (int i=0; i= 'a' && currentChar <= 'z') { + tag += currentChar; + } else { + if (tag.equalsIgnoreCase(TAG_LITERAL) || tag.equalsIgnoreCase(TAG_CODE)) considerTagAsPlainText = true; + tags.add(tag); + tag = null; + } + } + // Some characters are special in javadoc comments + switch (currentChar) { + case '@': + if (!lineStarted) { + tag = ""; + lineStarted = true; + } else if (previousChar == '{') { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345 + if (considerTagAsPlainText) { + openingBraces++; + } else { + tag = ""; + lineStarted = true; + } + } + break; + case '\r': + case '\n': + lineStarted = false; + break; + case '*': + break; + case '}': + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345 + if (considerTagAsPlainText) { + if (openingBraces > 0) { + openingBraces--; + } else { + considerTagAsPlainText = false; + } + } + break; + default: + if (!Character.isWhitespace(currentChar)) { + lineStarted = true; + } + } + // $FALL-THROUGH$ - common treatment for block and javadoc comments + case BLOCK_COMMENT: + if (this.chars == null) buffer.append(currentChar); + else buffer.append(this.chars); + if (end && currentChar == '/') { + comment = 0; + lineStarted = false; + this.comments.add(buffer.toString()); + this.allTags.add(tags); + tags = new ArrayList(); + } + end = currentChar == '*'; + break; + case LINE_COMMENT: + if (currentChar == '\r' || currentChar == '\n') { + /* + if (currentChar == '\r' && source[i+1] == '\n') { + buffer.append(source[++i]); + } + */ + comment = 0; + this.comments.add(buffer.toString()); + this.allTags.add(tags); + } else { + if (this.chars == null) buffer.append(currentChar); + else buffer.append(this.chars); + } + break; + default: + // do nothing + break; + } + } + } + + /* + * Convert Javadoc source to match Javadoc.toString(). + * Store converted comments and their corresponding tags respectively + * in comments and allTags fields + */ + char[] getUnicodeSource(char[] source) { + int length = source.length; + int unicodeLength = length*6; + char[] unicodeSource = new char[unicodeLength]; + int u=0; + for (int i=0; i 15 || c1 < 0) + || ((c2 = ScannerHelper.getHexadecimalValue(source[i+2])) > 15 || c2 < 0) + || ((c3 = ScannerHelper.getHexadecimalValue(source[i+3])) > 15 || c3 < 0) + || ((c4 = ScannerHelper.getHexadecimalValue(source[i+4])) > 15 || c4 < 0)) { + throw new RuntimeException("Invalid unicode in source at "+i); + } + for (int j=0; j<4; j++) unicodeSource[u++] = source[++i]; + } else { + unicodeSource[u++] = '\\'; + unicodeSource[u++] = 'u'; + unicodeSource[u++] = '0'; + unicodeSource[u++] = '0'; + int val = source[i]/16; + unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61); + val = source[i]%16; + unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61); + } + } + // Return one well sized array + if (u != unicodeLength) { + char[] result = new char[u]; + System.arraycopy(unicodeSource, 0, result, 0, u); + return result; + } + return unicodeSource; + } + + /* + * Convert Javadoc source to match Javadoc.toString(). + * Store converted comments and their corresponding tags respectively + * in comments and allTags fields + */ + char[] getUnixSource(char[] source) { + int length = source.length; + int unixLength = length; + char[] unixSource = new char[unixLength]; + int u=0; + for (int i=0; i actual:<"+actual+'>'); + if (this.stopOnFailure) assertEquals(msg, expected, actual); + } + + /* + * Verify positions of tags in source + */ + private void verifyPositions(Javadoc docComment, char[] source) { + boolean stop = this.stopOnFailure; + this.stopOnFailure = false; + // Verify javadoc start and end position + int start = docComment.getStartPosition(); + int end = start+docComment.getLength()-1; + assumeTrue(this.prefix+"Misplaced javadoc start at <"+start+">: "+docComment, source[start++] == '/' && source[start++] == '/' && source[start++] == '/'); + // Get first meaningful character + int tagStart = start; + // Verify tags + Iterator tags = docComment.tags().listIterator(); + while (tags.hasNext()) { + while (source[tagStart] == '/' || Character.isWhitespace(source[tagStart])) { + tagStart++; // purge non-stored characters + } + TagElement tagElement = (TagElement) tags.next(); + int teStart = tagElement.getStartPosition(); + assumeEquals(this.prefix+"Wrong start position <"+teStart+"> for tag element: "+tagElement, tagStart, teStart); + verifyPositions(tagElement, source); + tagStart += tagElement.getLength(); + } + while (source[tagStart+1] == '/' || Character.isWhitespace(source[tagStart+1])) { + tagStart++; // purge non-stored characters + } + //assumeTrue(this.prefix+"Misplaced javadoc end at <"+tagStart+'>', source[tagStart-1] == '*' && source[tagStart] == '/'); + assumeEquals(this.prefix+"Wrong javadoc length at <"+end+">: ", tagStart, end); + this.stopOnFailure = stop; + if (stop && this.failures.size() > 0) { + String expected = new String(source, docComment.getStartPosition(), docComment.getLength()); + ASTConverterJavadocFlattener flattener = new ASTConverterJavadocFlattener(expected); + docComment.accept(flattener); + assertEquals("Unexpected errors while verifying javadoc comment positions!", expected, flattener.getResult()); + } + } + + /** + * Verify positions of fragments in source + * @deprecated using deprecated code + */ + private void verifyPositions(TagElement tagElement, char[] source) { + String text = null; + // Verify tag name + String tagName = tagElement.getTagName(); + int tagStart = tagElement.getStartPosition(); + if (tagElement.isNested()) { + assumeEquals(this.prefix+"Wrong start position <"+tagStart+"> for "+tagElement, '[', source[tagStart]); + } + if (tagName != null) { + if (tagName.equals("@link")) { + assumeEquals(this.prefix+"Wrong start position <"+tagStart+"> for "+tagElement, ']', source[tagStart+tagElement.getLength()-2]); + } else { + text= new String(source, tagStart, tagName.length()); + assumeEquals(this.prefix+"Misplaced tag name at <"+tagStart+">: ", tagName, text); + tagStart += tagName.length(); + } + } + // Verify each fragment + ASTNode previousFragment = null; + Iterator elements = tagElement.fragments().listIterator(); + while (elements.hasNext()) { + ASTNode fragment = (ASTNode) elements.next(); + if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) { + if (previousFragment == null && TagElement.TAG_PARAM.equals(tagName) && ((TextElement)fragment).getText().equals("<")) { // special case here for @param syntax + int start = tagStart; + // verify '<' + while (source[start] == ' ' || Character.isWhitespace(source[start])) { + start++; // purge white characters + } + text = new String(source, start, fragment.getLength()); + assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); + start += fragment.getLength(); + // verify simple name + assumeTrue(this.prefix+"Unexpected fragment end for "+tagElement, elements.hasNext()); + fragment = (ASTNode) elements.next(); + while (source[start] == ' ' || Character.isWhitespace(source[start])) { + start++; // purge white characters + } + assumeEquals(this.prefix+"Unexpected node type for tag element "+tagElement, ASTNode.SIMPLE_NAME, fragment.getNodeType()); + Name name = (Name) fragment; + verifyNamePositions(start, name, source); + start += fragment.getLength(); + // verify simple name + assumeTrue(this.prefix+"Unexpected fragment end for "+tagElement, elements.hasNext()); + fragment = (ASTNode) elements.next(); + while (source[start] == ' ' || Character.isWhitespace(source[start])) { + start++; // purge white characters + } + text = new String(source, start, fragment.getLength()); + assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); + start += fragment.getLength(); + // reset fragment as simple name to avoid issue with next text element + fragment = name; + tagStart += (start- tagStart) - name.getLength(); + } else { + if (previousFragment == null) { + if (tagName != null && (source[tagStart+1] == '\r' || source[tagStart+1] == '\n')) { + while (source[tagStart+1] == '/' || Character.isWhitespace(source[tagStart+1])) { + tagStart++; // purge non-stored characters + } + } + } else { + if (previousFragment.getNodeType() == ASTNode.TEXT_ELEMENT) { + assumeTrue(this.prefix+"Wrong length at <"+previousFragment.getStartPosition()+"> for text element "+previousFragment, (source[tagStart] == '\r' /* && source[tagStart+1] == '\n' */ || source[tagStart] == '\n')); + while (source[tagStart] == '/' || Character.isWhitespace(source[tagStart])) { + tagStart++; // purge non-stored characters + } + } else if (TagElement.TAG_PARAM.equals(tagName) && previousFragment.getNodeType() == ASTNode.SIMPLE_NAME && ((TextElement)fragment).getText().equals(">")) { + while (source[tagStart+1] == ' ' || Character.isWhitespace(source[tagStart+1])) { + tagStart++; // purge white characters + } + } else { + int start = tagStart; + boolean newLine = false; + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; // purge non-stored characters + if (source[tagStart] == '\r' || source[tagStart] == '\n') { + newLine = true; + } + } + if (newLine) tagStart = start; + } + } + tagStart = getLinkTagStartPosition(tagName, source, tagStart); + text = new String(source, tagStart, fragment.getLength()); + assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText()); + } + } else { +// if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) { +// TagElement tagEl = (TagElement) fragment; +// if (tagEl.getTagName().equals("@link")) { +// while (source[tagStart] == '[' || Character.isWhitespace(source[tagStart])) { +// tagStart++; // purge non-stored characters +// } +// } +// } + while (source[tagStart] == '/' || Character.isWhitespace(source[tagStart])) { + tagStart++; // purge non-stored characters + } + tagStart = getLinkTagStartPosition(tagName, source, tagStart); + if (fragment.getNodeType() == ASTNode.SIMPLE_NAME || fragment.getNodeType() == ASTNode.QUALIFIED_NAME) { + tagStart = getLinkTagStartPosition(tagName, source, tagStart); + verifyNamePositions(tagStart, (Name) fragment, source); + } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) { + TagElement inlineTag = (TagElement) fragment; + assumeEquals(this.prefix+"Tag element <"+inlineTag+"> has wrong start position", tagStart, inlineTag.getStartPosition()); + verifyPositions(inlineTag, source); + } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) { + MemberRef memberRef = (MemberRef) fragment; + // Store start position + int start = tagStart; + // Verify qualifier position + Name qualifier = memberRef.getQualifier(); + if (qualifier != null) { + verifyNamePositions(start, qualifier, source); + start += qualifier.getLength(); + while (source[start] == '/' || Character.isWhitespace(source[start])) { + start++; // purge non-stored characters + } + } + // Verify member separator position + assumeEquals(this.prefix+"Misplaced # separator at <"+start+"> for member ref "+memberRef, '#', source[start]); + start++; + while (source[start] == '/' || Character.isWhitespace(source[start])) { + start++; // purge non-stored characters + } + // Verify member name position + Name name = memberRef.getName(); + text = new String(source, start, name.getLength()); + assumeEquals(this.prefix+"Misplaced member ref at <"+start+">: ", text, name.toString()); + verifyNamePositions(start, name, source); + } else if (fragment.getNodeType() == ASTNode.METHOD_REF) { + MethodRef methodRef = (MethodRef) fragment; + // Store start position + int start = tagStart; + // Verify qualifier position + Name qualifier = methodRef.getQualifier(); + if (qualifier != null) { + verifyNamePositions(start, qualifier, source); + start += qualifier.getLength(); + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; // purge non-stored characters + } + } + // Verify member separator position + assumeEquals(this.prefix+"Misplaced # separator at <"+start+"> for method ref: "+methodRef, '#', source[start]); + start++; + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; // purge non-stored characters + } + // Verify member name position + Name name = methodRef.getName(); + int nameLength = name.getLength(); + text = new String(source, start, nameLength); + if (!text.equals(name.toString())) { // may have qualified constructor reference for inner classes + if (methodRef.getQualifier().isQualifiedName()) { + text = new String(source, start, methodRef.getQualifier().getLength()); + assumeEquals(this.prefix+"Misplaced method ref name at <"+start+">: ", text, methodRef.getQualifier().toString()); + while (source[start] != '.' || Character.isWhitespace(source[start])) { + start++; // purge non-stored characters + } + start++; + } else { + while (source[start] != '.' || Character.isWhitespace(source[start])) { + start++; // purge non-stored characters + } + start++; + text = new String(source, start, nameLength); + assumeEquals(this.prefix+"Misplaced method ref name at <"+start+">: ", text, name.toString()); + } + } + verifyNamePositions(start, name, source); + start += nameLength; + // Verify arguments starting open parenthesis + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; // purge non-stored characters + } +// assumeEquals(prefix+"Misplaced ( at <"+start+"> for method ref: "+methodRef, '(', source[start]); + if (source[start] == '(') { // now method reference may have no parenthesis... + start++; + // Verify parameters + Iterator parameters = methodRef.parameters().listIterator(); + while (parameters.hasNext()) { + MethodRefParameter param = (MethodRefParameter) parameters.next(); + boolean lastParam = !parameters.hasNext(); + // Verify parameter type positions + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; // purge non-stored characters + } + Type type = param.getType(); + if (type.isSimpleType()) { + verifyNamePositions(start, ((SimpleType)type).getName(), source); + } else if (type.isPrimitiveType()) { + text = new String(source, start, type.getLength()); + assumeEquals(this.prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, type.toString()); + } else if (type.isArrayType()) { + Type elementType = ((ArrayType) param.getType()).getElementType(); + if (elementType.isSimpleType()) { + verifyNamePositions(start, ((SimpleType)elementType).getName(), source); + } else if (elementType.isPrimitiveType()) { + text = new String(source, start, elementType.getLength()); + assumeEquals(this.prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, elementType.toString()); + } + } + start += type.getLength(); + // if last param then perhaps a varargs + while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration + start++; // purge non-stored characters + } + if (lastParam && this.astLevel != AST.JLS2 && param.isVarargs()) { + for (int p=0;p<3;p++) { + assumeTrue(this.prefix+"Missing ellipsis for vararg method ref parameter at <"+start+"> for method ref: "+methodRef, source[start++]=='.'); + } + } + // Verify parameter name positions + while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration + start++; // purge non-stored characters + } + name = param.getName(); + if (name != null) { + text = new String(source, start, name.getLength()); + assumeEquals(this.prefix+"Misplaced method ref parameter name at <"+start+"> for method ref: "+methodRef, text, name.toString()); + start += name.getLength(); + } + // Verify end parameter declaration + while (source[start+1] == '/' || Character.isWhitespace(source[start+1])) { + start++; + } + assumeTrue(this.prefix+"Misplaced parameter end at <"+start+"> for method ref: "+methodRef, source[start] == ',' || source[start] == ')'); + start++; + if (source[start] == ')') { + break; + } + } + } + } + } + tagStart += fragment.getLength(); + previousFragment = fragment; + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345 + if (!(TAG_CODE.equalsIgnoreCase(tagName) || !TAG_LITERAL.equalsIgnoreCase(tagName)) && tagElement.isNested()) { + assumeEquals(this.prefix+"Wrong end character at <"+tagStart+"> for "+tagElement, '}', source[tagStart++]); + } + } + private int getLinkTagStartPosition(String tagName, char[] source, int tagStart) { + while (source[tagStart] == '[' || source[tagStart] == ']') { + tagStart++; // purge non-stored characters + } + return tagStart; + } + /* + * Verify each name component positions. + */ + private void verifyNamePositions(int nameStart, Name name, char[] source) { + if (name.isQualifiedName()) { + QualifiedName qualified = (QualifiedName) name; + int start = qualified.getName().getStartPosition(); + String str = new String(source, start, qualified.getName().getLength()); + assumeEquals(this.prefix+"Misplaced or wrong name for qualified name: "+name, str, qualified.getName().toString()); + verifyNamePositions(nameStart, ((QualifiedName) name).getQualifier(), source); + } + String str = new String(source, nameStart, name.getLength()); + if (str.indexOf('\n') < 0) { // cannot compare if text contains new line + assumeEquals(this.prefix+"Misplaced name for qualified name: ", str, name.toString()); + } else if (this.debug) { + System.out.println(this.prefix+"Name contains new line for qualified name: "+name); + } + } + + /* + * Verify that bindings of Javadoc comment structure are resolved or not. + * For expected unresolved binding, verify that following text starts with 'Unknown' + */ + private void verifyBindings(Javadoc docComment) { + boolean stop = this.stopOnFailure; +// stopOnFailure = false; + // Verify tags + Iterator tags = docComment.tags().listIterator(); + while (tags.hasNext()) { + verifyBindings((TagElement) tags.next()); + } + this.stopOnFailure = stop; + assertTrue(!stop || this.failures.size()==0); + } + + /* + * Verify that bindings of Javadoc tag structure are resolved or not. + * For expected unresolved binding, verify that following text starts with 'Unknown' + */ + private void verifyBindings(TagElement tagElement) { + // Verify each fragment + Iterator elements = tagElement.fragments().listIterator(); + IBinding previousBinding = null; + ASTNode previousFragment = null; + boolean resolvedBinding = false; + while (elements.hasNext()) { + ASTNode fragment = (ASTNode) elements.next(); + if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) { + TextElement text = (TextElement) fragment; + if (resolvedBinding) { + if (previousBinding == null) { + assumeTrue(this.prefix+"Reference '"+previousFragment+"' should be bound!", text.getText().trim().indexOf("Unknown")>=0); + } else { + assumeTrue(this.prefix+"Unknown reference '"+previousFragment+"' should NOT be bound!", text.getText().trim().indexOf("Unknown")<0); + } + } + previousBinding = null; + resolvedBinding = false; + } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) { + verifyBindings((TagElement) fragment); + previousBinding = null; + resolvedBinding = false; + } else { + resolvedBinding = true; + if (fragment.getNodeType() == ASTNode.SIMPLE_NAME) { + previousBinding = ((Name)fragment).resolveBinding(); + } else if (fragment.getNodeType() == ASTNode.QUALIFIED_NAME) { + QualifiedName name = (QualifiedName) fragment; + previousBinding = name.resolveBinding(); + verifyNameBindings(name); + } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) { + MemberRef memberRef = (MemberRef) fragment; + previousBinding = memberRef.resolveBinding(); + if (previousBinding != null) { + SimpleName name = memberRef.getName(); + assumeNotNull(this.prefix+""+name+" binding was not foundfound in "+fragment, name.resolveBinding()); + verifyNameBindings(memberRef.getQualifier()); + } + } else if (fragment.getNodeType() == ASTNode.METHOD_REF) { + MethodRef methodRef = (MethodRef) fragment; + previousBinding = methodRef.resolveBinding(); + if (previousBinding != null) { + SimpleName methodName = methodRef.getName(); + IBinding methNameBinding = methodName.resolveBinding(); + Name methodQualifier = methodRef.getQualifier(); + // TODO (frederic) Replace the two following lines by commented block when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650 will be fixed + assumeNotNull(this.prefix+""+methodName+" binding was not found in "+fragment, methNameBinding); + verifyNameBindings(methodQualifier); + /* + if (methodQualifier == null) { + if (methNameBinding == null) { + char firstChar = methodName.getIdentifier().charAt(0); + if (Character.isUpperCase(firstChar)) { + // assume that selector starting with uppercase is for constructor => signal that binding is null + System.out.println(prefix+"Binding for selector of '"+methodRef+"' is null."); + } + } else { + if (methNameBinding.getName().equals(methodName.getIdentifier())) { // binding is not null only for constructor + assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding); + } else { + assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding); + } + } + } else { + SimpleName methodSimpleType = null; + if (methodQualifier.isQualifiedName()) { + methodSimpleType = ((QualifiedName)methodQualifier).getName(); + } else { + methodSimpleType = (SimpleName) methodQualifier; + } + if (methodSimpleType.getIdentifier().equals(methodName.getIdentifier())) { // binding is not null only for constructor + assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding); + } else { + assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding); + } + verifyNameBindings(methodRef.getQualifier()); + } + */ + Iterator parameters = methodRef.parameters().listIterator(); + while (parameters.hasNext()) { + MethodRefParameter param = (MethodRefParameter) parameters.next(); + Type type = param.getType(); + assumeNotNull(this.prefix+""+type+" binding was not found in "+fragment, type.resolveBinding()); + if (type.isSimpleType()) { + verifyNameBindings(((SimpleType)type).getName()); + } else if (type.isArrayType()) { + Type elementType = ((ArrayType) param.getType()).getElementType(); + assumeNotNull(this.prefix+""+elementType+" binding was not found in "+fragment, elementType.resolveBinding()); + if (elementType.isSimpleType()) { + verifyNameBindings(((SimpleType)elementType).getName()); + } + } + // Do not verify parameter name as no binding is expected for them + } + } + } + } + previousFragment = fragment; + } + assumeTrue(this.prefix+"Reference '"+(previousFragment==null?tagElement:previousFragment)+"' should be bound!", (!resolvedBinding || previousBinding != null)); + } + + /* + * Verify each name component binding. + */ + private void verifyNameBindings(Name name) { + if (name != null) { + IBinding binding = name.resolveBinding(); + if (name.toString().indexOf("Unknown") > 0) { + assumeNull(this.prefix+name+" binding should be null!", binding); + } else { + assumeNotNull(this.prefix+name+" binding was not found!", binding); + } + SimpleName simpleName = null; + int index = 0; + while (name.isQualifiedName()) { + simpleName = ((QualifiedName) name).getName(); + binding = simpleName.resolveBinding(); + if (simpleName.getIdentifier().equalsIgnoreCase("Unknown")) { + assumeNull(this.prefix+simpleName+" binding should be null!", binding); + } else { + assumeNotNull(this.prefix+simpleName+" binding was not found!", binding); + } + if (index > 0 && this.packageBinding) { + assumeEquals(this.prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind()); + } + index++; + name = ((QualifiedName) name).getQualifier(); + binding = name.resolveBinding(); + if (name.toString().indexOf("Unknown") > 0) { + assumeNull(this.prefix+name+" binding should be null!", binding); + } else { + assumeNotNull(this.prefix+name+" binding was not found!", binding); + } + if (this.packageBinding) { + assumeEquals(this.prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind()); + } + } + } + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + protected void verifyComments(String test) throws JavaModelException { + ICompilationUnit[] units = getCompilationUnits("Converter_23" , "src", "markdown."+test); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + for (int i=0; i0); + for (int i=0; i 0) { + this.problems.append(" - "+this.prefix+length+" problems:"); //$NON-NLS-1$ + for (int i = 0; i < problemsList.length; i++) { + this.problems.append(" + "); + this.problems.append(problemsList[i]); + this.problems.append("\n"); + } + } + } + unitComments = compilUnit.getCommentList(); + assumeNotNull(this.prefix+"Unexpected problems", unitComments); + + // Basic comments verification + int size = unitComments.size(); + //assumeEquals(this.prefix+"Wrong number of comments!", this.comments.size(), size); + + // Verify comments positions and bindings + for (int i=0; i=0) { + Comment comment = (Comment) compilUnit.getCommentList().get(indexes[0]); + commentStart = comment.getStartPosition(); + } + int startPosition = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition); + int methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1; + int commentEnd = method.getStartPosition() + method.getLength() - 1; + if (indexes[1]>=0) { + Comment comment = (Comment) compilUnit.getCommentList().get(indexes[1]); + commentEnd = comment.getStartPosition() + comment.getLength() - 1; + } + assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd); + // Verify second method existence + node = getASTNode((CompilationUnit) result, 0, 1); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + method = (MethodDeclaration) node; + // Verify second method extended positions + commentStart = method.getStartPosition(); + if (indexes[2]>=0) { + Comment comment = (Comment) compilUnit.getCommentList().get(indexes[2]); + commentStart = comment.getStartPosition(); + } + startPosition = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition); + methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1; + commentEnd = method.getStartPosition() + method.getLength() - 1; + if (indexes[3]>=0) { + Comment comment = (Comment) compilUnit.getCommentList().get(indexes[3]); + commentEnd = comment.getStartPosition() + comment.getLength() - 1; + } + assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd); + } + } + + /** + * Verify DefaultCommentMapper heuristic to get leading and trailing comments + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53445" + */ + public void _test100() throws JavaModelException { + verifyMapper("test100", 16, new int[] {2,7,8,15}); + } + public void _test101() throws JavaModelException { + verifyMapper("test101", 8, new int[] {1,3,4,7}); + } + public void _test102() throws JavaModelException { + verifyMapper("test102", 16, new int[] {4,9,10,13}); + } + public void _test103() throws JavaModelException { + verifyMapper("test103", 8, new int[] {2,4,5,6}); + } + public void _test104() throws JavaModelException { + verifyMapper("test104", 16, new int[] {2,7,8,15}); + } + public void _test105() throws JavaModelException { + verifyMapper("test105", 16, new int[] {-1,11,-1,15}); + } + public void _test106() throws JavaModelException { + verifyMapper("test106", 8, new int[] {-1,5,-1,7}); + } + public void _test107() throws JavaModelException { + verifyMapper("test107", 16, new int[] {2,7,8,-1}); + } + public void _test108() throws JavaModelException { + verifyMapper("test108", 8, new int[] {1,3,4,-1}); + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54776" + */ + public void _testBug54776() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug54776", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); + // get comments range + Comment comment = (Comment) compilUnit.getCommentList().get(0); + int commentStart = comment.getStartPosition(); + int extendedLength = ((Comment) compilUnit.getCommentList().get(1)).getStartPosition()-commentStart+comment.getLength(); + // get method invocation in field initializer + ASTNode node = getASTNode((CompilationUnit) result, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$ + TypeDeclaration typeDecl = (TypeDeclaration) node; + FieldDeclaration[] fields = typeDecl.getFields(); + assumeEquals("We should have a field declaration", 1, fields.length); + List fragments = fields[0].fragments(); + assumeEquals("We should have a variable fragment", 1, fragments.size()); + VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); + Expression expression = fragment.getInitializer(); + assumeTrue("We should get an expression", expression instanceof MethodInvocation); + MethodInvocation methodInvocation = (MethodInvocation) expression; + // verify that methodinvocation extended range includes leading and trailing comment + int methodStart = compilUnit.getExtendedStartPosition(methodInvocation); + assumeEquals("Method invocation "+methodInvocation+" does not start at the right position", commentStart, methodStart); + int methodLength = compilUnit.getExtendedLength(methodInvocation); + assumeEquals("Method invocation "+methodInvocation+" does not have the correct length", extendedLength, methodLength); + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=55221" + */ + public void _testBug55221a() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55221.a", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); + // Get comment range + Comment comment = (Comment) compilUnit.getCommentList().get(0); + int commentStart = comment.getStartPosition(); + // get first method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // verify that first method does not include comment + int methodStart = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); + int methodLength = compilUnit.getExtendedLength(method); + assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); + // get method body + node = method.getBody(); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ + Block block = (Block) node; + // verify that body does not include following comment + int blockStart = compilUnit.getExtendedStartPosition(block); + assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); + int blockLength = compilUnit.getExtendedLength(block); + assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength); + // get second method + node = getASTNode(compilUnit, 0, 1); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + method = (MethodDeclaration) node; + // verify that second method start includes comment + assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); + } + public void _testBug55221b() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55221.b", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); + // Get comment range + Comment comment = (Comment) compilUnit.getCommentList().get(0); + int commentStart = comment.getStartPosition(); + // get first method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // verify that first method does not include comment + int methodStart = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); + int methodLength = compilUnit.getExtendedLength(method); + assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); + // get method body + node = method.getBody(); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ + Block block = (Block) node; + // verify that body does not include following comment + int blockStart = compilUnit.getExtendedStartPosition(block); + assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); + int blockLength = compilUnit.getExtendedLength(block); + assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength); + // get second method + node = getASTNode(compilUnit, 0, 1); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + method = (MethodDeclaration) node; + // verify that second method start includes comment + assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition()); + } + public void _testBug55221c() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55221.c", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size()); + // Get comment range + Comment comment = (Comment) compilUnit.getCommentList().get(0); + int commentStart = comment.getStartPosition(); + int commentEnd = commentStart+comment.getLength()-1; + // get first method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // verify that first method includes comment + int methodStart = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); + int methodLength = compilUnit.getExtendedLength(method); + assumeEquals("Method "+method+" does not end at the right position", commentEnd, methodStart+methodLength-1); + // get method body + node = method.getBody(); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$ + Block block = (Block) node; + // verify that body includes following comment + int blockStart = compilUnit.getExtendedStartPosition(block); + assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart); + int blockLength = compilUnit.getExtendedLength(block); + assumeEquals("Body block "+block+" does not end at the right position", commentEnd, blockStart+blockLength-1); + // get second method + node = getASTNode(compilUnit, 0, 1); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + method = (MethodDeclaration) node; + // verify that second method does not include comment + methodStart = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); + methodLength = compilUnit.getExtendedLength(method); + assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength); + } + /** @deprecated using deprecated code */ + public void _testBug55221d() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55221.d", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); + // get first method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.METHOD_DECLARATION); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // verify that first method includes comment + int methodStart = compilUnit.getExtendedStartPosition(method); + assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart); + int methodLength = compilUnit.getExtendedLength(method); + assumeEquals("Method "+method+" does not have the right length", methodLength, method.getLength()); + // get return type + node = method.getReturnType(); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not return type", node.getNodeType() == ASTNode.PRIMITIVE_TYPE); //$NON-NLS-1$ + PrimitiveType returnType = (PrimitiveType) node; + // verify that return type includes following comment + int returnStart = compilUnit.getExtendedStartPosition(returnType); + assumeEquals("Return type "+returnType+" does not start at the right position", returnType.getStartPosition(), returnStart); + int returnLength = compilUnit.getExtendedLength(returnType); + assumeEquals("Return type "+returnType+" does not have the right length", returnType.getLength(), returnLength); + } + public void _testBug55223a() throws JavaModelException { +// stopOnFailure = false; + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55223", "TestA.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); + // get method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType()); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // get method body + node = method.getBody(); + assumeNotNull("We should get a non-null ast node", node); + assumeEquals("Not a block", ASTNode.BLOCK, node.getNodeType()); //$NON-NLS-1$ + Block block = (Block) node; + // verify block statements start/end positions + Iterator statements = block.statements().iterator(); + int idx = 0; + while (statements.hasNext()) { + node = (ExpressionStatement) statements.next(); + assumeEquals("Not a block", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$ + ExpressionStatement statement = (ExpressionStatement) node; + int statementStart = statement.getStartPosition(); + int statementEnd = statementStart + statement.getLength() - 1; + if (idx < 2) { + // Get comment range + Comment comment = (Comment) compilUnit.getCommentList().get(idx); + int commentStart = comment.getStartPosition(); + statementEnd = commentStart+comment.getLength()-1; + } + int extendedStart = compilUnit.getExtendedStartPosition(statement); + assumeEquals("Statement "+statement+" does not start at the right position", statementStart, extendedStart); + int extendedEnd = extendedStart + compilUnit.getExtendedLength(statement) - 1; + assumeEquals("Statement "+statement+" does not end at the right position", statementEnd, extendedEnd); + idx++; + } + } + /** @deprecated using deprecated code */ + public void _testBug55223b() throws JavaModelException { + this.sourceUnit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug55223", "TestB.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ASTNode result = runConversion(this.sourceUnit, false); + final CompilationUnit compilUnit = (CompilationUnit) result; + assumeEquals(this.prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$ + assumeEquals(this.prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size()); + // Get comment range + Comment comment = (Comment) compilUnit.getCommentList().get(1); + int commentStart = comment.getStartPosition(); + // get method + ASTNode node = getASTNode(compilUnit, 0, 0); + assumeNotNull("We should get a non-null ast node", node); + assumeEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType()); //$NON-NLS-1$ + MethodDeclaration method = (MethodDeclaration) node; + // get return type + node = method.getReturnType(); + assumeNotNull("We should get a non-null ast node", node); + assumeTrue("Not return type", node.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$ + SimpleType returnType = (SimpleType) node; + // verify that return type includes following comment + int returnStart = compilUnit.getExtendedStartPosition(returnType); + assumeEquals("Return type "+returnType+" does not start at the right position", commentStart, returnStart); + int returnEnd = returnStart + compilUnit.getExtendedLength(returnType) - 1; + assumeEquals("Return type "+returnType+" does not end at the right length", returnType.getStartPosition()+returnType.getLength()-1, returnEnd); + } + /* + * End DefaultCommentMapper verifications + */ + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=48489" + */ + public void _testBug48489() throws JavaModelException { + verifyComments("testBug48489"); + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50898" + */ + public void _testBug50898() throws JavaModelException { + ICompilationUnit unit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug50898", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + this.packageBinding = false; + verifyComments(unit); + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51226" + */ + public void _testBug51226() throws JavaModelException { + ICompilationUnit[] units = getCompilationUnits("Converter_23" , "src", "javadoc.testBug51226"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + for (int i=0; if); + String failure = this.failures.get(f); + String expected = "Reference '"+unbound[i]+"' should be bound!"; + if (expected.equals(failure.substring(failure.indexOf(' ')+1))) { + this.failures.remove(f); + } else { + f++; // skip offending failure + i--; // stay on expected string + } + } + } + this.stopOnFailure = true; + } + public void _testBug54424() throws JavaModelException { + this.stopOnFailure = false; + String [] unbound = { "tho", + "A#getList(int,long,boolean)", + "#getList(Object,java.util.AbstractList)", + }; + verifyComments("testBug54424"); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + int size = unbound.length; + for (int i=0, f=0; if); + String failure = this.failures.get(f); + String expected = "Reference '"+unbound[i]+"' should be bound!"; + if (expected.equals(failure.substring(failure.indexOf(' ')+1))) { + this.failures.remove(f); + } else { + f++; // skip offending failure + i--; // stay on expected string + } + } + } + this.stopOnFailure = true; + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=63044" + */ + public void _testBug63044() throws JavaModelException { + verifyComments("testBug63044"); + } + + /** + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660" + */ + public void _testBug51660() throws JavaModelException { + this.stopOnFailure = false; + ICompilationUnit unit = getCompilationUnit("Converter_23" , "src", "javadoc.testBug51660", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + CompilationUnit compilUnit = verifyComments(unit); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + String[] tagNames = { + "@ejb", + "@ejb", + "@ejb", + "@ejb", + "@ejb", + "@ejb", + "@ejb(bean", + "@ejb)bean", + "@ejb", + "@ejb+bean", + "@ejb,bean", + "@ejb-bean", + "@ejb.bean", + "@ejb/bean", + "@ejb", + "@ejb;bean", + "@ejb", + "@ejb=bean", + "@ejb", + "@ejb?bean", + "@ejb@bean", + "@ejb[bean", + "@ejb\\bean", + "@ejb]bean", + "@ejb^bean", + "@ejb`bean", + "@ejb{bean", + "@ejb|bean", + "@ejb", + "@ejb~bean", + "@unknown" + }; + String[] tagTexts = { + "!bean test non-java id character '!' (val=33) in tag name", + "\"bean test non-java id character '\"' (val=34) in tag name", + "#bean test non-java id character '#' (val=35) in tag name", + "%bean test non-java id character '%' (val=37) in tag name", + "&bean test non-java id character '&' (val=38) in tag name", + "'bean test non-java id character ''' (val=39) in tag name", + " test non-java id character '(' (val=40) in tag name", + " test non-java id character ')' (val=41) in tag name", + "*bean test non-java id character '*' (val=42) in tag name", + " test non-java id character '+' (val=43) in tag name", + " test non-java id character ',' (val=44) in tag name", + " test non-java id character '-' (val=45) in tag name", + " test non-java id character '.' (val=46) in tag name", + " test non-java id character '/' (val=47) in tag name", + ":bean test non-java id character ':' (val=58) in tag name", + " test non-java id character ';' (val=59) in tag name", + "' (val=62) in tag name", + " test non-java id character '?' (val=63) in tag name", + " test non-java id character '@' (val=64) in tag name", + " test non-java id character '[' (val=91) in tag name", + " test non-java id character '\\' (val=92) in tag name", + " test non-java id character ']' (val=93) in tag name", + " test non-java id character '^' (val=94) in tag name", + " test non-java id character '`' (val=96) in tag name", + " test non-java id character '{' (val=123) in tag name", + " test non-java id character '|' (val=124) in tag name", + "}bean test non-java id character '}' (val=125) in tag name", + " test non-java id character '~' (val=126) in tag name", + " test java id" + }; + Comment comment = (Comment) compilUnit.getCommentList().get(0); + assumeTrue(this.prefix+"Comment should be a javadoc comment ", comment.isDocComment()); + Javadoc docComment = (Javadoc) comment; + int size = docComment.tags().size(); + for (int i=0; i Class type parameter\n" + + " * @see Object\n" + + " */\n" + + "public class Test {\n" + + " /**\n" + + " * @param t\n" + + " * @param Method type parameter\n" + + " */\n" + + " void foo(T t) {}\n" + + "}\n"); + verifyWorkingCopiesComments(); + } + public void _testBug79809b() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79809/Test.java", + "package javadoc.b79809;\n" + + "\n" + + "/**\n" + + " * New tags for 5.0\n" + + " * - literal: {@literal ac}\n" + + " * - code: {@code abc}\n" + + " * - value: {@value System#out}\n" + + " */\n" + + "public class Test {\n" + + "\n" + + "}\n"); + verifyWorkingCopiesComments(); + } + + /** + * Bug 79904: [1.5][dom][javadoc] TagElement range not complete for type parameter tags + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=79904" + */ + public void _testBug79904() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79904/Test.java", + "package javadoc.b79904;\n" + + "/**\n" + + " * @param \n" + + " * @see Object\n" + + " */\n" + + "public class Test {\n" + + " /**\n" + + " * @param t\n" + + " * @param \n" + + " */\n" + + " void foo(T t) {}\n" + + "}\n"); + verifyWorkingCopiesComments(); + } + + /** + * Bug 80221: [1.5][dom][javadoc] Need better support for type parameter Javadoc tags + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80221" + */ + public void _testBug80221() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b80221/Test.java", + "package javadoc.b80221;\n" + + "public class Test {\n" + + " /**\n" + + " * @see Object Unknown: ref is not resolved due to compile error...\n" + + " */\n" + + " public foo() {\n" + + " return 1;\n" + + " }\n" + + "}\n" + ); + verifyWorkingCopiesComments(); + } + + /** + * Bug 80257: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80257" + */ + public void _testBug80257() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b80257/Test.java", + "package javadoc.b80257;\n" + + "import java.util.*;\n" + + "public class Test {\n" + + " /**\n" + + " * @see ArrayList\n" + + " * @return {@link java.util.List}\n" + + " */\n" + + " List getList() {\n" + + " return new ArrayList();\n" + + " }\n" + + "}\n" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Do not need to verify following statement as we know it's ok as verifyComments did not fail + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // get javadoc comment + TagElement firstTag = (TagElement) docComment.tags().get(0); // get first tag + TagElement secondTag = (TagElement) docComment.tags().get(1); // get second tag + TagElement inlineTag = (TagElement) secondTag.fragments().get(1); // get inline tag + // Get tag simple name reference in first tag + assertEquals("Invalid number of fragments for tag element: "+firstTag, 1, firstTag.fragments().size()); + ASTNode node = (ASTNode) firstTag.fragments().get(0); + assertEquals("Invalid kind of name reference for tag element: "+firstTag, ASTNode.SIMPLE_NAME, node.getNodeType()); + SimpleName seeRef = (SimpleName) node; + // Verify binding for simple name + IBinding binding = seeRef.resolveBinding(); + assertTrue("Wrong kind of binding", binding instanceof ITypeBinding); + ITypeBinding typeBinding = (ITypeBinding)binding; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 + // only have RawTypeBinding in Javadocs + assertFalse(seeRef.toString()+" should NOT have a generic type binding", typeBinding.isGenericType()); + assertFalse(seeRef.toString()+" should NOT have a parameterized type binding", typeBinding.isParameterizedType()); + assertTrue(seeRef.toString()+" should have a raw type binding", typeBinding.isRawType()); + // Get inline tag simple name reference in second tag + assertEquals("Invalid number of fragments for inline tag element: "+inlineTag, 1, inlineTag.fragments().size()); + node = (ASTNode) inlineTag.fragments().get(0); + assertEquals("Invalid kind of name reference for tag element: "+inlineTag, ASTNode.QUALIFIED_NAME, node.getNodeType()); + QualifiedName linkRef = (QualifiedName) node; + // Verify binding for qualified name + binding = linkRef.resolveBinding(); + assertTrue("Wrong kind of binding", binding instanceof ITypeBinding); + typeBinding = (ITypeBinding)binding; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936 + // only have RawTypeBinding in Javadocs + assertFalse(linkRef.toString()+" should NOT have a generic type binding", typeBinding.isGenericType()); + assertFalse(linkRef.toString()+" should NOT have a parameterized type binding", typeBinding.isParameterizedType()); + assertTrue(linkRef.toString()+" should have a raw type binding", typeBinding.isRawType()); + } + } + + /** + * Bug 83804: [1.5][javadoc] Missing Javadoc node for package declaration + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=83804" + */ + public void _testBug83804() throws CoreException, JavaModelException { + this.astLevel = getJLS3(); + this.workingCopies = new ICompilationUnit[2]; + this.workingCopies[0] = getCompilationUnit("Converter_23", "src", "javadoc.b83804", "package-info.java"); + this.workingCopies[1] = getCompilationUnit("Converter_23", "src", "javadoc.b83804", "Test.java"); + verifyWorkingCopiesComments(); + } + public void _testBug83804a() throws CoreException, JavaModelException { + this.astLevel = getJLS3(); + this.workingCopies = new ICompilationUnit[2]; + this.workingCopies[0] = getCompilationUnit("Converter_23", "src", "javadoc.b83804a", "package-info.java"); + this.workingCopies[1] = getCompilationUnit("Converter_23", "src", "javadoc.b83804a", "Test.java"); + verifyWorkingCopiesComments(); + } + + /** + * Bug 84049: [javadoc][dom] Extended ranges wrong for method name without return type + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84049" + */ + public void _testBug84049() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b84049/Test.java", + "package javadoc.b84049;\n" + + "public class Test {\n" + + " /**\n" + + " * @see Object\n" + + " */\n" + + " foo() {\n" + + " }\n" + + "}\n" + ); + CompilationUnit compilUnit = (CompilationUnit) runConversion(this.workingCopies[0], true); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + ASTNode node = getASTNode(compilUnit, 0, 0); + assertEquals("Invalid type for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType()); + MethodDeclaration methodDeclaration = (MethodDeclaration) node; + Javadoc methodJavadoc = methodDeclaration.getJavadoc(); + assertNotNull("MethodDeclaration have a javadoc comment", methodJavadoc); + int javadocStart = methodJavadoc.getStartPosition(); + assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart); + SimpleName methodName = methodDeclaration.getName(); + int nameStart = methodName.getStartPosition(); + assertTrue("Method simple name should not include javadoc comment", nameStart > javadocStart+methodJavadoc.getLength()); + int extendedStart = compilUnit.getExtendedStartPosition(methodName); + assertEquals("Method simple name start position should not be extended!", nameStart, extendedStart); + int extendedLength = compilUnit.getExtendedLength(methodName); + assertEquals("Method simple name length should not be extended!", methodName.getLength(), extendedLength); + } + } + + /** + * Bug 87845: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=87845" + */ + public void _testBug87845() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b87845/Test.java", + "package javadoc.b87845;\n" + + "public class Test {\n" + + " public void foo(int a, int b) {} \n" + + " public void foo(int a, int... args) {}\n" + + " public void foo(String... args) {}\n" + + " public void foo(Exception str, boolean... args) {}\n" + + " /**\n" + + " * @see Test#foo(int, int)\n" + + " * @see Test#foo(int, int[])\n" + + " * @see Test#foo(int, int...)\n" + + " * @see Test#foo(String[])\n" + + " * @see Test#foo(String...)\n" + + " * @see Test#foo(Exception, boolean[])\n" + + " * @see Test#foo(Exception, boolean...)\n" + + " */\n" + + " public void valid() {}\n" + + " /**\n" + + " * @see Test#foo(int)\n" + + " * @see Test#foo(int, int, int)\n" + + " * @see Test#foo()\n" + + " * @see Test#foo(String)\n" + + " * @see Test#foo(String, String)\n" + + " * @see Test#foo(Exception)\n" + + " * @see Test#foo(Exception, boolean)\n" + + " * @see Test#foo(Exception, boolean, boolean)\n" + + " */\n" + + " public void invalid() {}\n" + + "}\n" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Do not need to verify following statement as we know it's ok as verifyComments did not fail + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // get first javadoc comment + // Verify last parameter for all methods reference in javadoc comment + List tags = docComment.tags(); + int size = tags.size(); + for (int i=0; i comment.getStartPosition()+comment.getLength()); + } + } + public void _testBug93880_14a() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b93880/Test.java", + "/**\n" + + " * Javadoc\n" + + " */\n" + + "package javadoc.b93880;\n" + + "public class Test {\n" + + "}\n" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get package declaration declaration and javadoc + PackageDeclaration packDecl = compilUnit.getPackage(); + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail + + // Verify package declaration declaration source start + assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); + } + } + public void _testBug93880_14b() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b93880/package-info.java", + "/**\n" + + " * Javadoc for all package\n" + + " */\n" + + "package javadoc.b93880;" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get package declaration declaration and javadoc + PackageDeclaration packDecl = compilUnit.getPackage(); + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail + + // Verify package declaration declaration source start + assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); + } + } + public void _testBug93880_14c() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b93880/package-info.java", + "/**\n" + + " * Javadoc for all package\n" + + " */\n" + + "private package javadoc.b93880;" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get package declaration declaration and javadoc + PackageDeclaration packDecl = compilUnit.getPackage(); + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail + + // Verify package declaration declaration source start + assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); + } + } + public void _testBug93880_14d() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b93880/package-info.java", + "/**\n" + + " * Javadoc for all package\n" + + " */\n" + + "@Deprecated\n" + + "package javadoc.b93880;" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get package declaration declaration and javadoc + PackageDeclaration packDecl = compilUnit.getPackage(); + assertNotNull("Compilation unit should have a package declaration", packDecl); + Javadoc docComment = (Javadoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail + + // Verify package declaration declaration source start + assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition()); + } + } + public void _testBug93880_14e() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b93880/package-info.java", + "/* (non-javadoc)\n" + + " * No comment\n" + + " */\n" + + "package javadoc.b93880;" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get package declaration declaration and javadoc + PackageDeclaration packDecl = compilUnit.getPackage(); + List unitComments = compilUnit.getCommentList(); + assertEquals("Wrong number of comments", 1, unitComments.size()); + Comment comment = (Comment) unitComments.get(0); + + // Verify package declaration declaration source start + assertTrue("Source range of PackageDeclaration should NOT not include Javadoc child", packDecl.getStartPosition() > comment.getStartPosition()+comment.getLength()); + } + } + + /** + * Bug 94150: [javadoc][dom] Extended ranges wrong for method name without return type + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=94150" + */ + public void _testBug94150() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.astLevel = getJLS3(); + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b94150/Category.java", + "package javadoc.b94150;\n" + + "public enum Category {\n" + + " /**\n" + + " * history style\n" + + " * @see Object\n" + + " */ \n" + + " HISTORY,\n" + + "\n" + + " /**\n" + + " * war style\n" + + " */ \n" + + " WAR;\n" + + "}\n" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get enum declaration + ASTNode node = getASTNode(compilUnit, 0); + assertEquals("Expected enum declaration.", ASTNode.ENUM_DECLARATION, node.getNodeType()); + EnumDeclaration enumDeclaration = (EnumDeclaration) node; + + // Verify each enum constant javadoc + List constants = enumDeclaration.enumConstants(); + int size = constants.size(); + assertEquals("Wrong number of constants", 2, size); + for (int i=0; i commentEnd); + Statement statement = ifStatement.getThenStatement(); + assertEquals("Expected block for node: "+statement, ASTNode.BLOCK, statement.getNodeType()); + Block block = (Block) statement; + assertTrue("Invalid start position for Block: "+block, block.getStartPosition() > commentEnd); + List statements = block.statements(); + assertEquals("Invalid number of statements for block: "+block, 1, statements.size()); + statement = (Statement) statements.get(0); + assertEquals("Expected variable declaration statement for node: "+statement, ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType()); + VariableDeclarationStatement varDecl = (VariableDeclarationStatement) statement; + assertTrue("Invalid start position for : VariableDeclarationStatement"+varDecl, varDecl.getStartPosition() > commentEnd); + } + } + public void _testBug100041b() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b100041/X.java", + "package javadoc.b100041;\n" + + "class X {\n" + + " static Object object;\n" + + " static void foo() {\n" + + " /**\n" + + " * javadoc comment.\n" + + " */\n" + + " if (object instanceof String)\n" + + " return;\n" + + " }\n" + + "}" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get comment + List unitComments = compilUnit.getCommentList(); + assertEquals("Wrong number of comments", 1, unitComments.size()); + Comment comment = (Comment) unitComments.get(0); + int commentStart = comment.getStartPosition(); + int commentEnd = commentStart+comment.getLength(); + + // Get local variable declaration + ASTNode node = getASTNode(compilUnit, 0, 1, 0); + assertEquals("Expected if statement for node: "+node, ASTNode.IF_STATEMENT, node.getNodeType()); + IfStatement ifStatement = (IfStatement) node; + assertTrue("Invalid start position for IfStatement: "+ifStatement, ifStatement.getStartPosition() > commentEnd); + Statement statement = ifStatement.getThenStatement(); + assertEquals("Expected block for node: "+statement, ASTNode.RETURN_STATEMENT, statement.getNodeType()); + ReturnStatement returnStatement = (ReturnStatement) statement; + assertTrue("Invalid start position for Block: "+returnStatement, returnStatement.getStartPosition() > commentEnd); + } + } + public void _testBug100041c() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy("/Converter_23/src/javadoc/b100041/Z.java", + "package javadoc.b100041;\n" + + "public class Z {\n" + + " /** C1 */\n" + + " class Z1 {}\n" + + " /** C2 */\n" + + " Z1 z1;\n" + + " /** C3 */\n" + + " public static void foo(Object object) {\n" + + " /** C4 */\n" + + " class ZZ {\n" + + " /** C5 */\n" + + " ZZ zz;\n" + + " /** C6 */\n" + + " public void bar() {}\n" + + " }\n" + + " }\n" + + "}\n" + ); + CompilationUnit compilUnit = verifyComments(this.workingCopies[0]); + if (this.docCommentSupport.equals(JavaCore.ENABLED)) { + // Get comments + List unitComments = compilUnit.getCommentList(); + int size = unitComments.size(); + assertEquals("Wrong number of comments", 6, size); + Javadoc[] javadocs = new Javadoc[size]; + Iterator iterator = unitComments.iterator(); + for (int i=0; ivalidateEdit for the given resource on IWorkspace. + * + * @param list Liste of things + * @see #foo(java.util. + * Vector) + */ + public void foo(java.util.Vector list) {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB1.java new file mode 100644 index 00000000000..edf452735da --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB1.java @@ -0,0 +1,11 @@ +package javadoc.test100; +public class TestB1 { /* C0 */ /* C1 */ + /* C2 */ /* C3 */ + /* C4 */ /* C5 */ + void foo() {} /* C6 */ /* C7 */ + /* C8 */ /* C9 */ + /* C10 */ /* C11 */ + void bar() {} + /* C12 */ /* C13 */ + /* C14 */ /* C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB2.java new file mode 100644 index 00000000000..a399fcd91d0 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestB2.java @@ -0,0 +1,11 @@ +package javadoc.test100; +public class TestB2 { /* C0 */ // C1 */ + /* C2 */ // C3 */ + /* C4 */ // C5 */ + void foo() {} /* C6 */ // C7 */ + /* C8 */ // C9 */ + /* C10 */ // C11 */ + void bar() {} + /* C12 */ // C13 */ + /* C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD1.java new file mode 100644 index 00000000000..454b2e8dfe3 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD1.java @@ -0,0 +1,11 @@ +package javadoc.test100; +public class TestD1 { /** C0 */ /** C1 */ + /** C2 */ /** C3 */ + /** C4 */ /** C5 */ + void foo() {} /** C6 */ /** C7 */ + /** C8 */ /** C9 */ + /** C10 */ /** C11 */ + void bar() {} + /** C12 */ /** C13 */ + /** C14 */ /** C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD2.java new file mode 100644 index 00000000000..e11fbf9e485 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test100/TestD2.java @@ -0,0 +1,11 @@ +package javadoc.test100; +public class TestD2 { /** C0 */ // C1 */ + /** C2 */ // C3 */ + /** C4 */ // C5 */ + void foo() {} /** C6 */ // C7 */ + /** C8 */ // C9 */ + /** C10 */ // C11 */ + void bar() {} + /** C12 */ // C13 */ + /** C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test101/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test101/Test.java new file mode 100644 index 00000000000..9c0b9b5bc90 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test101/Test.java @@ -0,0 +1,11 @@ +package javadoc.test101; +public class Test { // C0 */ // C0b */ + // C1 */ // C1b */ + // C2 */ // C2b */ + void foo() {} // C3 */ // C3b */ + // C4 */ // C4b */ + // C5 */ // C5b */ + void bar() {} + // C6 */ // C6b */ + // C7 */ // C7b */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB1.java new file mode 100644 index 00000000000..8806a5ec636 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB1.java @@ -0,0 +1,14 @@ +package javadoc.test102; +public class TestB1 { /* C0 */ /* C1 */ + /* C2 */ /* C3 */ + + /* C4 */ /* C5 */ + void foo() {} /* C6 */ /* C7 */ + /* C8 */ /* C9 */ + + /* C10 */ /* C11 */ + void bar() {} + /* C12 */ /* C13 */ + + /* C14 */ /* C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB2.java new file mode 100644 index 00000000000..e4f7bcd6f18 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestB2.java @@ -0,0 +1,14 @@ +package javadoc.test102; +public class TestB2 { /* C0 */ // C1 */ + /* C2 */ // C3 */ + + /* C4 */ // C5 */ + void foo() {} /* C6 */ // C7 */ + /* C8 */ // C9 */ + + /* C10 */ // C11 */ + void bar() {} + /* C12 */ // C13 */ + + /* C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD1.java new file mode 100644 index 00000000000..587cb57356d --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD1.java @@ -0,0 +1,14 @@ +package javadoc.test102; +public class TestD1 { /** C0 */ /** C1 */ + /** C2 */ /** C3 */ + + /** C4 */ /** C5 */ + void foo() {} /** C6 */ /** C7 */ + /** C8 */ /** C9 */ + + /** C10 */ /** C11 */ + void bar() {} + /** C12 */ /** C13 */ + + /** C14 */ /** C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD2.java new file mode 100644 index 00000000000..90f3552e893 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test102/TestD2.java @@ -0,0 +1,14 @@ +package javadoc.test102; +public class TestD2 { /** C0 */ // C1 */ + /** C2 */ // C3 */ + + /** C4 */ // C5 */ + void foo() {} /** C6 */ // C7 */ + /** C8 */ // C9 */ + + /** C10 */ // C11 */ + void bar() {} + /** C12 */ // C13 */ + + /** C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test103/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test103/Test.java new file mode 100644 index 00000000000..125b2963fcd --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test103/Test.java @@ -0,0 +1,14 @@ +package javadoc.test103; +public class Test { // C0 */ // C0b */ + // C1 */ // C1b */ + + // C2 */ // C2b */ + void foo() {} // C3 */ // C3b */ + // C4 */ // C4b */ + + // C5 */ // C5b */ + void bar() {} + // C6 */ // C6b */ + + // C7 */ // C7b */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD1.java new file mode 100644 index 00000000000..bbea44fc709 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD1.java @@ -0,0 +1,13 @@ +package javadoc.test104; +public class TestD1 { /** C0 */ /** C1 */ + /** C2 */ /** C3 */ + /** C4 */ /** C5 */ + + void foo() {} /** C6 */ /** C7 */ + /** C8 */ /** C9 */ + /** C10 */ /** C11 */ + + void bar() {} + /** C12 */ /** C13 */ + /** C14 */ /** C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD2.java new file mode 100644 index 00000000000..a8db31c06bb --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test104/TestD2.java @@ -0,0 +1,13 @@ +package javadoc.test104; +public class TestD2 { /** C0 */ // C1 */ + /** C2 */ // C3 */ + /** C4 */ // C5 */ + + void foo() {} /** C6 */ // C7 */ + /** C8 */ // C9 */ + /** C10 */ // C11 */ + + void bar() {} + /** C12 */ // C13 */ + /** C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB1.java new file mode 100644 index 00000000000..62330343722 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB1.java @@ -0,0 +1,13 @@ +package javadoc.test105; +public class TestB1 { /* C0 */ /* C1 */ + /* C2 */ /* C3 */ + /* C4 */ /* C5 */ + + void foo() {} /* C6 */ /* C7 */ + /* C8 */ /* C9 */ + /* C10 */ /* C11 */ + + void bar() {} + /* C12 */ /* C13 */ + /* C14 */ /* C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB2.java new file mode 100644 index 00000000000..608815cb71d --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test105/TestB2.java @@ -0,0 +1,13 @@ +package javadoc.test105; +public class TestB2 { /* C0 */ // C1 */ + /* C2 */ // C3 */ + /* C4 */ // C5 */ + + void foo() {} /* C6 */ // C7 */ + /* C8 */ // C9 */ + /* C10 */ // C11 */ + + void bar() {} + /* C12 */ // C13 */ + /* C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test106/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test106/Test.java new file mode 100644 index 00000000000..f4c7e73a961 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test106/Test.java @@ -0,0 +1,13 @@ +package javadoc.test106; +public class Test { // C0 */ // C0b */ + // C1 */ // C1b */ + // C2 */ // C2b */ + + void foo() {} // C3 */ // C3b */ + // C4 */ // C4b */ + // C5 */ // C5b */ + + void bar() {} + // C6 */ // C6b */ + // C7 */ // C7b */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB1.java new file mode 100644 index 00000000000..7a5724635ea --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB1.java @@ -0,0 +1,14 @@ +package javadoc.test107; +public class TestB1 { /* C0 */ /* C1 */ + + /* C2 */ /* C3 */ + /* C4 */ /* C5 */ + void foo() {} /* C6 */ /* C7 */ + + /* C8 */ /* C9 */ + /* C10 */ /* C11 */ + void bar() {} + + /* C12 */ /* C13 */ + /* C14 */ /* C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB2.java new file mode 100644 index 00000000000..a41e4469035 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestB2.java @@ -0,0 +1,14 @@ +package javadoc.test107; +public class TestB2 { /* C0 */ // C1 */ + + /* C2 */ // C3 */ + /* C4 */ // C5 */ + void foo() {} /* C6 */ // C7 */ + + /* C8 */ // C9 */ + /* C10 */ // C11 */ + void bar() {} + + /* C12 */ // C13 */ + /* C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD1.java new file mode 100644 index 00000000000..47bea7066a8 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD1.java @@ -0,0 +1,14 @@ +package javadoc.test107; +public class TestD1 { /** C0 */ /** C1 */ + + /** C2 */ /** C3 */ + /** C4 */ /** C5 */ + void foo() {} /** C6 */ /** C7 */ + + /** C8 */ /** C9 */ + /** C10 */ /** C11 */ + void bar() {} + + /** C12 */ /** C13 */ + /** C14 */ /** C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD2.java new file mode 100644 index 00000000000..860da71f6dc --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test107/TestD2.java @@ -0,0 +1,14 @@ +package javadoc.test107; +public class TestD2 { /** C0 */ // C1 */ + + /** C2 */ // C3 */ + /** C4 */ // C5 */ + void foo() {} /** C6 */ // C7 */ + + /** C8 */ // C9 */ + /** C10 */ // C11 */ + void bar() {} + + /** C12 */ // C13 */ + /** C14 */ // C15 */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test108/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test108/Test.java new file mode 100644 index 00000000000..0ed666d8ca6 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test108/Test.java @@ -0,0 +1,14 @@ +package javadoc.test108; +public class Test { // C0 */ // C0b */ + + // C1 */ // C1b */ + // C2 */ // C2b */ + void foo() {} // C3 */ // C3b */ + + // C4 */ // C4b */ + // C5 */ // C5b */ + void bar() {} + + // C6 */ // C6b */ + // C7 */ // C7b */ +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test109/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test109/Test.java new file mode 100644 index 00000000000..9f3d9fad201 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/test109/Test.java @@ -0,0 +1,7 @@ +public class SAMPLE_UTF8 { + /** + * @param nDataCount\uff1a\uff10 + */ + public static void main(String[] args) { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/A.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/A.java new file mode 100644 index 00000000000..3c082e7bfbe --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/A.java @@ -0,0 +1,12 @@ +package javadoc.testBug228648; +import javadoc.testBug228648.B.Inner; +/** + * {@link #foo(Inner)} + * {@link #foo2(B)} + */ +public class A { + public void foo(Inner inner) { + } + public void foo2(B b) { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/B.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/B.java new file mode 100644 index 00000000000..bb9fc995b17 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug228648/B.java @@ -0,0 +1,5 @@ +package javadoc.testBug228648; +public class B { + class Inner { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug336821/Try.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug336821/Try.java new file mode 100644 index 00000000000..baff0ca5306 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug336821/Try.java @@ -0,0 +1,16 @@ +package javadoc.testBug336821; +/** + * First ref should resolve to constructor + * @see #Try + * @see #Try(int, String) + * @see #foo + */ +public class Try { + public Try(int i, String message) { + System.out.println(message + i); + } + + public void foo(int i, String message) { + System.out.println(message + i); + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug347100/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug347100/X.java new file mode 100644 index 00000000000..33df576562f --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug347100/X.java @@ -0,0 +1,12 @@ +package javadoc.testBug347100; +/** + * Link to {@link javadoc},
+ * link to {@link "Hello World"},
+ * and {@link package documentation} + * + * @see javadoc + * @see "Hello World" + * @see package documentation + */ +public class X { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestA.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestA.java new file mode 100644 index 00000000000..71f05fb2295 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestA.java @@ -0,0 +1,11 @@ +package javadoc.testBug48489; +import java.util.*; +public class TestA { + /** + * Javadoc comment + */ + public static void main(String[] args) { + /* method main */ + System.out.println("Hello" + " world"); // comment + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestB.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestB.java new file mode 100644 index 00000000000..6042e42a4cd --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestB.java @@ -0,0 +1,8 @@ +package javadoc.testBug48489; +import java.util.*; +public class TestB { + /** + * Javadoc + */ + public static final /* */ String s = "NULL", s2="";// line comment +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestC.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestC.java new file mode 100644 index 00000000000..53cc3e973fc --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestC.java @@ -0,0 +1,11 @@ +package javadoc.testBug48489; +import java.util.*; +public class TestC { + /** + * Javadoc + */ + static { + /* */ + System.out.println("Hello" + " world"); // line comment + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestD.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestD.java new file mode 100644 index 00000000000..945fe0de53b --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestD.java @@ -0,0 +1,10 @@ +package javadoc.testBug48489; +import java.util.*; +public class TestD { + /** + * Javadoc + */ + public static void main(String[] args) { + System.out./* */println("Hello" + " world"); + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestE.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestE.java new file mode 100644 index 00000000000..1caa7558d29 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug48489/TestE.java @@ -0,0 +1,10 @@ +package javadoc.testBug48489; +import java.util.*; +public class TestE { + /** + * Javadoc + */ + public static void main(String[] args) { + System.out.println("Hello" + /* */ " world"); + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/G.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/G.java new file mode 100644 index 00000000000..76ec2ae1295 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/G.java @@ -0,0 +1,4 @@ +package javadoc.testBug50898; +public class G { + private static class Inner {} +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/Test.java new file mode 100644 index 00000000000..2ab1e697203 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug50898/Test.java @@ -0,0 +1,8 @@ +package javadoc.testBug50898; +public class Test { + /** + * @see G.Inner + */ + public void foo() { + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X1.java new file mode 100644 index 00000000000..dfe83b0054b --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X1.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +/*\u002A + * Test + */ +public class X1 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X2.java new file mode 100644 index 00000000000..40a06e3880b --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X2.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +/\u002A* + * Test + */ +public class X2 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X3.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X3.java new file mode 100644 index 00000000000..7d080e12f02 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X3.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +\u002F** + * Test + */ +public class X3 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X4.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X4.java new file mode 100644 index 00000000000..62f1d49f369 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X4.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +/\u002A\u002A + \u002A Test + \u002A/ +public class X4 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X5.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X5.java new file mode 100644 index 00000000000..b57e319cd13 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X5.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +\u002F** + * Test + *\u002F +public class X5 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X6.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X6.java new file mode 100644 index 00000000000..84c21ec312f --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51226/X6.java @@ -0,0 +1,6 @@ +package javadoc.testBug51226; +\u002F\u002A\u002A + \u002A Test + \u002A\u002F +public class X6 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51241/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51241/X.java new file mode 100644 index 00000000000..e97c9ab0654 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51241/X.java @@ -0,0 +1,20 @@ +package javadoc.testBug51241; +public class X { + // First class line comment + int i; + // C1 + + void foo() { + int x; + // C2 + int y; + // First method line comment + } + // Syntax error here! + int z + + // Second class line comment + void bar() { + // Second method line comment + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51363/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51363/Test.java new file mode 100644 index 00000000000..94bd7f547bd --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51363/Test.java @@ -0,0 +1,4 @@ +package javadoc.testBug51363; +\u002F\u002FUnicode comment\u000D\u000Apublic class Test { + \u002F\u002FUnicode comment\u000Dvoid foo() {} +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X1.java new file mode 100644 index 00000000000..49bb6b11da1 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X1.java @@ -0,0 +1,7 @@ +package javadoc.testBug51476; +/** + * @see "Test class X" + * @see Valid URL + */ +public class X1 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X2.java new file mode 100644 index 00000000000..af70b734334 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X2.java @@ -0,0 +1,6 @@ +package javadoc.testBug51476; +/** + * @see "Test class X" + */ +public class X2 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X3.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X3.java new file mode 100644 index 00000000000..75138f44fe5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51476/X3.java @@ -0,0 +1,6 @@ +package javadoc.testBug51476; +/** + * @see Valid URL + */ +public class X3 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X1.java new file mode 100644 index 00000000000..b10c28d9146 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X1.java @@ -0,0 +1,7 @@ +package javadoc.testBug51478; +/** + * {@inheritDoc} + * @deprecated + */ +public class X1 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X2.java new file mode 100644 index 00000000000..382683ecca5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X2.java @@ -0,0 +1,6 @@ +package javadoc.testBug51478; +/** + * {@inheritDoc} + */ +public class X2 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X3.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X3.java new file mode 100644 index 00000000000..8f1c92ee280 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51478/X3.java @@ -0,0 +1,6 @@ +package javadoc.testBug51478; +/** + * @deprecated + */ +public class X3 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51508/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51508/X.java new file mode 100644 index 00000000000..3f9d55f96a5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51508/X.java @@ -0,0 +1,7 @@ +package javadoc.testBug51508; +/** + * @see java + * @see java.util + */ +public class X { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51600/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51600/Test.java new file mode 100644 index 00000000000..2737b0faa29 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51600/Test.java @@ -0,0 +1,17 @@ +package javadoc.testBug51600; +public class Test { + /** + * @param str + * @param + * @param str + * @see + * @see + * @see # + * @see "Invalid + * @return String + * @return + * @return String + */ + String foo(String str) { return ""; } + +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51617/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51617/Test.java new file mode 100644 index 00000000000..4ca05bdd408 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51617/Test.java @@ -0,0 +1,10 @@ +package javadoc.testBug51617; +public class Test { + /** + * Set in separated folder as we have an unbound reference... + * @exception e + * @param name The name to set + */ + public void setName1(String name) { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51650/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51650/X.java new file mode 100644 index 00000000000..cc98705d69d --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51650/X.java @@ -0,0 +1,9 @@ +package javadoc.testBug51650; +public class X { + /** + * @see Exception + * {@link Exception} + */ + public void foo() { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51660/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51660/Test.java new file mode 100644 index 00000000000..630cfe5f5af --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51660/Test.java @@ -0,0 +1,37 @@ +package javadoc.testBug51660; +/** + * @ejb!bean test non-java id character '!' (val=33) in tag name + * @ejb"bean test non-java id character '"' (val=34) in tag name + * @ejb#bean test non-java id character '#' (val=35) in tag name + * @ejb%bean test non-java id character '%' (val=37) in tag name + * @ejb&bean test non-java id character '&' (val=38) in tag name + * @ejb'bean test non-java id character ''' (val=39) in tag name + * @ejb(bean test non-java id character '(' (val=40) in tag name + * @ejb)bean test non-java id character ')' (val=41) in tag name + * @ejb*bean test non-java id character '*' (val=42) in tag name + * @ejb+bean test non-java id character '+' (val=43) in tag name + * @ejb,bean test non-java id character ',' (val=44) in tag name + * @ejb-bean test non-java id character '-' (val=45) in tag name + * @ejb.bean test non-java id character '.' (val=46) in tag name + * @ejb/bean test non-java id character '/' (val=47) in tag name + * @ejb:bean test non-java id character ':' (val=58) in tag name + * @ejb;bean test non-java id character ';' (val=59) in tag name + * @ejb' (val=62) in tag name + * @ejb?bean test non-java id character '?' (val=63) in tag name + * @ejb@bean test non-java id character '@' (val=64) in tag name + * @ejb[bean test non-java id character '[' (val=91) in tag name + * @ejb\bean test non-java id character '\' (val=92) in tag name + * @ejb]bean test non-java id character ']' (val=93) in tag name + * @ejb^bean test non-java id character '^' (val=94) in tag name + * @ejb`bean test non-java id character '`' (val=96) in tag name + * @ejb{bean test non-java id character '{' (val=123) in tag name + * @ejb|bean test non-java id character '|' (val=124) in tag name + * @ejb}bean test non-java id character '}' (val=125) in tag name + * @ejb~bean test non-java id character '~' (val=126) in tag name + * @unknown test java id + */ +public class Test { + +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51770/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51770/X.java new file mode 100644 index 00000000000..7725030c4dd --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51770/X.java @@ -0,0 +1,6 @@ +package javadoc.testBug51770; +/** + * @see java.util.Vector + */ +public class X { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestInvalid.java new file mode 100644 index 00000000000..4a1b58264ec --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestInvalid.java @@ -0,0 +1,8 @@ +package javadoc.testBug51911; +/** + * @see #foo + */ +public class TestInvalid { + public void foo(int i, float f) {} + public void foo(String str) {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid1.java new file mode 100644 index 00000000000..5a62a696606 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid1.java @@ -0,0 +1,8 @@ +package javadoc.testBug51911; +/** + * @see #foo + */ +public class TestValid1 { + public int foo; + public void foo(String str) {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid2.java new file mode 100644 index 00000000000..68c04b6ba64 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid2.java @@ -0,0 +1,7 @@ +package javadoc.testBug51911; +/** + * @see #foo + */ +public class TestValid2 { + public void foo(String str) {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid3.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid3.java new file mode 100644 index 00000000000..07408c1a018 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug51911/TestValid3.java @@ -0,0 +1,9 @@ +package javadoc.testBug51911; +/** + * @see #foo + */ +public class TestValid3 { + public int foo; + public void foo() {} + public void foo(String str) {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/X.java new file mode 100644 index 00000000000..78edb122255 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/X.java @@ -0,0 +1,47 @@ +package javadoc.testBug52908; +public class X { + /** + * Text element starting with a + * { caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x1; + /** + * Text element ending with a } + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x2; + /** + * Text element starting with a + * } caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x3; + /** + * Text element ending with a { + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x4; + /** + * Text element starting with + * { and ending with } + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x6; + /** + * Text element starting with + * } and ending with { + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x7; +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/Y.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/Y.java new file mode 100644 index 00000000000..5eabbb2990e --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908/Y.java @@ -0,0 +1,14 @@ +package javadoc.testBug52908; +public class Y { + /** + * while (true) + * { + * int token = scanner.getNextToken(); + * if (token == ITerminalSymbols.TokenNameEOF) break; + * System.out.println(token + " : " + new String(scanner.getCurrentTokenSource())); + * } + *
+	 * 
+ */ + void foo() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908a/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908a/Test.java new file mode 100644 index 00000000000..e56eafbce9e --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908a/Test.java @@ -0,0 +1,15 @@ +package javadoc.testBug52908a; +import java.util.Vector; + +/** + * AST node for a parameter within a method reference ({@link Object}). + * These nodes only occur within doc comments ({@link Vector}). + *
+ * MethodRefParameter:
+ * 		Type [ Identifier ]
+ * 
+ * + * @see Vector + * @since 3.0 + */ +public class Test {} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/X.java new file mode 100644 index 00000000000..63150437c97 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/X.java @@ -0,0 +1,47 @@ +package javadoc.testBug52908unicode; +public class X { + /** + * Text element starting with a + * \u007b caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x1; + /** + * Text element ending with a \u007d + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x2; + /** + * Text element starting with a + * \u007d caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x3; + /** + * Text element ending with a \u007b + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x4; + /** + * Text element starting with + * \u007b and ending with \u007d + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x6; + /** + * Text element starting with + * \u007d and ending with \u007b + * caused troubles in its position + * if the bug is not fixed + * @see Object + */ + Object x7; +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/Y.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/Y.java new file mode 100644 index 00000000000..12fd5feb9af --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug52908unicode/Y.java @@ -0,0 +1,14 @@ +package javadoc.testBug52908unicode; +public class Y { + /** + * while (true) + * \u007b + * int token = scanner.getNextToken(); + * if (token == ITerminalSymbols.TokenNameEOF) break; + * System.out.println(token + " : " + new String(scanner.getCurrentTokenSource())); + * \u007d + *
+	 * 
+ */ + void foo() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53075/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53075/X.java new file mode 100644 index 00000000000..49c7974eff5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53075/X.java @@ -0,0 +1,9 @@ +package javadoc.testBug53075; +class X { +/** + * @link aggregates + * [... some more ...] + * @linkplain plain aggregates + */ +void foo() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestA.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestA.java new file mode 100644 index 00000000000..46099bbee5c --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestA.java @@ -0,0 +1,15 @@ +package javadoc.testBug53276; +public interface TestA { + /** + * Return the string specifying the pattern of this ignore. The string + * may include the wildcard characters '*' and '?'. If you wish to + * include either of these characters verbatim (i.e. you do not wish + * them to expand to wildcards), you must escape them with a backslash '\'. + *

+ * If you are using string literals in Java to represent the patterns, don't + * forget escape characters are represented by "\\". + * + * @return the pattern represented by this ignore info + */ + public String getPattern(); +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestB.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestB.java new file mode 100644 index 00000000000..b04fb60deee --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestB.java @@ -0,0 +1,23 @@ +package javadoc.testBug53276; + +/** + * Handles a "Removed" response from the CVS server. + *

+ * Suppose as a result of performing a command the CVS server responds + * as follows:
+ *

+ *   [...]
+ *   Removed ??? \n
+ *   [...]
+ * 
+ * Then + *

+ */ + +/** + * It removes the file from both the entries of the parent-folder + * and from the local filesystem. + */ +public class TestB { +} + diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestC.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestC.java new file mode 100644 index 00000000000..fc34792901c --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53276/TestC.java @@ -0,0 +1,12 @@ +package javadoc.testBug53276; +public class TestC { + + /** + * Returns the progress monitor. It there is no progress monitor the monitor\ + * is set to the NullProgressMonitor. + * + * @return the progress monitor + */ + public Object foo() { return null; } +} + diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53757/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53757/Test.java new file mode 100644 index 00000000000..5be71b599d5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug53757/Test.java @@ -0,0 +1,55 @@ +package javadoc.testBug53757; +public class Test { + /** + * Test all grammar keywords + * @abstract = 60, + * @assert = 71, + * @boolean = 31, + * @break = 72, + * @byte = 32, + * @case = 83, + * @catch = 86, + * @char = 33, + * @class = 81, + * @continue = 73, + * @default = 84, + * @do = 74, + * @double = 34, + * @else = 87, + * @extends = 91, + * @false = 44, + * @final = 61, + * @finally = 88, + * @float = 35, + * @for = 75, + * @if = 76, + * @implements = 103, + * @import = 82, + * @instanceof = 13, + * @int = 36, + * @interface = 89, + * @long = 37, + * @native = 62, + * @new = 41, + * @null = 45, + * @package = 85, + * @private = 63, + * @protected = 64, + * @public = 65, + * @short = 38, + * @static = 57, + * @strictfp = 66, + * @super = 42, + * @switch = 78, + * @synchronized = 55, + * @this = 43, + * @throw = 79, + * @transient = 67, + * @true = 46, + * @try = 80, + * @void = 39, + * @volatile = 68, + * @while = 70, + */ + void foo() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54424/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54424/Test.java new file mode 100644 index 00000000000..2fa14a76d27 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54424/Test.java @@ -0,0 +1,25 @@ +package javadoc.testBug54424; +import java.io.IOException; +import java.util.ArrayList; + +public class Test { + /** + * @param + * @param tho {@link getList(int, long)} + * @version throwaway + * @param from 1st param of {@link A#getList(int, long, boolean) me} + * @see #getList(Object, java.util.AbstractList) + * @param from 2nd + * @see #getList(int from, tho long) + * @see #getList(int from, long tho) + * @param + * @return the list + * @see #getList(..) + * @param to + * @throws .IOException + * @deprecated + * @throws IOException. + * @todo it + */ + public ArrayList getList(int from, long to) throws IOException {return null;} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54776/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54776/Test.java new file mode 100644 index 00000000000..dc3aee168b5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug54776/Test.java @@ -0,0 +1,9 @@ +package javadoc.testBug54776; +public class Test { + + private int field= /*]*/foo()/*[*/; + + public int foo() { + return 1; + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/a/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/a/Test.java new file mode 100644 index 00000000000..d27c9030d61 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/a/Test.java @@ -0,0 +1,18 @@ +package javadoc.testBug55221.a; +public class Test { + public int bar() { + int x=0; + if (true) { + x=1; + } else { + x=2; + } + return x; + } + /** + * This comment should not be attached to previous method body! + * @return int + */ + + public int foo() { return 1; } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/b/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/b/Test.java new file mode 100644 index 00000000000..c3d81a62a47 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/b/Test.java @@ -0,0 +1,17 @@ +package javadoc.testBug55221.b; +public class Test { + public int bar() { + int x=0; + if (true) { + x=1; + } else { + x=2; + } + return x; + } /** + * This comment should not be attached to previous method body! + * @return int + */ + + public int foo() { return 1; } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/c/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/c/Test.java new file mode 100644 index 00000000000..ff3e37b7298 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/c/Test.java @@ -0,0 +1,16 @@ +package javadoc.testBug55221.c; +public class Test { + public int bar() { + int x=0; + if (true) { + x=1; + } else { + x=2; + } + return x; + } /* + * This comment should not be attached to previous method body! + * @return int + */ + public int foo() { return 1; } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/d/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/d/Test.java new file mode 100644 index 00000000000..63538888420 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55221/d/Test.java @@ -0,0 +1,7 @@ +package javadoc.testBug55221.d; +public class Test { + /** + * Javadoc comment + */// Line comment + boolean foo() { return false; } +} \ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestA.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestA.java new file mode 100644 index 00000000000..0b1c78b1868 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestA.java @@ -0,0 +1,6 @@ +package javadoc.testBug55223; +public class TestA { + private void foo() { + foo();/* a */ foo(); /* b */ foo(); + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestB.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestB.java new file mode 100644 index 00000000000..32e13763df3 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug55223/TestB.java @@ -0,0 +1,10 @@ +package javadoc.testBug55223; +public class TestB { + /** + * Returns all of the filter elements of this shortcut as a List of String Pairs. + * + * @return all of the filter elements of this shortcut, or null if not + * specified + */ + public /* */ Object getFilters() { return null; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug63044/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug63044/Test.java new file mode 100644 index 00000000000..eaa92532389 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug63044/Test.java @@ -0,0 +1,11 @@ +package javadoc.testBug63044; +/** + * @see #Test() + * @see Test#Test() + * @see javadoc.testBug63044.Test#Test() + */ +public class Test{ + Test( ){ + new Test(); + }; +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65174/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65174/Test.java new file mode 100644 index 00000000000..a14d8f2728d --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65174/Test.java @@ -0,0 +1,39 @@ +package javadoc.testBug65174; +public class Test { + /** + * Comment with no error: {@link + * Object valid} because it's not on first line + */ + void foo_ok() {} + /** Comment previously with error: {@link + * Object valid} because tag is on comment very first line + */ + void foo_ko() {} + /** + * Comment with no error: {@link + * Object valid} because it's not on first line + */ + void fooA_ok() {} + /** Comment previously with error: {@link + * Object valid} because tag is on comment very first line + */ + void fooA_ko() {} + /** + * Comment with no error: {@link java.lang. + * Object valid} because it's not on first line + */ + void fooB_ok() {} + /** Comment previously with error: {@link java.lang. + * Object valid} because tag is on comment very first line + */ + void fooB_ko() {} + /** + * Comment with no error: {@link Object + * valid} because it's not on first line + */ + void fooC_ok() {} + /** Comment previously with error: {@link Object + * valid} because tag is on comment very first line + */ + void fooC_ko() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/Test.java new file mode 100644 index 00000000000..bde49a611c6 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/Test.java @@ -0,0 +1,15 @@ +package javadoc.testBug65253; +/** + * Comment + * @@@@see Unknown Should not complain on ref + */ +public class Test { + /** + * Comment + * @@@param xxx Should not complain on param + * @@return int Should not be '@return' tag element + */ + int foo() { // should warn on missing tag for return type + return 0; + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/TestD.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/TestD.java new file mode 100644 index 00000000000..82d22c46a7e --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65253/TestD.java @@ -0,0 +1,21 @@ +package javadoc.testBug65253; +public class TestD { + /** Comment previously with no error: {@link Object valid} comment on one line */ + void foo1() {} + /** Comment previously with no error: {@link Object valid} */ + void foo2() {} + /** Comment previously with no error: {@link Object valid}*/ + void foo3() {} + /** {@link Object valid} comment on one line */ + void foo4() {} + /**{@link Object valid} comment on one line */ + void foo5() {} + /** {@link Object valid} */ + void foo6() {} + /**{@link Object valid} */ + void foo7() {} + /** {@link Object valid}*/ + void foo8() {} + /**{@link Object valid}*/ + void foo9() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65288/Test.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65288/Test.java new file mode 100644 index 00000000000..59cb55a5e34 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug65288/Test.java @@ -0,0 +1,7 @@ +package javadoc.testBug65288; +/** + * @see + * @see*/ +public class Test { + +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestInvalid.java new file mode 100644 index 00000000000..7cfd712a20b --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestInvalid.java @@ -0,0 +1,13 @@ +package javadoc.testBug68017; +public class TestInvalid { + /**@return*/ + public int foo1() {return 0; } + /**@return */ + public int foo2() {return 0; } + /**@return****/ + public int foo3() {return 0; } + /** + * @return + */ + public int foo4() {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestValid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestValid.java new file mode 100644 index 00000000000..9ae41b22c75 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestValid.java @@ -0,0 +1,9 @@ +package javadoc.testBug68017; +public class TestValid { + /**@return integer*/ + public int foo1() {return 0; } + /** + * @return # + */ + public int foo2() {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn1.java new file mode 100644 index 00000000000..1d69e95dc74 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn1.java @@ -0,0 +1,8 @@ +package javadoc.testBug68017; +public class TestWarn1 { + /** + * @return* */ + public int foo1() {return 0; } + /**@return** **/ + public int foo2() {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn2.java new file mode 100644 index 00000000000..7c63b404b1c --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68017/TestWarn2.java @@ -0,0 +1,7 @@ +package javadoc.testBug68017; +public class TestWarn2 { + /** + * @return# + */ + public int foo() {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestA.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestA.java new file mode 100644 index 00000000000..db9750c0b5b --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestA.java @@ -0,0 +1,12 @@ + +package javadoc.testBug68025; +public class TestA { + + /** + * @see IJavaElement#getElementName#bug + * or closer to the reality (COPY is a constant): + * @see org.eclipse.ui.actions.ActionFactory#COPY#getId + */ + void foo() { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestB.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestB.java new file mode 100644 index 00000000000..d8a82577d92 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68025/TestB.java @@ -0,0 +1,17 @@ +package javadoc.testBug68025; +public class TestB { + public int field; + public void foo() {} + /** + * @see #field#invalid + * @see #foo#invalid + */ + public void foo1() {} + /**@see Y#field# invalid*/ + public void foo2() {} + /**@see Y#foo# invalid*/ + public void foo3() {} + /**@see Y#foo()# + *valid*/ + public void foo4() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform1.java new file mode 100644 index 00000000000..48fb7c5586d --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform1.java @@ -0,0 +1,9 @@ +package javadoc.testBug68726; +public class TestBug68726conform1 { + /** + * @see Object Eclipse + */ + void foo1() {} + /**@see Object Eclipse*/ + void foo2() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform2.java new file mode 100644 index 00000000000..33b0c66cf26 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726conform2.java @@ -0,0 +1,20 @@ +package javadoc.testBug68726; +/** + * @see IBM Home Page + * @see + * IBM Home Page + * @see + * IBM Home Page + * + * @see + * + * IBM + * + * Home Page + * + * + * + * @see Object + */ +public class TestBug68726conform2 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative1.java new file mode 100644 index 00000000000..b5ff34ad022 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative1.java @@ -0,0 +1,21 @@ +package javadoc.testBug68726; +public class TestBug68726negative1 { + /** + * Invalid URL link references + * + * @see + * @see + * @see invalid + * @see invalid< + * @see invalidinvalidinvalid no text allowed after the href + */ + public void s_foo() { + } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative2.java new file mode 100644 index 00000000000..227874ae286 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug68726/TestBug68726negative2.java @@ -0,0 +1,20 @@ +package javadoc.testBug68726; +/** + * @see IBM Home Page + * @see + * IBM Home Page + * @see + * IBM Home Page< + * /a> + * @see + * + * IBM + * + * Home Page + * + * + * + * @see Unknown Unknown reference + */ +public class TestBug68726negative2 { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassInvalid.java new file mode 100644 index 00000000000..6fa53837b98 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassInvalid.java @@ -0,0 +1,10 @@ +package javadoc.testBug69272; +public class TestClassInvalid { + /**@see Object* */ + public void foo1() {} + /**@see Object*** ***/ + public void foo2() {} + /**@see Object*** + */ + public void foo3() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassValid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassValid.java new file mode 100644 index 00000000000..5718e6d1e20 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestClassValid.java @@ -0,0 +1,14 @@ +package javadoc.testBug69272; +public class TestClassValid { + /**@see Object*/ + public void foo1() {} + /**@see Object + */ + public void foo2() {} + /**@see Object */ + public void foo3() {} + /**@see Object****/ + public void foo4() {} + /**@see Object ****/ + public void foo5() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldInvalid.java new file mode 100644 index 00000000000..34c96bd31ed --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldInvalid.java @@ -0,0 +1,11 @@ +package javadoc.testBug69272; +public class TestFieldInvalid { + int field; + /**@see #field* */ + public void foo1() {} + /**@see #field*** ***/ + public void foo2() {} + /**@see #field*** + */ + public void foo3() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldValid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldValid.java new file mode 100644 index 00000000000..4cb069443ab --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestFieldValid.java @@ -0,0 +1,15 @@ +package javadoc.testBug69272; +public class TestFieldValid { + int field; + /**@see #field*/ + public void foo1() {} + /**@see #field + */ + public void foo2() {} + /**@see #field */ + public void foo3() {} + /**@see #field****/ + public void foo4() {} + /**@see #field ********/ + public void foo5() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethInvalid.java new file mode 100644 index 00000000000..d3c2e566ff4 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethInvalid.java @@ -0,0 +1,10 @@ +package javadoc.testBug69272; +public class TestMethInvalid { + /**@see Object#wait()* */ + public void foo1() {} + /**@see Object#wait()*** ***/ + public void foo2() {} + /**@see Object#wait()*** + */ + public void foo3() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethValid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethValid.java new file mode 100644 index 00000000000..bff08700c37 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69272/TestMethValid.java @@ -0,0 +1,14 @@ +package javadoc.testBug69272; +public class TestMethValid { + /**@see Object#wait()*/ + public void foo1() {} + /**@see Object#wait() + */ + public void foo2() {} + /**@see Object#wait() */ + public void foo3() {} + /**@see Object#wait()****/ + public void foo4() {} + /**@see Object#wait() ****/ + public void foo5() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestA.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestA.java new file mode 100644 index 00000000000..c55a0a2546a --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestA.java @@ -0,0 +1,14 @@ +package javadoc.testBug69275; +public class TestA { + /**@see text*/ + void foo1() {} + /**@see text + */ + void foo2() {} + /**@see text */ + void foo3() {} + /**@see text**/ + void foo4() {} + /**@see text *****/ + void foo5() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestB.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestB.java new file mode 100644 index 00000000000..7abe307959f --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69275/TestB.java @@ -0,0 +1,10 @@ +package javadoc.testBug69275; +public class TestA { + /**@see text* */ + void foo1() {} + /**@see text *** **/ + void foo2() {} + /**@see text*** + */ + void foo3() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestInvalid.java new file mode 100644 index 00000000000..7a6dbcabcc4 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestInvalid.java @@ -0,0 +1,7 @@ +package javadoc.testBug69302; +public class TestInvalid { + /**@see Unknown Unknown reference text*/ + void foo1() {} + /**@see Unknown Unknown reference "Valid string reference"*/ + void foo2() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid1.java new file mode 100644 index 00000000000..402bcff550a --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid1.java @@ -0,0 +1,12 @@ +package javadoc.testBug69302; +public class TestValid1 { + /** + * @see Object Eclipse + */ + void foo1() {} + /** + * @see Object "Valid string reference" + */ + void foo2() {} + +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid2.java new file mode 100644 index 00000000000..31c92c478ae --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug69302/TestValid2.java @@ -0,0 +1,11 @@ +package javadoc.testBug69302; +public class TestValid2 { + /** + * @see Unknown Unknown + */ + void foo1() {} + /** + * @see Unknown "Valid Unknown reference" + */ + void foo2() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid1.java new file mode 100644 index 00000000000..2610fd04eec --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid1.java @@ -0,0 +1,12 @@ +package javadoc.testBug70892; +/** + * {@value "invalid"} + * {@value invalid} invalid + * {@value #field} + * {@value #foo} + * {@value #foo()} + */ +public class TestInvalid1 { + int field; + void foo() {} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid2.java new file mode 100644 index 00000000000..345f6a27922 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_23/src/markdown/testBug70892/TestInvalid2.java @@ -0,0 +1,12 @@ +package javadoc.testBug70892; +/** + * {@value "invalid} + * {@value invalid just add the element + TagElement inlineTag = this.ast.newTagElement(); + fragments.add(inlineTag); + previousTag = inlineTag; + } else { + // If last fragment is a tag, then use it as previous tag + ASTNode lastFragment = (ASTNode) fragments.get(size-1); + if (lastFragment.getNodeType() == ASTNode.TAG_ELEMENT) { + //lastFragment.setSourceRange(lastFragment.getStartPosition(), length); + previousTag = (TagElement) lastFragment; + } + } + if (tEnd != -1) { + TextElement text = this.ast.newTextElement(); + text.setText(new String( this.source, tStart, tEnd-tStart)); + text.setSourceRange(tStart, tEnd-tStart); + previousTag.fragments().add(0, text); + } + this.tagValue = NO_TAG_VALUE; + this.inlineTagStarted = false; + this.inlineTagStart = -1; + this.scanner.eofPosition = eofBkup; + break loop; + } + break; + case '\r': + case '\n': + return false; + default: + break; + } + currentChar = readChar(); + } + return valid; } @Override diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java index 6c468305214..b4652340fbf 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java @@ -126,7 +126,7 @@ private static synchronized char[] scannedIdentifier(String id, String sourceLev // Set scanner for given source and compliance levels SCANNER.sourceLevel = sourceLevel == null ? ClassFileConstants.JDK1_3 : CompilerOptions.versionToJdkLevel(sourceLevel); SCANNER.complianceLevel = complianceLevel == null ? ClassFileConstants.JDK1_3 : CompilerOptions.versionToJdkLevel(complianceLevel); - SCANNER.previewEnabled = previewEnabled == null ? false : JavaCore.ENABLED.equals(previewEnabled); + SCANNER.previewEnabled = previewEnabled == null ? true : JavaCore.ENABLED.equals(previewEnabled); try { SCANNER.setSource(id.toCharArray()); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java index ed7cb186e8f..a24bef801ff 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java @@ -1772,7 +1772,6 @@ public static boolean isValidCompilationUnitName(String name, String sourceLevel public static boolean isValidFolderNameForPackage(String folderName, String sourceLevel, String complianceLevel) { return JavaConventions.validateIdentifier(folderName, sourceLevel, complianceLevel).getSeverity() != IStatus.ERROR; } - /** * Returns true if the given method signature is valid, * false if it is not.