|
Lines 16-21
Link Here
|
| 16 |
* Bug 415543 - [1.8][compiler] Incorrect bound index in RuntimeInvisibleTypeAnnotations attribute |
16 |
* Bug 415543 - [1.8][compiler] Incorrect bound index in RuntimeInvisibleTypeAnnotations attribute |
| 17 |
* Bug 415397 - [1.8][compiler] Type Annotations on wildcard type argument dropped |
17 |
* Bug 415397 - [1.8][compiler] Type Annotations on wildcard type argument dropped |
| 18 |
* Bug 415399 - [1.8][compiler] Type annotations on constructor results dropped by the code generator |
18 |
* Bug 415399 - [1.8][compiler] Type annotations on constructor results dropped by the code generator |
|
|
19 |
* Bug 415470 - [1.8][compiler] Type annotations on class declaration go vanishing |
| 19 |
*******************************************************************************/ |
20 |
*******************************************************************************/ |
| 20 |
package org.eclipse.jdt.core.tests.compiler.regression; |
21 |
package org.eclipse.jdt.core.tests.compiler.regression; |
| 21 |
|
22 |
|
|
Lines 1424-1430
public class JSR308SpecSnippetTests extends AbstractRegressionTest {
Link Here
|
| 1424 |
"The annotation @MAnno is disallowed for this location\n" + |
1425 |
"The annotation @MAnno is disallowed for this location\n" + |
| 1425 |
"----------\n"); |
1426 |
"----------\n"); |
| 1426 |
} |
1427 |
} |
| 1427 |
public void test030() throws Exception { // WILL FAIL WHEN https://bugs.eclipse.org/bugs/show_bug.cgi?id=415470 IS FIXED. |
1428 |
public void test030() throws Exception { |
| 1428 |
this.runConformTest( |
1429 |
this.runConformTest( |
| 1429 |
new String[] { |
1430 |
new String[] { |
| 1430 |
"X.java", |
1431 |
"X.java", |
|
Lines 1436-1441
public class JSR308SpecSnippetTests extends AbstractRegressionTest {
Link Here
|
| 1436 |
"}\n", |
1437 |
"}\n", |
| 1437 |
}, |
1438 |
}, |
| 1438 |
""); |
1439 |
""); |
|
|
1440 |
// javac b100 produces: |
| 1441 |
// RuntimeInvisibleAnnotations: |
| 1442 |
// 0: #11() LAnnotation; |
| 1443 |
// 1: #12() LTypeAnnotation; |
| 1439 |
String expectedOutput = |
1444 |
String expectedOutput = |
| 1440 |
"// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + |
1445 |
"// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + |
| 1441 |
"class X {\n" + |
1446 |
"class X {\n" + |
|
Lines 1457-1462
public class JSR308SpecSnippetTests extends AbstractRegressionTest {
Link Here
|
| 1457 |
" constant #15 utf8: \"X.java\"\n" + |
1462 |
" constant #15 utf8: \"X.java\"\n" + |
| 1458 |
" constant #16 utf8: \"RuntimeInvisibleAnnotations\"\n" + |
1463 |
" constant #16 utf8: \"RuntimeInvisibleAnnotations\"\n" + |
| 1459 |
" constant #17 utf8: \"LAnnotation;\"\n" + |
1464 |
" constant #17 utf8: \"LAnnotation;\"\n" + |
|
|
1465 |
" constant #18 utf8: \"LTypeAnnotation;\"\n" + |
| 1460 |
" \n" + |
1466 |
" \n" + |
| 1461 |
" // Method descriptor #6 ()V\n" + |
1467 |
" // Method descriptor #6 ()V\n" + |
| 1462 |
" // Stack: 1, Locals: 1\n" + |
1468 |
" // Stack: 1, Locals: 1\n" + |
|
Lines 1472-1477
public class JSR308SpecSnippetTests extends AbstractRegressionTest {
Link Here
|
| 1472 |
" RuntimeInvisibleAnnotations: \n" + |
1478 |
" RuntimeInvisibleAnnotations: \n" + |
| 1473 |
" #17 @Annotation(\n" + |
1479 |
" #17 @Annotation(\n" + |
| 1474 |
" )\n" + |
1480 |
" )\n" + |
|
|
1481 |
" #18 @TypeAnnotation(\n" + |
| 1482 |
" )\n" + |
| 1483 |
"}"; |
| 1484 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); |
| 1485 |
} |
| 1486 |
|
| 1487 |
public void test030a() throws Exception { |
| 1488 |
this.runConformTest( |
| 1489 |
new String[] { |
| 1490 |
"X.java", |
| 1491 |
"import java.lang.annotation.*;\n" + |
| 1492 |
"import static java.lang.annotation.ElementType.*; \n" + |
| 1493 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1494 |
"@Target({TYPE_USE}) @interface TypeAnnotation { }\n" + |
| 1495 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1496 |
"@Target({TYPE}) @interface Annotation { }\n" + |
| 1497 |
"@Annotation @TypeAnnotation class X {\n" + |
| 1498 |
"}\n", |
| 1499 |
}, |
| 1500 |
""); |
| 1501 |
String expectedOutput = |
| 1502 |
"// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + |
| 1503 |
"class X {\n" + |
| 1504 |
" Constant pool:\n" + |
| 1505 |
" constant #1 class: #2 X\n" + |
| 1506 |
" constant #2 utf8: \"X\"\n" + |
| 1507 |
" constant #3 class: #4 java/lang/Object\n" + |
| 1508 |
" constant #4 utf8: \"java/lang/Object\"\n" + |
| 1509 |
" constant #5 utf8: \"<init>\"\n" + |
| 1510 |
" constant #6 utf8: \"()V\"\n" + |
| 1511 |
" constant #7 utf8: \"Code\"\n" + |
| 1512 |
" constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + |
| 1513 |
" constant #9 name_and_type: #5.#6 <init> ()V\n" + |
| 1514 |
" constant #10 utf8: \"LineNumberTable\"\n" + |
| 1515 |
" constant #11 utf8: \"LocalVariableTable\"\n" + |
| 1516 |
" constant #12 utf8: \"this\"\n" + |
| 1517 |
" constant #13 utf8: \"LX;\"\n" + |
| 1518 |
" constant #14 utf8: \"SourceFile\"\n" + |
| 1519 |
" constant #15 utf8: \"X.java\"\n" + |
| 1520 |
" constant #16 utf8: \"RuntimeVisibleAnnotations\"\n" + |
| 1521 |
" constant #17 utf8: \"LAnnotation;\"\n" + |
| 1522 |
" constant #18 utf8: \"LTypeAnnotation;\"\n" + |
| 1523 |
" \n" + |
| 1524 |
" // Method descriptor #6 ()V\n" + |
| 1525 |
" // Stack: 1, Locals: 1\n" + |
| 1526 |
" X();\n" + |
| 1527 |
" 0 aload_0 [this]\n" + |
| 1528 |
" 1 invokespecial java.lang.Object() [8]\n" + |
| 1529 |
" 4 return\n" + |
| 1530 |
" Line numbers:\n" + |
| 1531 |
" [pc: 0, line: 7]\n" + |
| 1532 |
" Local variable table:\n" + |
| 1533 |
" [pc: 0, pc: 5] local: this index: 0 type: X\n" + |
| 1534 |
"\n" + |
| 1535 |
" RuntimeVisibleAnnotations: \n" + |
| 1536 |
" #17 @Annotation(\n" + |
| 1537 |
" )\n" + |
| 1538 |
" #18 @TypeAnnotation(\n" + |
| 1539 |
" )\n" + |
| 1540 |
"}"; |
| 1541 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); |
| 1542 |
} |
| 1543 |
|
| 1544 |
public void test030b() throws Exception { |
| 1545 |
this.runNegativeTest( |
| 1546 |
new String[] { |
| 1547 |
"X.java", |
| 1548 |
"import java.lang.annotation.*;\n" + |
| 1549 |
"import static java.lang.annotation.ElementType.*; \n" + |
| 1550 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1551 |
// Only TYPE_USE annotations get this special treatment |
| 1552 |
"@Target({TYPE_PARAMETER}) @interface TypeAnnotation { }\n" + |
| 1553 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1554 |
"@Target({TYPE}) @interface Annotation { }\n" + |
| 1555 |
"@Annotation @TypeAnnotation class X {\n" + |
| 1556 |
"}\n", |
| 1557 |
}, |
| 1558 |
"----------\n" + |
| 1559 |
"1. ERROR in X.java (at line 7)\n" + |
| 1560 |
" @Annotation @TypeAnnotation class X {\n" + |
| 1561 |
" ^^^^^^^^^^^^^^^\n" + |
| 1562 |
"The annotation @TypeAnnotation is disallowed for this location\n" + |
| 1563 |
"----------\n"); |
| 1564 |
} |
| 1565 |
public void test030c() throws Exception { |
| 1566 |
this.runConformTest( |
| 1567 |
new String[] { |
| 1568 |
"X.java", |
| 1569 |
"import java.lang.annotation.*;\n" + |
| 1570 |
"import static java.lang.annotation.ElementType.*; \n" + |
| 1571 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1572 |
"@Target({TYPE_USE,TYPE_PARAMETER}) @interface TypeAnnotation { }\n" + |
| 1573 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
| 1574 |
"@Target({TYPE}) @interface Annotation { }\n" + |
| 1575 |
"@Annotation @TypeAnnotation class X {\n" + |
| 1576 |
"}\n", |
| 1577 |
}, |
| 1578 |
""); |
| 1579 |
String expectedOutput = |
| 1580 |
"// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + |
| 1581 |
"class X {\n" + |
| 1582 |
" Constant pool:\n" + |
| 1583 |
" constant #1 class: #2 X\n" + |
| 1584 |
" constant #2 utf8: \"X\"\n" + |
| 1585 |
" constant #3 class: #4 java/lang/Object\n" + |
| 1586 |
" constant #4 utf8: \"java/lang/Object\"\n" + |
| 1587 |
" constant #5 utf8: \"<init>\"\n" + |
| 1588 |
" constant #6 utf8: \"()V\"\n" + |
| 1589 |
" constant #7 utf8: \"Code\"\n" + |
| 1590 |
" constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + |
| 1591 |
" constant #9 name_and_type: #5.#6 <init> ()V\n" + |
| 1592 |
" constant #10 utf8: \"LineNumberTable\"\n" + |
| 1593 |
" constant #11 utf8: \"LocalVariableTable\"\n" + |
| 1594 |
" constant #12 utf8: \"this\"\n" + |
| 1595 |
" constant #13 utf8: \"LX;\"\n" + |
| 1596 |
" constant #14 utf8: \"SourceFile\"\n" + |
| 1597 |
" constant #15 utf8: \"X.java\"\n" + |
| 1598 |
" constant #16 utf8: \"RuntimeVisibleAnnotations\"\n" + |
| 1599 |
" constant #17 utf8: \"LAnnotation;\"\n" + |
| 1600 |
" constant #18 utf8: \"LTypeAnnotation;\"\n" + |
| 1601 |
" \n" + |
| 1602 |
" // Method descriptor #6 ()V\n" + |
| 1603 |
" // Stack: 1, Locals: 1\n" + |
| 1604 |
" X();\n" + |
| 1605 |
" 0 aload_0 [this]\n" + |
| 1606 |
" 1 invokespecial java.lang.Object() [8]\n" + |
| 1607 |
" 4 return\n" + |
| 1608 |
" Line numbers:\n" + |
| 1609 |
" [pc: 0, line: 7]\n" + |
| 1610 |
" Local variable table:\n" + |
| 1611 |
" [pc: 0, pc: 5] local: this index: 0 type: X\n" + |
| 1612 |
"\n" + |
| 1613 |
" RuntimeVisibleAnnotations: \n" + |
| 1614 |
" #17 @Annotation(\n" + |
| 1615 |
" )\n" + |
| 1616 |
" #18 @TypeAnnotation(\n" + |
| 1617 |
" )\n" + |
| 1475 |
"}"; |
1618 |
"}"; |
| 1476 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); |
1619 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); |
| 1477 |
} |
1620 |
} |