Skip to content

Commit 5d61854

Browse files
Merge master
2 parents e66fd6f + 2919ad2 commit 5d61854

25 files changed

+419
-156
lines changed

.jcheck/conf

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
1+
;
2+
; Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
;
5+
; This code is free software; you can redistribute it and/or modify it
6+
; under the terms of the GNU General Public License version 2 only, as
7+
; published by the Free Software Foundation.
8+
;
9+
; This code is distributed in the hope that it will be useful, but WITHOUT
10+
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
; version 2 for more details (a copy is included in the LICENSE file that
13+
; accompanied this code).
14+
;
15+
; You should have received a copy of the GNU General Public License version
16+
; 2 along with this work; if not, write to the Free Software Foundation,
17+
; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
;
19+
; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
; or visit www.oracle.com if you need additional information or have any
21+
; questions.
22+
;
23+
124
[general]
2-
project=jdk
3-
jbs=JDK
25+
project=amber
26+
repository=amber
27+
jbs=jdk
428

529
[checks]
6-
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
30+
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace
731

832
[repository]
9-
tags=(?:jdk-(?:[1-9]([0-9]*)(?:\.(?:0|[1-9][0-9]*)){0,4})(?:\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\d{1,3})?-(?:(?:b\d{2,3})|(?:ga)))|(?:hs\d\d(?:\.\d{1,2})?-b\d\d)
33+
tags=(?:jdk-(?:[1-9]([0-9]*)(?:\\.(?:0|[1-9][0-9]*)){0,4})(?:\\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\\d{1,3})?-(?:(?:b\\d{2,3})|(?:ga)))|(?:hs\\d\\d(?:\\.\\d{1,2})?-b\\d\\d)
1034
branches=
1135

1236
[census]
@@ -30,4 +54,4 @@ role=committer
3054
pattern=^([124-8][0-9]{6}): (\S.*)$
3155

