Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 409236 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java (+239 lines)
Lines 13-18 Link Here
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
16
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.jdt.core.tests.compiler.regression;
18
package org.eclipse.jdt.core.tests.compiler.regression;
18
19
Lines 3060-3065 public class TypeAnnotationTest extends AbstractRegressionTest { Link Here
3060
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3061
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3061
	}
3062
	}
3062
	
3063
	
3064
	public void test070a_codeblocks_castWithIntersectionCast() throws Exception {
3065
		this.runConformTest(
3066
			new String[] {
3067
				"X.java",
3068
			"import java.io.*;\n" +
3069
				"public class X {\n" + 
3070
				"   public void foo(Object o) {\n" +
3071
				"	  I i = (@B(1) I & J) o;\n" +
3072
				"	  J j = (I & @B(2) J) o;\n" +
3073
			    "   }\n" +
3074
				"}\n" +
3075
				"interface I {}\n" +
3076
				"interface J {}\n",
3077
				
3078
				"B.java",
3079
				"import java.lang.annotation.*;\n" + 
3080
				"@Target(ElementType.TYPE_USE)\n" + 
3081
				"@Retention(RetentionPolicy.RUNTIME)\n" + 
3082
				"@interface B {\n" + 
3083
				"	int value() default 1;\n" + 
3084
				"}\n",
3085
		},
3086
		"");
3087
		String expectedOutput =
3088
				"  // Method descriptor #15 (Ljava/lang/Object;)V\n" + 
3089
				"  // Stack: 1, Locals: 4\n" + 
3090
				"  public void foo(java.lang.Object o);\n" + 
3091
				"     0  aload_1 [o]\n" + 
3092
				"     1  checkcast I [16]\n" + 
3093
				"     4  checkcast J [18]\n" + 
3094
				"     7  astore_2 [i]\n" + 
3095
				"     8  aload_1 [o]\n" + 
3096
				"     9  checkcast I [16]\n" + 
3097
				"    12  checkcast J [18]\n" +
3098
				"    15  astore_3 [j]\n" + 
3099
				"    16  return\n" + 
3100
				"      Line numbers:\n" + 
3101
				"        [pc: 0, line: 4]\n" + 
3102
				"        [pc: 8, line: 5]\n" + 
3103
				"        [pc: 16, line: 6]\n" + 
3104
				"      Local variable table:\n" + 
3105
				"        [pc: 0, pc: 17] local: this index: 0 type: X\n" + 
3106
				"        [pc: 0, pc: 17] local: o index: 1 type: java.lang.Object\n" + 
3107
				"        [pc: 8, pc: 17] local: i index: 2 type: I\n" + 
3108
				"        [pc: 16, pc: 17] local: j index: 3 type: J\n" + 
3109
				"    RuntimeVisibleTypeAnnotations: \n" + 
3110
				"      #27 @B(\n" + 
3111
				"        #28 value=(int) 1 (constant type)\n" + 
3112
				"        target type = 0x47 CAST\n" + 
3113
				"        offset = 1\n" + 
3114
				"        type argument index = 0\n" + 
3115
				"      )\n" + 
3116
				"      #27 @B(\n" + 
3117
				"        #28 value=(int) 2 (constant type)\n" + 
3118
				"        target type = 0x47 CAST\n" + 
3119
				"        offset = 9\n" + 
3120
				"        type argument index = 1\n" + 
3121
				"      )\n";
3122
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3123
	}
3124
	
