Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8230082: [lworld] Volatile field declaration in inline class fails with ClassFormatError #43

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1453,7 +1453,7 @@ else if ((sym.kind == TYP ||
PRIVATE,
PUBLIC | PROTECTED)
&&
checkDisjoint(pos, flags,
checkDisjoint(pos, (flags | implicit), // complain against volatile & implcitly final entities too.
FINAL,
VOLATILE)
&&
@@ -0,0 +1,18 @@
/*
* @test /nodynamiccopyright/
* @bug 8230082
* @summary Javac should not allow inline type's fields to be volatile (as they are final)
* @compile/fail/ref=NoVolatileFields.out -XDrawDiagnostics NoVolatileFields.java
*/

public class NoVolatileFields {

static class Foo {
volatile final int i = 0; // Error
}

static inline class Bar {
volatile int i = 0; // Error
}
}

@@ -0,0 +1,3 @@
NoVolatileFields.java:11:28: compiler.err.illegal.combination.of.modifiers: final, volatile
NoVolatileFields.java:15:22: compiler.err.illegal.combination.of.modifiers: final, volatile
2 errors