Skip to content
Permalink
Browse files

Bug 533488 - [9] @deprecated may cause AIOOBE

Change-Id: I3f61e194da38f4105e34aab5226d5f688af6ec9f
Signed-off-by: Alexander Leshkin <alexander.leshkin@gmail.com>
  • Loading branch information...
axls authored and stephan-herrmann committed Apr 9, 2018
1 parent d3417b0 commit e60c4f1f36f7efd5fbc1bbc661872b78c6939230
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;

import junit.framework.Test;

@SuppressWarnings({ "rawtypes" })
public class AnnotationTest_9 extends AbstractComparableTest {

public AnnotationTest_9(String name) {
super(name);
}

public static Test suite() {
return buildMinimalComplianceTestSuite(testClass(), F_9);
}

public static Class testClass() {
return AnnotationTest_9.class;
}

public void testBug532913() throws Exception {
this.complianceLevel = ClassFileConstants.JDK9;
if (this.complianceLevel < ClassFileConstants.JDK9) {
return;
}

runConformTest(
new String[] {
"p/A.java",
"package p;\n" +
"@java.lang.annotation.Target({\n" +
" java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD})\n" +
"@Deprecated\n" +
"public @interface A {}\n",
},"");
runConformTest(
new String[] {
"X.java",
"import p.A;\n" +
"class X {\n" +
" @A void foo() {}\n" +
"}\n",
},"", null, false, null);
}
}
@@ -76,7 +76,7 @@
result[index++] = buildTargetAnnotation(annotationTagBits, env);
if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0)
result[index++] = buildRetentionAnnotation(annotationTagBits, env);
if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0)
if (!haveDeprecated && (annotationTagBits & TagBits.AnnotationDeprecated) != 0)
result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_DEPRECATED, env.javaBaseModule(), env);
if ((annotationTagBits & TagBits.AnnotationDocumented) != 0)
result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED, env.javaBaseModule(), env);

0 comments on commit e60c4f1

Please sign in to comment.
You can’t perform that action at this time.