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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-26 / +20 lines)
Lines 401-413 Link Here
401
			this.contents[this.contentsOffset++] = methodIndexByte2;
401
			this.contents[this.contentsOffset++] = methodIndexByte2;
402
			attributesNumber++;
402
			attributesNumber++;
403
		}
403
		}
404
		if (this.targetJDK >= ClassFileConstants.JDK1_5) {
404
		TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext;
405
			TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext;
405
		if (typeDeclaration != null) {
406
			if (typeDeclaration != null) {
406
			final Annotation[] annotations = typeDeclaration.annotations;
407
				final Annotation[] annotations = typeDeclaration.annotations;
407
			if (annotations != null) {
408
				if (annotations != null) {
408
				attributesNumber += generateRuntimeAnnotations(annotations);
409
					attributesNumber += generateRuntimeAnnotations(annotations);
410
				}
411
			}
409
			}
412
		}
410
		}
413
411
Lines 673-685 Link Here
673
			this.contents[this.contentsOffset++] = (byte) signatureIndex;
671
			this.contents[this.contentsOffset++] = (byte) signatureIndex;
674
			attributesNumber++;
672
			attributesNumber++;
675
		}
673
		}
676
		if (this.targetJDK >= ClassFileConstants.JDK1_5) {
674
		FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
677
			FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
675
		if (fieldDeclaration != null) {
678
			if (fieldDeclaration != null) {
676
			Annotation[] annotations = fieldDeclaration.annotations;
679
				Annotation[] annotations = fieldDeclaration.annotations;
677
			if (annotations != null) {
680
				if (annotations != null) {
678
				attributesNumber += generateRuntimeAnnotations(annotations);
681
					attributesNumber += generateRuntimeAnnotations(annotations);
682
				}
683
			}
679
			}
684
		}
680
		}
685
		if ((fieldBinding.tagBits & TagBits.HasMissingType) != 0) {
681
		if ((fieldBinding.tagBits & TagBits.HasMissingType) != 0) {
Lines 6290-6307 Link Here
6290
			this.contents[this.contentsOffset++] = (byte) signatureIndex;
6286
			this.contents[this.contentsOffset++] = (byte) signatureIndex;
6291
			attributeNumber++;
6287
			attributeNumber++;
6292
		}
6288
		}
6293
		if (this.targetJDK >= ClassFileConstants.JDK1_5) {
6289
		AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
6294
			AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
6290
		if (methodDeclaration != null) {
6295
			if (methodDeclaration != null) {
6291
			Annotation[] annotations = methodDeclaration.annotations;
6296
				Annotation[] annotations = methodDeclaration.annotations;
6292
			if (annotations != null) {
6297
				if (annotations != null) {
6293
				attributeNumber += generateRuntimeAnnotations(annotations);
6298
					attributeNumber += generateRuntimeAnnotations(annotations);
6294
			}
6299
				}
6295
			if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) {
6300
				if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) {
6296
				Argument[] arguments = methodDeclaration.arguments;
6301
					Argument[] arguments = methodDeclaration.arguments;
6297
				if (arguments != null) {
6302
					if (arguments != null) {
6298
					attributeNumber += generateRuntimeAnnotationsForParameters(arguments);
6303
						attributeNumber += generateRuntimeAnnotationsForParameters(arguments);
6304
					}
6305
				}
6299
				}
6306
			}
6300
			}
6307
		}
6301
		}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (-1 / +34 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[] { 271 };
47
//		TESTS_NUMBERS = new int[] { 272 };
48
//		TESTS_RANGE = new int[] { 249, -1 };
48
//		TESTS_RANGE = new int[] { 249, -1 };
49
	}
49
	}
50
50
Lines 8889-8892 Link Here
8889
8889
8890
	checkDisassembledClassFile(OUTPUT_DIR + File.separator  +"X.class", "X", expectedOutput, ClassFileBytesDisassembler.DETAILED);
8890
	checkDisassembledClassFile(OUTPUT_DIR + File.separator  +"X.class", "X", expectedOutput, ClassFileBytesDisassembler.DETAILED);
8891
}
8891
}
8892
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=289576
8893
public void test272() throws Exception {
8894
	if (this.complianceLevel != ClassFileConstants.JDK1_5) {
8895
		return;
8896
	}
8897
	Map options = getCompilerOptions();
8898
	options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
8899
	options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
8900
	options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
8901
	this.runConformTest(
8902
		new String[] {
8903
			"X.java",
8904
			"@interface A {}\n" + 
8905
			"public class X {\n" + 
8906
			"	@SuppressWarnings(\"unused\")\n" + 
8907
			"	private void foo(@A Object o) {}\n" + 
8908
			"}"
8909
		},
8910
		"",
8911
		null,
8912
		true,
8913
		null,
8914
		options,
8915
		null,
8916
		true);
8917
8918
	String expectedOutput =
8919
		"  // Method descriptor #15 (Ljava/lang/Object;)V\n" + 
8920
		"  // Stack: 0, Locals: 2\n" + 
8921
		"  private void foo(@A java.lang.Object o);\n";
8922
8923
	checkDisassembledClassFile(OUTPUT_DIR + File.separator  +"X.class", "X", expectedOutput, ClassFileBytesDisassembler.DETAILED);
8924
}
8892
}
8925
}

Return to bug 289516