3125
	public void test070b_codeblocks_castWithIntersectionCast() throws Exception {
3126
		this.runConformTest(
3127
			new String[] {
3128
				"X.java",
3129
			"import java.io.*;\n" +
3130
				"public class X {\n" + 
3131
				"   public void foo(Object o) {\n" +
3132
				"     System.out.println(123);\n" +
3133
				"	  I<String> i = (I<@B(1) String> & @B(2) J<String>) o;\n" +
3134
			    "   }\n" +
3135
				"}\n" +
3136
				"interface I<T> {}\n" +
3137
				"interface J<T> {}\n",
3138
				
3139
				"B.java",
3140
				"import java.lang.annotation.*;\n" + 
3141
				"@Target(ElementType.TYPE_USE)\n" + 
3142
				"@Retention(RetentionPolicy.RUNTIME)\n" + 
3143
				"@interface B {\n" + 
3144
				"	int value() default 1;\n" + 
3145
				"}\n",
3146
		},
3147
		"");
3148
		String expectedOutput =
3149
				"  public void foo(java.lang.Object o);\n" + 
3150
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
3151
				"     3  bipush 123\n" + 
3152
				"     5  invokevirtual java.io.PrintStream.println(int) : void [22]\n" + 
3153
				"     8  aload_1 [o]\n" + 
3154
				"     9  checkcast I [28]\n" + 
3155
				"    12  checkcast J [30]\n" + 
3156
				"    15  astore_2 [i]\n" + 
3157
				"    16  return\n" + 
3158
				"      Line numbers:\n" + 
3159
				"        [pc: 0, line: 4]\n" + 
3160
				"        [pc: 8, line: 5]\n" + 
3161
				"        [pc: 16, line: 6]\n" + 
3162
				"      Local variable table:\n" + 
3163
				"        [pc: 0, pc: 17] local: this index: 0 type: X\n" + 
3164
				"        [pc: 0, pc: 17] local: o index: 1 type: java.lang.Object\n" + 
3165
				"        [pc: 16, pc: 17] local: i index: 2 type: I\n" + 
3166
				"      Local variable type table:\n" + 
3167
				"        [pc: 16, pc: 17] local: i index: 2 type: I<java.lang.String>\n" + 
3168
				"    RuntimeVisibleTypeAnnotations: \n" + 
3169
				"      #39 @B(\n" + 
3170
				"        #40 value=(int) 1 (constant type)\n" + 
3171
				"        target type = 0x47 CAST\n" + 
3172
				"        offset = 9\n" + 
3173
				"        type argument index = 0\n" + 
3174
				"        location = [TYPE_ARGUMENT(0)]\n" + 
3175
				"      )\n" + 
3176
				"      #39 @B(\n" + 
3177
				"        #40 value=(int) 2 (constant type)\n" + 
3178
				"        target type = 0x47 CAST\n" + 
3179
				"        offset = 9\n" + 
3180
				"        type argument index = 1\n" + 
3181
				"      )\n";
3182
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3183
	}
3184
	
3185
	public void test070c_codeblocks_castTwiceInExpression() throws Exception {
3186
		this.runConformTest(
3187
			new String[] {
3188
				"X.java",
3189
			"import java.io.*;\n" +
3190
				"public class X {\n" + 
3191
				"   public void foo(Object o) {\n" +
3192
				"     System.out.println(123);\n" +
3193
				"	  I i = (@B(1) I)(@B(2) J) o;\n" +
3194
			    "   }\n" +
3195
				"}\n" +
3196
				"interface I {}\n" +
3197
				"interface J {}\n",
3198
				
3199
				"B.java",
3200
				"import java.lang.annotation.*;\n" + 
3201
				"@Target(ElementType.TYPE_USE)\n" + 
3202
				"@Retention(RetentionPolicy.RUNTIME)\n" + 
3203
				"@interface B {\n" + 
3204
				"	int value() default 1;\n" + 
3205
				"}\n",
3206
		},
3207
		"");
3208
		String expectedOutput =
3209
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
3210
				"     3  bipush 123\n" + 
3211
				"     5  invokevirtual java.io.PrintStream.println(int) : void [22]\n" + 
3212
				"     8  aload_1 [o]\n" + 
3213
				"     9  checkcast J [28]\n" + 
3214
				"    12  checkcast I [30]\n" + 
3215
				"    15  astore_2 [i]\n" + 
3216
				"    16  return\n" + 
3217
				"      Line numbers:\n" + 
3218
				"        [pc: 0, line: 4]\n" + 
3219
				"        [pc: 8, line: 5]\n" + 
3220
				"        [pc: 16, line: 6]\n" + 
3221
				"      Local variable table:\n" + 
3222
				"        [pc: 0, pc: 17] local: this index: 0 type: X\n" + 
3223
				"        [pc: 0, pc: 17] local: o index: 1 type: java.lang.Object\n" + 
3224
				"        [pc: 16, pc: 17] local: i index: 2 type: I\n" + 
3225
				"    RuntimeVisibleTypeAnnotations: \n" + 
3226
				"      #37 @B(\n" + 
3227
				"        #38 value=(int) 2 (constant type)\n" + 
3228
				"        target type = 0x47 CAST\n" + 
3229
				"        offset = 9\n" + 
3230
				"        type argument index = 0\n" + 
3231
				"      )\n" + 
3232
				"      #37 @B(\n" + 
3233
				"        #38 value=(int) 1 (constant type)\n" + 
3234
				"        target type = 0x47 CAST\n" + 
3235
				"        offset = 12\n" + 
3236
				"        type argument index = 0\n" + 
3237
				"      )\n";
3238
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3239
	}
