8025537: Convert 2 javac/enumdeclarations tests in jtreg for regression ws

Reviewed-by: jjg
This commit is contained in:
Sonali Goel 2013-09-27 10:39:52 -07:00
parent e0f4378a6c
commit 475b209cf7
6 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/**
* @test /nodynamiccopyright/
* @bug 8025537
* @author sogoel
* @summary enum keyword used as an identifier
* @compile/ref=EnumAsIdentifier4.out -XDrawDiagnostics -source 1.4 EnumAsIdentifier.java
* @compile/fail/ref=EnumAsIdentifier5.out -XDrawDiagnostics -source 1.5 EnumAsIdentifier.java
* @compile/fail/ref=EnumAsIdentifier.out -XDrawDiagnostics EnumAsIdentifier.java
*/
public class EnumAsIdentifier {
int enum = 0;
}

View File

@ -0,0 +1,2 @@
EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier
1 error

View File

@ -0,0 +1,6 @@
- compiler.warn.source.no.bootclasspath: 1.4
- compiler.warn.option.obsolete.source: 1.4
- compiler.warn.option.obsolete.target: 1.4
- compiler.warn.option.obsolete.suppression
EnumAsIdentifier.java:13:9: compiler.warn.enum.as.identifier
5 warnings

View File

@ -0,0 +1,6 @@
- compiler.warn.source.no.bootclasspath: 1.5
- compiler.warn.option.obsolete.source: 1.5
- compiler.warn.option.obsolete.suppression
EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier
1 error
3 warnings

View File

@ -0,0 +1,20 @@
/**
* @test /nodynamiccopyright/
* @bug 8025537 5028491
* @author sogoel
* @summary enum constants should precede other enum members
* @compile/fail/ref=EnumMembersOrder.out -XDrawDiagnostics EnumMembersOrder.java
*/
enum Days {
Days(String d) { day = d; } // constructor
// enum constants
WEEKEND("SAT"),
WEEKDAY("MON");
private String day;
}

View File

@ -0,0 +1,7 @@
EnumMembersOrder.java:11:16: compiler.err.expected: ')'
EnumMembersOrder.java:11:17: compiler.err.expected3: ',', '}', ';'
EnumMembersOrder.java:11:19: compiler.err.expected: '}'
EnumMembersOrder.java:11:31: compiler.err.expected3: class, interface, enum
EnumMembersOrder.java:17:13: compiler.err.expected3: class, interface, enum
EnumMembersOrder.java:19:1: compiler.err.expected3: class, interface, enum
6 errors