3256
[checks "problemlists"]
33-
dirs=test/jdk|test/langtools|test/lib-test|test/hotspot/jtreg|test/jaxp
57+
dirs=test/jdk|test/langtools|test/lib-test|test/hotspot/jtreg|test/jaxp

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3917,9 +3917,9 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
39173917
permitted_subclasses_attribute_start = cfs->current();
39183918
permitted_subclasses_attribute_length = attribute_length;
39193919
}
3920-
}
3920+
}
39213921
// Skip attribute_length for any attribute where major_verson >= JAVA_16_VERSION
3922-
cfs->skip_u1(attribute_length, CHECK);
3922+
cfs->skip_u1(attribute_length, CHECK);
39233923
} else {
39243924
// Unknown attribute
39253925
cfs->skip_u1(attribute_length, CHECK);

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -383,30 +383,31 @@ public static EnumSet<Flag> asFlagSet(long flags) {
383383
/** Modifier masks.
384384
*/
385385
public static final int
386-
AccessFlags = PUBLIC | PROTECTED | PRIVATE,
387-
LocalClassFlags = FINAL | ABSTRACT | STRICTFP | ENUM | SYNTHETIC,
388-
StaticLocalFlags = LocalClassFlags | STATIC | INTERFACE,
389-
MemberClassFlags = LocalClassFlags | INTERFACE | AccessFlags,
390-
MemberRecordFlags = MemberClassFlags | STATIC,
391-
ClassFlags = LocalClassFlags | INTERFACE | PUBLIC | ANNOTATION,
392-
InterfaceVarFlags = FINAL | STATIC | PUBLIC,
393-
VarFlags = AccessFlags | FINAL | STATIC |
394-
VOLATILE | TRANSIENT | ENUM,
395-
ConstructorFlags = AccessFlags,
396-
InterfaceMethodFlags = ABSTRACT | PUBLIC,
397-
MethodFlags = AccessFlags | ABSTRACT | STATIC | NATIVE |
398-
SYNCHRONIZED | FINAL | STRICTFP,
399-
RecordMethodFlags = AccessFlags | ABSTRACT | STATIC |
400-
SYNCHRONIZED | FINAL | STRICTFP;
386+
AccessFlags = PUBLIC | PROTECTED | PRIVATE,
387+
LocalClassFlags = FINAL | ABSTRACT | STRICTFP | ENUM | SYNTHETIC,
388+
StaticLocalFlags = LocalClassFlags | STATIC | INTERFACE,
389+
MemberClassFlags = LocalClassFlags | INTERFACE | AccessFlags,
390+
MemberStaticClassFlags = MemberClassFlags | STATIC,
391+
ClassFlags = LocalClassFlags | INTERFACE | PUBLIC | ANNOTATION,
392+
InterfaceVarFlags = FINAL | STATIC | PUBLIC,
393+
VarFlags = AccessFlags | FINAL | STATIC |
394+
VOLATILE | TRANSIENT | ENUM,
395+
ConstructorFlags = AccessFlags,
396+
InterfaceMethodFlags = ABSTRACT | PUBLIC,
397+
MethodFlags = AccessFlags | ABSTRACT | STATIC | NATIVE |
398+
SYNCHRONIZED | FINAL | STRICTFP,
399+
RecordMethodFlags = AccessFlags | ABSTRACT | STATIC |
400+
SYNCHRONIZED | FINAL | STRICTFP;
401401
public static final long
402-
ExtendedStandardFlags = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED,
403-
ExtendedMemberClassFlags = (long)MemberClassFlags | SEALED | NON_SEALED,
404-
ExtendedClassFlags = (long)ClassFlags | SEALED | NON_SEALED,
405-
ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED,
406-
InterfaceMethodMask = ABSTRACT | PRIVATE | STATIC | PUBLIC | STRICTFP | DEFAULT,
407-
AnnotationTypeElementMask = ABSTRACT | PUBLIC,
408-
LocalVarFlags = FINAL | PARAMETER,
409-
ReceiverParamFlags = PARAMETER;
402+
ExtendedStandardFlags = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED,
403+
ExtendedMemberClassFlags = (long)MemberClassFlags | SEALED | NON_SEALED,
404+
ExtendedMemberStaticClassFlags = (long) MemberStaticClassFlags | SEALED | NON_SEALED,
405+
ExtendedClassFlags = (long)ClassFlags | SEALED | NON_SEALED,
406+
ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED,
407+
InterfaceMethodMask = ABSTRACT | PRIVATE | STATIC | PUBLIC | STRICTFP | DEFAULT,
408+
AnnotationTypeElementMask = ABSTRACT | PUBLIC,
409+
LocalVarFlags = FINAL | PARAMETER,
410+
ReceiverParamFlags = PARAMETER;
410411

411412
@SuppressWarnings("preview")
412413
public static Set<Modifier> asModifierSet(long flags) {

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5307,18 +5307,6 @@ private void attribClassBody(Env<AttrContext> env, ClassSymbol c) {
53075307
for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
53085308
// Attribute declaration
53095309
attribStat(l.head, env);
5310-
// Check that declarations in inner classes are not static (JLS 8.1.2)
5311-
// Make an exception for static constants.
5312-
if (c.owner.kind != PCK &&
5313-
((c.flags() & STATIC) == 0 || c.name == names.empty) &&
5314-
(TreeInfo.flags(l.head) & (STATIC | INTERFACE)) != 0) {
5315-
Symbol sym = null;
5316-
if (l.head.hasTag(VARDEF)) sym = ((JCVariableDecl) l.head).sym;
5317-
if (sym == null ||
5318-
sym.kind != VAR ||
5319-
((VarSymbol) sym).getConstValue() == null)
5320-
log.error(l.head.pos(), Errors.IclsCantHaveStaticDecl(c));
5321-
}
53225310
}
53235311

53245312
// Check for cycles among non-initial constructors.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,24 +1216,19 @@ else if ((sym.owner.flags_field & INTERFACE) != 0)
12161216
implicit |= sym.owner.flags_field & STRICTFP;
12171217
break;
12181218
case TYP:
1219-
if (sym.isLocal()) {
1219+
if (sym.owner.kind.matches(KindSelector.VAL_MTH)) {
12201220
boolean implicitlyStatic = !sym.isAnonymous() &&
12211221
((flags & RECORD) != 0 || (flags & ENUM) != 0 || (flags & INTERFACE) != 0);
12221222
boolean staticOrImplicitlyStatic = (flags & STATIC) != 0 || implicitlyStatic;
12231223
mask = staticOrImplicitlyStatic && allowRecords && (flags & ANNOTATION) == 0 ? StaticLocalFlags : LocalClassFlags;
12241224
implicit = implicitlyStatic ? STATIC : implicit;
1225-
if (staticOrImplicitlyStatic) {
1226-
if (sym.owner.kind == TYP) {
1227-
log.error(pos, Errors.StaticDeclarationNotAllowedInInnerClasses);
1228-
}
1229-
}
12301225
} else if (sym.owner.kind == TYP) {
1231-
mask = (flags & RECORD) != 0 ? MemberRecordFlags : ExtendedMemberClassFlags;
1226+
mask = ((flags & STATIC) != 0) && allowRecords ? ExtendedMemberStaticClassFlags : ExtendedMemberClassFlags;
12321227
if (sym.owner.owner.kind == PCK ||
12331228
(sym.owner.flags_field & STATIC) != 0)
12341229
mask |= STATIC;
12351230
else if ((flags & ENUM) != 0 || (flags & RECORD) != 0) {
1236-
log.error(pos, Errors.StaticDeclarationNotAllowedInInnerClasses);
1231+
//log.error(pos, Errors.StaticDeclarationNotAllowedInInnerClasses);
12371232
}
12381233
// Nested interfaces and enums are always STATIC (Spec ???)
12391234
if ((flags & (INTERFACE | ENUM | RECORD)) != 0 ) implicit = STATIC;
@@ -1306,7 +1301,10 @@ && checkDisjoint(pos, flags,
13061301
SEALED | NON_SEALED)
13071302
&& checkDisjoint(pos, flags,
13081303
SEALED,
1309-
FINAL | NON_SEALED)) {
1304+
FINAL | NON_SEALED)
1305+
&& checkDisjoint(pos, flags,
1306+
RECORD,
1307+
SEALED | NON_SEALED) ) {
13101308
// skip
13111309
}
13121310
return flags & (mask | ~ExtendedStandardFlags) | implicit;

src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,6 @@ compiler.err.generic.array.creation=\
575575
compiler.err.generic.throwable=\
576576
a generic class may not extend java.lang.Throwable
577577

578-
# 0: symbol
579-
compiler.err.icls.cant.have.static.decl=\
580-
Illegal static declaration in inner class {0}\n\
581-
modifier \''static\'' is only allowed in constant variable declarations
582-
583578
# 0: string
584579
compiler.err.illegal.char=\
585580
illegal character: ''{0}''
@@ -3605,9 +3600,6 @@ compiler.err.first.statement.must.be.call.to.another.constructor=\
36053600
compiler.err.instance.initializer.not.allowed.in.records=\
36063601
instance initializers not allowed in records
36073602

3608-
compiler.err.static.declaration.not.allowed.in.inner.classes=\
3609-
static declarations not allowed in inner classes
3610-
36113603
compiler.err.record.header.expected=\
36123604
record header expected
36133605

test/hotspot/jtreg/runtime/records/recordAttributeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it

test/langtools/tools/javac/AnonStaticMember_1.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
/*
2525
* @test
2626
* @bug 4279339
27-
* @summary Verify that an anonymous class cannot contain a static field.
27+
* @summary Verify that an anonymous class can contain a static field.
2828
* @author maddox
2929
*
30-
* @run compile/fail AnonStaticMember_1.java
30+
* @compile AnonStaticMember_1.java
3131
*/
3232

3333
class AnonStaticMember_1 {

test/langtools/tools/javac/AnonStaticMember_2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
22
* @test /nodynamiccopyright/
33
* @bug 4279339 6969184
4-
* @summary Verify that an anonymous class cannot contain a static method.
4+
* @summary Verify that an anonymous class can contain a static method.
55
* @author maddox
66
*
7-
* @run compile/fail/ref=AnonStaticMember_2.out -XDrawDiagnostics AnonStaticMember_2.java
7+
* @compile AnonStaticMember_2.java
88
*/
99

1010
class AnonStaticMember_2 {

test/langtools/tools/javac/AnonStaticMember_2.out

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)