3240
	
3241
	public void test070d_codeblocks_castDoubleIntersectionCastInExpression() throws Exception {
3242
		this.runConformTest(
3243
			new String[] {
3244
				"X.java",
3245
			"import java.io.*;\n" +
3246
				"public class X {\n" + 
3247
				"   public void foo(Object o) {\n" +
3248
				"     System.out.println(123);\n" +
3249
				"	  I i = (@B(1) I & J)(K & @B(2) L) o;\n" +
3250
			    "   }\n" +
3251
				"}\n" +
3252
				"interface I {}\n" +
3253
				"interface J {}\n" +
3254
				"interface K {}\n" +
3255
				"interface L {}\n",
3256
				
3257
				"B.java",
3258
				"import java.lang.annotation.*;\n" + 
3259
				"@Target(ElementType.TYPE_USE)\n" + 
3260
				"@Retention(RetentionPolicy.RUNTIME)\n" + 
3261
				"@interface B {\n" + 
3262
				"	int value() default 1;\n" + 
3263
				"}\n",
3264
		},
3265
		"");
3266
		String expectedOutput =
3267
				"  public void foo(java.lang.Object o);\n" + 
3268
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
3269
				"     3  bipush 123\n" + 
3270
				"     5  invokevirtual java.io.PrintStream.println(int) : void [22]\n" + 
3271
				"     8  aload_1 [o]\n" + 
3272
				"     9  checkcast K [28]\n" + 
3273
				"    12  checkcast L [30]\n" + 
3274
				"    15  checkcast I [32]\n" + 
3275
				"    18  checkcast J [34]\n" + 
3276
				"    21  astore_2 [i]\n" + 
3277
				"    22  return\n" + 
3278
				"      Line numbers:\n" + 
3279
				"        [pc: 0, line: 4]\n" + 
3280
				"        [pc: 8, line: 5]\n" + 
3281
				"        [pc: 22, line: 6]\n" + 
3282
				"      Local variable table:\n" + 
3283
				"        [pc: 0, pc: 23] local: this index: 0 type: X\n" + 
3284
				"        [pc: 0, pc: 23] local: o index: 1 type: java.lang.Object\n" + 
3285
				"        [pc: 22, pc: 23] local: i index: 2 type: I\n" + 
3286
				"    RuntimeVisibleTypeAnnotations: \n" + 
3287
				"      #41 @B(\n" + 
3288
				"        #42 value=(int) 2 (constant type)\n" + 
3289
				"        target type = 0x47 CAST\n" + 
3290
				"        offset = 9\n" + 
3291
				"        type argument index = 1\n" + 
3292
				"      )\n" + 
3293
				"      #41 @B(\n" + 
3294
				"        #42 value=(int) 1 (constant type)\n" + 
3295
				"        target type = 0x47 CAST\n" + 
3296
				"        offset = 15\n" + 
3297
				"        type argument index = 0\n" + 
3298
				"      )\n";
3299
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
3300
	}
3301
	
