View | Details | Raw Unified | Return to bug 108622 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java (-2 / +64 lines)
Lines 113-119 Link Here
113
		// Run test cases subset
113
		// Run test cases subset
114
		COPY_DIR = false;
114
		COPY_DIR = false;
115
		System.err.println("WARNING: only subset of tests will be executed!!!");
115
		System.err.println("WARNING: only subset of tests will be executed!!!");
116
		suite.addTest(new ASTConverterJavadocTest("testBug106581"));
116
		suite.addTest(new ASTConverterJavadocTest("testBug84049"));
117
		suite.addTest(new ASTConverterJavadocTest("testBug108622"));
117
		return suite;
118
		return suite;
118
	}
119
	}
119
120
Lines 2450-2456 Link Here
2450
			ASTNode node = getASTNode(compilUnit, 0, 0);
2451
			ASTNode node = getASTNode(compilUnit, 0, 0);
2451
			assertEquals("Invalid type for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
2452
			assertEquals("Invalid type for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
2452
			MethodDeclaration methodDeclaration = (MethodDeclaration) node;
2453
			MethodDeclaration methodDeclaration = (MethodDeclaration) node;
2453
			assertNull("MethodDeclaration should not have any javadoc comment", methodDeclaration.getJavadoc());
2454
			Javadoc methodJavadoc = methodDeclaration.getJavadoc();
2455
			assertNotNull("MethodDeclaration have a javadoc comment", methodJavadoc);
2456
			int javadocStart = methodJavadoc.getStartPosition();
2457
			assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
2458
			/* TODO (frederic) Enable this block when bug will be fixed...
2459
			SimpleName methodName = methodDeclaration.getName();
2460
			int nameStart = methodName.getStartPosition();
2461
			assertTrue("Method simple name should not include javadoc comment", nameStart > javadocStart+methodJavadoc.getLength());
2462
			int extendedStart = compilUnit.getExtendedStartPosition(methodName);
2463
			assertEquals("Method simple name start position should not be extended!", nameStart, extendedStart);
2464
			int extendedLength = compilUnit.getExtendedLength(methodName);
2465
			assertEquals("Method simple name length should not be extended!", methodName.getLength(), extendedLength);
2466
			*/
2454
		}
2467
		}
2455
	}
2468
	}
2456
2469
Lines 3009-3012 Link Here
3009
			assertNotNull("We should have a type binding for simple name: "+simpleName, simpleName.resolveTypeBinding());
3022
			assertNotNull("We should have a type binding for simple name: "+simpleName, simpleName.resolveTypeBinding());
3010
		}
3023
		}
3011
	}
3024
	}
3025
3026
	/**
3027
	 * Bug 108622: [javadoc][dom] ASTNode not including javadoc
3028
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=108622"
3029
	 */
3030
	public void testBug108622() throws JavaModelException {
3031
		workingCopies = new ICompilationUnit[1];
3032
		astLevel = AST.JLS3;
3033
		workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b108622/Test.java",
3034
			"package javadoc.b108622;\n" + 
3035
			"/**\n" + 
3036
			" * \n" + 
3037
			" */\n" + 
3038
			"public abstract class Test {\n" + 
3039
			"\n" + 
3040
			"	/**\n" + 
3041
			"	 * \n" + 
3042
			"	 */\n" + 
3043
			"	public abstract Zork getFoo();\n" + 
3044
			"\n" + 
3045
			"	/**\n" + 
3046
			"	 * \n" + 
3047
			"	 */\n" + 
3048
			"	public abstract void setFoo(Zork dept);\n" + 
3049
			"\n" + 
3050
			"}"
3051
			);
3052
		CompilationUnit compilUnit = (CompilationUnit) runConversion(workingCopies[0], true);
3053
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
3054
			// Verify first method
3055
			ASTNode node = getASTNode(compilUnit, 0, 0);
3056
			assertEquals("Invalid type for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
3057
			MethodDeclaration methodDeclaration = (MethodDeclaration) node;
3058
			assertEquals("Invalid method name", "getFoo", methodDeclaration.getName().toString());
3059
			Javadoc methodJavadoc = methodDeclaration.getJavadoc();
3060
			assertNotNull("MethodDeclaration have a javadoc comment", methodJavadoc);
3061
			int javadocStart = methodJavadoc.getStartPosition();
3062
			assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
3063
			// Verify second method
3064
			node = getASTNode(compilUnit, 0, 1);
3065
			assertEquals("Invalid type for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
3066
			methodDeclaration = (MethodDeclaration) node;
3067
			assertEquals("Invalid method name", "setFoo", methodDeclaration.getName().toString());
3068
			methodJavadoc = methodDeclaration.getJavadoc();
3069
			assertNotNull("MethodDeclaration have a javadoc comment", methodJavadoc);
3070
			javadocStart = methodJavadoc.getStartPosition();
3071
			assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
3072
		}
3073
	}
3012
}
3074
}

Return to bug 108622