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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (-1 / +25 lines)
Lines 44-50 Link Here
44
	// All specified tests which do not belong to the class are skipped...
44
	// All specified tests which do not belong to the class are skipped...
45
	static {
45
	static {
46
//		TESTS_NAMES = new String[] { "test127" };
46
//		TESTS_NAMES = new String[] { "test127" };
47
//		TESTS_NUMBERS = new int[] { 249 };
47
//		TESTS_NUMBERS = new int[] { 269 };
48
//		TESTS_RANGE = new int[] { 249, -1 };
48
//		TESTS_RANGE = new int[] { 249, -1 };
49
	}
49
	}
50
50
Lines 8826-8829 Link Here
8826
		"The value for annotation attribute X.Anno2.value must be an enum constant expression\n" + 
8826
		"The value for annotation attribute X.Anno2.value must be an enum constant expression\n" + 
8827
		"----------\n");
8827
		"----------\n");
8828
}
8828
}
8829
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=274917
8830
public void test269() {
8831
	Map customOptions = new Hashtable();
8832
	String[] warnings = CompilerOptions.warningOptionNames();
8833
	for (int i = 0, ceil = warnings.length; i < ceil; i++) {
8834
		customOptions.put(warnings[i], CompilerOptions.WARNING);
8835
	}
8836
	this.runConformTest(
8837
			true,
8838
			new String[] {
8839
					"X.java",
8840
					"@interface X {}",
8841
			},
8842
			null,
8843
			customOptions,
8844
			"----------\n" + 
8845
			"1. WARNING in X.java (at line 1)\n" + 
8846
			"	@interface X {}\n" + 
8847
			"	             ^^\n" + 
8848
			"Empty block should be documented\n" + 
8849
			"----------\n",
8850
			null, null,
8851
			JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
8852
}
8829
}
8853
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-4 / +8 lines)
Lines 1357-1362 Link Here
1357
	typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
1357
	typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
1358
}
1358
}
1359
protected void consumeAnnotationTypeDeclarationHeader() {
1359
protected void consumeAnnotationTypeDeclarationHeader() {
1360
	TypeDeclaration annotationTypeDeclaration = (TypeDeclaration) this.astStack[this.astPtr];
1361
	if (this.currentToken == TokenNameLBRACE) {
1362
		annotationTypeDeclaration.bodyStart = this.scanner.currentPosition;
1363
	}
1360
	if (this.currentElement != null) {
1364
	if (this.currentElement != null) {
1361
		this.restartRecovery = true; // used to avoid branching back into the regular automaton
1365
		this.restartRecovery = true; // used to avoid branching back into the regular automaton
1362
	}
1366
	}
Lines 1420-1430 Link Here
1420
			0,
1424
			0,
1421
			length);
1425
			length);
1422
	}
1426
	}
1423
	annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.sourceEnd + 1;
1424
1427
1425
	// javadoc
1428
	// javadoc
1426
	annotationTypeDeclaration.javadoc = this.javadoc;
1429
	annotationTypeDeclaration.javadoc = this.javadoc;
1427
	this.javadoc = null;
1430
	this.javadoc = null;
1431
	annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.sourceEnd + 1;
1432
	
1428
	pushOnAstStack(annotationTypeDeclaration);
1433
	pushOnAstStack(annotationTypeDeclaration);
1429
	if(!this.statementRecoveryActivated &&
1434
	if(!this.statementRecoveryActivated &&
1430
			this.options.sourceLevel < ClassFileConstants.JDK1_5 &&
1435
			this.options.sourceLevel < ClassFileConstants.JDK1_5 &&
Lines 1449-1457 Link Here
1449
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, annotationTypeDeclaration.typeParameters = new TypeParameter[length], 0, length);
1454
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, annotationTypeDeclaration.typeParameters = new TypeParameter[length], 0, length);
1450
1455
1451
	problemReporter().invalidUsageOfTypeParametersForAnnotationDeclaration(annotationTypeDeclaration);
1456
	problemReporter().invalidUsageOfTypeParametersForAnnotationDeclaration(annotationTypeDeclaration);
1452
1457
	
1453
	annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.typeParameters[length-1].declarationSourceEnd + 1;
1454
1455
//	annotationTypeDeclaration.typeParameters = null;
1458
//	annotationTypeDeclaration.typeParameters = null;
1456
1459
1457
	this.listTypeParameterLength = 0;
1460
	this.listTypeParameterLength = 0;
Lines 1473-1478 Link Here
1473
	annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);
1476
	annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);
1474
	annotationTypeDeclaration.name = this.identifierStack[this.identifierPtr--];
1477
	annotationTypeDeclaration.name = this.identifierStack[this.identifierPtr--];
1475
	this.identifierLengthPtr--;
1478
	this.identifierLengthPtr--;
1479
	annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.typeParameters[length-1].declarationSourceEnd + 1;
1476
1480
1477
	//compute the declaration source too
1481
	//compute the declaration source too
1478
	// 'interface' push two int positions: the beginning of the class token and its end.
1482
	// 'interface' push two int positions: the beginning of the class token and its end.

Return to bug 274917