3063
	public void test071_codeblocks_constructorInvocationTypeArgument() throws Exception {
3302
	public void test071_codeblocks_constructorInvocationTypeArgument() throws Exception {
3064
		this.runConformTest(
3303
		this.runConformTest(
3065
			new String[] {
3304
			new String[] {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-2 / +2 lines)
Lines 15-20 Link Here
15
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335             
15
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335             
16
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
16
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
17
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
17
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
18
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
18
 *******************************************************************************/
19
 *******************************************************************************/
19
package org.eclipse.jdt.internal.compiler;
20
package org.eclipse.jdt.internal.compiler;
20
21
Lines 2190-2197 public class ClassFile implements TypeConstants, TypeIds { Link Here
2190
				// bytecode offset
2191
				// bytecode offset
2191
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2192
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2192
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2193
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2193
				// type_argument_index not set for cast
2194
				this.contents[this.contentsOffset++] = (byte) annotationContext.info2;
2194
				this.contents[this.contentsOffset++] = (byte)0;
2195
				break;
2195
				break;
2196
				
2196
				
2197
			case AnnotationTargetTypeConstants.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT :
2197
			case AnnotationTargetTypeConstants.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT :
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntersectionCastTypeReference.java (+8 lines)
Lines 11-16 Link Here
11
 * 
11
 * 
12
 * Contributors:
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
15
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
14
 *******************************************************************************/
16
 *******************************************************************************/
15
package org.eclipse.jdt.internal.compiler.ast;
17
package org.eclipse.jdt.internal.compiler.ast;
16
18
Lines 30-35 public class IntersectionCastTypeReference extends TypeReference { Link Here
30
		this.sourceStart = typeReferences[0].sourceStart;
32
		this.sourceStart = typeReferences[0].sourceStart;
31
		int length = typeReferences.length;
33
		int length = typeReferences.length;
32
		this.sourceEnd = typeReferences[length - 1].sourceEnd;
34
		this.sourceEnd = typeReferences[length - 1].sourceEnd;
35
		for (int i = 0, max = typeReferences.length; i < max; i++) {
36
			if ((typeReferences[i].bits & ASTNode.HasTypeAnnotations) != 0) {
37
				this.bits |= ASTNode.HasTypeAnnotations;
38
				break;
39
			}
40
		}
33
	}
41
	}
34
42
35
	public TypeReference copyDims(int dim) {
43
	public TypeReference copyDims(int dim) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-8 / +14 lines)
Lines 16-21 Link Here
16
 *								bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types
16
 *								bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types
17
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
17
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
18
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
18
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
19
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
19
 *******************************************************************************/
20
 *******************************************************************************/
20
package org.eclipse.jdt.internal.compiler.ast;
21
package org.eclipse.jdt.internal.compiler.ast;
21
22
Lines 51-58 static class AnnotationCollector extends ASTVisitor { Link Here
51
	TypeReference typeReference;
52
	TypeReference typeReference;
52
	int targetType;
53
	int targetType;
53
	Annotation[] primaryAnnotations;
54
	Annotation[] primaryAnnotations;
54
	int info = -1;
55
	int info = 0;
55
	int info2 = -1;
56
	int info2 = 0;
56
	LocalVariableBinding localVariable;
57
	LocalVariableBinding localVariable;
57
	Annotation[][] annotationsOnDimensions;
58
	Annotation[][] annotationsOnDimensions;
58
	int dimensions;
59
	int dimensions;
Lines 183-194 static class AnnotationCollector extends ASTVisitor { Link Here
183
				case AnnotationTargetTypeConstants.NEW :
184
				case AnnotationTargetTypeConstants.NEW :
184
				case AnnotationTargetTypeConstants.CONSTRUCTOR_REFERENCE :
185
				case AnnotationTargetTypeConstants.CONSTRUCTOR_REFERENCE :
185
				case AnnotationTargetTypeConstants.METHOD_REFERENCE :
186
				case AnnotationTargetTypeConstants.METHOD_REFERENCE :
186
				case AnnotationTargetTypeConstants.CAST:
187
					annotationContext.info = this.info;
188
					break;
189
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
190
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
191
					annotationContext.info2 = this.info2;
192
					annotationContext.info = this.info;
187
					annotationContext.info = this.info;
193
					break;
188
					break;
194
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
189
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
Lines 199-204 static class AnnotationCollector extends ASTVisitor { Link Here
199
				case AnnotationTargetTypeConstants.METHOD_INVOCATION_TYPE_ARGUMENT :
194
				case AnnotationTargetTypeConstants.METHOD_INVOCATION_TYPE_ARGUMENT :
200
				case AnnotationTargetTypeConstants.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT :
195
				case AnnotationTargetTypeConstants.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT :
201
				case AnnotationTargetTypeConstants.METHOD_REFERENCE_TYPE_ARGUMENT :
196
				case AnnotationTargetTypeConstants.METHOD_REFERENCE_TYPE_ARGUMENT :
197
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
198
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
199
				case AnnotationTargetTypeConstants.CAST:
202
					annotationContext.info2 = this.info2;
200
					annotationContext.info2 = this.info2;
203
					annotationContext.info = this.info;
201
					annotationContext.info = this.info;
204
					break;
202
					break;
Lines 225-230 static class AnnotationCollector extends ASTVisitor { Link Here
225
		this.currentWildcard = wildcard;
223
		this.currentWildcard = wildcard;
226
		return true;
224
		return true;
227
	}
225
	}
226
	public boolean visit(IntersectionCastTypeReference intersectionCastTypeReference, BlockScope scope) {
227
		int length = intersectionCastTypeReference.typeReferences == null ? 0 : intersectionCastTypeReference.typeReferences.length;
228
		for (int i = 0; i < length; i++) {
229
			this.info2 = i;
230
			intersectionCastTypeReference.typeReferences[i].traverse(this, scope);
231
		}
232
		return false; // iteration was done here, do not repeat in the caller
233
	}
228
	public boolean visit(Argument argument, BlockScope scope) {
234
	public boolean visit(Argument argument, BlockScope scope) {
229
		if ((argument.bits & ASTNode.IsUnionType) == 0) {
235
		if ((argument.bits & ASTNode.IsUnionType) == 0) {
230
			return true;
236
			return true;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-1 / +2 lines)
Lines 18-23 Link Here
18
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335        
18
 *							Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335        
19
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
19
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
20
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
20
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
21
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
21
 *******************************************************************************/
22
 *******************************************************************************/
22
package org.eclipse.jdt.internal.compiler.codegen;
23
package org.eclipse.jdt.internal.compiler.codegen;
23
24
Lines 656-662 public void checkcast(TypeReference typeReference, TypeBinding typeBinding) { Link Here
656
	   reality this should not matter. In its intended use form such as (I & Serializable) () -> {}, no cast is emitted at all
657
	   reality this should not matter. In its intended use form such as (I & Serializable) () -> {}, no cast is emitted at all
657
	*/
658
	*/
658
	TypeBinding [] types = typeBinding instanceof IntersectionCastTypeBinding ? typeBinding.getIntersectingTypes() : new TypeBinding [] { typeBinding };
659
	TypeBinding [] types = typeBinding instanceof IntersectionCastTypeBinding ? typeBinding.getIntersectingTypes() : new TypeBinding [] { typeBinding };
659
	for (int i = types.length - 1; i >=0; i--) {
660
	for (int i = 0, max = types.length; i < max; i++) {
660
		this.countLabels = 0;
661
		this.countLabels = 0;
661
		if (this.classFileOffset + 2 >= this.bCodeStream.length) {
662
		if (this.classFileOffset + 2 >= this.bCodeStream.length) {
662
			resizeByteArray();
663
			resizeByteArray();
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java (-2 / +5 lines)
Lines 13-18 Link Here
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
14
 *        Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
15
 *                          Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
16
 *                          Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.jdt.internal.core.util;
18
package org.eclipse.jdt.internal.core.util;
18
19
Lines 209-215 public class ExtendedAnnotation extends ClassFileStruct implements IExtendedAnno Link Here
209
210
210
			case IExtendedAnnotationConstants.CAST :
211
			case IExtendedAnnotationConstants.CAST :
211
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
212
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
212
				this.readOffset += 3; // skipping the 3rd byte which will be 0 for CAST
213
				this.readOffset += 2; 
214
				// read type_argument_index
215
				this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);
216
				this.readOffset++;
213
				break;
217
				break;
214
218
215
			case IExtendedAnnotationConstants.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT :
219
			case IExtendedAnnotationConstants.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT :
216
- 

Return to bug 409236