View | Details | Raw Unified | Return to bug 130752
Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/ASTConverter.java (-1 / +8 lines)
Lines 3302-3308 Link Here
3302
			comment = docComment;
3302
			comment = docComment;
3303
		} else {
3303
		} else {
3304
			end = -end;
3304
			end = -end;
3305
			if (positions[0]>0) { // Block comment have positive start position
3305
			if (positions[0] == 0) { // we cannot know without testing chars again
3306
				if (this.docParser.scanner.source[1] == '/') {
3307
					comment = new LineComment(this.ast);
3308
				} else {
3309
					comment = new BlockComment(this.ast);
3310
				}
3311
			}
3312
			else if (positions[0]>0) { // Block comment have positive start position
3306
				comment = new BlockComment(this.ast);
3313
				comment = new BlockComment(this.ast);
3307
			} else { // Line comment have negative start and end position
3314
			} else { // Line comment have negative start and end position
3308
				start = -start;
3315
				start = -start;
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java (-1 / +61 lines)
Lines 114-120 Link Here
114
		// Run test cases subset
114
		// Run test cases subset
115
		COPY_DIR = false;
115
		COPY_DIR = false;
116
		System.err.println("WARNING: only subset of tests will be executed!!!");
116
		System.err.println("WARNING: only subset of tests will be executed!!!");
117
		suite.addTest(new ASTConverterJavadocTest("testBug125903"));
117
		suite.addTest(new ASTConverterJavadocTest("testBug130752"));
118
		return suite;
118
		return suite;
119
	}
119
	}
120
120
Lines 3285-3288 Link Here
3285
			assertEquals("Tag name should be empty", tag.getTagName(), "@");
3285
			assertEquals("Tag name should be empty", tag.getTagName(), "@");
3286
		}
3286
		}
3287
	}
3287
	}
3288
3289
	/**
3290
	 * @bug 130752: [comments] first BlockComment parsed as LineComment
3291
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130752"
3292
	 */
3293
	public void testBug130752() throws JavaModelException {
3294
		workingCopies = new ICompilationUnit[1];
3295
		workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java",
3296
			"/* Ceci n'est pas\n" + 
3297
			" * une ligne. */\n" + 
3298
			"package javadoc.b130752;\n" + 
3299
			"public class Test {\n" + 
3300
			"}\n"
3301
		);
3302
		CompilationUnit compilUnit = (CompilationUnit) runConversion(workingCopies[0], true);
3303
		verifyWorkingCopiesComments();
3304
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
3305
			// Verify comment type
3306
			List unitComments = compilUnit.getCommentList();
3307
			assertEquals("Wrong number of comments", 1, unitComments.size());
3308
			Comment comment = (Comment) unitComments.get(0);
3309
			assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.BLOCK_COMMENT);
3310
		}
3311
	}
3312
	public void testBug130752b() throws JavaModelException {
3313
		workingCopies = new ICompilationUnit[1];
3314
		workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java",
3315
			"// Line comment\n" + 
3316
			"package javadoc.b130752;\n" + 
3317
			"public class Test {\n" + 
3318
			"}\n"
3319
		);
3320
		CompilationUnit compilUnit = (CompilationUnit) runConversion(workingCopies[0], true);
3321
		verifyWorkingCopiesComments();
3322
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
3323
			// Verify comment type
3324
			List unitComments = compilUnit.getCommentList();
3325
			assertEquals("Wrong number of comments", 1, unitComments.size());
3326
			Comment comment = (Comment) unitComments.get(0);
3327
			assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.LINE_COMMENT);
3328
		}
3329
	}
3330
	public void testBug130752c() throws JavaModelException {
3331
		workingCopies = new ICompilationUnit[1];
3332
		workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.java",
3333
			"/** Javadoc comment */\n" + 
3334
			"package javadoc.b130752;\n" + 
3335
			"public class Test {\n" + 
3336
			"}\n"
3337
		);
3338
		CompilationUnit compilUnit = (CompilationUnit) runConversion(workingCopies[0], true);
3339
		verifyWorkingCopiesComments();
3340
		if (docCommentSupport.equals(JavaCore.ENABLED)) {
3341
			// Verify comment type
3342
			List unitComments = compilUnit.getCommentList();
3343
			assertEquals("Wrong number of comments", 1, unitComments.size());
3344
			Comment comment = (Comment) unitComments.get(0);
3345
			assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JAVADOC);
3346
		}
3347
	}
3288
}
3348
}

Return to bug 130752